:root,
[data-theme="dark"] {
  --bg: #131722;
  --panel: #1e222d;
  --panel-2: #2a2e39;
  --border: #2a2e39;
  --text: #d1d4dc;
  --muted: #787b86;
  --accent: #2962ff;
  --accent-soft: rgba(41, 98, 255, 0.18);
  --up: #089981;
  --down: #f23645;
  --hover: #2a2e39;
  --grid: rgba(42, 46, 57, 0.6);
  --input: #131722;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --gold: #d4a514;
  --gold-soft: rgba(212, 165, 20, 0.16);
  --scroll: #363a45;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #ffffff;
  --panel: #f8f9fd;
  --panel-2: #eef0f6;
  --border: #e0e3eb;
  --text: #131722;
  --muted: #6a6d78;
  --accent: #2962ff;
  --accent-soft: rgba(41, 98, 255, 0.12);
  --up: #089981;
  --down: #f23645;
  --hover: #eef0f6;
  --grid: rgba(224, 227, 235, 0.7);
  --input: #ffffff;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  --gold: #b8860b;
  --gold-soft: rgba(184, 134, 11, 0.14);
  --scroll: #c9cdd6;
  color-scheme: light;
}
* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
}
*:hover {
  scrollbar-color: var(--scroll) transparent;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 4px;
}
:hover::-webkit-scrollbar-thumb {
  background: var(--scroll);
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font:
    13px/1.4 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Ubuntu,
    "Helvetica Neue",
    Arial,
    sans-serif;
  overflow: hidden;
}
button,
select,
input,
textarea {
  font: inherit;
  color: inherit;
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.hidden {
  display: none !important;
}
.spacer {
  flex: 1;
}
.up {
  color: var(--up);
}
.down {
  color: var(--down);
}
.muted {
  color: var(--muted);
}

/* top bar */
.topbar {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  overflow-x: auto;
  overflow-y: hidden;
}
.topbar::-webkit-scrollbar {
  height: 0;
}
.brand {
  display: flex;
  align-items: center;
  padding: 0 8px 0 2px;
}
.sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 6px;
  flex: none;
}
.tb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  flex: none;
}
a.tb {
  color: inherit;
  text-decoration: none;
}
.tb:hover,
.tb.active {
  background: var(--hover);
}
.tb.on {
  color: var(--accent);
}
.tb.icon {
  padding: 0 7px;
}
select.tb {
  appearance: none;
  padding-right: 22px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 12px) 14px,
    calc(100% - 8px) 14px;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
select.tb option {
  background: var(--panel);
}
.tb.check {
  gap: 5px;
  color: var(--muted);
}
.symbol-btn {
  font-weight: 600;
  font-size: 14px;
}
.tf-group {
  display: flex;
  gap: 1px;
  flex: none;
}
.tf-group button {
  height: 32px;
  min-width: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  padding: 0 6px;
}
.tf-group button:hover {
  background: var(--hover);
}
.tf-group button.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.tf-custom {
  width: 46px;
  height: 28px;
  margin-left: 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input);
  padding: 0 6px;
  text-align: center;
  flex: none;
}
.status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  margin: 0 6px 0 8px;
  flex: none;
}
.status.ok {
  background: var(--up);
}
.status.warn {
  background: #f7a600;
}
.status.bad {
  background: var(--down);
}

/* main layout */
.main {
  display: flex;
  height: calc(100% - 44px);
}
.drawbar {
  width: 44px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
  gap: 2px;
  flex: none;
}
.drawbar button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.drawbar button:hover {
  background: var(--hover);
}
.drawbar button.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.drawbar hr {
  width: 24px;
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}
.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.grid {
  flex: 1;
  display: grid;
  gap: 1px;
  background: var(--border);
  min-height: 0;
}
.side {
  width: 300px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex: none;
  background: var(--bg);
}

