:root{
  --bg:#070a12;--panel:#0f172a;--panel2:#111c33;--muted:#8ea0c0;--text:#eaf0ff;
  --accent:#58f0c7;--accent2:#7c5cff;--bad:#ff5c7a;--warn:#ffd166;--line:#22304d;
  --shadow:0 24px 80px rgba(0,0,0,.45);--radius:22px;
}
*{box-sizing:border-box;font-weight:300 !important}
body{margin:0;font-family:'SK-Modernist',Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial;background:
  radial-gradient(900px 500px at 20% -10%,rgba(124,92,255,.35),transparent 60%),
  radial-gradient(800px 500px at 110% 20%,rgba(88,240,199,.18),transparent 55%),var(--bg);color:var(--text)}
.wrap{max-width:100%;margin:0 auto;padding:34px 24px 60px}
.hero{display:flex;justify-content:space-between;gap:18px;align-items:flex-start;margin-bottom:20px}
h1{font-size:clamp(30px,5vw,56px);line-height:.95;margin:0;letter-spacing:-2.5px}
.sub{color:var(--muted);font-size:15px;max-width:720px;margin-top:14px;line-height:1.5}
.pill{border:1px solid rgba(88,240,199,.35);background:rgba(88,240,199,.08);color:var(--accent);padding:10px 14px;border-radius:999px;font-size:13px;white-space:nowrap}
.grid{display:grid;grid-template-columns:420px 1fr;gap:18px;align-items:start}
.card{background:linear-gradient(180deg,rgba(255,255,255,.055),rgba(255,255,255,.025));border:1px solid rgba(255,255,255,.09);border-radius:var(--radius);box-shadow:var(--shadow);backdrop-filter:blur(10px)}
.card h2{font-size:16px;margin:0 0 14px;color:#fff;letter-spacing:.2px;text-align:center}.pad{padding:18px}
label{display:block;color:var(--muted);font-size:12px;margin:12px 0 7px;text-transform:uppercase;letter-spacing:.08em;text-align:center}
input:not([type="checkbox"]),textarea{width:100%;background:#091225;border:1px solid var(--line);color:var(--text);border-radius:14px;padding:12px 13px;font-size:14px;outline:none;text-align:center}
input:not([type="checkbox"]):focus,textarea:focus{border-color:rgba(88,240,199,.7);box-shadow:0 0 0 3px rgba(88,240,199,.1)}
.row{display:grid;grid-template-columns:1fr 1fr;gap:10px}.row3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:10px}
button{border:0;border-radius:15px;padding:13px 16px;cursor:pointer;color:#061018;background:linear-gradient(135deg,var(--accent),#9fffe6);box-shadow:0 12px 30px rgba(88,240,199,.18)}
button.secondary{background:#111c33;color:var(--text);border:1px solid var(--line);box-shadow:none}button:disabled{opacity:.55;cursor:not-allowed}.actions{display:flex;gap:10px;margin-top:16px}.actions button{flex:1}
.metrics{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px;margin-bottom:18px}.metric{padding:16px;border-radius:20px;background:rgba(15,23,42,.78);border:1px solid rgba(255,255,255,.08);text-align:center}
.metric .k{font-size:12px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.metric .v{font-size:26px;margin-top:8px;letter-spacing:-1px}.metric .good{color:var(--accent)}.metric .bad{color:var(--bad)}.metric .warn{color:var(--warn)}
.log{height:54px;overflow:auto;background:#050a14;border:1px solid var(--line);border-radius:16px;padding:12px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;color:#b7c5e6;white-space:pre-wrap}
table{width:100%;border-collapse:collapse;font-size:12px}th,td{border-bottom:1px solid rgba(255,255,255,.07);padding:9px;text-align:center;white-space:nowrap}th{color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.07em;background:rgba(255,255,255,.03);position:sticky;top:0} .tablewrap{max-height:850px;overflow:auto;border-radius:18px;border:1px solid rgba(255,255,255,.08)}
.note{font-size:12px;color:var(--muted);line-height:1.45}.danger{color:#ffc3ce}
.good{color:var(--accent)}.bad{color:var(--bad)}.warn{color:var(--warn)}.blue{color:#38bdf8}
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(7, 10, 18, 0.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 98%; max-width: 98%; max-height: 90vh; display: flex; flex-direction: column;
  background: #0f172a; border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.modal-header { padding: 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 18px; color: #fff; }
.modal-close { background: none !important; box-shadow: none !important; border: none !important; color: var(--muted); font-size: 28px; cursor: pointer; padding: 0 5px !important; line-height: 1; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 18px; overflow-y: auto; flex: 1; }
.load-btn { padding: 5px 10px; font-size: 11px; border-radius: 8px; background: linear-gradient(135deg,var(--accent2),#9b84ff); color: #fff; box-shadow: none; border: none; cursor: pointer; }
.load-btn:hover { filter: brightness(1.1); }
.delete-btn { padding: 5px 10px; font-size: 11px; border-radius: 8px; background: linear-gradient(135deg,var(--bad),#ff809b); color: #fff; box-shadow: none; border: none; cursor: pointer; margin-left: 6px; }
.delete-btn:hover { filter: brightness(1.1); }
@media(max-width:980px){.grid{grid-template-columns:1fr}.metrics{grid-template-columns:repeat(2,1fr)}.hero{display:block}.pill{display:inline-block;margin-top:16px}}

/* Custom Styled Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.4);
}
::-webkit-scrollbar-thumb {
  background: rgba(88, 240, 199, 0.2);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(88, 240, 199, 0.4);
}

/* Firefox scrollbar compatibility */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(88, 240, 199, 0.2) rgba(15, 23, 42, 0.4);
}

/* Wide screen layout stretching for status */
@media(min-width:981px) {
  .grid {
    align-items: stretch;
  }
  .left-col {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  .status-card {
    display: flex;
    flex-direction: column;
    flex: 1;
  }
  .status-card .log {
    flex: 1;
    height: auto;
  }
}

/* Clickable and active states for metric cards */
.metric.clickable {
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.metric.clickable:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.metric.clickable:active {
  transform: translateY(0);
}
.metric.active-green {
  border-color: var(--accent) !important;
  box-shadow: 0 0 16px rgba(88, 240, 199, 0.35) !important;
  background: rgba(88, 240, 199, 0.08) !important;
}
.metric.active-blue {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35) !important;
  background: rgba(56, 189, 248, 0.08) !important;
}
.metric.active-yellow {
  border-color: var(--warn) !important;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.35) !important;
  background: rgba(255, 209, 102, 0.08) !important;
}
.metric.active-red {
  border-color: var(--bad) !important;
  box-shadow: 0 0 16px rgba(255, 92, 122, 0.35) !important;
  background: rgba(255, 92, 122, 0.08) !important;
}

/* Navigation Header Styles */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}
.header .brand {
  display: flex;
  flex-direction: column;
}
.header h1 {
  font-size: clamp(24px, 4vw, 36px);
  margin: 0;
}
.header .accent-text {
  color: var(--accent);
  background: linear-gradient(135deg, var(--accent), #9fffe6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.header .sub {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}
.nav-links {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.nav-btn {
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 500 !important;
}
.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.nav-btn.active {
  color: #061018;
  background: linear-gradient(135deg, var(--accent), #9fffe6);
  font-weight: 600 !important;
}

/* Live Dashboard Specific Grid and Layout */
.live-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.text-orange {
  color: #f59e0b !important;
}
.metric.highlight-card {
  border-color: rgba(88, 240, 199, 0.25);
  box-shadow: 0 10px 40px rgba(88, 240, 199, 0.05);
}

.live-controls-card {
  margin-bottom: 20px;
}
.live-controls select {
  width: 100%;
  background: #091225;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 13px;
  font-size: 14px;
  outline: none;
  text-align: center;
  appearance: none;
  cursor: pointer;
  font-weight: 400 !important;
}
.live-controls select:focus {
  border-color: rgba(88, 240, 199, 0.7);
  box-shadow: 0 0 0 3px rgba(88, 240, 199, 0.1);
}

.live-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}
@media (max-width: 1024px) {
  .live-grid {
    grid-template-columns: 1fr;
  }
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.card-header-flex h2 {
  margin: 0 !important;
  text-align: left !important;
}

/* Order Book Layout */
.orderbook-container {
  display: flex;
  flex-direction: column;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  user-select: none;
}
.orderbook-side {
  display: flex;
  flex-direction: column;
}
.ob-header {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  font-weight: 500 !important;
}
.ob-header div:nth-child(2), .ob-header div:nth-child(3) {
  text-align: right;
}

.ob-list {
  display: flex;
  flex-direction: column;
  min-height: 250px;
  max-height: 330px;
  overflow-y: hidden;
}

.asks-side .ob-list {
  justify-content: flex-end; /* Asks stack upwards from spread */
}

.ob-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr;
  padding: 4px 8px;
  position: relative;
  transition: background 0.15s ease;
  line-height: 1.4;
}
.ob-row:hover {
  background: rgba(255, 255, 255, 0.04);
}
.ob-row > div:not(.ob-bar) {
  position: relative;
  z-index: 2;
}
.ob-row > .ob-size, .ob-row > .ob-total {
  text-align: right;
}
.ob-bar {
  position: absolute;
  top: 1px;
  bottom: 1px;
  right: 0;
  z-index: 1;
  opacity: 0.12;
  pointer-events: none;
  border-radius: 2px;
}
.bid-bar {
  background-color: var(--accent);
}
.ask-bar {
  background-color: var(--bad);
}

/* Spread row */
.ob-spread-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 8px;
  margin: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.01);
  font-weight: 500 !important;
}
.spread-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.spread-label span {
  font-family: ui-monospace, monospace;
  font-weight: bold !important;
  color: var(--text);
}
.mid-price {
  font-size: 16px;
  font-weight: bold !important;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* Live Trades Section */
.trades-container {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  display: flex;
  flex-direction: column;
}
.trades-header {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr 1fr 1.2fr;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  font-weight: 500 !important;
}
.trades-header div:nth-child(3), .trades-header div:nth-child(4) {
  text-align: right;
}
.trades-list {
  display: flex;
  flex-direction: column;
  height: 600px;
  overflow-y: auto;
}
.trade-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr 1fr 1.2fr;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  animation: fadeInRow 0.3s ease-out;
  align-items: center;
}
@keyframes fadeInRow {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Depth Chart Styling */
.depth-chart-card h2 {
  text-align: left !important;
  margin-bottom: 14px;
}
.depth-chart-wrapper {
  background: #091225;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px;
  overflow: hidden;
  position: relative;
}
#depthChartCanvas {
  display: block;
  width: 100%;
  height: 220px;
  background: transparent;
}

/* Pair Switcher Tab Styles */
.pair-switcher {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
  border-radius: 18px;
  border: 1px solid var(--line);
  align-self: flex-start;
  max-width: fit-content;
}
.pair-tab {
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.2s ease;
  font-weight: 500 !important;
}
.pair-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.pair-tab.active {
  color: #061018;
  background: linear-gradient(135deg, var(--accent), #9fffe6);
  box-shadow: 0 8px 24px rgba(88, 240, 199, 0.15);
  font-weight: 600 !important;
}

/* Controls Grid responsive layout */
.live-controls-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.live-controls-grid select, .live-controls-grid input {
  width: 100%;
  background: #091225;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 13px;
  font-size: 14px;
  outline: none;
  text-align: center;
  appearance: none;
  cursor: pointer;
  font-weight: 400 !important;
}
.live-controls-grid select:focus, .live-controls-grid input:focus {
  border-color: rgba(88, 240, 199, 0.7);
  box-shadow: 0 0 0 3px rgba(88, 240, 199, 0.1);
}
@media (max-width: 1100px) {
  .live-controls-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .live-controls-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .live-controls-grid {
    grid-template-columns: 1fr;
  }
}

/* Scalper Assistant Layout */
.assistant-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 1.2fr 1fr;
  gap: 16px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .assistant-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .assistant-grid {
    grid-template-columns: 1fr;
  }
}
.assistant-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.assistant-value {
  font-size: 22px;
  font-weight: bold !important;
  margin: 6px 0;
  letter-spacing: -0.5px;
}
.assistant-sub {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
.clickable-assistant-card:hover {
  background: rgba(255, 255, 255, 0.03) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}
.clickable-assistant-card.active-suggestion {
  border-color: var(--accent) !important;
  background: rgba(88, 240, 199, 0.05) !important;
  box-shadow: 0 0 12px rgba(88, 240, 199, 0.15);
}
.clickable-assistant-card.active-suggestion .assistant-value {
  text-shadow: 0 0 10px rgba(88, 240, 199, 0.2);
}
