/* Inter (SIL Open Font License, see /fonts/LICENSE-Inter.txt), self-hosted so visitors' browsers don't contact Google Fonts */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter-latin-700.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap; src: url('/fonts/inter-latin-800.woff2') format('woff2'); }

/* ============ Design tokens ============ */
:root {
  --font: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, sans-serif;
  --app-bg: #0c0d10;
  --panel: #15161a;
  --panel-2: #1a1b20;
  --elev: #1e2025;
  --line: #25272d;
  --line-2: #303239;
  --text: #d6d7db;
  --strong: #f4f4f5;
  --muted: #8b8e97;
  --faint: #5a5d66;
  --hover: rgba(255, 255, 255, 0.05);
  --press: rgba(255, 255, 255, 0.08);
  --accent: #e2a03f;
  --accent-2: #e2a03f;
  --accent-soft: rgba(226, 160, 63, 0.14);
  --on-accent: #1b1306;
  --up: #089981;
  --down: #f23645;
  --up-soft: rgba(8, 153, 129, 0.14);
  --down-soft: rgba(242, 54, 69, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --input: #101114;
  --r: 10px;
  --r-sm: 6px;
  --gap: 6px;
}
[data-theme='light'] {
  --app-bg: #f2f2f0;
  --panel: #ffffff;
  --panel-2: #f8f9fb;
  --elev: #ffffff;
  --line: #eceef3;
  --line-2: #dfe2ea;
  --text: #2a2e39;
  --strong: #0f1219;
  --muted: #6a6d78;
  --faint: #a3a6af;
  --hover: rgba(15, 18, 25, 0.045);
  --press: rgba(15, 18, 25, 0.08);
  --accent: #a8590a;
  --accent-2: #a8590a;
  --accent-soft: rgba(168, 89, 10, 0.09);
  --on-accent: #ffffff;
  --up-soft: rgba(8, 153, 129, 0.1);
  --down-soft: rgba(242, 54, 69, 0.1);
  --shadow: 0 10px 30px rgba(20, 25, 40, 0.14), 0 0 0 1px rgba(15, 18, 25, 0.06);
  --input: #f3f4f7;
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--app-bg);
  color: var(--text);
  font: 13px/1.4 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: var(--gap);
  overflow: hidden;
  user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input { font: inherit; color: var(--text); }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.up { color: var(--up); }
.down { color: var(--down); }
.num { font-variant-numeric: tabular-nums; }
.panel { background: var(--panel); border-radius: var(--r); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ Top bar ============ */
.topbar {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 0 10px 0 2px; text-decoration: none; color: var(--strong); }
.wordmark { font-size: 16px; font-weight: 500; letter-spacing: -0.2px; }
.wordmark b { font-weight: 700; }
.tb-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
}
.tb-btn:hover { background: var(--hover); color: var(--strong); }
.tb-btn:active { background: var(--press); }
.tb-btn.icon { width: 34px; padding: 0; justify-content: center; }
.tb-btn.icon.sm { width: 28px; height: 28px; }
.tb-btn.on { color: var(--accent); }
.tb-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 6px; flex: none; }

