/* =========================================================================
 * terminal.css — the dark production look of the workspace.
 * All tokens live in base.css so the same stack can be re-themed.
 * ========================================================================= */

:root,
body.sci-fi-orange {
  --bg: #0b0f14;
  --bg-panel: #10161e;
  --bg-panel2: #161f2a;
  --bg-input: #0d1218;
  --line: rgba(255, 145, 40, 0.14);
  --txt: #dce4ee;
  --dim: #8898aa;
  --amber: #ff9429;
  --orange: #e87a14;
  --green: #2cc982;
  --red: #f05a68;
  --blue: #ffa64d;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

body.theme-light,
body.sci-fi-orange.theme-light {
  --bg: #f4f6f9;
  --bg-panel: #ffffff;
  --bg-panel2: #eef2f7;
  --bg-input: #ffffff;
  --line: #d6dee8;
  --txt: #18222f;
  --dim: #526273;
  --amber: #c95f00;
  --orange: #c95f00;
  --green: #0b8f53;
  --red: #d42b39;
  --blue: #1d6fe8;
}

body.theme-light .appbar {
  background: linear-gradient(180deg, #ffffff 0%, #eef2f7 100%) !important;
  color: var(--txt);
  border-bottom: 1px solid var(--line);
}
body.theme-light .appbar a.brand,
body.theme-light .brand {
  color: #18222f !important;
}
body.theme-light .panel__head,
body.theme-light .panel-head,
body.theme-light .dock__tabs,
body.theme-light .dock-tabs,
body.theme-light .dockbar,
body.theme-light .viewtabs,
body.theme-light .chart-head,
body.theme-light .chart-tools,
body.theme-light .heat-head {
  background: #f8fafc !important;
  color: var(--txt) !important;
  border-color: var(--line) !important;
}
body.theme-light .chsym {
  color: #0f172a !important;
}
body.theme-light .dtab {
  color: var(--dim) !important;
}
body.theme-light .dtab.is-active {
  color: var(--amber) !important;
  border-bottom-color: var(--amber) !important;
}
body.theme-light .btn,
body.theme-light .tb,
body.theme-light .icon-btn {
  background: #ffffff !important;
  color: #18222f !important;
  border-color: var(--line) !important;
}
body.theme-light .btn--primary {
  background: var(--green) !important;
  border-color: var(--green) !important;
  color: #ffffff !important;
}
body.theme-light .tb.is-active {
  background: #fff3e6 !important;
  border-color: var(--amber) !important;
  color: var(--amber) !important;
}
body.theme-light .wl__row {
  border-bottom-color: #e6ecf2 !important;
  color: var(--txt) !important;
}
body.theme-light .wl__row:hover {
  background: #eef3f8 !important;
}
body.theme-light .wl__row.is-active,
body.theme-light .symrow.is-active {
  background: #e3edfa !important;
  color: #0f172a !important;
}
body.theme-light .symrow,
body.theme-light .sym-menu__list,
body.theme-light .picker__body,
body.theme-light .picker__cats,
body.theme-light #btCanvas,
body.theme-light .script-editor {
  background: #ffffff !important;
  color: var(--txt) !important;
  border-color: var(--line) !important;
}
body.theme-light .interval-menu__item.is-active,
body.theme-light .picker__cat--active,
body.theme-light .picker__row.is-active,
body.theme-light .chip.is-active {
  background: #e6f4ee !important;
  border-color: var(--green) !important;
  color: var(--green) !important;
}
body.theme-light .class-tab.is-active {
  background: #fff3e6 !important;
  border-color: var(--amber) !important;
  color: var(--amber) !important;
}
body.theme-light .hm-matrix th {
  background: #e8eef5;
  color: #18222f;
}
body.theme-light .hm-cell {
  background: #f1f5f9;
  border-color: #dbe3ec;
}
body.theme-light .hm-hover-card {
  background: #ffffff;
  color: #18222f;
}

/* Live price flash animations */
@keyframes flashUp {
  0% { background: rgba(33, 208, 122, 0.35); }
  100% { background: transparent; }
}
@keyframes flashDown {
  0% { background: rgba(255, 77, 94, 0.35); }
  100% { background: transparent; }
}
.flash-up { animation: flashUp 0.65s ease-out; }
.flash-down { animation: flashDown 0.65s ease-out; }

/* Color palette popover & floating drawing/indicator toolbar */
.cpal-swatch { width: 28px; height: 24px; border-radius: 5px; border: 1px solid var(--line); cursor: pointer; }
.cpal-pop { width: 246px; display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.cpal-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.cpal-cell { width: 20px; height: 20px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.12); cursor: pointer; }
.cpal-cell.is-active { outline: 2px solid #fff; outline-offset: 1px; }
.cpal-custom, .cpal-opacity { display: flex; align-items: center; gap: 8px; }
.settings__candle-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }

.float-bar { position: absolute; z-index: 25; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; background: var(--bg-panel2); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 26px rgba(0,0,0,0.45); }
.float-bar__btn { padding: 4px 7px; border-radius: 4px; font-size: 12px; color: var(--txt); }
.float-bar__btn:hover { background: rgba(255,148,41,0.14); color: var(--amber); }
.float-bar__btn--danger:hover { background: rgba(255,77,94,0.16); color: var(--red); }

/* Fullscreen exit floating button */
.fs-exit-btn { display: none; position: fixed; top: 12px; right: 16px; z-index: 80; padding: 6px 12px; border-radius: 6px; background: var(--bg-panel2); border: 1px solid var(--amber); color: var(--amber); font-size: 12px; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,0.45); }
body.chart-fullscreen .fs-exit-btn { display: inline-flex; align-items: center; gap: 6px; }

/* Lightweight animated login backdrop */
@keyframes gateGridDrift {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 48px 48px, 48px 48px; }
}
.gate::before, .admin-gate::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 148, 41, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 148, 41, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  animation: gateGridDrift 18s linear infinite;
  pointer-events: none;
}

