:root {
  --drag-cursor: grab;
  --surface-soft: #121824;
  --surface-hover: #192131;
}

.topbar,
.subbar { background: linear-gradient(180deg, #111722 0%, #0d121b 100%); }
.topbar { box-shadow: 0 1px 0 #ffffff06; }
.subbar { min-width: 0; }
.timeframes { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.timeframes::-webkit-scrollbar { display: none; }
.timeframes button { position: relative; min-width: 34px; transition: color .15s ease, background .15s ease; }
.timeframes button.active { color: #e8efff; background: #24375f; box-shadow: inset 0 -2px 0 #5f8cff; }
.main-view-label { padding-inline: 12px; color: #dbe5ff !important; background: #1d2c4b !important; font-weight: 700; letter-spacing: .2px; }

.token-logo {
  --logo-a: #2962ff;
  --logo-b: #82a5ff;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  overflow: hidden;
  border: 1px solid #ffffff24;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--logo-a), var(--logo-b));
  box-shadow: inset 0 1px 0 #ffffff2a, 0 4px 12px #0005;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  letter-spacing: -.5px;
  text-shadow: 0 1px 2px #0007;
}
.selected-token-logo { width: 29px; height: 29px; font-size: 14px; }
.list-token-logo { width: 29px; height: 29px; }
.mini-token-logo { width: 19px; height: 19px; font-size: 8px; box-shadow: inset 0 1px 0 #ffffff24; }
.micro-token-logo { width: 15px; height: 15px; font-size: 6px; border-width: 0; box-shadow: none; }
.symbol-identity { display: flex; align-items: center; min-width: 0; gap: 9px; }
.symbol-identity > span:last-child { min-width: 0; }

.statusbar a[href*="tradingview.com"] {
  color: #4d5665;
  opacity: .55;
  font-size: 8px;
  transition: opacity .15s ease, color .15s ease;
}

.statusbar a[href*="tradingview.com"]:hover {
  color: #8792a5;
  opacity: .9;
}

.workspace {
  grid-template-columns: 42px minmax(500px, 1fr) 344px;
  transition: grid-template-columns .18s ease;
}

.workspace.signal-collapsed {
  grid-template-columns: 42px minmax(500px, 1fr) 38px;
}

.chart-stack {
  grid-template-rows: minmax(260px, 1fr) repeat(3, 145px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.price-panel {
  cursor: crosshair;
}

.liquidity-indicator-panel {
  border-top: 1px solid var(--line);
}

.indicator-values .red b {
  color: var(--red);
}

.indicator-values .purple b {
  color: #d28bff;
}

.indicator-panel {
  border-top: 1px solid var(--line);
}

.icon-button:disabled {
  opacity: .28;
  cursor: default;
}

.history-button svg,
.layout-save-action svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-button svg { display: block; }
.redo-button svg { transform: scaleX(-1); }
.layout-save-action { gap: 5px; }
.layout-save-action svg { width: 14px; height: 14px; stroke-width: 1.55; }

.indicator-legend {
  gap: 14px;
  align-items: flex-start;
}

.indicator-actions,
.main-indicator-control {
  display: flex;
  align-items: center;
  gap: 3px;
  pointer-events: auto;
}

.indicator-actions,
.main-indicator-control button {
  opacity: 0;
  pointer-events: none;
  transform: translateX(4px);
  transition: opacity .14s ease, transform .14s ease;
}

.indicator-panel:hover .indicator-actions,
.indicator-panel:focus-within .indicator-actions,
.price-panel:hover .main-indicator-control button,
.main-indicator-control:focus-within button {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.indicator-values span i {
  font-style: normal;
  color: inherit;
}

.indicator-actions button,
.main-indicator-control button {
  width: 23px;
  height: 22px;
  border-radius: 4px;
  color: #7d8799;
  font-size: 12px;
}

.indicator-actions button:hover,
.main-indicator-control button:hover {
  color: #fff;
  background: #252d3e;
}

.indicator-actions button.is-hidden,
.main-indicator-control button.is-hidden {
  color: #ffb74d;
  background: #3d2d1b;
}

.main-indicator-control {
  position: absolute;
  z-index: 5;
  pointer-events: auto;
  top: 8px;
  right: 84px;
  min-height: 25px;
  padding: 2px 4px 2px 8px;
  border: 1px solid #252c3a;
  border-radius: 5px;
  background: #10151ddd;
}

.main-indicator-control span {
  color: #8993a7;
  font-size: 9px;
  margin-right: 4px;
}

.settings-modal {
  width: min(440px, 92vw);
}

.layout-modal { width: min(480px, 92vw); }
.layout-editor { display: grid; gap: 7px; padding: 17px 18px 13px; }
.layout-editor label { color: #8e98aa; font-size: 10px; }
.layout-editor input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #30394d;
  border-radius: 5px;
  outline: 0;
  color: #e0e5ed;
  background: #0b0e15;
}
.layout-editor input:focus { border-color: #2962ff; box-shadow: 0 0 0 1px #2962ff44; }
.layout-list { max-height: 260px; overflow: auto; padding: 0 18px 8px; }
.layout-empty { padding: 25px 10px; text-align: center; color: #657086; font-size: 10px; border: 1px dashed #293244; border-radius: 6px; }
.layout-row { display: grid; grid-template-columns: minmax(0, 1fr) 48px; align-items: stretch; border-bottom: 1px solid #202735; }
.layout-row.active { background: #17243a; }
.layout-load { min-width: 0; padding: 10px; text-align: left; }
.layout-load span, .layout-load small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.layout-load span { color: #d6dce7; font-size: 11px; }
.layout-load small { margin-top: 3px; color: #69768b; font-size: 8px; }
.layout-rename { margin: 8px 5px; border-radius: 4px; color: #7f8ba0; font-size: 9px; }
.layout-load:hover, .layout-rename:hover { color: #fff; background: #222c3f; }

.telegram-action span { margin-right: 4px; color: #63a5ff; }
.telegram-action.is-active { color: #8fc0ff; background: #1c3152; }
.telegram-modal { width: min(500px, 92vw); }
.telegram-fields { display: grid; gap: 14px; padding: 18px; }
.telegram-preview { height: 150px; overflow: hidden; border: 1px solid #2c3445; border-radius: 6px; background: #080b10; }
.telegram-preview img { width: 100%; height: 100%; object-fit: contain; object-position: center; }
.telegram-fields label { display: grid; grid-template-columns: 1fr 180px; align-items: center; gap: 20px; }
.telegram-fields small, .telegram-fields p { color: #758095; font-size: 10px; line-height: 1.55; }
.telegram-fields small { display: block; margin-top: 4px; }
.telegram-fields p { margin: 0; padding: 11px; border-left: 2px solid #2962ff; background: #171d29; }
.telegram-fields select { height: 35px; padding: 0 9px; border: 1px solid #30394d; border-radius: 5px; outline: 0; color: #d7dce7; background: #0b0e15; }
.telegram-schedule { padding: 8px 10px; border: 1px solid #2c3b52; border-radius: 5px; color: #9fc0f3; background: #142038; font-size: 10px; }
#telegram-start:disabled { opacity: .45; cursor: default; }

.signal-monitor {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #101620 0%, #0d121a 100%);
}

.signal-monitor-head {
  height: 50px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 2px;
  padding: 0 7px 0 12px;
  border-bottom: 1px solid var(--line);
}

.signal-monitor-head b,
.signal-monitor-head span { display: block; }
.signal-monitor-head b { font-size: 12px; color: #eef2f9; letter-spacing: .15px; }
.signal-monitor-head span { margin-top: 3px; color: #7c879b; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal-monitor-head button { width: 27px; height: 27px; border-radius: 5px; color: #7e899d; font-size: 15px; }
.signal-monitor-head button:hover { color: #fff; background: #222a39; }

.signal-monitor-body {
  height: calc(100% - 50px);
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #30394a transparent;
}

.signal-monitor.is-collapsed .signal-monitor-head {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 7px 5px;
}
.signal-monitor.is-collapsed .signal-monitor-head > div,
.signal-monitor.is-collapsed #signal-refresh,
.signal-monitor.is-collapsed .signal-monitor-body { display: none; }
.signal-monitor.is-collapsed #signal-collapse { transform: rotate(180deg); }

.universe-section summary b em {
  margin-left: 5px;
  color: #8cb0ff;
  font-style: normal;
  font-size: 10px;
}
.universe-editor { padding: 0 9px 10px; }
.universe-threshold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  padding: 7px 8px;
  border: 1px solid #293245;
  border-radius: 5px;
  color: #8d98aa;
  background: #101620;
  font-size: 9px;
}
.universe-threshold > span:last-child { display: flex; align-items: center; gap: 5px; }
.universe-threshold input {
  width: 68px;
  height: 26px;
  padding: 0 7px;
  border: 1px solid #344159;
  border-radius: 4px;
  outline: 0;
  color: #e1e6ef;
  background: #090d14;
  text-align: right;
}
.universe-threshold input:focus { border-color: #4b75d6; }
.universe-threshold i { color: #6f7b90; font-style: normal; }
.universe-add { display: grid; grid-template-columns: minmax(0, 1fr) 42px; gap: 5px; }
.universe-add input {
  min-width: 0;
  height: 29px;
  padding: 0 8px;
  border: 1px solid #2a3345;
  border-radius: 5px;
  outline: 0;
  color: #d6dce6;
  background: #0a0e15;
  font-size: 9px;
}
.universe-add input:focus { border-color: #3f6bcf; }
.universe-add button { border-radius: 5px; color: #8fb1ff; background: #1d3156; font-size: 9px; }
.universe-add button:hover { color: #fff; background: #29467b; }
.universe-suggestions { display: none; gap: 3px; margin-top: 5px; padding: 5px; border: 1px solid #293245; border-radius: 5px; background: #0b1018; }
.universe-suggestions.visible { display: grid; }
.universe-suggestions button { display: grid; grid-template-columns: 19px minmax(0, 1fr) auto 15px; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 3px; text-align: left; }
.universe-suggestions button:hover { background: #202a3b; }
.universe-suggestions b { color: #d5dbe6; font-size: 10px; }
.universe-suggestions span { color: #7b879b; font-size: 9px; }
.universe-suggestions i { color: #79a1ff; font-style: normal; }
.universe-list { max-height: 184px; margin-top: 7px; overflow: auto; border: 1px solid #252e3e; border-radius: 5px; scrollbar-width: thin; scrollbar-color: #30394a transparent; }
.universe-row { display: grid; grid-template-columns: minmax(0, 1fr) 29px; min-height: 34px; border-bottom: 1px solid #1c2330; }
.universe-row:last-child { border-bottom: 0; }
.universe-symbol { display: flex; align-items: center; justify-content: space-between; min-width: 0; padding: 0 7px; text-align: left; }
.universe-symbol:hover { background: #182131; }
.universe-identity { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.universe-symbol b { color: #d1d7e2; font-size: 10px; }
.universe-symbol .universe-volume { color: #7d899d; font-size: 9px; }
.universe-remove { color: #667286; font-size: 14px; }
.universe-remove:hover { color: #ff8d9d; background: #3a2029; }

.signal-section { border-bottom: 1px solid #202736; }
.signal-section summary { min-height: 51px; display: flex; align-items: center; justify-content: space-between; padding: 0 11px; cursor: pointer; list-style: none; }
.signal-section summary::-webkit-details-marker { display: none; }
.signal-section summary:hover { background: #151b26; }
.signal-section summary b,
.signal-section summary small { display: block; }
.signal-section summary b { color: #e1e6ef; font-size: 11px; }
.signal-section summary small { margin-top: 3px; color: #778297; font-size: 9px; }
.signal-section summary i { color: #657086; font-style: normal; transition: transform .15s; }
.signal-section:not([open]) summary i { transform: rotate(-90deg); }
.signal-list { display: grid; gap: 7px; padding: 0 9px 10px; }
.signal-empty { padding: 16px 8px; text-align: center; color: #717d92; font-size: 10px; border: 1px dashed #2d384c; border-radius: 7px; }
.signal-card { padding: 9px; border: 1px solid #2a3549; border-radius: 8px; background: linear-gradient(145deg, #151c29, #111722); box-shadow: 0 5px 18px #0002; }
.signal-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
.signal-direction { padding: 4px 7px; border-radius: 5px; font-size: 9px; font-weight: 800; letter-spacing: .2px; }
.signal-direction.buy { color: #75dbc2; background: #173b35; }
.signal-direction.sell { color: #ff8986; background: #472421; }
.signal-card-head small { color: #8792a6; font-size: 9px; }
.signal-members { display: flex; flex-wrap: wrap; gap: 5px; }
.signal-symbol { display: inline-flex; align-items: center; gap: 4px; padding: 5px 7px; border-radius: 5px; color: #c8cfda; background: #202a3b; font-size: 9px; }
.signal-symbol.featured { padding: 3px 5px; background: transparent; font-weight: 700; }
button.signal-symbol:hover { color: #fff; background: #2a3954; }
.signal-symbol i { margin-left: 2px; color: #7f8da4; font-style: normal; font-size: 8px; }
.signal-timeframes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.signal-timeframes span { padding: 5px 2px; border-radius: 4px; text-align: center; color: #748197; background: #1a2230; font-size: 9px; }
.signal-timeframes span.active.buy { color: #75dbc2; background: #17322f; }
.signal-timeframes span.active.sell { color: #ff8986; background: #3b2423; }
.signal-footnote { padding: 11px; color: #6d788c; font-size: 9px; line-height: 1.5; }
.signal-monitor.is-loading #signal-refresh { animation: spin .8s linear infinite; }

.symbol-list-head,
.symbol-row { grid-template-columns: minmax(0, 1fr) 175px; min-height: 54px; }
.market-cell { display: flex; align-items: center; justify-content: space-between; gap: 7px; }
.market-activity { display: grid; gap: 2px; text-align: right; font-style: normal; font-size: 8px; color: #8d98aa; }
.market-activity .up { color: #58d6aa; }
.market-activity .down { color: #ef6d6b; }

.settings-fields {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.settings-fields label {
  display: grid;
  grid-template-columns: 1fr 120px;
  align-items: center;
  gap: 16px;
  color: #aab2c0;
}

.settings-fields label small {
  display: block;
  margin-top: 3px;
  color: #697487;
  font-size: 9px;
}

.settings-fields input[type="number"] {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid #30394d;
  border-radius: 5px;
  outline: 0;
  background: #0b0e15;
}

.settings-fields input[type="checkbox"] {
  justify-self: end;
  width: 17px;
  height: 17px;
  accent-color: #2962ff;
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 17px;
  border-top: 1px solid var(--line);
}

.settings-footer button {
  padding: 8px 15px;
  border-radius: 5px;
  color: #8d97aa;
  background: #202635;
}

.settings-footer button.primary {
  color: #fff;
  background: #2962ff;
}

.chart-stack::-webkit-scrollbar {
  width: 7px;
}

.chart-stack::-webkit-scrollbar-thumb {
  background: #30394a;
  border-radius: 8px;
}

@media (max-width: 950px) {
  .workspace {
    grid-template-columns: 36px minmax(480px, 1fr) 280px;
  }

  .workspace.signal-collapsed { grid-template-columns: 36px minmax(480px, 1fr) 36px; }
}

@media (max-width: 680px) {
  .app { grid-template-rows: 48px 38px minmax(0, 1fr) 24px; }

  .topbar { padding: 0 6px; }
  .symbol-button { flex: 1; min-width: 0; }
  .symbol-button strong { font-size: 12px; }
  .topbar #undo-button,
  .topbar #redo-button,
  .topbar #fullscreen-button { display: none; }
  .live-pill { padding-left: 7px; margin-left: 0; }

  .subbar {
    padding: 0 6px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .subbar::-webkit-scrollbar { display: none; }
  .timeframes { flex: 0 0 auto; }
  .session-label, .separator { display: none; }

  .workspace {
    position: relative;
    grid-template-columns: minmax(0, 1fr) 38px;
  }

  .workspace.signal-collapsed { grid-template-columns: minmax(0, 1fr) 38px; }
  .drawing-tools { display: none; }

  .chart-stack {
    grid-column: 1 / 3;
    min-width: 0;
    grid-template-rows: minmax(250px, 1fr) repeat(3, 135px);
  }

  .signal-monitor {
    position: absolute;
    z-index: 20;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(330px, 92vw);
    box-shadow: -12px 0 30px #000b;
    transition: width .18s ease, box-shadow .18s ease;
  }

  .signal-monitor.is-collapsed {
    width: 38px;
    box-shadow: none;
  }

  .main-indicator-control { right: 74px; }
  .chart-legend { max-width: calc(100% - 82px); }
  .ohlc-line { gap: 5px; font-size: 8px; }
  .statusbar { gap: 6px; padding: 0 5px; }
  .statusbar #latency,
  .statusbar > span:nth-of-type(2),
  .statusbar a { display: none; }

}
