:root {
  color-scheme: dark;

  --bg: #08111f;
  --panel: #0e1a2b;
  --panel-2: #101f34;
  --line: #233550;
  --text: #d9e5f5;
  --muted: #8294ae;
  --accent: #26d6a3;
  --red: #f05d72;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  overflow: hidden;

  background: var(--bg);
  color: var(--text);

  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
}

/* =========================================================
   TOP BAR
   ========================================================= */

.topbar {
  height: 62px;

  display: flex;
  align-items: center;

  gap: 28px;

  padding: 0 22px;

  border-bottom: 1px solid var(--line);

  background: #0a1525;
}

.brand {
  font-weight: 750;
  letter-spacing: .08em;
  font-size: 14px;
  white-space: nowrap;
}

.brand-mark {
  color: var(--accent);
  font-size: 19px;
  vertical-align: -1px;
}

.chart-count-control {
  margin-left: auto;

  color: var(--muted);

  font-size: 13px;

  display: flex;
  align-items: center;

  gap: 9px;
}

/* =========================================================
   SELECTS
   ========================================================= */

select {
  border: 1px solid #314661;

  border-radius: 5px;

  background: #122139;

  color: var(--text);

  padding: 6px 27px 6px 9px;

  font: inherit;

  outline: none;

  cursor: pointer;
}

select:focus {
  border-color: var(--accent);
}

/* =========================================================
   CONNECTION STATUS
   ========================================================= */

.connection-status {
  display: flex;
  gap: 7px;

  align-items: center;

  color: #80e8c8;

  font-weight: 700;

  font-size: 11px;

  letter-spacing: .08em;

  white-space: nowrap;
}

.connection-status span {
  height: 8px;
  width: 8px;

  border-radius: 50%;

  background: var(--accent);

  box-shadow:
    0 0 10px var(--accent);
}

.connection-status.connecting {
  color: #f4be55;
}

.connection-status.connecting span {
  background: #f4be55;

  box-shadow:
    0 0 10px #f4be55;
}

.connection-status.error {
  color: var(--red);
}

.connection-status.error span {
  background: var(--red);

  box-shadow:
    0 0 10px var(--red);
}

/* =========================================================
   DASHBOARD GRID
   ========================================================= */

.dashboard {
  height: calc(100vh - 106px);

  display: grid;

  gap: 8px;

  padding: 8px;
}

.grid-1 {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
}

.grid-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.grid-6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.grid-8 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

/* =========================================================
   CHART PANE
   ========================================================= */

.chart-pane {
  min-width: 0;
  min-height: 0;

  display: flex;

  flex-direction: column;

  border:
    1px solid var(--line);

  border-radius: 7px;

  overflow: hidden;

  background: var(--panel);

  box-shadow:
    0 8px 25px #02081244;
}

/* =========================================================
   PANE HEADER
   ========================================================= */

.pane-header {
  position: relative;

  flex: none;

  min-height: 43px;

  display: flex;

  align-items: center;

  gap: 8px;

  padding: 6px 9px;

  border-bottom:
    1px solid var(--line);

  background: var(--panel-2);

  z-index: 50;
}

.pane-search-slot {
  position: relative;

  flex: 0 0 auto;
}

.pane-meta {
  margin-left: auto;

  min-width: 0;

  max-width: 42%;

  text-align: right;

  line-height: 1.1;

  overflow: hidden;
}

.pane-symbol {
  font-weight: 800;

  font-size: 13px;

  letter-spacing: .04em;

  white-space: nowrap;

  overflow: hidden;

  text-overflow: ellipsis;
}

.pane-price {
  margin-top: 3px;

  color: var(--accent);

  font-size: 12px;

  font-variant-numeric:
    tabular-nums;

  white-space: nowrap;
}

.timeframe-select {
  min-width: 55px;
}

/* =========================================================
   SEARCH INPUT
   ========================================================= */

.market-search-wrap {
  position: relative;

  width: 122px;
}

.symbol-search {
  width: 122px;

  border:
    1px solid #314661;

  border-radius: 5px;

  background: #122139;

  color: var(--text);

  padding: 6px 8px;

  font: inherit;

  outline: none;
}

.symbol-search:focus {
  border-color: var(--accent);
}

/* =========================================================
   SEARCH DROPDOWN
   ========================================================= */

.market-dropdown {
  position: absolute;

  top: calc(100% + 5px);

  left: 0;

  width: 230px;

  max-height: 300px;

  overflow-y: auto;

  z-index: 1000;

  border:
    1px solid #314661;

  border-radius: 5px;

  background: #0d1b2e;

  box-shadow:
    0 12px 30px rgba(0, 0, 0, .45);
}

.market-dropdown[hidden] {
  display: none;
}

.market-option {
  display: block;

  width: 100%;

  padding: 8px 10px;

  border: 0;

  border-bottom:
    1px solid #1d3049;

  background: transparent;

  color: var(--text);

  text-align: left;

  font: inherit;

  font-size: 12px;

  cursor: pointer;
}

.market-option:last-child {
  border-bottom: 0;
}

.market-option:hover {
  background: #162b45;

  color: var(--accent);
}

.market-empty {
  cursor: default;

  color: var(--muted);
}

.market-empty:hover {
  background: transparent;

  color: var(--muted);
}

/* =========================================================
   CHART AREA
   ========================================================= */