.brand { display: inline-flex; align-items: center; gap: 7px; }
.brand__logo { width: 20px; height: 20px; border-radius: 4px; object-fit: contain; }
.gate__logo, .admin-brand__logo { width: 34px; height: 34px; border-radius: 6px; object-fit: contain; }

.gate {
  backdrop-filter: blur(18px) saturate(140%) !important;
  -webkit-backdrop-filter: blur(18px) saturate(140%) !important;
  background: rgba(8, 12, 18, 0.58) !important;
}
.gate__head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gate__close {
  margin-left: auto;
  font-size: 14px;
}

.pw-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.pw-wrap input {
  width: 100%;
  padding-right: 36px;
}
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--dim);
  font-size: 13px;
}
.pw-toggle:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ---------- fullscreen chart (F key) ---------- */
body.chart-fullscreen .appbar,
body.chart-fullscreen .rail,
body.chart-fullscreen .side,
body.chart-fullscreen .dock,
body.chart-fullscreen .mobilenav,
body.chart-fullscreen .viewtabs {
  display: none !important;
}
body.chart-fullscreen .workspace {
  grid-template-columns: 1fr !important;
  grid-template-rows: 1fr !important;
}
body.chart-fullscreen .stage {
  height: 100dvh;
}

/* ---------- symbol search modal ---------- */
.modal--symbols .modal__panel { width: min(680px, 95vw); max-height: 82dvh; display: flex; flex-direction: column; }
.sym-modal { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.sym-modal__bar { display: flex; gap: 8px; align-items: center; }
.sym-modal__input { flex: 1; }
.sym-modal__tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.sym-modal__tab {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--dim);
}
.sym-modal__tab.is-active { background: rgba(255, 148, 41, 0.16); border-color: var(--amber); color: var(--amber); }
.sym-modal__list { overflow-y: auto; max-height: 52dvh; display: flex; flex-direction: column; gap: 4px; }
.sym-modal__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  text-align: left;
}
.sym-modal__row:hover, .sym-modal__row.is-active { background: var(--bg-panel2); border-color: var(--line); }
.sym-modal__left { display: flex; align-items: center; gap: 10px; }
.sym-modal__badge {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 148, 41, 0.14); color: var(--amber); font-size: 10px; font-weight: 700;
}
.sym-modal__sym { font-weight: 700; font-size: 12px; }
.sym-modal__name { font-size: 11px; color: var(--dim); }
.sym-modal__right { display: flex; align-items: center; gap: 10px; font-size: 11.5px; }