.symbol-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 10px 0 6px;
  border-radius: 8px;
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.12s;
}
.symbol-btn:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.symbol-btn .logo { width: 24px; height: 24px; font-size: 10px; }
.sym-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; }
.sym-text b { color: var(--strong); font-size: 14px; font-weight: 700; letter-spacing: 0.1px; }
.sym-text small { color: var(--muted); font-size: 10.5px; font-weight: 500; letter-spacing: 0.3px; }
.chev { color: var(--muted); margin-left: 2px; }
.hdr-quote { display: flex; align-items: baseline; gap: 8px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.hdr-quote .px { font-size: 15px; font-weight: 600; color: var(--strong); }
.pill { white-space: nowrap; display: inline-flex; align-items: center; padding: 2px 7px; border-radius: 5px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pill.up { background: var(--up-soft); }
.pill.down { background: var(--down-soft); }

.segmented { display: flex; gap: 2px; padding: 3px; background: var(--panel-2); border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.segmented button { height: 28px; min-width: 34px; padding: 0 8px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: background 0.12s, color 0.12s; }
.segmented button:hover { color: var(--strong); }
.segmented button.active { background: var(--elev); color: var(--strong); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 1px var(--line-2); }
[data-theme='light'] .segmented button.active { box-shadow: 0 1px 3px rgba(20, 25, 40, 0.12), 0 0 0 1px var(--line-2); }

.mkt-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-right: 8px; padding: 6px 10px; border-radius: 8px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); }
.i-sun { display: none; }
[data-theme='light'] .i-sun { display: block; }
[data-theme='light'] .i-moon { display: none; }

.dropdown { position: relative; }
.menu {
  position: absolute;
  top: 40px;
  left: 0;
  min-width: 210px;
  background: var(--elev);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 50;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
}
.dropdown.open .menu { opacity: 1; transform: none; pointer-events: auto; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 10px; border-radius: 6px; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button.active { color: var(--accent); background: var(--accent-soft); }

/* ============ Layout ============ */
.layout { flex: 1; min-height: 0; display: flex; gap: var(--gap); }
.toolbar {
  width: 50px;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 0;
  gap: 2px;
  overflow-y: auto;
}
.toolbar button {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.12s, color 0.12s;
}
.toolbar button:hover { background: var(--hover); color: var(--strong); }
.toolbar button.active { color: var(--accent); background: var(--accent-soft); }
.toolbar .tsep { width: 26px; height: 1px; background: var(--line-2); margin: 5px 0; flex: none; }

.center { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.chart-card { flex: 1; min-height: 200px; display: flex; flex-direction: column; overflow: hidden; }
.chart-box { flex: 1; min-height: 160px; position: relative; overflow: hidden; }
.rangebar { height: 36px; flex: none; display: flex; align-items: center; border-top: 1px solid var(--line); padding: 0 8px; gap: 6px; }
.ranges { display: flex; gap: 2px; }
.rb-btn { padding: 4px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); transition: background 0.12s, color 0.12s; }
.rb-btn:hover { background: var(--hover); color: var(--strong); }
.rb-btn.active { color: var(--accent); background: var(--accent-soft); }
.rb-sep { width: 1px; height: 16px; background: var(--line-2); }

/* ============ Chart overlays ============ */
.fc canvas { display: block; touch-action: none; }
.fc-msg { position: absolute; inset: 0 80px 28px 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 13px; pointer-events: none; text-align: center; }
.fc-msg b { color: var(--strong); font-size: 15px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fc-legends { position: absolute; inset: 0; pointer-events: none; }
.lg-box { position: absolute; left: 12px; max-width: calc(100% - 130px); }
.lg-row { display: flex; align-items: center; gap: 6px; height: 22px; white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
.lg-head { font-size: 13px; height: 26px; }
.lg-sym { color: var(--strong); font-weight: 700; font-size: 14px; }
.lg-dot { color: var(--faint); }
.lg-ohlc { margin-left: 10px; color: var(--muted); }
.lg-ohlc span { margin: 0 6px 0 3px; }
.lg-name { color: var(--text); font-weight: 500; }
.lg-vals span { margin-right: 5px; }
.lg-btns { display: none; gap: 1px; pointer-events: auto; }
.lg-ind { pointer-events: auto; border-radius: 6px; padding: 0 3px 0 6px; margin-left: -6px; transition: background 0.12s; }
.lg-ind:hover { background: color-mix(in srgb, var(--panel) 85%, transparent); box-shadow: inset 0 0 0 1px var(--line-2); }
.lg-ind:hover .lg-btns { display: inline-flex; }
.lg-btns button { width: 22px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 4px; color: var(--muted); }
.lg-btns button:hover { background: var(--hover); color: var(--strong); }
.lg-ind.off .lg-name { color: var(--faint); text-decoration: line-through; }

.fc-selbar {
  position: absolute;
  top: 10px;
  right: 96px;
  display: none;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  background: var(--elev);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 5;
}
.fc-selbar .sw { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); transition: transform 0.1s; }
.fc-selbar .sw:hover { transform: scale(1.15); }
.fc-selbar .sw.on { outline: 2px solid var(--strong); outline-offset: 2px; }
.fc-selbar .sep { width: 1px; height: 18px; background: var(--line-2); margin: 0 3px; }
.fc-selbar .del { width: 26px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 6px; color: var(--muted); }
.fc-selbar .del:hover { background: var(--down-soft); color: var(--down); }
.fc-rt {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--elev);
  box-shadow: var(--shadow);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.fc-rt:hover { color: var(--accent); }

/* ============ Bottom trading panel ============ */
.bottom { height: var(--bottom-h, 250px); flex: none; display: flex; flex-direction: column; position: relative; z-index: 3; transition: height 0.2s ease; }
.bottom.collapsed { height: 44px; }
.bottom.collapsed .bottom-body { visibility: hidden; }
.bottom.collapsed #bottomToggle svg { transform: rotate(180deg); }
.bottom-head { height: 44px; flex: none; display: flex; align-items: center; padding: 0 8px; gap: 12px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; }
.tab { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; font-weight: 600; color: var(--muted); transition: background 0.12s, color 0.12s; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { color: var(--strong); background: var(--hover); }
.count { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--hover); border-radius: 10px; padding: 1px 7px; }
.acct { flex: 1; display: flex; gap: 26px; justify-content: flex-end; font-size: 11.5px; }
.acct div { display: flex; flex-direction: column; align-items: flex-end; }
.acct span { color: var(--muted); }
.acct b { color: var(--strong); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bottom-body { flex: 1; min-height: 0; display: flex; overflow: hidden; border-radius: 0 0 var(--r) var(--r); }
.ticket { width: 300px; flex: none; padding: 12px 14px; overflow-y: auto; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.ticket-head { display: flex; justify-content: space-between; align-items: center; }
.ticket-sym { font-weight: 700; color: var(--strong); font-size: 14px; }
.badge { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 10px; }
.ticket-btns { display: flex; align-items: stretch; position: relative; gap: 6px; }
.ticket-btns button { flex: 1; border-radius: 8px; padding: 7px 10px; color: #fff; display: flex; flex-direction: column; align-items: flex-start; font-size: 11.5px; font-weight: 500; transition: filter 0.12s, transform 0.06s; }
.ticket-btns button b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.2px; }
.ticket-btns .sell { background: #e0323f; }
.ticket-btns .buy { background: #0e9472; align-items: flex-end; }
.ticket-btns button:hover { filter: brightness(1.08); }
.ticket-btns button:active { transform: translateY(1px); }
.spread { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--panel); border-radius: 5px; padding: 1px 5px; font-size: 10.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; box-shadow: 0 0 0 1px var(--line-2); }
.qty-row { display: flex; align-items: center; justify-content: space-between; }
.stepper { display: flex; align-items: center; background: var(--input); border-radius: 7px; box-shadow: inset 0 0 0 1px var(--line-2); overflow: hidden; }
.stepper:focus-within { box-shadow: inset 0 0 0 1px var(--accent); }
.stepper button { width: 28px; height: 30px; color: var(--muted); font-size: 16px; }
.stepper button:hover { color: var(--strong); background: var(--hover); }
.stepper input { width: 84px; background: none; border: 0; text-align: center; outline: none; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-chips { display: flex; gap: 4px; }
.qty-chips button { flex: 1; font-size: 11.5px; font-weight: 600; padding: 4px 0; border-radius: 6px; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }
.qty-chips button:hover { color: var(--strong); background: var(--hover); }
.ticket-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.link-btn { color: var(--muted); font-size: 12px; padding: 0; }
.link-btn:hover { color: var(--down); }
.tbl-wrap { flex: 1; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
th { position: sticky; top: 0; background: var(--panel); color: var(--muted); font-weight: 500; font-size: 11.5px; text-align: right; padding: 9px 14px; border-bottom: 1px solid var(--line); }
td { text-align: right; padding: 8px 14px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
tr:hover td { background: var(--hover); }
.side { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.side.up { background: var(--up-soft); }
.side.down { background: var(--down-soft); }
.empty { color: var(--muted); padding: 36px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty svg { color: var(--faint); }
.close-pos { box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 6px; padding: 3px 10px; font-size: 12px; font-weight: 500; }
.close-pos:hover { box-shadow: inset 0 0 0 1px var(--down); color: var(--down); background: var(--down-soft); }
.sym-link { font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; color: var(--strong); }
.sym-link .logo { width: 20px; height: 20px; font-size: 9px; }
.sym-link:hover { color: var(--accent); }

/* ============ Watchlist ============ */
.right { width: var(--right-w, 336px); flex: none; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.right.hidden { display: none; }
.wl-head { height: 48px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); }
.wl-head .title { font-weight: 700; color: var(--strong); font-size: 14px; }
.wl-list { flex: 1; overflow-y: auto; min-height: 120px; padding: 4px 6px; }
.wl-section { padding: 10px 10px 4px; font-size: 10.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.7px; }
.wl-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 58px 88px;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 8px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  transition: background 0.12s;
}
.wl-row:hover { background: var(--hover); }
.wl-row.active { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.wl-row .logo { width: 28px; height: 28px; font-size: 11px; }
.wl-row .nm { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.wl-row .nm b { color: var(--strong); font-weight: 600; font-size: 13px; }
.wl-row .nm small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wl-row svg.spark { width: 58px; height: 24px; display: block; }
.wl-row .q { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; font-variant-numeric: tabular-nums; }
.wl-row .last { color: var(--strong); font-weight: 600; font-size: 13px; border-radius: 4px; padding: 0 3px; margin-right: -3px; transition: background 0.5s; }
.wl-row .last.flash-up { background: var(--up-soft); color: var(--up); transition: none; }
.wl-row .last.flash-down { background: var(--down-soft); color: var(--down); transition: none; }
.wl-row .chg { font-size: 11.5px; font-weight: 500; }
.wl-row .rm { position: absolute; right: -2px; top: 50%; transform: translateY(-50%); display: none; width: 18px; height: 18px; border-radius: 50%; background: var(--elev); box-shadow: var(--shadow); color: var(--muted); font-size: 13px; line-height: 18px; }
.wl-row:hover .rm { display: block; }
.wl-row .rm:hover { color: var(--down); }

.details { flex: none; border-top: 1px solid var(--line); padding: 16px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); }
.d-head { display: flex; align-items: center; gap: 12px; }
.d-head .logo { width: 38px; height: 38px; font-size: 14px; }
.d-sym { font-weight: 700; font-size: 15px; color: var(--strong); }
.d-name { color: var(--muted); font-size: 12px; }
.d-price { display: flex; align-items: baseline; gap: 6px; margin-top: 14px; }
.d-price b { font-size: 30px; font-weight: 700; color: var(--strong); font-variant-numeric: tabular-nums; letter-spacing: -0.8px; }
.d-price small { font-size: 12px; color: var(--muted); }
.d-chg { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.range { margin: 16px 0 4px; }
.range-top { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.range-bar { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--down), #f5a623, var(--up)); position: relative; margin: 8px 0 6px; opacity: 0.85; }
.range-bar span { position: absolute; top: -4px; width: 4px; height: 12px; border-radius: 2px; background: var(--strong); box-shadow: 0 0 0 2px var(--panel); transform: translateX(-2px); transition: left 0.3s; }
.range-lbl { display: flex; justify-content: space-between; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin-top: 14px; background: var(--line); border-radius: 8px; overflow: hidden; font-size: 12px; }
.d-grid div { background: var(--panel); padding: 8px 10px; }
.d-grid div span { display: block; color: var(--muted); font-size: 11px; }
.d-grid div b { font-weight: 600; color: var(--strong); font-variant-numeric: tabular-nums; }

.logo { position: relative; overflow: hidden; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; width: 22px; height: 22px; font-size: 9px; letter-spacing: -0.2px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }

/* real logos sit on top of the lettered fallback */
.logo img.co { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 12%; border-radius: 50%; }
.logo img.full { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.logo svg { width: 70%; height: 70%; }
.logo.fx { overflow: visible; background: transparent !important; color: transparent; box-shadow: none; }
.logo.fx img { position: absolute; width: 72%; height: 72%; object-fit: cover; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--panel); }
.logo.fx img.f1 { left: 0; top: 0; }
.logo.fx img.f2 { right: 0; bottom: 0; }

/* ============ Modals ============ */
.backdrop { position: fixed; inset: 0; background: rgba(5, 7, 12, 0.6); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding-top: 9vh; z-index: 100; animation: fade 0.15s ease-out; }
.modal { width: 680px; max-width: calc(100vw - 24px); max-height: 78vh; background: var(--elev); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; animation: pop 0.18s ease-out; }
.modal.sm { width: 400px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.985); } }
.m-head { display: flex; align-items: center; padding: 18px 20px 12px; font-size: 17px; font-weight: 700; color: var(--strong); }
.m-head .x { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; font-size: 20px; color: var(--muted); }
.m-head .x:hover { background: var(--hover); color: var(--strong); }
.m-search { display: flex; align-items: center; gap: 10px; margin: 0 20px 12px; padding: 0 12px; border-radius: 9px; background: var(--input); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--muted); }
.m-search:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
.m-search input { flex: 1; background: none; border: 0; outline: none; font-size: 15px; padding: 10px 0; text-transform: uppercase; }
.m-search input:focus-visible { outline: none; }
.m-search input::placeholder { text-transform: none; color: var(--muted); }
.m-filters { display: flex; gap: 6px; padding: 0 20px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.chip { border-radius: 16px; padding: 5px 12px; font-size: 12.5px; font-weight: 500; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); transition: background 0.12s; }
.chip:hover { background: var(--hover); }
.chip.active { background: var(--strong); color: var(--elev); box-shadow: none; }
.m-list { overflow-y: auto; flex: 1; min-height: 200px; padding: 6px; }
.m-item { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-radius: 8px; cursor: pointer; }
.m-item:hover, .m-item.kb { background: var(--hover); }
.m-item .logo { width: 28px; height: 28px; font-size: 11px; }
.m-item .sym { font-weight: 700; width: 86px; color: var(--strong); }
.m-item .nm { flex: 1; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-item .tp { color: var(--muted); font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--hover); }
.m-item .ex { color: var(--muted); font-size: 11.5px; width: 60px; text-align: right; font-weight: 500; }
.m-item .add { color: var(--accent); font-weight: 600; font-size: 12px; }
.m-body { padding: 4px 20px 18px; display: flex; flex-direction: column; gap: 14px; }
.m-field { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.m-field input[type='number'] { width: 120px; background: var(--input); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 7px; padding: 7px 10px; outline: none; font-variant-numeric: tabular-nums; }
.m-field input[type='number']:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.m-field input[type='color'] { width: 44px; height: 30px; border: 0; border-radius: 7px; background: none; padding: 0; cursor: pointer; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.btn { padding: 8px 18px; border-radius: 8px; font-weight: 600; box-shadow: inset 0 0 0 1px var(--line-2); }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.btn.primary:hover { filter: brightness(1.08); }

/* ============ Trading v2: accounts, ticket, markets ============ */
.menu.up { top: auto; bottom: 40px; transform: translateY(4px); min-width: 280px; }
.menu-label { font-size: 10.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.6px; padding: 6px 10px 4px; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu button small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.menu button b { font-weight: 600; }
.acct-btn { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-radius: 8px; background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; color: var(--strong); }
.acct-btn:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.acct-btn svg { color: var(--muted); }
.env { font-size: 10px; font-weight: 700; letter-spacing: 0.4px; padding: 1px 6px; border-radius: 4px; color: var(--accent); background: var(--accent-soft); }
.env.live { color: #fff; background: var(--down); }
.acct-ic { width: 28px; height: 28px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; background: #5b6577; }
.acct-ic.paper { background: var(--accent); color: var(--on-accent); }
.acct-ic.ghost { background: var(--hover); color: var(--text); }
.segmented.sm { padding: 2px; border-radius: 7px; }
.segmented.sm button { height: 24px; min-width: 0; padding: 0 8px; font-size: 11.5px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-row[hidden] { display: none; }
.inp { background: var(--input); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 7px; padding: 6px 9px; outline: none; font-weight: 500; font-variant-numeric: tabular-nums; width: 140px; }
.inp:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }
.field-row .inp { text-align: right; }
.sltp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sltp label { display: flex; flex-direction: column; gap: 4px; }
.sltp .inp { width: 100%; }
.sltp input::placeholder { color: var(--faint); }
.rtabs { display: flex; gap: 2px; }
.rtabs button { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 7px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.rtabs button:hover { color: var(--text); background: var(--hover); }
.rtabs button.active { color: var(--strong); }
.wl-head { padding-left: 8px; }
.mk-cats[hidden] { display: none; }
.mk-cats { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px 6px; border-bottom: 1px solid var(--line); }
.mk-cats .chip { padding: 3px 10px; font-size: 12px; }
.wl-row .star { position: absolute; right: -2px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; font-size: 14px; color: var(--faint); opacity: 0; transition: opacity 0.12s; }
.wl-row:hover .star, .wl-row .star.on { opacity: 1; }
.wl-row .star.on { color: #f5a623; }
.see-all { display: block; width: calc(100% - 8px); margin: 8px 4px; padding: 9px; border-radius: 8px; color: var(--accent); font-weight: 600; font-size: 12.5px; box-shadow: inset 0 0 0 1px var(--line-2); }
.see-all:hover { background: var(--accent-soft); }
.skel { display: inline-block; width: 54px; height: 11px; border-radius: 4px; background: linear-gradient(90deg, var(--line) 25%, var(--line-2) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skel.wide { width: 140px; height: 26px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.m-note { padding: 10px 20px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }
.modal.wide { width: 820px; }
.cx { display: flex; min-height: 420px; border-top: 1px solid var(--line); overflow: auto; }
.cx-list { width: 250px; flex: none; padding: 10px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.cx-list button { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; text-align: left; }
.cx-list button:hover { background: var(--hover); }
.cx-list button.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(226, 160, 63, 0.35); }
.cx-list small { display: block; color: var(--muted); font-size: 11px; }
.cx-form { flex: 1; padding: 6px 22px 0; display: flex; flex-direction: column; gap: 12px; }
.cx-form h3 { margin: 10px 0 0; color: var(--strong); font-size: 17px; }
.cx-form p { margin: 0; }
.cx-form .segmented { align-self: flex-start; }
.m-field.col { flex-direction: column; align-items: stretch; gap: 5px; font-size: 12px; color: var(--muted); }
.m-field.col .inp, .m-field.col select { width: 100%; }
select { background: var(--input); color: var(--text); border: 0; box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 7px; padding: 7px 9px; font: inherit; outline: none; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); cursor: pointer; }
.cx-help { font-size: 12px; color: var(--muted); background: var(--hover); border-radius: 8px; padding: 9px 11px; }
.cx-sec { font-size: 11.5px; color: var(--muted); }
.cx-err { color: var(--down); font-size: 12.5px; min-height: 16px; }
.m-foot.flat { border: 0; padding: 4px 0 18px; margin-top: auto; }
.btn.danger { background: var(--down); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.bal-range { width: 100%; accent-color: var(--accent); }
.bal-input { display: flex; align-items: center; gap: 8px; background: var(--input); border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-2); padding: 4px 14px; font-size: 26px; font-weight: 700; color: var(--strong); }
.bal-input:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent); }
.bal-input input { flex: 1; background: none; border: 0; outline: none; font-size: 26px; font-weight: 700; color: var(--strong); font-variant-numeric: tabular-nums; min-width: 0; }
.m-body p { margin: 0; }


/* ============ Indicators & Strategies library ============ */
.lib-tabs { display: flex; gap: 4px; padding: 0 20px 12px; }
.lib-tabs button { padding: 7px 14px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.lib-tabs button:hover { color: var(--text); background: var(--hover); }
.lib-tabs button.active { color: var(--strong); background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-2); }
.strat-item { align-items: flex-start; }
.strat-item .nm { white-space: normal; display: flex; flex-direction: column; gap: 2px; }
.strat-item .nm b { color: var(--strong); }
.strat-item .nm small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.strat-item .tp { white-space: nowrap; }
.strat-ic { width: 30px; height: 30px; flex: none; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: var(--on-accent); background: var(--accent); }
.strat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: var(--accent); margin-right: 7px; }
.count.dot { padding: 0; width: 7px; height: 7px; background: var(--accent); }

/* ============ Strategy Tester ============ */
.bottom.tester-mode .ticket { display: none; }
.tester { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ts-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ts-head .strat-ic { width: 24px; height: 24px; font-size: 10px; border-radius: 7px; }
.ts-head b { color: var(--strong); }
.ts-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.ts-card { background: var(--panel); padding: 8px 14px; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.ts-card span { font-size: 11px; color: var(--muted); }
.ts-card b { font-size: 15px; color: var(--strong); font-weight: 700; }
.ts-card b.up, .ts-card small.up { color: var(--up); }
.ts-card b.down, .ts-card small.down { color: var(--down); }
.ts-card small { font-size: 11px; color: var(--muted); }
.ts-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
.ts-eq-wrap { position: relative; border-right: 1px solid var(--line); min-height: 0; padding: 6px 10px; display: flex; flex-direction: column; }
.ts-sub { font-size: 11px; color: var(--muted); }
.ts-eq { flex: 1; width: 100%; min-height: 0; display: block; }
.ts-trades { overflow: auto; min-height: 0; }
.ts-trades td, .ts-trades th { padding: 5px 12px; }
.ts-trades small { font-size: 10.5px; }
.ts-note { font-size: 10.5px; color: var(--faint); padding: 4px 14px; border-top: 1px solid var(--line); }
.ts-pick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }

/* ============ Account / sign-in ============ */
.user-btn { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--strong); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); margin-right: 4px; position: relative; }
.user-btn:hover { background: var(--hover); }
.user-btn.signed { padding: 0; width: 34px; justify-content: center; background: none; box-shadow: none; }
.user-btn img, .user-btn .avatar, .user-card img, .user-card .avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.user-btn .sync { position: absolute; right: 0; bottom: 1px; width: 9px; height: 9px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 2px var(--panel); }
.user-btn .sync.err { background: var(--down); }
.menu.right { left: auto; right: 0; min-width: 290px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.user-card img, .user-card .avatar { width: 38px; height: 38px; }
.user-card small { display: block; color: var(--muted); font-size: 12px; }
.sync-line { font-size: 11.5px; padding: 2px 10px 6px; }
.signin p { margin: 0; }
.perks { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.perks li { padding-left: 24px; position: relative; color: var(--strong); }
.perks li::before { content: '✓'; position: absolute; left: 0; color: var(--up); font-weight: 800; }
.g-btn { display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; border-radius: 10px; font-weight: 600; font-size: 14.5px; color: #1f1f1f; background: #fff; box-shadow: inset 0 0 0 1px #dadce0, 0 1px 2px rgba(0, 0, 0, 0.1); }
.g-btn:hover { background: #f7f8fa; }
.setup { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.setup code, .m-body code { font-size: 12px; background: var(--hover); padding: 1px 5px; border-radius: 4px; }

/* ============ Consent ============ */
.consent-backdrop { z-index: 400; align-items: center; padding-top: 0; }
.consent { width: 460px; }
.consent-hero { text-align: center; padding: 26px 24px 6px; }
.consent-hero h2 { margin: 12px 0 6px; font-size: 21px; color: var(--strong); letter-spacing: -0.01em; }
.consent-hero p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.consent-points { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.consent-points li { padding: 10px 12px; border-radius: 9px; background: var(--hover); font-size: 13px; line-height: 1.5; color: var(--text); }
.consent-points b { color: var(--strong); }
.consent-check { align-items: flex-start; line-height: 1.5; }
.consent-check input { margin-top: 3px; flex: none; width: 16px; height: 16px; accent-color: var(--accent); }
.consent-check a { color: var(--accent); }
.consent .m-foot a.btn { text-decoration: none; color: var(--text); }
.btn:disabled, .g-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.menu-links { padding: 4px 10px 6px; font-size: 11.5px; color: var(--muted); }
.menu-links a { color: var(--muted); }
.menu-links a:hover { color: var(--accent); }


/* ============ Real-time vs standard data ============ */
.rt-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; color: var(--muted); background: var(--hover); cursor: pointer; white-space: nowrap; }
.rt-tag.fast { color: var(--up); background: var(--up-soft); }
.rt-tag.on { color: #fff; background: #0e9472; cursor: default; }
.mkt-status { cursor: pointer; }
.mkt-status.rt span:first-of-type { color: var(--strong); font-weight: 600; }
.mkt-status.sim span { color: #f5a623; }
.mkt-status.err span { color: var(--down); }

/* ============ Broker directory ============ */
.acct-ic.brand { position: relative; overflow: hidden; }
.acct-ic.brand img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.acct-ic.sm { width: 22px; height: 22px; font-size: 10px; border-radius: 6px; }
.acct-ic.xs { width: 18px; height: 18px; font-size: 9px; border-radius: 5px; vertical-align: -4px; }
.acct-ic.lg { width: 34px; height: 34px; border-radius: 9px; }
.cx-soon { display: flex; align-items: center; gap: 9px; }
.cx-disclaimer { font-size: 10.5px; color: var(--faint); margin: 0 10px 10px; line-height: 1.4; }
.modal.wide { width: 920px; max-height: 88vh; }
.cx { min-height: 480px; max-height: calc(88vh - 60px); }
.cx-list { width: 270px; overflow-y: auto; gap: 2px; }
.cx-search { width: 100%; margin-bottom: 6px; }
.cx-groups { display: flex; flex-direction: column; gap: 2px; }
.cx-cat { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: var(--faint); padding: 10px 10px 4px; }
.cx-list button.mt { padding: 7px 10px; }
.cx-list button.mt .acct-ic { width: 24px; height: 24px; font-size: 9px; border-radius: 6px; }
.cx-soon { padding: 6px 10px; opacity: 0.6; }
.cx-soon b { display: block; font-size: 12.5px; color: var(--text); }
.cx-soon small { font-size: 11px; color: var(--muted); }
.cx-guide { display: block; margin: 10px; font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }
.cx-form { overflow-y: auto; }
.cx-steps { border-radius: 10px; background: var(--hover); padding: 10px 14px; }
.cx-steps summary { cursor: pointer; font-weight: 600; color: var(--strong); }
.cx-steps ol { margin: 8px 0 2px; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; line-height: 1.5; }
.cx-steps a { color: var(--accent); }
.cx-steps code { font-size: 11.5px; background: var(--panel); padding: 1px 4px; border-radius: 4px; }
.env-seg em.real { font-style: normal; font-size: 10px; color: var(--down); margin-left: 4px; }
.env-note { font-size: 12.5px; color: var(--text); padding: 8px 12px; border-radius: 8px; background: var(--down-soft); }
textarea.inp { width: 100%; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; text-align: left; }

/* ============ Sign-in gate ============ */
.ticket { position: relative; }
.ticket-lock { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px; text-align: center; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(3px); color: var(--muted); }
.ticket-lock[hidden] { display: none; }
.ticket-lock b { color: var(--strong); font-size: 14px; }
.ticket-lock span { font-size: 12px; line-height: 1.45; }
.signin-reason { padding: 10px 12px; border-radius: 9px; background: var(--accent-soft); color: var(--strong); font-weight: 600; font-size: 13px; }

/* ============ Plans & settings ============ */
.plan-badge { height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; letter-spacing: 0.2px; margin-right: 4px; white-space: nowrap; }
.plan-badge.upgrade { color: var(--on-accent); background: var(--accent); }
.plan-badge.upgrade:hover { filter: brightness(1.1); }
.plan-badge.pro { color: var(--strong); background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-2); }
.plan-badge.pro_plus { color: #e2a03f; background: rgba(226, 160, 63, 0.14); }
.plan-badge.elite { color: var(--on-accent); background: var(--accent); }
.modal.plans { width: 1080px; max-height: 88vh; }
.plans-wrap { overflow-y: auto; padding: 0 22px 18px; }
.plans-reason { margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--strong); font-weight: 500; }
.plans-top { display: flex; justify-content: center; margin-bottom: 16px; }
.plans-top .segmented button { height: 32px; padding: 0 14px; }
.plans-top em { font-style: normal; font-size: 11px; color: var(--up); margin-left: 4px; }
.plans-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 16px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line-2); }
.plan-card.popular { box-shadow: inset 0 0 0 2px var(--accent), 0 12px 30px rgba(226, 160, 63, 0.18); }
.plan-card.current { box-shadow: inset 0 0 0 2px var(--up); }
.plan-card .ribbon { position: absolute; top: -10px; left: 16px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--on-accent); padding: 3px 9px; border-radius: 999px; background: var(--accent); }
.plan-card h3 { margin: 0; color: var(--strong); font-size: 18px; }
.plan-card .tag { margin: -4px 0 0; color: var(--muted); font-size: 12.5px; min-height: 34px; }
.plan-card .price b { font-size: 28px; color: var(--strong); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.plan-card .price span { color: var(--muted); font-size: 12px; margin-left: 4px; }
.plan-card .btn { width: 100%; padding: 9px; }
.plan-card ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 7px; font-size: 12.5px; }
.plan-card li { padding-left: 20px; position: relative; color: var(--text); line-height: 1.4; }
.plan-card li::before { content: '✓'; position: absolute; left: 0; color: var(--up); font-weight: 800; }
.soon { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: #b8860b; background: rgba(245, 166, 35, 0.14); padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }
.addons { margin-top: 18px; }
.addons h4 { margin: 0 0 8px; color: var(--strong); }
.addon { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-radius: 10px; box-shadow: inset 0 0 0 1px var(--line-2); margin-bottom: 8px; }
.addon b { color: var(--strong); }
.addon small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.founding { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 16px 18px; border-radius: 12px; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--line-2); }
.founding b { display: block; color: var(--strong); }
.founding span { color: var(--text); font-size: 12.5px; }
.founding .btn { white-space: nowrap; }
.plans-note { color: var(--muted); font-size: 11.5px; margin: 14px 0 0; }
.modal.settings-modal { width: 760px; }
.settings { display: flex; min-height: 420px; border-top: 1px solid var(--line); }
.set-nav { width: 190px; flex: none; padding: 10px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.set-nav button { text-align: left; padding: 9px 12px; border-radius: 8px; font-weight: 600; color: var(--muted); }
.set-nav button:hover { background: var(--hover); color: var(--text); }
.set-nav button.active { background: var(--accent-soft); color: var(--accent); }
.set-body { flex: 1; padding: 4px 22px 22px; overflow-y: auto; }
.set-body h3 { color: var(--strong); margin: 14px 0 12px; font-size: 17px; }
.set-body p { margin: 6px 0; }
.sub-card { padding: 16px 18px; border-radius: 12px; background: var(--hover); box-shadow: inset 0 0 0 1px var(--line-2); }
.sub-card b { display: block; font-size: 24px; color: var(--strong); letter-spacing: -0.02em; }
.sub-card.plan-pro { background: var(--accent-soft); }
.sub-card.plan-pro_plus { background: rgba(226, 160, 63, 0.12); }
.sub-card.plan-elite { background: rgba(245, 166, 35, 0.12); }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 10px; }
.set-actions .btn, .set-row .btn { text-decoration: none; color: var(--text); }
.set-actions .btn.primary { color: var(--on-accent); }
.btn.danger-outline { color: var(--down) !important; box-shadow: inset 0 0 0 1px var(--down); }
.limits h4 { margin: 18px 0 6px; color: var(--strong); font-size: 13px; }
.limits ul { margin: 0; padding-left: 18px; color: var(--text); font-size: 13px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row b { display: block; color: var(--strong); }
.set-row small { color: var(--muted); font-size: 12px; }
.user-card.big { padding: 10px 0; }
.ts-note a { color: var(--accent); }
@media (max-width: 1000px) { .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .plans-grid { grid-template-columns: 1fr; }
  .settings { flex-direction: column; } .set-nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .founding { flex-direction: column; align-items: flex-start; }
  .plan-badge { display: none; }
}

/* ============ Tooltip & toasts ============ */
.tip {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  background: #0f1219;
  color: #f2f4f8;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.12s, transform 0.12s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.tip.show { opacity: 1; transform: none; }
.tip kbd { font: inherit; color: #9aa0ad; margin-left: 6px; }
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--elev); box-shadow: var(--shadow); border-radius: 10px; padding: 10px 16px 10px 12px; animation: tin 0.22s ease-out; transition: opacity 0.3s, transform 0.3s; }
.toast i { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-style: normal; font-weight: 700; font-size: 12px; }
.toast.buy i { background: var(--up-soft); color: var(--up); }
.toast.sell i { background: var(--down-soft); color: var(--down); }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes tin { from { opacity: 0; transform: translateY(10px); } }

/* ============ Responsive ============ */
.tab, .acct-btn, .user-btn, .mkt-status, .acct div, .tb-btn { white-space: nowrap; }
.acct { min-width: 0; overflow: hidden; }
@media (max-width: 1560px) {
  #indicatorsBtn .lbl { font-size: 0; }
  #indicatorsBtn .lbl::after { content: 'Indicators'; font-size: 13px; }
}
@media (max-width: 1440px) {
  .acct { gap: 16px; }
  .wordmark { display: none; }
}
@media (max-width: 1280px) {
  .hdr-quote, .mkt-status { display: none; }
}
@media (max-width: 1100px) {
  #indicatorsBtn .lbl, .wordmark, .mkt-status { display: none; }
  .acct { gap: 16px; }
}
@media (max-width: 900px) {
  .ts-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ts-body { grid-template-columns: 1fr; } .ts-eq-wrap { display: none; }
  .cx { flex-direction: column; } .cx-list { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .right { position: fixed; right: 6px; top: 64px; bottom: 6px; z-index: 40; box-shadow: var(--shadow); }
  .ticket { width: 240px; }
  .acct { display: none; }
}
/* ============ Phone layout (bottom tabs) ============ */
.mtabs { display: none; }
@media (max-width: 760px) {
  body { padding: 0; gap: 0; height: 100dvh; padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
  .panel { border-radius: 0; }
  .topbar { height: 50px; flex: none; padding: 0 6px; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .brand, .tb-sep, #snapBtn, #volumeBtn, .mkt-status, .hdr-quote, .plan-badge, #panelBtn, #settingsBtn, #themeBtn, .symbol-btn small, .chev, .user-btn span, #indicatorsBtn .lbl { display: none !important; }
  .topbar .spacer { flex: 0 0 4px; }
  .symbol-btn { flex: none; height: 36px; padding: 0 8px 0 4px; }
  .segmented { flex: none; }
  .segmented button { min-width: 30px; padding: 0 6px; }
  .user-btn { flex: none; width: 34px; padding: 0; justify-content: center; }
  .menu { position: fixed; top: 54px; left: 8px; right: 8px; min-width: 0; }
  .layout { gap: 0; }
  .toolbar { display: none; }
  .center { gap: 0; }
  .chart-card { border-radius: 0; }
  .rangebar { height: 40px; padding: 0 4px; }
  .ranges { overflow-x: auto; scrollbar-width: none; }
  .ranges .rb-btn { padding: 6px 8px; }
  .lg-ohlc { display: none; }
  .fc-selbar { right: 8px; top: 34px; }
  .tip { display: none !important; }

  /* one section at a time */
  body[data-mview='chart'] .bottom, body[data-mview='chart'] .right { display: none !important; }
  body[data-mview='list'] .center { display: none; }
  body[data-mview='list'] .right { display: flex !important; position: static; width: 100%; box-shadow: none; }
  body[data-mview='trade'] .chart-card, body[data-mview='trade'] .right { display: none !important; }
  body[data-mview='trade'] .bottom { display: flex; flex: 1; height: auto; min-height: 0; margin: 0; }
  body[data-mview='trade'] .bottom.collapsed .bottom-body { visibility: visible; }
  #bottomToggle { display: none; }
  .bottom-head { flex-wrap: wrap; height: auto; padding: 8px; gap: 8px; }
  .tabs { overflow-x: auto; scrollbar-width: none; flex: 1; }
  .tab { padding: 6px 10px; }
  .acct { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 6px 14px; width: 100%; order: 3; }
  .acct div { align-items: flex-start; }
  .bottom-body { flex-direction: column; overflow-y: auto; border-radius: 0; }
  .ticket { width: 100%; flex: none; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .ticket-lock { position: static; min-height: 220px; }
  .ticket-lock:not([hidden]) ~ * { display: none; }
  .tbl-wrap { overflow: auto; flex: none; }
  table { font-size: 12px; }
  th, td { padding: 7px 10px; white-space: nowrap; }
  .tester .ts-head { gap: 6px; }
  .ts-cards { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }

  .mtabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--panel); border-top: 1px solid var(--line); }
  .mtabs button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
  .mtabs button.active { color: var(--accent); }

  /* dialogs become bottom sheets */
  .backdrop { align-items: flex-end; padding-top: 0; }
  .modal, .modal.sm, .modal.wide, .modal.plans, .modal.settings-modal, .consent { width: 100%; max-width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; }
  .m-head { padding: 14px 16px 10px; }
  .m-search { margin: 0 16px 10px; }
  .cx { flex-direction: column; min-height: 0; }
  .cx-list { width: auto; max-height: 32dvh; flex-direction: column; border-right: 0; border-bottom: 1px solid var(--line); }
  .cx-form { padding: 6px 16px 0; }
  .settings { flex-direction: column; min-height: 0; }
  .set-nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .set-nav button { white-space: nowrap; }
  .set-body { padding: 4px 16px 20px; }
  .plans-grid { grid-template-columns: 1fr; }
  .plans-wrap { padding: 0 14px 16px; }
  .founding { flex-direction: column; align-items: flex-start; }
  .toast-wrap { bottom: calc(70px + env(safe-area-inset-bottom)); width: calc(100% - 24px); }
  .toast { width: 100%; }
}

/* Settings → Market data: bring-your-own real-time feed */
.own-data { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2, rgba(127,127,127,.05)); }
.own-head { display: flex; gap: 10px; align-items: center; }
.own-head b { display: block; color: var(--strong); }
.own-head small { color: var(--muted); }
.own-st { margin: 10px 0 4px; font-size: 13px; color: var(--muted); }
.own-st.ok { color: var(--up); }
.own-st.err { color: var(--down); }
.own-steps { margin: 8px 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.own-form { display: grid; gap: 8px; margin: 10px 0; }
.own-form input:not([type=checkbox]) { padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
.own-form .chk { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.own-form .err-text { color: var(--down); font-size: 13px; margin: 0; min-height: 0; }

/* Multi-chart layouts (paid: 2 Pro, 4 Pro+, 8 Elite) */
.chart-grid { flex: 1; min-height: 160px; display: grid; gap: 1px; background: var(--line); grid-template-columns: 1fr; grid-template-rows: 1fr; }
.chart-grid[data-n='2'] { grid-template-columns: 1fr 1fr; }
.chart-grid[data-n='4'] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.chart-grid[data-n='8'] { grid-template-columns: repeat(4, 1fr); grid-template-rows: 1fr 1fr; }
.chart-grid > .chart-box, .chart-grid > .pane { min-width: 0; min-height: 0; background: var(--panel); }
.chart-grid[data-n='1'] > .chart-box { min-height: 160px; }
.pane { display: flex; flex-direction: column; position: relative; }
.pane-head { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-bottom: 1px solid var(--line); font-size: 12px; min-height: 28px; }
.pane-sym { display: flex; align-items: center; gap: 6px; background: none; border: 0; color: var(--strong); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.pane-sym:hover, .pane-main:hover { background: var(--panel-2); }
.pane-sym .logo, .pane-sym img { width: 16px; height: 16px; }
.pane-px { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text); }
.pane-px.up { color: var(--up); } .pane-px.down { color: var(--down); }
.pane-main { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; font-size: 13px; }
.pane-chart { flex: 1; min-height: 0; position: relative; overflow: hidden; }
#layoutMenu button { display: flex; align-items: center; gap: 10px; width: 100%; }
#layoutMenu .lay-ic { display: grid; gap: 1px; width: 22px; height: 15px; }
#layoutMenu .lay-ic i { background: currentColor; opacity: .55; border-radius: 1px; }
#layoutMenu .req { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--accent); padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
@media (max-width: 760px) { #layoutDropdown { display: none; } }
.cx-note { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
#acctMenu button.locked { opacity: .6; }
em.beta { font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--accent); padding: 1px 5px; border-radius: 5px; background: color-mix(in srgb, var(--accent) 14%, transparent); vertical-align: middle; }
.replay-bar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); font-size: 13px; flex-wrap: wrap; }
.replay-bar .spacer { flex: 1; }

/* Trader Chat */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat[hidden] { display: none; }
.chat-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chat-rooms { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.chat-rooms .chip { white-space: nowrap; }
.chat-rooms .chip.locked { opacity: .55; }
.chat-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { display: flex; gap: 8px; }
.chat-av { width: 28px; height: 28px; flex: none; border-radius: 50%; overflow: hidden; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; color: var(--strong); }
.chat-av img { width: 100%; height: 100%; object-fit: cover; }
.chat-body { min-width: 0; flex: 1; }
.chat-meta { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.chat-meta b { color: var(--strong); }
.chat-meta time { color: var(--muted); font-size: 11px; }
.chat-more { margin-left: auto; background: none; border: 0; color: var(--muted); cursor: pointer; opacity: 0; padding: 0 4px; }
.chat-msg:hover .chat-more, .chat-more:focus { opacity: 1; }
@media (hover: none) { .chat-more { opacity: .7; } }
.chat-text { font-size: 13px; line-height: 1.45; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.me .chat-meta b { color: var(--accent); }
.chat-chart { margin-top: 4px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--strong); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.chat-chart img, .chat-chart .logo { width: 16px; height: 16px; }
.chat-acts { display: flex; gap: 6px; margin-top: 4px; }
.chat-acts button { font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.chat-form { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; min-height: 36px; max-height: 110px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
.chat-attach { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
.chat-attach.on { border-color: var(--accent); }
.chat-attached { font-size: 12px; color: var(--muted); padding: 0 10px 8px; }
.chat-attached button { background: none; border: 0; color: var(--muted); cursor: pointer; }
.chat-lock { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 24px 18px; color: var(--muted); font-size: 13px; }
.chat-lock b { color: var(--strong); font-size: 15px; }
.chat-lock svg { color: var(--accent); }
.replay-bar[hidden] { display: none; }
/* small layout panes: the pane header already names the symbol */
.pane-chart .fc-legends { display: none; }

/* Full-screen chart: hides everything except the chart */
.fs-exit { display: none; }
body.focus .app-header, body.focus header, body.focus .toolbar, body.focus .right, body.focus .bottom,
body.focus .rangebar, body.focus .replay-bar, body.focus .mtabs { display: none !important; }
body.focus .layout { padding: 0 !important; gap: 0 !important; height: 100vh; height: 100dvh; }
body.focus .center { gap: 0 !important; }
body.focus .chart-card { border-radius: 0; border: 0; box-shadow: none; }
body.focus .fs-exit { display: flex; align-items: center; gap: 6px; position: fixed; top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); z-index: 60;
  padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 88%, transparent); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; opacity: .55; transition: opacity .15s; backdrop-filter: blur(6px); }
body.focus .fs-exit:hover, body.focus .fs-exit:focus { opacity: 1; }
@media (hover: none) { body.focus .fs-exit { opacity: .9; } body.focus .fs-exit span { display: none; } }
body.focus { padding: 0 !important; gap: 0 !important; height: 100vh; height: 100dvh; }
body.focus .center, body.focus .chart-card { display: flex !important; }

/* Watchlists, alerts, strategy builder */
.wl-lists { display: flex; gap: 6px; padding: 6px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); flex: none; }
.wl-lists[hidden] { display: none; }
.wl-lists .chip { white-space: nowrap; }
.chip.ghost { background: none; color: var(--muted); }
.chip.locked { opacity: .55; }
.inp.sm { width: 76px; flex: none; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.m-foot .spacer { flex: 1; }
#alertsBtn { position: relative; }
.alert-count { position: absolute; top: 2px; right: 2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--on-accent, #1a1204); font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; }
.alert-count[hidden] { display: none; }
.alerts-modal { width: min(560px, 96vw); }
.alerts-body { padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 12px; max-height: 72vh; overflow-y: auto; }
.al-new { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.al-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.al-row .inp { flex: 1; min-width: 110px; }
.al-row .inp.sm { flex: none; }
.al-sym { display: inline-flex; align-items: center; gap: 6px; }
.al-sym img, .al-sym .logo { width: 18px; height: 18px; }
.segmented button.locked { opacity: .55; }
.al-list { display: flex; flex-direction: column; gap: 6px; }
.al-item.off { opacity: .7; }
.al-item.locked small { color: var(--down); }
.builder-modal { width: min(720px, 96vw); }
.sb-body { padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; max-height: 70vh; overflow-y: auto; }
.sb-body h4 { margin: 10px 0 2px; font-size: 13px; color: var(--strong); }
.sb-body h4 small { color: var(--muted); font-weight: 400; }
.sb-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sb-row select.inp { width: auto; min-width: 104px; }
.sb-body .chk { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 13px; }
.strat-item.build .strat-ic { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.strat-item.locked { opacity: .6; }
@media (max-width: 760px) { #alertsBtn { flex: none; } }
.al-item { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); font-size: 13px; }
.al-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.al-txt small { color: var(--muted); }
.al-item .btn { width: auto; flex: none; }

/* ============ Phone fixes: two-row header, scrolling lists, sheets ============ */
@media (max-width: 760px) {
  /* row 1: symbol + actions · row 2: timeframes + chart type */
  .topbar { height: auto; flex-wrap: wrap; overflow: visible; padding: 4px 6px; row-gap: 4px; align-items: center; }
  .topbar > * { order: 5; }
  .topbar .symbol-btn { order: 1; }
  .topbar .spacer { order: 2; flex: 1 1 0; }
  #indicatorsBtn { order: 3; flex: none; width: 36px; padding: 0; justify-content: center; }
  #alertsBtn { order: 4; }
  #fsBtn { order: 5; }
  #userDropdown { order: 6; }
  #tfGroup { order: 10; flex: 1 1 calc(100% - 50px); display: flex; }
  #tfGroup button { flex: 1; min-width: 0; }
  #typeDropdown { order: 11; flex: none; }
  .topbar .tb-btn.icon { flex: none; width: 36px; height: 36px; }
  .menu { top: 96px; }
  #userMenu { left: auto; right: 8px; width: min(320px, calc(100vw - 16px)); }

  /* watchlist tab: the whole panel scrolls, the list is no longer squeezed by the details card */
  body[data-mview='list'] .right { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  body[data-mview='list'] .wl-head { position: sticky; top: 0; z-index: 3; background: var(--panel); }
  body[data-mview='list'] .wl-list { flex: none; overflow: visible; min-height: 0; }
  body[data-mview='list'] .right .chat:not([hidden]) { flex: 1; min-height: calc(100dvh - 160px); }
  .wl-row { grid-template-columns: 28px minmax(0, 1fr) 52px 92px 24px; padding-right: 4px; }
  .wl-row .rm, .wl-row .star { position: static; transform: none; display: block; opacity: 1; width: 24px; height: 24px; box-shadow: none; background: none; }
  .wl-row .star:not(.on) { color: var(--muted); }

  /* trade tab: account menu as a sheet above the tab bar */
  #acctMenu { position: fixed; left: 8px; right: 8px; top: auto; bottom: calc(66px + env(safe-area-inset-bottom)); transform: none; min-width: 0; max-height: 60dvh; overflow-y: auto; z-index: 70; }
  .bottom-head { row-gap: 6px; }
  .bottom-head .dropdown { order: 1; }
  .acct { order: 2; }
  .tabs { order: 3; flex: 1 1 100%; }
  .tab { flex: none; }
}
@media (max-width: 760px) { #userDropdown { display: none !important; } }

/* tablets: keep every header button reachable and evenly spaced */
@media (min-width: 761px) and (max-width: 1100px) {
  .topbar { gap: 4px; }
  #snapBtn, #themeBtn { display: none; } /* theme stays in Settings → Appearance */
}
@media (min-width: 761px) and (max-width: 960px) {
  .topbar { height: auto; flex-wrap: wrap; row-gap: 4px; padding-top: 6px; padding-bottom: 6px; }
  .topbar .spacer { flex: 1 1 0; }
  .brand { display: none; }
}
@media (min-width: 761px) and (max-width: 960px) { .right { top: 106px; } }

/* drag handles to resize the watchlist and the trading panel (desktop) */
.split-v, .split-h { flex: none; position: relative; z-index: 6; touch-action: none; }
.split-v { width: 10px; margin: 0 -8px; cursor: col-resize; }
.split-h { height: 10px; margin: -8px 0; cursor: row-resize; }
.split-v::after, .split-h::after { content: ''; position: absolute; border-radius: 3px; background: var(--accent); opacity: 0; transition: opacity .15s; }
.split-v::after { top: 30%; bottom: 30%; left: 4px; width: 3px; }
.split-h::after { left: 40%; right: 40%; top: 4px; height: 3px; }
.split-v:hover::after, .split-h:hover::after, .split-v.drag::after, .split-h.drag::after { opacity: .8; }
body.resizing, body.resizing * { user-select: none !important; }
body.resizing .bottom { transition: none; }
.right.hidden + .split-v, .split-v.off { display: none; }
@media (max-width: 900px) { .split-v { display: none; } }
@media (max-width: 760px) { .split-h { display: none; } }
body.focus .split-v, body.focus .split-h { display: none; }
.mk-cats { flex-direction: column; flex-wrap: nowrap; gap: 8px; }
.mk-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.mk-filter { width: 100%; }
.d-origin { display: flex; align-items: center; gap: 5px; margin-top: 3px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.o-flag { width: 18px; height: 13px; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
#symbolEx { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; text-transform: none; }

/* AI analysis */
.ai-btn { color: var(--accent); font-weight: 600; }
.ai-btn svg { color: var(--accent); }
.ai-modal { width: min(640px, 96vw); }
.ai-title { display: inline-flex; align-items: center; gap: 8px; }
.ai-title svg { color: var(--accent); }
.ai-body { padding: 4px 20px 20px; max-height: 78vh; overflow-y: auto; font-size: 13.5px; line-height: 1.55; }
.ai-body h4 { margin: 14px 0 4px; color: var(--strong); font-size: 13px; }
.ai-body ul { margin: 0; padding-left: 18px; }
.ai-body p { margin: 6px 0; }
.ai-loading { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 10px; text-align: center; color: var(--muted); }
.ai-loading b { color: var(--strong); }
.ai-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-top .tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); color: var(--muted); text-transform: capitalize; }
.ai-bias { font-weight: 700; padding: 3px 10px; border-radius: 7px; background: var(--panel-2); color: var(--strong); }
.ai-bias.up { background: var(--up-soft); color: var(--up); }
.ai-bias.down { background: var(--down-soft); color: var(--down); }
.ai-headline { margin: 12px 0 2px; font-size: 17px; color: var(--strong); }
.ai-plan { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0 6px; }
.ai-plan > div { background: var(--panel-2); border-radius: 9px; padding: 9px 11px; display: flex; flex-direction: column; }
.ai-plan span { color: var(--muted); font-size: 11.5px; }
.ai-plan b { color: var(--strong); font-size: 15px; font-variant-numeric: tabular-nums; }
.ai-plan small { color: var(--muted); font-size: 11px; }
.ai-plan .sl b { color: var(--down); }
.ai-plan .tp b { color: var(--up); }
.ai-act { font-weight: 800; font-size: 16px; color: var(--strong); justify-content: center; }
.ai-act.buy { background: var(--up-soft) !important; color: var(--up); }
.ai-act.sell { background: var(--down-soft) !important; color: var(--down); }
.ai-act small { font-weight: 500; text-transform: capitalize; }
.ai-inv { font-size: 12.5px; color: var(--muted); }
.ai-levels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.ai-levels span { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 3px; }
.ai-levels .lv { display: inline-block; margin: 0 5px 4px 0; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.ai-levels .lv.s { background: var(--up-soft); color: var(--up); }
.ai-levels .lv.r { background: var(--down-soft); color: var(--down); }
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-grid div { background: var(--panel-2); border-radius: 9px; padding: 8px 10px; font-size: 12.5px; }
.ai-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.ai-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ai-disc { margin-top: 14px !important; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
@media (max-width: 760px) { .ai-plan { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ai-cols, .ai-grid { grid-template-columns: 1fr; } #aiBtn { order: 3; flex: none; width: 36px; padding: 0; justify-content: center; } #aiBtn .lbl { display: none; } }
@media (max-width: 1100px) { #aiBtn .lbl { display: none; } }

/* News */
.news { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 10px; }
.news[hidden] { display: none; }
.news-head { display: flex; align-items: center; gap: 10px; padding: 8px 6px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.news-head > div { flex: 1; min-width: 0; }
.news-head b { display: block; color: var(--strong); }
.news-head small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.news-head .btn { text-decoration: none; color: var(--text); flex: none; }
.news-item { display: flex; gap: 10px; padding: 9px 6px; border-radius: 8px; text-decoration: none; color: inherit; }
.news-item:hover { background: var(--hover); }
.news-item img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; background: var(--panel-2); }
.news-item b { display: block; color: var(--strong); font-weight: 600; font-size: 13px; line-height: 1.35; }
.news-item small { color: var(--muted); font-size: 11.5px; }
.news-item.sm b { font-size: 12.5px; }
.news-note { color: var(--muted); font-size: 11px; padding: 6px; margin: 0; }
.mk-country { width: 100%; }
.mk-country[hidden] { display: none; }
.ai-admin { margin-top: 12px; padding: 10px 12px; border-radius: 9px; background: var(--down-soft); color: var(--text); font-size: 12px; font-family: ui-monospace, Menlo, monospace; }
.ai-admin b { display: block; font-family: var(--font); color: var(--down); margin-bottom: 4px; }

/* market open / closed badge */
.mkt-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; padding: 2px 7px; border-radius: 5px; white-space: nowrap; color: var(--muted); background: var(--hover); }
.mkt-tag i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mkt-tag.open { color: var(--up); background: var(--up-soft); }
.mkt-tag.closed { color: var(--down, #f23645); }
.mkt-tag.ext { color: #e2a03f; }
/* saved AI analyses */
.ai-saved { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.ai-sv { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 26px 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--hover); color: inherit; cursor: pointer; text-align: left; font: inherit; }
.ai-sv span, .ai-sv small { color: var(--muted); font-size: 12px; }
.ai-sv i { position: absolute; top: 4px; right: 8px; font-style: normal; color: var(--muted); font-size: 16px; }
.ai-sv i:hover { color: var(--down, #f23645); }
.ai-saved-note { margin: 6px 0 0; }

/* alert notifications row */
.al-push { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--hover); }
.al-push > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 200px; flex: 1; }
.al-push span { color: var(--muted); font-size: 12.5px; }
.al-push.on { border-color: rgba(8, 153, 129, 0.45); }
.al-push-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* chart: "+" at the crosshair price, context menu */
.fc-plus { position: absolute; z-index: 4; display: none; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border-radius: 4px; border: 1px solid var(--line); background: var(--elev); color: var(--text); cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.fc-plus:hover { background: var(--accent, #e2a03f); color: #1b1306; border-color: transparent; }
.ctx-menu { position: fixed; z-index: 1000; min-width: 230px; padding: 5px; border-radius: 8px; border: 1px solid var(--line); background: var(--elev); box-shadow: 0 10px 30px rgba(0,0,0,.35); font-size: 13px; }
.ctx-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 5px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.ctx-menu button:hover { background: var(--hover); }
.ctx-menu button i { width: 18px; text-align: center; font-style: normal; color: var(--muted); }
.ctx-menu button kbd { margin-left: auto; color: var(--muted); font: 11px inherit; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }
.ctx-menu .buy { color: var(--up); } .ctx-menu .sell { color: var(--down, #f23645); }
/* range bar: scale modes + clock */
.rb-btn.on { color: var(--accent, #e2a03f); background: var(--hover); }
.rb-clock { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; padding: 0 8px; white-space: nowrap; }
.rb-sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.cs-grid { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: center; margin: 4px 0 14px; }
.cs-grid input[type=color] { width: 44px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; }
.cs-grid select { min-width: 150px; }
.cs-sec { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); margin: 6px 0 2px; grid-column: 1 / -1; }
.modal.cs-modal { width: 440px; } .cs-modal .m-body { overflow-y: auto; }

.cs-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.cs-pre { display: inline-flex; align-items: center; gap: 3px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--hover); color: var(--text); font: 12px var(--font); cursor: pointer; }
.cs-pre:hover { border-color: var(--accent); }
.cs-pre i { width: 8px; height: 14px; border-radius: 2px; }
.cs-pre span { margin-left: 4px; }
.cs-parts { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 56px 56px; gap: 8px 10px; align-items: center; }
.cs-parts b { font-size: 11px; color: var(--muted); text-align: center; font-weight: 600; }
.cs-parts label { display: flex; align-items: center; gap: 8px; }
.cs-parts input[type=color] { width: 44px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; cursor: pointer; justify-self: center; }
.admin-link b { color: var(--accent); }

/* top bar: never wider than the screen. Less important bits compact first, and the price
   area gives way before any button is pushed off the edge. */
.topbar > * { flex-shrink: 0; }
.topbar > .spacer { flex: 1 1 0; min-width: 0; }
.topbar > .hdr-quote { flex-shrink: 1; min-width: 0; overflow: hidden; }
@media (min-width: 761px) and (max-width: 1760px) {
  .mkt-status { display: none; }
  .hdr-quote .mkt-tag { font-size: 0; gap: 0; padding: 5px; } /* just the colored dot; the tooltip says open/closed */
  .hdr-quote .mkt-tag i { width: 8px; height: 8px; }
}
@media (min-width: 761px) and (max-width: 1560px) {
  .wordmark { display: none; }
}
@media (min-width: 761px) and (max-width: 1400px) {
  #aiBtn .lbl { font-size: 0; }
  #aiBtn .lbl::after { content: 'AI'; font-size: 13px; }
}
@media (min-width: 761px) and (max-width: 1280px) {
  #aiBtn .lbl { display: none; }
  #aiBtn { width: 34px; padding: 0; justify-content: center; }
  #snapBtn { display: none; }
  .topbar .tb-sep { margin: 0 3px; }
}
@media (min-width: 761px) and (max-width: 1100px) {
  #volumeBtn { display: none; } /* volume is also in Chart settings */
  #tfGroup button { padding: 0 7px; min-width: 0; }
}
@media (min-width: 761px) and (max-width: 1760px) {
  #indicatorsBtn .lbl { font-size: 0; }
  #indicatorsBtn .lbl::after { content: 'Indicators'; font-size: 13px; }
}
@media (min-width: 761px) and (max-width: 1440px) {
  #indicatorsBtn .lbl { display: none; }
  #indicatorsBtn { width: 34px; padding: 0; justify-content: center; }
}
@media (min-width: 761px) and (max-width: 1999px) { .mkt-status { display: none; } }
@media (min-width: 761px) and (max-width: 1600px) {
  #indicatorsBtn .lbl { display: none; }
  #indicatorsBtn { width: 34px; padding: 0; justify-content: center; }
}
@media (min-width: 761px) and (max-width: 1500px) {
  #aiBtn .lbl { font-size: 0; }
  #aiBtn .lbl::after { content: 'AI'; font-size: 13px; }
  #themeBtn { display: none; } /* also in Settings → Appearance */
}
@media (min-width: 761px) and (max-width: 1400px) { #snapBtn { display: none; } }

/* drag handle between the watchlist and the symbol details box */
.split-d { flex: none; height: 10px; margin: -5px 0; position: relative; z-index: 6; cursor: row-resize; touch-action: none; }
.split-d[hidden] { display: none; }
.split-d::after { content: ''; position: absolute; left: 40%; right: 40%; top: 4px; height: 3px; border-radius: 3px; background: var(--accent); opacity: 0; transition: opacity .15s; }
.split-d:hover::after, .split-d.drag::after { opacity: .8; }
.details.sized { overflow-y: auto; min-height: 0; }
.details.sized[style*="height: 0px"] { padding: 0; border-top-width: 0; }
body.resizing-v, body.resizing-v * { cursor: row-resize !important; user-select: none !important; }
@media (max-width: 760px) { .split-d { display: none; } }

/* owner (admin) badge and profile check mark */
.owner-badge { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; padding: 1px 6px 1px 4px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 700; letter-spacing: .2px; vertical-align: middle; white-space: nowrap; }
.owner-badge svg { color: #1d9bf0; }
.user-btn { position: relative; }
.user-btn .owner-check { position: absolute; right: -2px; bottom: -2px; width: 15px; height: 15px; border-radius: 50%; background: #1d9bf0; color: #fff; font: 700 9px/15px var(--font); font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--panel); }
.user-card .owner-badge { margin: 2px 0 2px 0; width: max-content; }
/* chat: daily message counter */
.chat-quota { padding: 4px 12px 8px; font-size: 11.5px; color: var(--muted); }
.chat-quota a { color: var(--accent); }
/* site-wide announcement from the admin panel */
.site-notice { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 7px 40px 7px 14px; font-size: 13px; position: relative; flex: none; border-radius: var(--r); }
.site-notice.info { background: rgba(41, 98, 255, .14); color: var(--strong); }
.site-notice.success { background: var(--up-soft); color: var(--strong); }
.site-notice.warning { background: var(--accent-soft); color: var(--strong); }
.site-notice a { color: var(--accent); font-weight: 600; }
.site-notice button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }

/* risk calculator in the order ticket */
.risk-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px; align-items: center; margin-top: 6px; }
.risk-row .inp { height: 30px; min-width: 0; }
.risk-row select.inp { padding: 0 6px; }
.risk-info { margin-top: 4px; line-height: 1.35; min-height: 15px; }

/* AI follow-up questions */
.ai-ask { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.ai-qa { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.ai-q { align-self: flex-end; max-width: 85%; background: var(--accent-soft); color: var(--strong); padding: 6px 10px; border-radius: 10px 10px 2px 10px; }
.ai-a { align-self: flex-start; max-width: 92%; background: var(--hover); padding: 8px 10px; border-radius: 10px 10px 10px 2px; white-space: pre-wrap; }
.ai-ask-form { display: flex; gap: 6px; }
.ai-ask-form .inp { flex: 1; }

/* ============ Tools (js/tools.js) ============ */
.tools-menu { width: 300px; }
.tools-menu button svg { flex: none; color: var(--muted); }
.modal.tl-modal.wide { width: 1100px; max-height: 90vh; }
.tl-body { overflow-y: auto; }
.tl-loading { display: flex; justify-content: center; padding: 40px; }
.tl-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tl-row .inp { flex: 1; min-width: 0; }
.tl-tabs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tl-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tl-stats > div { background: var(--hover); border-radius: 10px; padding: 10px 12px; }
.tl-stats span { display: block; color: var(--muted); font-size: 12px; }
.tl-stats b { font-size: 18px; color: var(--strong); font-variant-numeric: tabular-nums; }
.tl-body table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tl-body th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; background: var(--elev); }
.tl-body td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tl-body .up { color: var(--up); } .tl-body .down { color: var(--down); }
.tl-body .empty { text-align: center; color: var(--muted); padding: 24px; }
.sc-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.sc-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sc-filters .inp { height: 32px; }
.sc-f { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.sc-tbl { max-height: 52vh; overflow: auto; }
.sc-tbl th[data-sort] { cursor: pointer; user-select: none; }
.sc-tbl th.sorted { color: var(--accent); }
.sc-tbl tbody tr { cursor: pointer; }
.sc-tbl tbody tr:hover { background: var(--hover); }
.sc-sym { display: flex; align-items: center; gap: 8px; min-width: 170px; }
.sc-sym .logo { width: 24px; height: 24px; flex: none; }
.sc-sym span { display: flex; flex-direction: column; min-width: 0; }
.sc-sym small { color: var(--muted); font-size: 11px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; background: var(--accent-soft); color: var(--strong); font-size: 13px; border-radius: var(--r) var(--r) 0 0; }
.share-bar span { flex: 1; }
/* journal */
.jr-tbl tbody tr[data-jid] { cursor: pointer; }
.jr-tbl tbody tr[data-jid]:hover, .jr-tbl tr.open { background: var(--hover); }
.jr-tag { display: inline-block; padding: 1px 7px; margin: 1px 3px 1px 0; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 11px; }
.jr-note { color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-form { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; padding: 6px 0; }
.jr-shot { background: var(--hover); border-radius: 8px; min-height: 160px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.jr-shot img { width: 100%; display: block; }
.jr-fields { display: flex; flex-direction: column; gap: 8px; }
.jr-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.jr-moods { display: flex; gap: 6px; }
.jr-moods button { font-size: 20px; width: 38px; height: 38px; border-radius: 8px; background: var(--hover); filter: grayscale(.8); opacity: .7; }
.jr-moods button.on { filter: none; opacity: 1; box-shadow: inset 0 0 0 2px var(--accent); }
.jr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.card-ish { background: var(--hover); border-radius: 10px; padding: 10px 12px; }
.card-ish h4 { margin: 0 0 6px; }
.card-ish th { background: transparent; position: static; }
/* portfolio */
.pf-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pf-allocs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.pf-alloc h4 { margin: 0 0 6px; }
.pf-bar { display: grid; grid-template-columns: 110px 1fr 52px; align-items: center; gap: 8px; font-size: 12px; margin: 3px 0; }
.pf-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-bar i { height: 8px; border-radius: 4px; background: var(--accent); min-width: 2px; }
.pf-bar b { text-align: right; font-weight: 600; }
/* ideas */
.ideas-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.idea { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.idea p { margin: 0; white-space: pre-wrap; }
.idea-head { display: flex; align-items: center; gap: 8px; }
.idea-head img, .idea-head .av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--hover); font-weight: 700; }
.idea-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.idea-head small { color: var(--muted); font-size: 11.5px; }
.idea-sym { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.idea-open { display: inline-flex; align-items: center; gap: 6px; color: var(--strong); }
.idea-open .logo { width: 22px; height: 22px; }
.idea-side { font-weight: 700; font-size: 12px; }
.idea-side.up { color: var(--up); } .idea-side.down { color: var(--down); }
.tag-grey, .tag-up, .tag-down { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: var(--hover); color: var(--muted); }
.tag-up { background: var(--up-soft); color: var(--up); } .tag-down { background: var(--down-soft); color: var(--down); }
.idea-lv { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.idea-lv b { color: var(--strong); }
.idea-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.idea-form label, .idea-text { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
/* contest */
.ct-hero { display: flex; gap: 16px; align-items: stretch; flex-wrap: wrap; }
.ct-hero > div:first-child { flex: 1; min-width: 260px; }
.ct-hero h3 { margin: 0 0 4px; }
.ct-prize { margin-top: 6px !important; color: var(--accent); }
.ct-me { display: grid; grid-template-columns: auto auto; gap: 2px 12px; align-items: baseline; background: var(--hover); border-radius: 12px; padding: 12px 16px; min-width: 220px; }
.ct-me span { color: var(--muted); font-size: 12px; } .ct-me b { font-size: 20px; color: var(--strong); } .ct-me small { grid-column: 2; }
.ct-me .btn { grid-column: 1 / -1; margin-top: 6px; }
.ct-trade { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ct-trade .btn.buy { background: var(--up); color: #fff; } .ct-trade .btn.sell { background: var(--down); color: #fff; }
.ct-board tr.me { background: var(--accent-soft); }
.ct-av { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
/* learn */
.ln-progress { display: flex; flex-direction: column; gap: 6px; }
.ln-progress i { height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.ln-progress span { display: block; height: 100%; background: var(--accent); }
.ln-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.ln-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-align: left; color: var(--text); }
.ln-card:hover { border-color: var(--accent); }
.ln-card.done { border-color: rgba(8, 153, 129, .5); }
.ln-card small { color: var(--muted); }
.ln-ic { font-size: 22px; }
.ln-badges { display: flex; gap: 8px; flex-wrap: wrap; font-size: 26px; }
.ln-badges span { filter: grayscale(1); opacity: .3; }
.ln-badges span.on { filter: none; opacity: 1; }
.ln-body p { margin: 0 0 8px; line-height: 1.55; }
.ln-quiz { display: flex; flex-direction: column; gap: 10px; }
.ln-q { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--hover); }
.ln-q label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.ln-q.q-ok { box-shadow: inset 3px 0 0 var(--up); } .ln-q.q-bad { box-shadow: inset 3px 0 0 var(--down); }
.ln-why { color: var(--muted); }
@media (max-width: 760px) { .jr-form, .idea-form { grid-template-columns: 1fr; } .modal.tl-modal.wide { width: 100vw; max-height: 92vh; } }
.tl-body th, .tl-body td { text-align: left; }
.tl-body .btn.sm[data-lhome] { align-self: flex-start; }
.tl-body > .btn, .tl-body .set-actions .btn { align-self: flex-start; }
@media (min-width: 761px) and (max-width: 1400px) { #fsBtn { display: none; } }

/* right-panel tabs (Watchlist · Markets · News · Chat) always fit the panel's width */
.right { container-type: inline-size; container-name: rpanel; }
.rtabs { flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.rtabs::-webkit-scrollbar { display: none; }
.rtabs button { flex: none; white-space: nowrap; }
.wl-head .spacer { flex: 0 0 0; }
@container rpanel (max-width: 340px) {
  .rtabs button { padding: 6px 7px; font-size: 13px; gap: 4px; }
}
@container rpanel (max-width: 300px) {
  .rtabs button { padding: 5px 6px; font-size: 12.5px; }
  .rtabs .count { display: none; }
}
@container rpanel (max-width: 300px) {
  .rtabs button { padding: 5px 5px; font-size: 12px; }
  .rtabs button[data-rt="watchlist"], .rtabs button[data-rt="markets"] { font-size: 0; gap: 0; }
  .rtabs button[data-rt="watchlist"]::before { content: 'List'; font-size: 12px; }
  .rtabs button[data-rt="markets"]::before { content: 'Markets'; font-size: 12px; }
}
@container rpanel (max-width: 260px) {
  .rtabs button[data-rt="markets"]::before { content: 'Mkts'; }
  .rtabs { gap: 0; }
}

.acct-ic.contest { background: var(--accent-soft); font-size: 13px; }
.env.contest { color: var(--on-accent); background: var(--accent); }

/* ============ Tools, round 2 ============ */
.tools-menu { width: 600px; max-height: 80vh; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0 4px; }
.tools-menu .menu-label { grid-column: 1 / -1; margin-top: 4px; }
@media (max-width: 760px) { .tools-menu { width: min(92vw, 360px); grid-template-columns: 1fr; } }
.link { cursor: pointer; text-decoration: underline; text-decoration-color: transparent; }
.link:hover { text-decoration-color: currentColor; color: var(--accent); }
.sc-help { font-size: 12.5px; color: var(--muted); }
.sc-help summary { cursor: pointer; color: var(--accent); }
.sc-help ul { margin: 6px 0 0; padding-left: 18px; line-height: 1.5; }
.sc-count td { color: var(--muted); font-size: 12px; padding: 4px 8px !important; cursor: default; }
.ct-acct { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pf-src { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pf-src label.chip { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.pf-src input { margin: 0; }
.jn-edit { display: flex; flex-direction: column; gap: 8px; }
.jn-edit textarea { min-height: 220px; resize: vertical; line-height: 1.5; }
.jn-list { display: flex; flex-direction: column; gap: 8px; }
.jn-item { text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); display: flex; flex-direction: column; gap: 4px; }
.jn-item:hover { border-color: var(--accent); }
.jn-item small { display: block; color: var(--muted); font-size: 11.5px; }
.jn-item p { margin: 0; color: var(--muted); white-space: pre-wrap; }
.heat { display: flex; flex-direction: column; gap: 10px; }
.heat-sec h5 { margin: 0 0 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.heat-tiles { display: flex; flex-wrap: wrap; gap: 3px; }
.heat-t { flex-basis: 70px; min-height: 52px; border-radius: 5px; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.heat-t b { font-size: 12.5px; } .heat-t small { font-size: 11px; opacity: .9; }
.heat-t:hover { outline: 2px solid var(--strong); }
.pat { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.pat.bullish { border-left-color: var(--up); } .pat.bearish { border-left-color: var(--down); }
.pat p { margin: 0; }
.pat-h { display: flex; gap: 8px; align-items: center; }
.pat-lv { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.pat-lv b { color: var(--strong); }
.mtf-sum { padding: 12px 14px; border-radius: 10px; background: var(--hover); font-size: 14px; }
.mtf-sum.up { background: var(--up-soft); } .mtf-sum.down { background: var(--down-soft); }
.wi-in { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 16px; }
.wi-in label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.wi-in label span { display: flex; gap: 8px; align-items: center; } .wi-in input[type=range] { flex: 1; }
.wi-in .tl-row { grid-column: 1 / -1; }
.wi-bars { display: flex; flex-direction: column; gap: 4px; }
.wi-row { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) 100px 72px; gap: 10px; align-items: center; font-size: 13px; }
.wi-track { position: relative; height: 10px; background: var(--hover); border-radius: 5px; }
.wi-track::after { content: ''; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-2, var(--line)); }
.wi-track i { position: absolute; top: 0; bottom: 0; border-radius: 5px; }
.wi-track i.up { background: var(--up); } .wi-track i.down { background: var(--down); }
.wi-row .inp { height: 28px; padding: 0 6px; }
.corr td { text-align: center !important; font-variant-numeric: tabular-nums; color: var(--strong); }
.corr th { font-size: 11px; }
.sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.sum-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.sum-row span:first-child { display: flex; gap: 6px; align-items: center; } .sum-row .logo { width: 20px; height: 20px; }
.sum-big { font-size: 22px; font-weight: 700; margin: 4px 0 !important; }
.prof-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.prof-head img, .prof-head .av { width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--hover); font-size: 26px; font-weight: 700; }
.prof-head > div { flex: 1; min-width: 200px; } .prof-head h3 { margin: 0; }
.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach-i { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 10px; border-radius: 10px; background: var(--hover); opacity: .45; filter: grayscale(1); }
.ach-i.on { opacity: 1; filter: none; box-shadow: inset 0 0 0 1px var(--accent); }
.ach-i span { font-size: 26px; } .ach-i small { color: var(--muted); font-size: 11px; }
.prof-ideas .sum-row { grid-template-columns: auto 1fr auto; cursor: default; }
@media (max-width: 760px) { .wi-row { grid-template-columns: 1fr 70px; } .wi-row .wi-track, .wi-row .inp { display: none; } }
.wi-row .inp { width: 72px; min-width: 0; }
/* Save button + saved charts */
.rb-btn.rb-save { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.sv-list { display: flex; flex-direction: column; gap: 6px; }
.sv-item { display: flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.sv-open { flex: 1; display: flex; gap: 10px; align-items: center; text-align: left; color: var(--text); min-width: 0; }
.sv-open .logo { width: 28px; height: 28px; flex: none; }
.sv-open span { display: flex; flex-direction: column; min-width: 0; }
.sv-open small { color: var(--muted); font-size: 11.5px; }
.sv-item:hover { border-color: var(--accent); }

/* order ticket: two columns side by side so Buy/Sell, quantity, stop loss, take profit and risk all
   fit the trading panel without scrolling (one column on narrow screens) */
.tk-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
@media (min-width: 901px) {
  .ticket { width: 600px; flex-direction: row; gap: 16px; padding: 10px 14px; }
  .ticket > .tk-col { flex: 1 1 0; }
  .ticket .ticket-foot { margin-top: 0; }
  .ticket .risk-row { margin-top: 0; }
}
@media (min-width: 901px) and (max-width: 1180px) { .ticket { width: 480px; } }
@media (max-width: 900px) { .ticket > .tk-col + .tk-col { margin-top: 1px; } }
.risk-row { grid-template-columns: auto minmax(0, 1fr) 58px auto; }
.risk-row select.inp { width: 58px; }
