:root {
  --cc-bg: #0a0d12;
  --cc-panel: #11151d;
  --cc-line: #1f2530;
  --cc-text: #d7dce3;
  --cc-text-dim: #6b7482;
  --cc-bid: #29c98f;   /* order-flow bid green */
  --cc-ask: #e8a33d;   /* order-flow ask amber */
  --cc-accent: #3fa9ff;
  --cc-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --cc-sans: "Inter", -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--cc-bg);
  color: var(--cc-text);
  font-family: var(--cc-sans);
  overflow: hidden;
}

.cc-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ---- Top bar ---- */
.cc-topbar {
  height: 56px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--cc-panel);
  border-bottom: 1px solid var(--cc-line);
}

.cc-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cc-brand-mark {
  font-family: var(--cc-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--cc-bg);
  background: var(--cc-bid);
  padding: 4px 7px;
  border-radius: 4px;
}

.cc-brand-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cc-text);
}

.cc-topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.cc-divider {
  width: 1px;
  height: 22px;
  background: var(--cc-line);
}

/* ---- Toggle switch ---- */
.cc-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.cc-switch input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cc-switch-track {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 10px;
  background: var(--cc-line);
  border: 1px solid var(--cc-line);
  flex: 0 0 auto;
  transition: background .15s ease, border-color .15s ease;
}

.cc-switch-thumb {
  position: absolute;
  top: 1px;
  left: 1px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--cc-text-dim);
  transition: transform .15s ease, background .15s ease;
}

.cc-switch input:checked + .cc-switch-track {
  background: rgba(41, 201, 143, 0.18);
  border-color: var(--cc-bid);
}

.cc-switch input:checked + .cc-switch-track .cc-switch-thumb {
  transform: translateX(15px);
  background: var(--cc-bid);
  box-shadow: 0 0 6px var(--cc-bid);
}

.cc-switch-label {
  font-size: 12px;
  color: var(--cc-text-dim);
  white-space: nowrap;
  transition: color .12s ease;
}

.cc-switch:hover .cc-switch-label {
  color: var(--cc-text);
}

/* ---- Status pills (uptime / clock) ---- */
.cc-status-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cc-status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: var(--cc-bg);
  border: 1px solid var(--cc-line);
  border-radius: 7px;
}

.cc-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cc-bid);
  box-shadow: 0 0 6px var(--cc-bid);
  flex: 0 0 auto;
  animation: cc-pulse 2s ease-in-out infinite;
}

@keyframes cc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.cc-status-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--cc-text-dim);
}

.cc-status-value {
  font-family: var(--cc-mono);
  font-size: 12.5px;
  color: var(--cc-text);
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}

.cc-status-pill--clock {
  color: var(--cc-text-dim);
}

/* ---- View mode segmented control (Auto / Desktop / Mobile) ---- */
.cc-view-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--cc-bg);
  border: 1px solid var(--cc-line);
  border-radius: 7px;
  padding: 3px;
}

.cc-view-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--cc-text-dim);
  font-family: var(--cc-sans);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}

.cc-view-btn:hover {
  color: var(--cc-text);
}

.cc-view-btn.is-active {
  background: rgba(41, 201, 143, 0.16);
  color: var(--cc-bid);
}

/* =========================================================
   Mobile-adaptive layout
   Driven by html[data-view="mobile"], set automatically from
   device detection, or forced by the Auto/Desktop/Mobile switch
   above regardless of actual screen size.
   ========================================================= */
html[data-view="mobile"] .cc-topbar {
  height: auto;
  flex-wrap: wrap;
  row-gap: 10px;
  padding: 10px 12px;
}

html[data-view="mobile"] .cc-brand-text {
  font-size: 12.5px;
}

html[data-view="mobile"] .cc-topbar-right {
  width: 100%;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

html[data-view="mobile"] .cc-switch-label {
  display: none;
}

html[data-view="mobile"] .cc-view-btn {
  padding: 7px 9px;
  font-size: 11px;
}

html[data-view="mobile"] .cc-status-label {
  display: none;
}

html[data-view="mobile"] .cc-status-pill {
  padding: 7px 10px;
}

html[data-view="mobile"] .cc-tabbar {
  padding: 8px 10px 0 10px;
}

html[data-view="mobile"] .cc-tab {
  padding: 12px 14px;
  font-size: 13px;
}

html[data-view="mobile"] .cc-tab-label {
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Tab bar ---- */
.cc-tabbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 3px;
  padding: 8px 14px 0 14px;
  background: var(--cc-bg);
  border-bottom: 1px solid var(--cc-line);
  overflow-x: auto;
}

.cc-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--cc-panel);
  border: 1px solid var(--cc-line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  color: var(--cc-text-dim);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  top: 1px;
  transition: color .12s ease, background .12s ease;
}

.cc-tab:hover {
  color: var(--cc-text);
}

.cc-tab.is-active {
  color: var(--cc-text);
  background: var(--cc-bg);
  border-color: var(--cc-line);
  border-bottom: 1px solid var(--cc-bg);
}

.cc-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cc-text-dim);
  flex: 0 0 auto;
}

.cc-tab.is-active .cc-tab-dot {
  background: var(--cc-bid);
  box-shadow: 0 0 6px var(--cc-bid);
}

.cc-tab.is-loaded:not(.is-active) .cc-tab-dot {
  background: var(--cc-accent);
}

.cc-tab-close {
  margin-left: 2px;
  color: var(--cc-text-dim);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 3px;
}

.cc-tab-close:hover {
  color: var(--cc-ask);
  background: rgba(232, 163, 61, 0.12);
}

/* ---- Workspace ---- */
.cc-workspace {
  flex: 1 1 auto;
  position: relative;
  background: var(--cc-bg);
  min-height: 0;
}

.cc-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--cc-text-dim);
  font-size: 13px;
}

.cc-empty-glyph {
  font-size: 34px;
  color: var(--cc-line);
}

.cc-pane {
  position: absolute;
  inset: 0;
  display: none;
}

.cc-pane.is-active {
  display: block;
}

.cc-pane iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #05070a;
}

.cc-pane-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--cc-mono);
  font-size: 12px;
  color: var(--cc-text-dim);
  background: var(--cc-bg);
}

.cc-pane-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--cc-line);
  border-top-color: var(--cc-bid);
  animation: cc-spin .7s linear infinite;
}

@keyframes cc-spin {
  to { transform: rotate(360deg); }
}

/* scrollbar for tab overflow */
.cc-tabbar::-webkit-scrollbar { height: 4px; }
.cc-tabbar::-webkit-scrollbar-thumb { background: var(--cc-line); border-radius: 2px; }