/* ---------- settings modal alignment ---------- */
.modal--settings .modal__panel { width: min(720px, 95vw); max-height: 84dvh; display: flex; flex-direction: column; }
.modal--settings .settings { display: grid; grid-template-columns: 196px minmax(0, 1fr); gap: 16px; min-height: 320px; }
.modal--settings .settings__nav { display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); padding: 4px 10px 4px 4px; background: transparent; border-bottom: 0; }
.modal--settings .settings__nav-item {
  flex: 0 0 auto; display: flex; align-items: center; gap: 9px; justify-content: flex-start;
  padding: 8px 10px; border-radius: 5px; text-align: left; font-size: 12px; color: var(--dim);
  white-space: nowrap; border: 1px solid transparent;
}
.modal--settings .settings__nav-item.is-active { background: rgba(255, 148, 41, 0.14); color: var(--amber); border-color: rgba(255, 148, 41, 0.28); }
.modal--settings .settings__nav-icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modal--settings .settings__tab {
  padding: 8px 10px; border-radius: 5px; text-align: left; font-size: 12px; color: var(--dim);
}
.modal--settings .settings__tab.is-active { background: rgba(255, 148, 41, 0.14); color: var(--amber); }
.modal--settings .settings__pane { padding: 4px 8px; overflow-y: auto; max-height: 58dvh; }
.modal--settings .settings__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(255, 145, 40, 0.08); }
@media (max-width: 640px) {
  .modal--settings .settings { grid-template-columns: 1fr; }
  .modal--settings .settings__nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
}

.ticker { display: none !important; }
.viewtabs .hint { display: none !important; }
/* ---------- vertical drawing rail & chart area ---------- */
.chart-area {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}
.draw-rail {
  width: 40px;
  flex: 0 0 40px;
  background: var(--bg-panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  gap: 4px;
  overflow-y: auto;
}
.draw-rail__btn {
  width: 30px;
  height: 30px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  border: 1px solid transparent;
}
.draw-rail__btn:hover { color: var(--txt); background: var(--bg-panel2); }
.draw-rail__btn.is-active {
  color: var(--amber);
  background: rgba(255, 148, 41, 0.16);
  border-color: rgba(255, 148, 41, 0.45);
}
.draw-rail__btn--danger { margin-top: auto; }
.draw-rail__btn--danger:hover { color: var(--red); background: rgba(240, 90, 104, 0.12); }
.draw-rail__sep { width: 24px; height: 1px; background: var(--line); margin: 4px 0; }
.draw-flyout {
  position: fixed;
  z-index: 65;
  min-width: 210px;
  max-height: 62dvh;
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.draw-flyout__title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--amber); padding: 4px 8px; }
.draw-flyout__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 12px;
  text-align: left;
  color: var(--txt);
}
.draw-flyout__item:hover { background: var(--bg-panel2); }
.draw-flyout__item.is-active { background: rgba(255, 148, 41, 0.16); color: var(--amber); }

.search-pill {
  min-width: 150px;
  justify-content: flex-start;
  color: var(--dim) !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--line) !important;
  border-radius: 6px;
}
.search-pill:hover { border-color: var(--amber) !important; color: var(--txt) !important; }

.btn--primary {
  background: linear-gradient(180deg, #ff8c00 0%, #e06800 100%) !important;
  color: #07090c !important;
  border: 1px solid #ff9f43 !important;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(255, 123, 0, 0.25);
}
.btn--primary:hover { filter: brightness(1.08); }

.gate__card {
  border-color: rgba(255, 136, 0, 0.32);
  box-shadow: 0 0 32px rgba(255, 123, 0, 0.12);
}
.gate__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}
.gate__tab {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--dim);
  font-size: 12px;
  font-weight: 600;
}
.gate__tab.is-active {
  background: rgba(255, 123, 0, 0.16);
  border-color: var(--orange);
  color: var(--amber);
}
.gate__code--wrap {
  display: block;
  margin-top: 6px;
  word-break: break-all;
  font-size: 10px;
}
div.modal.is-open {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 9, 12, 0.72);
  backdrop-filter: blur(8px);
}