/* chart panes */
.pane {
  position: relative;
  background: var(--bg);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.pane.active::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--accent);
  pointer-events: none;
  z-index: 5;
}
.grid[data-count="1"] .pane.active::after {
  display: none;
}
.pane .chart {
  position: absolute;
  inset: 0;
}
.legend {
  position: absolute;
  left: 8px;
  top: 6px;
  z-index: 4;
  pointer-events: none;
  font-size: 12px;
  max-width: calc(100% - 90px);
}
.legend .row {
  background: var(--legend-bg, transparent);
  border-radius: 4px;
  width: fit-content;
  max-width: 100%;
  padding: 0 4px;
  margin-left: -4px;
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 20px;
}
.legend .title {
  font-weight: 600;
  font-size: 13px;
  pointer-events: auto;
  cursor: pointer;
}
.legend .ohlc span {
  margin-right: 6px;
}
.legend .ohlc b {
  font-weight: 400;
  color: var(--muted);
  margin-right: 2px;
}
.legend .ind {
  pointer-events: auto;
  border-radius: 3px;
  padding: 0 4px 0 2px;
}
.legend .ind:hover {
  background: var(--panel);
}
.legend .ind .name {
  color: var(--muted);
}
.legend .ind .acts {
  display: none;
  gap: 2px;
}
.legend .ind:hover .acts {
  display: inline-flex;
}
.legend .ind .acts button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0 2px;
  color: var(--muted);
  height: 18px;
}
.legend .ind .acts button:hover {
  color: var(--text);
}
.legend .ind .acts svg {
  width: 14px;
  height: 14px;
}
.legend .note {
  color: #f7a600;
  font-size: 11px;
  pointer-events: auto;
  white-space: normal;
  max-width: 420px;
}
.pane-msg {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  z-index: 3;
  pointer-events: none;
  text-align: center;
  padding: 20px;
}
.replay-bar {
  position: absolute;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 4px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  box-shadow: var(--shadow);
}
.replay-bar button,
.replay-bar select {
  height: 28px;
  border: 0;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  padding: 0 8px;
}
.replay-bar button:hover {
  background: var(--hover);
}
.replay-bar .hint {
  color: var(--muted);
  padding: 0 6px;
}

