.active-chart-grid {
  --grid-columns: 3;
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(340px, 1fr));
  gap: 4px;
  padding: 4px;
  background: #050709;
}

.active-chart-grid[hidden] { display: none; }

.spike-grid-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px solid #26313c;
  color: #8794a2;
}

.spike-grid-card {
  min-width: 0;
  border: 1px solid #242b31;
  background: #070a0d;
  overflow: hidden;
}

.spike-grid-card.is-high { border-top-color: #f7a500; }

.spike-grid-card-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  padding: 3px 5px;
  border-bottom: 1px solid #242b31;
  background: #090c0f;
  color: #e8eef5;
  font: 10px Consolas, monospace;
}

.spike-grid-symbol {
  flex: 1 1 60px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.spike-grid-state { color: #f7a500; white-space: nowrap; }
.spike-grid-build { margin-left: auto; color: #31c7ce; white-space: nowrap; }
.spike-grid-age { color: #8794a2; white-space: nowrap; }

.spike-grid-signals {
  flex: 0 0 100%;
  min-width: 0;
  height: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 2px;
  border-top: 1px solid #171d22;
  line-height: 1;
}
.spike-grid-entry {
  flex: 0 0 auto;
  color: #ff74d4;
  font-weight: 700;
  white-space: nowrap;
}
.spike-grid-spikes {
  min-width: 0;
  overflow: hidden;
  color: #8794a2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spike-grid-spikes[data-tone="detected"] { color: #f2bd4d; }
.spike-grid-spikes[data-tone="partial"],
.spike-grid-spikes[data-tone="unavailable"] { color: #b794f6; }

.spike-grid-action {
  width: 24px;
  height: 22px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid #29333c;
  border-radius: 2px;
  background: #090c0f;
  color: #a9b4bf;
  font-size: 13px;
  line-height: 1;
}

.spike-grid-action:hover { border-color: #31c7ce; color: #ffffff; }
.spike-grid-action[data-grid-ban] {
  width: 32px;
  border-color: #714047;
  color: #ff6767;
  font-size: 9px;
}

.spike-grid-chart-wrap {
  position: relative;
  height: 320px;
  background: #070a0d;
}

.spike-grid-chart {
  position: relative;
  width: 100%;
  height: 100%;
}

.spike-chart-band-scale {
  position: absolute;
  z-index: 4;
  inset: 0 auto 0 3px;
  width: 64px;
  color: #8d9bab;
  font: 9px Consolas, monospace;
  pointer-events: none;
}
.spike-chart-band-scale span {
  position: absolute;
  left: 0;
  padding: 1px 2px;
  background: rgba(7, 10, 13, 0.78);
  white-space: nowrap;
}
.spike-chart-band-scale [data-band-volume-max] { top: 65%; }
.spike-chart-band-scale [data-band-volume-zero] { top: 77%; }
.spike-chart-band-scale [data-band-oi-max] { top: 80%; color: #9fbeff; }
.spike-chart-band-scale [data-band-oi-min] { bottom: 3%; color: #9fbeff; }
.spike-chart-band-scale.compact { width: 54px; font-size: 8px; }

.spike-grid-status {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(7, 10, 13, 0.82);
  color: #8794a2;
  text-align: center;
  pointer-events: none;
}

.spike-grid-status[hidden] { display: none; }

.spike-grid-card-foot {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 6px;
  border-top: 1px solid #202830;
  color: #718091;
  font: 9px Consolas, monospace;
}

.spike-grid-card-foot strong { color: #9fbeff; font-weight: 500; }

.spike-zoom-modal {
  position: fixed;
  z-index: 9000;
  top: 50%;
  left: 50%;
  display: block;
  width: min(1180px, calc(100vw - 64px));
  height: min(760px, calc(100vh - 64px));
  overflow: hidden;
  border: 1px solid rgba(160, 170, 184, 0.22);
  border-radius: 0;
  background: #000;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.72);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.992);
  transition: opacity 90ms ease-out, transform 90ms ease-out;
}

.spike-zoom-modal[hidden] { display: none; }
.spike-zoom-modal.is-open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.spike-zoom-modal.has-position,
.spike-zoom-modal.is-open.has-position {
  transform: none;
  transition: opacity 90ms ease-out;
}
.spike-zoom-modal.is-dragging,
.spike-zoom-modal.is-resizing { user-select: none; }

.spike-zoom-chrome {
  position: absolute;
  z-index: 3;
  inset: 0 0 auto;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 30px 3px 34px;
  border-bottom: 1px solid rgba(160, 170, 184, 0.16);
  background: rgba(5, 7, 8, 0.97);
  color: #dce4ec;
  font: 10px Consolas, monospace;
}

.spike-zoom-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.spike-zoom-close,
.spike-zoom-move,
.spike-zoom-resize {
  position: absolute;
  z-index: 4;
  width: 22px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(160, 170, 184, 0.2);
  border-radius: 2px;
  background: #080b0e;
  color: #cbd5df;
}

.spike-zoom-close { top: 4px; right: 4px; font-size: 15px; }
.spike-zoom-move {
  top: 4px;
  left: 4px;
  background:
    radial-gradient(circle, rgba(229, 233, 240, 0.55) 1px, transparent 1.5px) 4px 3px / 6px 6px,
    #080b0e;
  cursor: move;
  touch-action: none;
}

.spike-zoom-frame {
  position: absolute;
  inset: 28px 0 0;
  width: 100%;
  height: calc(100% - 28px);
  border: 0;
  background: #070a0d;
}

.spike-zoom-modal.is-dragging .spike-zoom-frame,
.spike-zoom-modal.is-resizing .spike-zoom-frame { pointer-events: none; }

.spike-zoom-resize {
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  border: 0;
  cursor: nwse-resize;
  touch-action: none;
}

.spike-zoom-resize::before,
.spike-zoom-resize::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  border-right: 1px solid rgba(229, 233, 240, 0.5);
  border-bottom: 1px solid rgba(229, 233, 240, 0.5);
}
.spike-zoom-resize::before { width: 13px; height: 13px; }
.spike-zoom-resize::after { width: 7px; height: 7px; }

.spike-chart-page {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow: hidden;
  background: #070a0d;
  color: #e8eef5;
  font-family: Consolas, monospace;
  letter-spacing: 0;
}

.spike-chart-page-head {
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 8px;
  border-bottom: 1px solid #29333c;
  background: #090c0f;
}

.spike-chart-page-identity { min-width: 0; display: grid; gap: 2px; }
.spike-chart-page-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.spike-chart-page-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  color: #8794a2;
  font-size: 9px;
  white-space: nowrap;
}
.spike-chart-page-meta span,
.spike-chart-page-meta strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.spike-chart-page-meta strong[data-tone="detected"] { flex: 0 0 auto; color: #ff74d4; }
.spike-chart-page-meta strong[data-tone="none"] { color: #8794a2; }
.spike-chart-page-meta strong[data-tone="unavailable"] { color: #b794f6; }
#zoomSpikeMeta[data-tone="detected"] { color: #f2bd4d; }
#zoomSpikeMeta[data-tone="partial"],
#zoomSpikeMeta[data-tone="unavailable"] { color: #b794f6; }
.spike-chart-page-tools,
.spike-timeframe-group { display: flex; align-items: center; gap: 4px; }
.spike-chart-page button {
  height: 26px;
  padding: 3px 7px;
  border: 1px solid #29333c;
  border-radius: 2px;
  background: #0e1318;
  color: #cbd5df;
  font: 10px Consolas, monospace;
  cursor: pointer;
}
.spike-chart-page button.active { border-color: #31c7ce; color: #31c7ce; }
.spike-chart-page button:disabled { opacity: 0.5; cursor: wait; }
.spike-chart-page-main { position: relative; height: calc(100vh - 42px); }
.spike-chart-page-canvas { width: 100%; height: 100%; }
.spike-chart-page-status {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  background: #070a0d;
  color: #8794a2;
  font-size: 11px;
}
.spike-chart-page-status[hidden] { display: none; }

@media (max-width: 1200px) {
  .active-chart-grid { --grid-columns: 2 !important; }
}

@media (max-width: 760px) {
  .active-chart-grid { --grid-columns: 1 !important; }
  .spike-grid-chart-wrap { height: 360px; }
  .spike-zoom-modal { width: calc(100vw - 16px) !important; height: calc(100vh - 16px) !important; }
  .spike-chart-page-head { height: auto; min-height: 42px; align-items: flex-start; flex-wrap: wrap; }
  .spike-chart-page-main { height: calc(100vh - 72px); }
}