.mon--wide { width: 100%; border-collapse: collapse; }
.mon--wide th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-panel);
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid rgba(255, 148, 41, 0.08);
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--amber);
}
.mon--wide td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 148, 41, 0.1);
  border-right: 1px solid rgba(255, 148, 41, 0.06);
}
.mon--wide th.r, .mon--wide td.r { text-align: right; }
.mon--wide tbody tr:hover { background: var(--bg-panel2); }
.heat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-panel);
}
.wl__img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; display: block; }
.heat-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dock-resizer { height: 5px; flex: 0 0 5px; cursor: row-resize; background: var(--bg-panel); border-top: 1px solid var(--line); }
.dock-resizer:hover { background: rgba(255, 148, 41, 0.35); }
.wl__row { display: grid; grid-template-columns: 22px 1fr auto auto auto; align-items: center; gap: 6px; padding: 6px 8px; cursor: pointer; }
.wl__logo { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; }
.wl__del { opacity: 0.45; font-size: 13px; padding: 0 3px; }
.wl__del:hover { opacity: 1; color: var(--red); }
.picker__cat--active { display: flex; align-items: center; gap: 4px; padding: 0; }
.picker__cat-main { flex: 1; display: flex; align-items: center; gap: 6px; padding: 6px 8px; text-align: left; min-width: 0; }