/* tabs and panels */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 6px;
  height: 38px;
  flex: none;
}
.tabs button {
  border: 0;
  background: transparent;
  height: 30px;
  padding: 0 10px;
  cursor: pointer;
  border-radius: 4px;
  color: var(--muted);
  white-space: nowrap;
}
.tabs button:hover {
  background: var(--hover);
  color: var(--text);
}
.tabs button.active {
  color: var(--text);
  background: var(--hover);
}
.tabs .icon {
  padding: 0 6px;
}
.tab-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.bottom {
  height: var(--bottom-h, 320px);
  position: relative;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex: none;
  background: var(--bg);
}
.bottom.collapsed {
  height: 39px;
}
.bottom.collapsed .tab-body {
  display: none;
}
.bottom.collapsed #bottomToggle svg {
  transform: rotate(180deg);
}
.pad {
  padding: 10px 12px;
}
.row-flex {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.field {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
}
.field > input,
.field > select {
  min-width: 70px;
}
input.in,
select.in,
textarea.in,
.field input,
.field select {
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input);
  padding: 0 7px;
  color: var(--text);
}
textarea.in {
  height: auto;
  padding: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  width: 100%;
  resize: vertical;
  tab-size: 2;
}
.btn {
  height: 28px;
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover {
  background: var(--hover);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  filter: brightness(1.1);
}
.btn.small {
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
}
.btn.danger {
  color: var(--down);
}
.link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.hint-text {
  color: var(--muted);
  font-size: 12px;
}

/* tables */
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
table.t th {
  position: sticky;
  top: 0;
  background: var(--bg);
  text-align: right;
  font-weight: 500;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  z-index: 1;
}
table.t td {
  text-align: right;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
table.t th:first-child,
table.t td:first-child,
table.t .l {
  text-align: left;
}
table.t tbody tr {
  cursor: pointer;
}
table.t tbody tr:hover {
  background: var(--hover);
}

/* watchlist */
.wl-head {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}
.wl-head select {
  flex: 1;
}
.wl-row {
  display: grid;
  grid-template-columns: 1fr auto 64px 18px;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.wl-row:hover {
  background: var(--hover);
}
.wl-row.current {
  background: var(--accent-soft);
}
.wl-row .sym {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wl-row .ex {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.wl-row .px {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.wl-row .chg {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.wl-row .x {
  opacity: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}
.wl-row:hover .x {
  opacity: 1;
}
.wl-row .x svg {
  width: 14px;
  height: 14px;
}

/* cards in side panel */
.card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 8px;
  background: var(--panel);
}
.card .top {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: start;
}
.card .sub {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.impact-High {
  color: var(--down);
}
.impact-Medium {
  color: #f7a600;
}
.impact-Low {
  color: var(--muted);
}
.impact-Holiday {
  color: var(--muted);
}

/* stats grid */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.stat .k {
  color: var(--muted);
  font-size: 11px;
}
.stat .v {
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.tester {
  display: grid;
  grid-template-columns: minmax(330px, 420px) 1fr;
  height: 100%;
}
.tester .left {
  border-right: 1px solid var(--border);
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 12px;
}
.tester .right {
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rules {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 10px;
}
.rule {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px;
}
.rule select,
.rule input {
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--input);
  padding: 0 5px;
  max-width: 150px;
}
.rule input.num {
  width: 70px;
}
.rule .x {
  margin-left: auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}
h4 {
  margin: 10px 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.equity {
  height: 150px;
  border: 1px solid var(--border);
  border-radius: 6px;
  position: relative;
}
.next-step {
  font-size: 12px;
  color: var(--muted);
  border-left: 2px solid var(--accent);
  padding: 4px 10px;
}

/* heatmap */
.heatmap-wrap {
  position: relative;
  height: 100%;
}
.heatmap-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.tip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  box-shadow: var(--shadow);
  font-size: 12px;
}

/* modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 40;
  display: grid;
  place-items: start center;
  padding-top: 9vh;
}
.modal-card {
  width: min(560px, 94vw);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}
.modal-head button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}
.modal-body {
  padding: 12px 14px;
  overflow: auto;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.search-in {
  width: 100%;
  height: 38px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input);
  padding: 0 12px;
  color: var(--text);
}
.list {
  margin-top: 8px;
}
.list .item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.list .item:hover,
.list .item.sel {
  background: var(--hover);
}
.list .item .meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.list .group {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 10px 4px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.form-grid .field input,
.form-grid .field select {
  width: 100%;
}

/* toasts */
.toasts {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  max-width: 360px;
  animation: in 0.2s ease-out;
}
.toast.err {
  border-left-color: var(--down);
}
.toast.alert {
  border-left-color: #f7a600;
}
@keyframes in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

@media (max-width: 900px) {
  .side {
    display: none;
  }
  .bottom {
    height: 45%;
  }
}

.quant-verdict { display: inline-block; margin: 8px 0; padding: 4px 10px; border-radius: 4px; font-weight: 600; background: var(--hover); }
.quant-verdict.up { color: var(--up); } .quant-verdict.down { color: var(--down); } .quant-verdict.warn { color: #f7a600; }
.tester code { background: var(--hover); padding: 1px 4px; border-radius: 3px; font-size: 12px; }

/* news */
a.card.news { display: block; color: inherit; text-decoration: none; }
a.card.news:hover { border-color: var(--accent); }
.news-title { font-weight: 600; line-height: 1.35; }
.news-sum { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; }
/* seasonals */
.seas { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); height: 100%; }
.seas-left { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--border); }
.seas-chart { flex: 1; min-height: 160px; position: relative; }
.seas-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 6px 12px; font-size: 12px; }
.seas-legend i { display: inline-block; width: 10px; height: 3px; margin-right: 5px; vertical-align: middle; }
.seas-right { overflow: auto; }
.seas-table td, .seas-table th { padding: 4px 5px; font-size: 11px; text-align: center; }
.seas-table td.l, .seas-table th:first-child { text-align: left; }
.seas-sum td { font-weight: 600; border-top: 1px solid var(--border); }
/* financials */
.fin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 12px; }
.fin-stats div { display: flex; flex-direction: column; }
.fin-bars { display: flex; gap: 10px; align-items: flex-end; height: 150px; margin: 12px 0 4px; }
.fin-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.fin-stack { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.fin-bar { width: 38%; border-radius: 3px 3px 0 0; min-height: 1px; }
.fin-bar.rev { background: var(--accent); } .fin-bar.ni { background: var(--up); } .fin-bar.ni.neg { background: var(--down); }
.fin-col .sub { font-size: 10px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.replay-bar.follower { pointer-events: none; opacity: .8; }

/* gold: bonus quant features */
.gold-box { border: 1.5px solid var(--gold); border-radius: 8px; padding: 10px 12px; background: var(--panel); box-shadow: 0 0 0 3px var(--gold-soft); }
.gold-box { min-width: 0; overflow-x: auto; }
.gold-box table.t td, .gold-box table.t th, .tester .right table.t td, .tester .right table.t th { white-space: normal; }
.gold-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.gold-badge { background: var(--gold); color: #1a1405; font-weight: 700; font-size: 11px; padding: 1px 7px; border-radius: 3px; letter-spacing: .03em; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1a1405; font-weight: 600; }
.btn.gold:hover { filter: brightness(1.08); }
.gold-text { color: var(--gold) !important; }
#tQuant { margin-top: 4px; }
table.t.heat td { text-align: center; } table.t.heat td.base { outline: 2px solid var(--gold); outline-offset: -2px; font-weight: 700; }
/* Right panel can be collapsed to a narrow strip of tab buttons */
.side { transition: width 0.12s ease; }
.side.collapsed { width: 34px; }
.side.collapsed #sideBody { display: none; }
.side.collapsed .tabs { flex-direction: column; height: auto; padding: 6px 0; gap: 6px; border-bottom: 0; align-items: stretch; }
.side.collapsed .tabs .spacer { display: none; }
.side.collapsed .tabs button { writing-mode: vertical-rl; height: auto; padding: 10px 0; width: 100%; }
.side.collapsed #sideToggle { writing-mode: horizontal-tb; order: -1; padding: 6px 0; height: 28px; }

/* Data tab and the chart's info chip */
.info-chip { border: 1px solid var(--border); background: var(--panel); color: var(--muted); border-radius: 10px; padding: 1px 8px; font-size: 11px; cursor: pointer; }
.info-chip:hover { color: var(--text); background: var(--hover); }
.data-tab { padding: 10px 12px; font-size: 12px; }
.data-tab h4 { margin: 0 0 8px; font-size: 13px; }
.data-tab h5 { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.data-tab .kv { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.data-tab .kv span { color: var(--muted); flex: none; }
.data-tab .kv b { font-weight: 500; text-align: right; word-break: break-word; }
.data-tab .note-row { padding: 4px 0; line-height: 1.4; }

/* Side tabs: five tabs plus the collapse button must always fit; the button is never clipped */
.side:not(.collapsed) { width: 320px; }
.side .tabs { min-width: 0; gap: 0; padding: 0 4px; overflow: hidden; }
.side .tabs button { padding: 0 7px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side .tabs .spacer { flex: 1 1 0; min-width: 0; }
.side .tabs #sideToggle { flex: none; width: 28px; padding: 0; font-size: 16px; line-height: 1; }
.side.collapsed .tabs button { padding: 10px 0; }

/* Tooltips */
#qtTip { position: fixed; z-index: 10000; display: none; pointer-events: none; padding: 7px 10px; border-radius: 6px; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35); font-size: 12px; line-height: 1.35; }
#qtTip.on { display: block; }
#qtTip .tip-head { font-weight: 600; }
#qtTip .tip-body { margin-top: 3px; color: var(--muted); }

/* Selecting and moving drawings */
.pane.over-drawing, .pane.over-drawing * { cursor: move !important; }
.pane.over-drawing.over-handle, .pane.over-drawing.over-handle * { cursor: pointer !important; }
.pane { position: relative; }
.draw-edit { position: absolute; z-index: 6; top: 52px; left: 50%; transform: translateX(-50%); display: flex; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 24px); align-items: center; gap: 4px; padding: 4px 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3); font-size: 12px; }
.draw-edit.hidden { display: none; }
.draw-edit button { background: none; border: 1px solid transparent; color: var(--text); border-radius: 5px; padding: 3px 7px; cursor: pointer; }
.draw-edit button:hover { background: var(--panel); }
.draw-edit button.on { border-color: var(--accent); }
.draw-edit .sw { width: 18px; height: 18px; padding: 0; border-radius: 50%; border: 2px solid transparent; }
.draw-edit .sw.on { border-color: var(--text); }
.draw-edit .wd { width: 26px; display: flex; align-items: center; justify-content: center; padding: 3px 0; }
.draw-edit .wd i { display: block; width: 16px; background: var(--text); }
.draw-edit .sep { width: 1px; height: 16px; background: var(--border); margin: 0 3px; }

.draw-edit button { white-space: nowrap; }

/* AI indicator dialog */
.ai-box textarea { width: 100%; box-sizing: border-box; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font: inherit; resize: vertical; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ai-chips .chip { background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); border-radius: 12px; padding: 3px 10px; font-size: 11px; cursor: pointer; }
.ai-chips .chip:hover { color: var(--text); }
.ai-actions { display: flex; align-items: center; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.ai-result { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 8px; }
.ai-result h4 { margin: 0 0 4px; }
.ai-code { max-height: 260px; overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px; font-size: 11px; white-space: pre-wrap; }

/* AI chat panel (left of the chart) */
.ai-panel { width: 340px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--border); min-height: 0; }
.ai-panel.hidden { display: none; }
#aiBtn.on { background: var(--panel-2); color: var(--accent); }
.ai-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; font-weight: 600; border-bottom: 1px solid var(--border); }
.ai-head-btns { display: flex; gap: 6px; }
.ai-head-btns button { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 5px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.ai-head-btns button:hover { color: var(--text); }
.ai-log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.ai-log .msg { max-width: 94%; padding: 9px 11px; border-radius: 10px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.ai-log .msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.ai-log .msg.ai { align-self: flex-start; background: var(--panel-2); border-bottom-left-radius: 3px; }
.ai-log .msg.sys { align-self: center; background: none; color: var(--muted); font-size: 12px; text-align: center; }
.ai-log .thinking { display: flex; gap: 5px; padding: 12px; }
.ai-log .thinking span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: aiDot 1.2s infinite ease-in-out; }
.ai-log .thinking span:nth-child(2) { animation-delay: 0.2s; }
.ai-log .thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDot { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.ai-card { margin-top: 8px; padding: 8px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; }
.ai-card-btns { display: flex; gap: 6px; margin-top: 6px; }
.ai-card-btns button { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 5px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.ai-card-btns button:hover { background: var(--panel-2); }
.ai-log .ai-chips { display: flex; flex-direction: column; gap: 6px; }
.ai-log .ai-chips .chip { text-align: left; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 7px 10px; font-size: 12px; cursor: pointer; }
.ai-log .ai-chips .chip:hover { border-color: var(--accent); }
.ai-input { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.ai-input textarea { flex: 1; resize: none; box-sizing: border-box; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px; font: inherit; font-size: 13px; max-height: 120px; }
.ai-foot { padding: 0 12px 8px; font-size: 10.5px; color: var(--muted); }

/* Time zone strip */
.chart-bar { height: 26px; flex: none; display: flex; align-items: center; gap: 4px; padding: 0 8px; border-top: 1px solid var(--border); background: var(--panel); font-size: 12px; }
.chart-bar .spacer { flex: 1; }
.cb-btn { background: none; border: 0; color: var(--text); padding: 3px 8px; border-radius: 5px; cursor: pointer; font: inherit; font-variant-numeric: tabular-nums; }
.cb-btn:hover { background: var(--panel-2); }
.tz-menu { position: fixed; z-index: 9000; max-height: 70vh; overflow-y: auto; min-width: 260px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); padding: 4px 0; font-size: 12.5px; }
.tz-row { display: flex; gap: 8px; padding: 6px 12px; cursor: pointer; }
.tz-row:hover { background: var(--panel); }
.tz-row.on { color: var(--accent); }
.tz-row .ck { width: 12px; }

/* Left toolbar groups, flyouts and the favourites bar */
.drawbar .spacer { flex: 1; }
.drawbar .grp { position: relative; width: 100%; display: flex; justify-content: center; }
.drawbar .grp-arrow { position: absolute; right: 1px; top: 50%; width: 9px; height: 22px; margin-top: -11px; padding: 0 !important; border: 0; background: none; cursor: pointer; }
.drawbar .grp-arrow::after { content: ""; position: absolute; right: 1px; top: 8px; border: 3px solid transparent; border-left-color: var(--muted); }
.drawbar .grp-arrow:hover::after { border-left-color: var(--text); }
.drawbar button.on { color: var(--accent); }
.tool-flyout { position: fixed; z-index: 9000; min-width: 250px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); padding: 6px 0; font-size: 13px; }
.fly-head { padding: 4px 14px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.fly-row { display: flex; align-items: center; gap: 10px; padding: 6px 12px; cursor: pointer; }
.fly-row:hover { background: var(--panel); }
.fly-row .fi svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.fly-row .nm { flex: 1; }
.fly-row .kb { color: var(--muted); font-size: 11px; }
.fly-row .star { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 2px; opacity: 0; }
.fly-row:hover .star, .fly-row .star.on { opacity: 1; }
.fly-row .star.on { color: #f5b301; }
.fly-row .star svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
#favBar { position: absolute; z-index: 7; top: 40px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 4px 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35); }
#favBar.hidden { display: none; }
#favBar button { width: 30px; height: 30px; padding: 0; background: none; border: 1px solid transparent; border-radius: 6px; color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; }
#favBar button:hover { background: var(--panel-2); }
#favBar button.active { background: var(--panel-2); border-color: var(--accent); color: var(--accent); }
#favBar svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.6; }
#favBar .fav-grip { cursor: grab; color: var(--muted); padding: 0 4px; letter-spacing: -2px; user-select: none; }
#favBar .fav-hint { color: var(--muted); font-size: 12px; padding: 0 8px; }
#favBar .fav-x { color: var(--muted); font-size: 16px; width: 22px; }
.center { position: relative; }

/* Context menu, countdown, tables */
.ctx-menu { position: fixed; z-index: 9500; min-width: 280px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); padding: 5px 0; font-size: 13px; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.ctx-row { display: flex; justify-content: space-between; gap: 24px; padding: 7px 14px; cursor: pointer; }
.ctx-row:hover { background: var(--panel); }
.ctx-row.off { opacity: 0.4; cursor: default; }
.ctx-row .kb { color: var(--muted); font-size: 11px; }
.countdown { position: absolute; z-index: 5; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; background: var(--panel-2); color: var(--text); padding: 2px 0; border-radius: 3px; pointer-events: none; }
.countdown.hidden { display: none; }
.tbl-wrap { max-height: 60vh; overflow: auto; }
.obj-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.obj-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 8px; border-radius: 6px; background: var(--panel-2); font-size: 12.5px; }
.obj-row button { margin-left: 6px; background: none; border: 1px solid var(--border); color: var(--text); border-radius: 5px; padding: 2px 8px; cursor: pointer; font-size: 12px; }
.tb.icon:disabled { opacity: 0.35; cursor: default; }

.pane.over-tradeline, .pane.over-tradeline * { cursor: ns-resize !important; }
.draw-edit .mini { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.draw-edit .mini input { width: 52px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 5px; padding: 2px 4px; font-size: 12px; }
.pp-more { margin-top: 10px; }
.pp-more summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
.draw-edit button:disabled { opacity: 0.4; cursor: default; }

.bottom-resizer { position: absolute; z-index: 20; top: -4px; left: 0; right: 0; height: 9px; cursor: ns-resize; }
.bottom-resizer::after { content: ""; position: absolute; left: 50%; top: 3px; width: 44px; height: 3px; margin-left: -22px; border-radius: 2px; background: var(--border); }
.bottom-resizer:hover::after, .bottom-resizer.drag::after { background: var(--accent); }
body.resizing-bottom, body.resizing-bottom * { cursor: ns-resize !important; user-select: none !important; }

.oneclick { position: absolute; z-index: 7; top: 8px; right: 78px; display: flex; align-items: stretch; gap: 0; border-radius: 6px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.35); font-size: 12px; }
.oneclick.hidden { display: none; }
.oneclick.off { opacity: 0.55; }
.oc-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 78px; padding: 3px 10px; border: 0; color: #fff; cursor: pointer; line-height: 1.15; }
.oc-btn b { font-size: 11px; letter-spacing: .04em; }
.oc-btn .oc-px { font-variant-numeric: tabular-nums; font-size: 11px; opacity: .95; }
.oc-short { background: var(--down); }
.oc-long { background: var(--up); }
.oc-btn:hover { filter: brightness(1.12); }
.oc-size { display: flex; flex-direction: column; background: var(--panel-2); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
.oc-size select, .oc-size input { width: 78px; box-sizing: border-box; border: 0; background: transparent; color: var(--text); font-size: 11px; padding: 2px 4px; text-align: center; }
.oc-size input { border-top: 1px solid var(--border); }

/* Analytics tab */
.analytics { padding: 8px 12px 16px; }
.an-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.an-filters .field select, .an-filters .field input { min-width: 90px; }
.an-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 10px; margin: 10px 0; }
.an-card { background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.an-card h4 { margin: 0 0 6px; display: flex; gap: 8px; align-items: baseline; }
.an-card canvas { width: 100%; display: block; }
.seg { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.seg button { background: none; border: 0; color: var(--muted); padding: 2px 10px; cursor: pointer; font-size: 12px; }
.seg button.on { background: var(--accent); color: #fff; }
.cal-month { display: inline-block; margin: 0 14px 8px 0; vertical-align: top; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 22px); gap: 2px; font-size: 9.5px; margin-top: 3px; }
.cal-grid span { text-align: center; color: var(--muted); }
.cal-grid i { height: 20px; line-height: 20px; text-align: center; font-style: normal; border-radius: 3px; color: var(--text); }

.shots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.shots figure { margin: 0; width: 150px; }
.shots img { width: 150px; height: 94px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; cursor: zoom-in; display: block; }
.shots figcaption { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.shots .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.lightbox { position: fixed; inset: 0; z-index: 10000; background: rgba(0, 0, 0, 0.82); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 6px; }
.oc-scalp { border: 0; background: var(--panel-2); color: var(--muted); cursor: pointer; padding: 0 9px; font-size: 14px; border-left: 1px solid var(--border); }
.oc-scalp.on { background: #2962ff; color: #fff; }

.badge-on { background: var(--accent); color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 10.5px; margin-left: 4px; }
.cmp-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; margin: 4px 0 10px; }
.cmp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.checks { margin-top: 8px; }
.chk { display: block; font-size: 13px; padding: 2px 0; cursor: pointer; }
.oc-size .oc-strat { width: 78px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 10px; padding: 2px 2px; }

/* Prop-firm challenge */
.prop-panel { position: absolute; z-index: 7; left: 56px; bottom: 36px; width: 250px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.35); font-size: 11.5px; }
.prop-panel.hidden { display: none; }
.prop-panel .pp-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 6px 9px; cursor: pointer; }
.prop-panel .pp-head b { color: #fff; border-radius: 4px; padding: 1px 6px; font-size: 10px; letter-spacing: .04em; }
.prop-panel .pp-body { padding: 2px 9px 8px; }
.prop-panel.collapsed .pp-body { display: none; }
.pp-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; color: var(--muted); }
.pp-row b { color: var(--text); font-weight: 600; white-space: nowrap; }
.pp-bar { height: 4px; border-radius: 2px; background: var(--border); margin-top: 2px; overflow: hidden; }
.pp-bar i { display: block; height: 100%; }
.pp-fail { margin-top: 8px; color: #ef5350; line-height: 1.35; }
.badge-failed, .badge-passed, .badge-active { border-radius: 4px; padding: 1px 6px; font-size: 10.5px; margin-left: 4px; color: #fff; }
.badge-failed { background: #ef5350; } .badge-passed { background: #26a69a; } .badge-active { background: #2962ff; }
.prop-form select, .prop-form input[type=number], .prop-form input:not([type]) { max-width: 100%; }

/* News tab (economic calendar archive) */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 14px; padding: 3px 10px; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.imp-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: #787b86; }
.chip .imp-dot { margin-right: 0; }
.imp-high { --c: #ef5350; } .imp-medium { --c: #ff9800; } .imp-low { --c: #fdd835; } .imp-holiday { --c: #787b86; }
i.imp-dot.imp-high { background: #ef5350; } i.imp-dot.imp-medium { background: #ff9800; } i.imp-dot.imp-low { background: #fdd835; } i.imp-dot.imp-holiday { background: #787b86; } i.imp-dot.imp-none { background: #444; }
.news-t .day-row td { background: var(--panel-2); font-weight: 600; padding: 6px 10px; text-align: left; }
.news-t tr.past td { opacity: 0.55; }
.news-t tr.next td { background: rgba(41, 98, 255, 0.12); }

.out-rows .out-row { display: flex; align-items: center; gap: 10px; margin: 5px 0; }
.out-rows .out-name { flex: 1; min-width: 90px; }
.out-rows select { width: 84px; }
.out-rows label { display: flex; align-items: center; gap: 4px; white-space: nowrap; }

.cb-btn.live-live { color: #26a69a; }
.cb-btn.live-stale, .cb-btn.live-waiting { color: #ff9800; }
.cb-btn.live-disconnected { color: #ef5350; }
.cb-btn.live-off, .cb-btn.live-na, .cb-btn.live-closed { color: var(--muted, #787b86); }
.live-banner { position: absolute; top: 34px; left: 50%; transform: translateX(-50%); z-index: 6; max-width: 80%; padding: 4px 10px; border-radius: 4px; background: #ef5350; color: #fff; font-size: 12px; pointer-events: none; }
.live-banner.warn { background: #ff9800; color: #222; }

/* ---------- sign-in screen, workspaces, account ---------- */
.login-overlay { position: fixed; inset: 0; z-index: 5000; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.login-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card .sub { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.login-card .field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.login-card .field input { font-size: 15px; padding: 9px 10px; background: var(--input); color: var(--text); border: 1px solid var(--border); border-radius: 6px; }
.login-card .err { min-height: 18px; color: var(--down); font-size: 13px; }
.login-card .btn { padding: 10px; font-size: 14px; }
.ws-bar { display: flex; align-items: center; gap: 6px; margin-right: 6px; }
.ws-bar #wsBtn span { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-chip { background: none; border: 0; font-size: 11px; color: var(--muted); cursor: default; padding: 2px 6px; white-space: nowrap; }
.save-chip.saved { color: var(--up); }
.save-chip.saving { color: var(--muted); }
.save-chip.error, .save-chip.conflict { color: #ff9800; cursor: pointer; font-weight: 600; }
.ws-list { display: flex; flex-direction: column; gap: 6px; max-height: 55vh; overflow: auto; }
.ws-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; }
.ws-row.active { border-color: var(--accent); background: var(--accent-soft); }
.ws-open { flex: 1; text-align: left; background: none; border: 0; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 2px; }
.ws-acts { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-size: 10px; padding: 1px 6px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-weight: 400; }
.badge.on { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 800px) { .ws-bar #wsBtn span { max-width: 90px; } .save-chip { display: none; } }

/* ---------- frame: top bar, avatar, left toolbar (TradingView-like, clearer icons) ---------- */
.topbar { height: 48px; gap: 3px; padding: 0 8px 0 0; }
.main { height: calc(100% - 48px); }
.topbar svg { width: 20px; height: 20px; stroke-width: 1.8; }
.topbar .tb { height: 36px; padding: 0 10px; border-radius: 6px; font-size: 14px; font-weight: 500; }
.topbar .tb.icon { padding: 0 8px; }
.topbar .symbol-btn { font-weight: 700; font-size: 15px; padding: 0 10px 0 8px; }
.topbar .symbol-btn svg { color: var(--muted); }
.topbar .sep { height: 24px; margin: 0 4px; }
.topbar .tf-group button { height: 36px; min-width: 34px; border-radius: 6px; font-size: 14px; font-weight: 500; }
.topbar .tf-group button.active { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.topbar select.tb { padding-right: 24px; background-position: calc(100% - 13px) 16px, calc(100% - 9px) 16px; }
.avatar-btn { width: 52px; height: 48px; flex: none; border: 0; border-right: 1px solid transparent; background: none; cursor: pointer; display: grid; place-items: center; padding: 0; margin-right: 2px; position: relative; }
.avatar-btn { color: #fff; font-weight: 700; font-size: 15px; }
.avatar-btn:hover .av { box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 3px var(--accent); }
.avatar-btn .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.avatar-lg { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; flex: none; }
.avatar-lg.big { width: 72px; height: 72px; font-size: 28px; }
.drawbar { width: 52px; padding-top: 4px; gap: 3px; }
.drawbar button { width: 44px; height: 42px; border-radius: 8px; color: var(--text); }
.drawbar button svg { width: 27px; height: 27px; stroke-width: 1.85; }
.drawbar button:hover { background: var(--hover); }
.drawbar button.active { color: var(--accent); background: var(--accent-soft); }
.drawbar hr { width: 30px; margin: 5px 0; }
.drawbar .grp-arrow { width: 11px; right: 0; }
.drawbar button.fav-switch { margin-bottom: 6px; color: var(--muted); }
.drawbar button.fav-switch.on { color: #f7b500; }
.drawbar button.fav-switch svg { width: 26px; height: 26px; }
.pop { position: fixed; z-index: 9500; min-width: 220px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.pop-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; font-size: 13px; }
.pop-hint { margin: 0; padding: 0 8px 6px; font-size: 11px; color: var(--muted); }
.pop-item { text-align: left; background: none; border: 0; border-radius: 6px; padding: 8px 10px; font-size: 14px; color: var(--text); cursor: pointer; }
.pop-item:hover { background: var(--hover); }
.pop-item.danger { color: var(--down); }
.pop-item.on { color: var(--accent); }
.pop hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; width: 100%; }
.pop-head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.pop .tf-custom { margin: 0; }
#morePop .pop-item.on::after { content: " (on)"; color: var(--muted); }

/* chart settings dialog */
.settings-card { width: min(820px, 96vw) !important; height: min(640px, 82vh); }
.settings-card .modal-body { padding: 0; overflow: hidden; flex: 1; display: flex; }
.set-wrap { display: flex; width: 100%; min-height: 0; }
.set-nav { width: 168px; flex: none; border-right: 1px solid var(--border); padding: 8px 0; display: flex; flex-direction: column; overflow: auto; }
.set-nav button { text-align: left; border: 0; background: transparent; color: var(--text); padding: 9px 16px; cursor: pointer; font-size: 13px; border-left: 3px solid transparent; }
.set-nav button:hover { background: var(--hover); }
.set-nav button.on { background: var(--hover); border-left-color: var(--accent); font-weight: 600; }
.set-page { flex: 1; overflow: auto; padding: 4px 18px 14px; }
.set-page h3 { margin: 12px 0 8px; font-size: 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 6px 0; min-height: 34px; }
.set-row.check { justify-content: flex-start; }
.set-row.check input { margin: 0; }
.set-label { font-size: 13px; }
.set-row select, .set-row input[type=number] { min-width: 170px; max-width: 280px; }
.set-color { display: inline-flex; align-items: center; gap: 8px; }
.set-color input[type=color] { width: 40px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 4px; background: transparent; cursor: pointer; }
.set-color input.auto { opacity: 0.45; }
.set-color .hint-text { width: 62px; }
.tpl-wrap { position: relative; }
.tpl-menu { position: absolute; bottom: 38px; left: 0; min-width: 270px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 5px 0; z-index: 5; }
.tpl-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.tpl-item { display: flex; align-items: center; gap: 6px; padding: 2px 8px; }
.tpl-item input { flex: 1; min-width: 0; }
.tpl-name { flex: 1; text-align: left; border: 0; background: transparent; color: var(--text); padding: 7px 8px; cursor: pointer; border-radius: 4px; font-size: 13px; width: 100%; }
.tpl-name:hover, .tpl-ic:hover { background: var(--hover); }
.tpl-ic { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px 7px; border-radius: 4px; }
@media (max-width: 640px) {
  .set-wrap { flex-direction: column; }
  .set-nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 0; }
  .set-nav button { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; }
  .set-nav button.on { border-bottom-color: var(--accent); }
  .set-row { flex-wrap: wrap; }
}

/* two-factor sign-in */
.tfa-box { border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin-bottom: 6px; }
.tfa-key { font-family: ui-monospace, Consolas, monospace; font-size: 16px; letter-spacing: 1px; user-select: all; margin: 6px 0; word-break: break-all; }
.tfa-codes { font-family: ui-monospace, Consolas, monospace; font-size: 14px; columns: 2; margin: 6px 0; user-select: all; }
.tfa-box input { min-width: 140px; }