.chart-area {
  flex: 1;

  min-height: 0;

  position: relative;

  display: flex;

  flex-direction: column;
}

.chart-area canvas {
  display: block;
}

/* =========================================================
   PANE STATUS
   ========================================================= */

.pane-status {
  color: var(--muted);

  font-size: 10px;

  margin-left: 4px;

  white-space: nowrap;
}

.pane-status.error {
  color: var(--red);
}

/* =========================================================
   FLOATING OHLCV TOOLTIP
   ========================================================= */

.chart-tooltip {
  position: absolute;

  z-index: 20;

  min-width: 150px;

  padding: 9px 11px;

  border:
    1px solid #314761;

  border-radius: 5px;

  background:
    rgba(8, 17, 31, .96);

  box-shadow:
    0 8px 22px rgba(0, 0, 0, .35);

  color: var(--text);

  pointer-events: none;

  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;

  font-size: 11px;

  backdrop-filter: blur(5px);
}

.chart-tooltip-time {
  margin-bottom: 7px;

  padding-bottom: 6px;

  border-bottom:
    1px solid #263a54;

  color: #a9bad0;

  font-size: 10px;

  white-space: nowrap;
}

.chart-tooltip-row {
  display: flex;

  justify-content: space-between;

  gap: 18px;

  line-height: 1.55;

  font-variant-numeric:
    tabular-nums;
}

.chart-tooltip-row span {
  color: #8294ae;

  font-weight: 700;
}

.chart-tooltip-row strong {
  color: #d9e5f5;

  font-weight: 600;
}

.chart-tooltip-change {
  margin-top: 6px;

  padding-top: 5px;

  border-top:
    1px solid #263a54;

  font-weight: 700;

  text-align: right;

  font-variant-numeric:
    tabular-nums;
}

.chart-tooltip-change.positive {
  color: var(--accent);
}

.chart-tooltip-change.negative {
  color: var(--red);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1200px) {

  .grid-8 {
    grid-template-columns:
      repeat(2, 1fr);

    grid-template-rows:
      repeat(4, 1fr);
  }

  .pane-meta {
    max-width: 36%;
  }
}

@media (max-width: 900px) {

  .grid-6,
  .grid-8 {
    grid-template-columns:
      repeat(2, 1fr);

    grid-template-rows:
      repeat(3, 1fr);

    overflow: auto;
  }

  .topbar {
    gap: 12px;

    padding: 0 12px;
  }
}

@media (max-width: 560px) {

  body {
    overflow: auto;
  }

  .topbar {
    height: auto;

    min-height: 62px;

    flex-wrap: wrap;

    padding: 10px 12px;
  }

  .chart-count-control {
    margin-left: 0;
  }

  .dashboard {
    height:
      calc(100vh - 82px);
  }

  .grid-2,
  .grid-4,
  .grid-6,
  .grid-8 {
    grid-template-columns: 1fr;

    grid-template-rows: none;

    grid-auto-rows: 360px;

    overflow-y: auto;
    overflow-x: hidden;

    align-content: start;
  }

  .pane-meta {
    max-width: 32%;
  }
}

.tb-pane-favorite{
  position:absolute;
  top:6px;
  right:6px;
  z-index:30;
  width:24px;
  height:24px;
  padding:0;
  margin:0;
  border:1px solid rgba(255,255,255,.12);
  border-radius:5px;
  background:rgba(14,26,43,.88);
  color:#8fa3ba;
  font-size:17px;
  line-height:22px;
  text-align:center;
  cursor:pointer;
}

.tb-pane-favorite:hover{
  color:#ffd15c;
  border-color:rgba(255,209,92,.45);
}

.tb-pane-favorite.is-favorite{
  color:#ffd15c;
  border-color:rgba(255,209,92,.55);
  text-shadow:0 0 7px rgba(255,209,92,.35);
}


/* =========================================================
   ALPHAMESH BRAND THEME — compact chart-first workspace
   ========================================================= */
:root {
  --bg: #050d18;
  --panel: #091524;
  --panel-2: #0c1b2d;
  --line: #1c3855;
  --text: #e1ecfa;
  --muted: #8ca2bd;
  --accent: #258dff;
  --red: #f05d72;
}

.topbar {
  height: 58px;
  gap: 18px;
  padding: 0 18px;
  background: linear-gradient(105deg, #050d18 0%, #0a1a2d 58%, #071324 100%);
  border-bottom: 1px solid #1d4164;
  box-shadow: inset 0 -1px 0 rgba(48, 143, 255, .08);
}

.brand {
  display: inline-flex;
  align-items: center;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1;
  text-transform: none;
  color: #f2f7ff;
  flex: 0 0 auto;
}

.brand-alpha { color: #f2f7ff; }
.brand-mesh {
  margin-left: 0;
  background: linear-gradient(100deg, #38b7ff 0%, #258dff 55%, #3973ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-mark { display: none; }

.chart-count-control {
  margin-left: auto;
  gap: 8px;
}

.topbar select {
  border-color: #294a70;
  background: #0c1c30;
  border-radius: 6px;
}

.connection-status span {
  box-shadow: 0 0 9px var(--accent);
}

.chart-pane {
  border-color: #1b3855;
  background: #071321;
}

@media (max-width: 560px) {
  .topbar {
    min-height: 58px;
    gap: 12px;
    padding: 8px 12px;
  }
  .brand { font-size: 21px; }
}