/* ---------- Finviz-style Matrix / Map / Bubbles heatmap & macro maps ---------- */
.hm-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 0; flex: 1; min-height: 0; overflow: hidden; }
.hm-sidebar { background: var(--bg-panel); border-right: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.hm-side-block { display: flex; flex-direction: column; gap: 6px; }
.hm-side-title { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); }
.hm-view-list { display: flex; flex-direction: column; gap: 4px; }
.hm-view-btn { text-align: left; padding: 6px 8px; border-radius: 5px; font-size: 12px; color: var(--fg); border: 1px solid transparent; background: rgba(255,255,255,0.02); }
.hm-view-btn:hover { background: rgba(255, 148, 41, 0.08); }
.hm-view-btn.is-active { background: #1d6fe8; color: #fff; font-weight: 600; }
.hm-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.hm-seg-btn { padding: 5px 8px; border-radius: 4px; font-size: 11px; border: 1px solid var(--line); color: var(--muted); }
.hm-seg-btn.is-active { background: #1d6fe8; border-color: #1d6fe8; color: #fff; font-weight: 600; }
.hm-filters { display: flex; flex-direction: column; gap: 6px; }
.hm-tiers { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; }
.hm-tier-row { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--fg); }
.hm-tier-row em { margin-left: auto; font-style: normal; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.hm-side-search { flex: 1; min-height: 160px; }
.hm-ticker-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; max-height: 220px; border-top: 1px solid var(--line); padding-top: 6px; }
.hm-ticker-item { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 4px; font-size: 11px; text-align: left; }
.hm-ticker-item:hover { background: rgba(255, 148, 41, 0.1); }
.hm-ticker-sym { font-family: var(--mono); font-weight: 700; min-width: 54px; color: var(--fg); }
.hm-ticker-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.hm-scale { display: inline-flex; gap: 2px; }
.hm-scale-pill { padding: 2px 7px; border-radius: 3px; font-family: var(--mono); font-size: 10px; font-weight: 700; color: #fff; }
.hm-canvas-wrap { flex: 1; min-height: 0; overflow: auto; padding: 8px; }

.hm-matrix { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 11px; }
.hm-matrix th { text-align: left; padding: 6px 8px; background: #141c26; color: #c7d4e5; font-weight: 700; border-radius: 4px; font-size: 11px; white-space: nowrap; }
.hm-matrix th span { float: right; color: var(--muted); font-family: var(--mono); font-weight: 400; }
.hm-sector-cell { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; background: #1d6fe8; color: #fff; font-weight: 700; letter-spacing: 0.06em; padding: 8px 4px; border-radius: 4px; font-size: 10.5px; width: 28px; }
.hm-industry-cell { background: #173a6e; color: #e8f1fa; font-weight: 600; padding: 8px 10px; border-radius: 4px; min-width: 155px; max-width: 190px; vertical-align: middle; }
.hm-industry-cell span { float: right; color: rgba(232,241,250,0.7); font-family: var(--mono); font-size: 10.5px; }
.hm-cell { background: #0f151d; border: 1px solid rgba(255,255,255,0.05); border-radius: 4px; padding: 4px; vertical-align: top; min-width: 115px; }
.hm-cell-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; }
.hm-cell-clusters { display: flex; flex-wrap: wrap; gap: 3px; }
.hm-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 5px; border-radius: 3px; color: #fff; font-family: var(--mono); font-size: 10.5px; font-weight: 700; text-align: left; min-width: 0; overflow: hidden; }
.hm-pill img { width: 13px; height: 13px; border-radius: 3px; flex: 0 0 auto; background: rgba(0,0,0,0.2); }
.hm-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-pill--more { background: #1c2735; color: #9db2cc; justify-content: center; }

.hm-treemap { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; align-items: start; }
.treemap__sector { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.treemap__head { font-size: 11px; font-weight: 700; color: var(--amber); margin-bottom: 6px; letter-spacing: 0.04em; }
.treemap__tiles { display: flex; flex-wrap: wrap; gap: 4px; }
.treemap__tile { flex: 1 1 82px; min-height: 58px; border-radius: 4px; padding: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.treemap__tile--w2 { flex-grow: 2; min-height: 70px; }
.treemap__tile--w3 { flex-grow: 3; min-height: 82px; }
.tile__badge { width: 20px; height: 20px; border-radius: 50%; background: rgba(0, 0, 0, 0.28); font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.hm-bubbles { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; padding: 20px; }
.hm-bubble { border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; font-family: var(--mono); border: 1px solid rgba(255,255,255,0.18); box-shadow: 0 6px 18px rgba(0,0,0,0.35); transition: transform 0.12s ease; }
.hm-bubble:hover { transform: scale(1.06); }

.hm-hover-card { position: fixed; z-index: 60; width: 320px; background: #141a22; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px; box-shadow: 0 18px 42px rgba(0,0,0,0.65); pointer-events: none; font-size: 12px; }
.hm-hover-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 8px; font-weight: 700; }
.hm-hover-body { display: grid; grid-template-columns: 115px 1fr; gap: 10px; align-items: center; }
.hm-hover-meta { display: flex; flex-direction: column; gap: 6px; font-size: 11px; }
.hm-hover-meta label { display: block; font-size: 9.5px; color: var(--muted); letter-spacing: 0.05em; }
@media (max-width: 820px) { .hm-shell { grid-template-columns: 1fr; } .hm-sidebar { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); } }

.macro-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.macro-layout { display: grid; grid-template-columns: 1fr 340px; gap: 12px; flex: 1; min-height: 0; overflow: hidden; padding: 10px; }
.macro-map-wrap { position: relative; background: var(--bg-panel); border: 1px solid var(--line); border-radius: 6px; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: grab; }
.macro-map-wrap:active { cursor: grabbing; }
.macro-svg { width: 100%; height: 100%; max-height: 520px; user-select: none; touch-action: none; }
.macro-land { transition: fill 0.15s ease, stroke-width 0.15s ease; cursor: pointer; }
.macro-land:hover { stroke: #ffffff; stroke-width: 1.4; }
.macro-node { cursor: pointer; }
.macro-zoom-ctrl { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; z-index: 4; background: var(--bg-panel2); padding: 4px; border-radius: 5px; border: 1px solid var(--line); }
.macro-tip { position: absolute; pointer-events: none; z-index: 6; background: var(--bg-panel2); border: 1px solid var(--amber); color: var(--txt); padding: 4px 8px; border-radius: 4px; font-size: 11px; white-space: nowrap; box-shadow: 0 4px 12px rgba(0,0,0,0.45); }
.macro-list { background: var(--bg-panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; }
.macro-table tbody tr { cursor: pointer; }
.macro-table tbody tr:hover { background: rgba(255, 148, 41, 0.08); }

/* ---------- FOREX Matrix & Heatmap tabs ---------- */
.hm-cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fx-matrix-wrap { width: 100%; overflow-x: auto; padding: 8px; }
.fx-matrix { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 12px; }
.fx-matrix th, .fx-matrix td { border: 1px solid var(--line); padding: 10px 8px; text-align: center; }
.fx-matrix thead th { background: var(--bg-panel2); color: var(--amber); font-weight: 700; letter-spacing: 0.05em; }
.fx-matrix .fx-corner { color: var(--amber); font-size: 11px; }
.fx-matrix .fx-base { background: var(--bg-panel2); color: var(--amber); font-weight: 700; }
.fx-cell { cursor: pointer; font-weight: 600; transition: filter 0.12s ease; }
.fx-cell:hover { filter: brightness(1.22); outline: 1px solid var(--amber); }
.fx-cell--up { background: rgba(28, 124, 74, 0.45); color: #e6fff2; }
.fx-cell--dn { background: rgba(142, 30, 38, 0.45); color: #ffe6e8; }
.fx-cell--flat { background: rgba(58, 68, 82, 0.35); color: var(--txt); }
.fx-cell--diag { background: var(--bg-panel); color: var(--dim); cursor: default; }

/* ---------- Custom inline color picker ---------- */
.cpal-sv { width: 100%; height: 96px; border-radius: 4px; border: 1px solid var(--line); cursor: crosshair; display: block; }
.cpal-hue { width: 100%; height: 12px; border-radius: 4px; border: 1px solid var(--line); cursor: pointer; display: block; }
.cpal-hex { width: 84px; padding: 3px 6px; font-size: 11px; text-transform: uppercase; }
.macro-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-bottom: 1px solid rgba(255, 148, 41, 0.08); font-size: 12px; }
.macro-row__left { display: flex; align-items: center; gap: 8px; }
.macro-flag { font-size: 16px; }
@media (max-width: 780px) { .macro-layout { grid-template-columns: 1fr; overflow-y: auto; } }

.slash { color: var(--orange); }
.qr-box {
  display: flex;
  justify-content: center;
  margin: 10px auto;
  padding: 6px;
  background: #ffffff;
  border-radius: 6px;
  width: fit-content;
}

button {
  font: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 290px;
  grid-template-rows: minmax(0, 1fr);
}

body:not(.rail-open) .rail { display: none; }
body:not(.rail-open) .workspace { grid-template-columns: minmax(0, 1fr) 290px; }

.stage { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.side { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; border-left: 1px solid var(--line); background: var(--bg-panel); }
.side > .panel { flex: 0 0 auto; }
.dock { flex: 0 0 auto; max-height: 210px; }

/* ---------- appbar ---------- */
.appbar {
  flex: 0 0 auto;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: linear-gradient(180deg, #12181f 0%, #0b0f13 100%);
  border-bottom: 1px solid var(--line);
}
.appbar a.brand {
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: 13px;
  color: #e8f1fa;
}
.appbar a.brand span.slash { color: var(--amber); }

.appbar__spacer { flex: 1; }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--dim);
  font-size: 13px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: var(--bg-panel2); border-color: var(--line); color: var(--txt); }
.feed-chip {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.feed-chip--ok { background: rgba(33,208,122,0.15); color: var(--green); border: 1px solid rgba(33,208,122,0.35); }
.feed-chip--warn { background: rgba(255,166,43,0.15); color: var(--amber); border: 1px solid rgba(255,166,43,0.35); }
.feed-chip--muted { background: rgba(109,124,139,0.15); color: var(--dim); border: 1px solid var(--line); }
.feed-chip--loading { background: rgba(78,161,255,0.15); color: var(--blue); border: 1px solid rgba(78,161,255,0.35); }
.clock {
  font-size: 11px;
  color: var(--dim);
  cursor: pointer;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
}
.clock:hover { border-color: var(--amber); color: var(--txt); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-panel2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 3px 8px;
}
.chip__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.chip__text { font-size: 11px; }
.chip--admin { background: rgba(78,161,255,0.14); border-color: rgba(78,161,255,0.35); color: var(--blue); }

/* ---------- quick timeframe group ---------- */
.tf-group { display: flex; gap: 2px; }
.tf-group .tb { min-width: 24px; height: 18px; font-size: 10px; padding: 0 5px; }

/* ---------- ticker ---------- */
.ticker {
  height: 18px;
  flex: 0 0 18px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #0a0e12;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ticker-inner { display: inline-flex; gap: 14px; align-items: center; animation: marquee 12s linear infinite; }
.ticker:hover .ticker-inner { animation-play-state: paused; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tick-item { display: inline-flex; gap: 6px; align-items: center; padding: 0 2px; }
.tick-item b { color: #9fb0c0; font-weight: 600; }
.tick-item i { font-style: normal; }
.tick-item .up { color: var(--green); }
.tick-item .dn { color: var(--red); }
.tick-item .flat { color: var(--dim); }

/* ---------- chart ---------- */
.chart-wrap { position: relative; flex: 1 1 auto; min-height: 240px; overflow: hidden; }
.chart-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.chart-canvas--overlay { cursor: crosshair; }
.chart-canvas--base { cursor: crosshair; }

/* ---------- dialogs ---------- */
.modal__panel { font-size: 13px; }
.modal__foot { gap: 8px; }
.modal__list { display: flex; flex-direction: column; }
.modal--picker .modal__panel {
  width: min(780px, 95vw);
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
}
.modal--picker .modal__body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal--picker .picker { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.modal--picker .picker__content {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 12px;
}
.modal--picker .picker__side { width: 200px; overflow-y: auto; padding-right: 8px; }
.modal--picker .picker__main { flex: 1; width: auto; min-width: 0; display: flex; flex-direction: column; }
.modal--picker .picker__list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.modal--picker .picker__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
}
.modal--picker .picker__row-main { min-width: 0; }
.modal--picker .picker__row-end { flex-direction: row; align-items: center; gap: 8px; }

@media (max-width: 640px) {
  .modal--picker .picker__content { grid-template-columns: 1fr; }
  .modal--picker .picker__side { width: 100%; max-height: 130px; border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
}

.field--row { flex-direction: row; align-items: center; gap: 10px; }
.field--row .field__label { flex: none; }

/* ---------- indicator picker ---------- */
.picker__content { flex: 1; min-height: 0; display: flex; }
.picker__main { width: 400px; }
.picker__list { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.picker__row { padding: 7px; }
.picker__row-main { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
.picker__name { flex: 1; }
.picker__cat-label { font-size: 10px; }

/* ---------- settings dialog ---------- */
.settings__pane { padding: 12px 14px; }
.settings__section { margin: 10px 0; padding: 8px 0; }
.settings__row { padding: 7px 0; }
.settings__row-label { flex: none; }
.color-input { width: 30px; height: 30px; padding: 2px; }
.settings__candle-row { gap: 16px; }

/* ---------- interval menu ---------- */
.interval-menu { width: min(340px, calc(100vw - 16px)); max-height: 50vh; }

/* ---------- indicator picker ---------- */
.picker__main { width: 420px; }
.picker__cat-text { flex: 1; }

/* ---------- backtest / script ---------- */
.bt-grid { grid-template-columns: 1fr 1fr 1fr; }
.bt-chart { min-height: 180px; }
.bt-trades { max-height: 200px; }

/* ---------- mobile ---------- */
.mobilenav { display: none; }

@media (max-width: 1024px) {
  .workspace,
  body:not(.rail-open) .workspace { grid-template-columns: minmax(0, 1fr) 260px; }
  .dock { max-height: 190px; flex: 0 0 auto; }
  .dock-collapse { display: none; }
}

@media (max-width: 640px) {
  .appbar {
    height: auto;
    min-height: 38px;
    flex-wrap: wrap;
    row-gap: 4px;
    column-gap: 4px;
    padding: 5px 6px;
    overflow: visible;
  }
  .appbar a.brand { font-size: 10px; letter-spacing: 0.04em; white-space: nowrap; }
  .appbar .btn, .appbar .icon-btn { white-space: nowrap; flex-shrink: 0; height: 24px; }
  .appbar .icon-btn { width: 24px; font-size: 12px; }
  .appbar .btn--sm { padding: 0 6px; font-size: 10px; }
  #indicatorButton { padding: 0 5px; font-size: 10px; }
  #feedChip { padding: 1px 4px; font-size: 9px; letter-spacing: 0.03em; }
  .appbar__spacer { flex: 1 1 auto; min-width: 0; }
  #clock, #fullscreenButton { display: none; }
  #accountChip { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; font-size: 10px; padding: 2px 6px; }
  #authOpenBtn { flex-shrink: 0; }
  .search-pill { min-width: 70px; max-width: 82px; overflow: hidden; text-overflow: ellipsis; }
  .viewtabs .hint { display: none; }
  .workspace,
  body:not(.rail-open) .workspace { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
  .rail { display: none; }
  body.rail-open .rail,
  body[data-mobile-tab="markets"] .rail {
    display: flex;
    position: fixed;
    inset: 38px 0 40px 0;
    z-index: 40;
    width: 100%;
    background: var(--bg-panel);
  }
  .stage { min-height: 0; }
  .side { display: none; }
  body[data-mobile-tab="account"] .stage { display: none; }
  body[data-mobile-tab="account"] .side {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-left: 0;
  }
  .dock { display: none; }
  body[data-mobile-tab="tools"] .stage { display: none; }
  body[data-mobile-tab="tools"] .dock {
    display: flex;
    flex: 1 1 auto;
    max-height: none;
  }
  .mobilenav { display: flex; flex: 0 0 auto; }
  .viewtabs { flex: 0 0 28px; }
  .chart-tools { gap: 6px; flex-wrap: wrap; }
  .tf-group { display: flex; gap: 3px; }
  .tf-group .tb { min-width: 21px; height: 17px; font-size: 9px; padding: 0 4px; }
}
