:root {
  --bg: #0a0a0b;
  --panel: #121214;
  --panel-2: #1a1b1e;
  --line: #2a2d31;
  --line-soft: #202328;
  --text: #efefec;
  --muted: #98a0aa;
  --muted-2: #6f7782;
  --success: #10b981;
  --danger: #ef4444;
  --info: #f5f5f4;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.05), transparent 28%),
    linear-gradient(180deg, #0a0a0b 0%, #0d0e10 100%);
  color: var(--text);
  font-family: 'Geist', sans-serif;
}

body {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18, 18, 20, 0.96), rgba(12, 12, 13, 0.94));
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ffffff, #d2d5d8);
  color: #09090b;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: default;
}

.nav-item-active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border-radius: 16px;
}

.sidebar-metric {
  margin: 10px 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sidebar-copy,
.support-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.workspace {
  min-width: 0;
  height: 100vh;
  overflow: auto;
  padding: 24px;
}

.topbar,
.hero-grid,
.main-grid {
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

.topbar h1,
.panel-header h2 {
  margin: 4px 0 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
  letter-spacing: -0.04em;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.badge,
.ghost-button,
.action-button,
.select-control,
.input-group input {
  border-radius: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.85rem;
}

.badge-live {
  color: #cbffe8;
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.12);
}

.badge-muted {
  color: var(--muted);
}

.ghost-button,
.select-control,
.input-group input {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text);
}

.ghost-button {
  padding: 10px 14px;
  cursor: pointer;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.hero-card,
.panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 18px 48px -24px var(--shadow);
}

.hero-card {
  padding: 20px;
}

.eyebrow {
  margin: 0;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
  font-weight: 700;
}

.metric-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0 8px;
}

.metric-value {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.06em;
  font-weight: 700;
}

.metric-unit {
  color: var(--muted);
  font-size: 0.9rem;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--muted-2);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.15);
}

.status-live {
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.08);
}

.status-offline {
  background: var(--danger);
  box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.08);
}

.status-text {
  font-size: 1.2rem;
  font-weight: 600;
}

.main-grid {
  display: grid;
  grid-template-columns: 1.55fr 0.75fr 0.75fr;
  gap: 16px;
}

.panel {
  padding: 18px;
}

.panel-large {
  grid-column: span 1;
}

.panel-tall {
  min-height: 380px;
}

.panel-full {
  grid-column: 1 / -1;
  min-height: 280px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  font-size: 1.12rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.select-control {
  padding: 10px 12px;
}

.chart-panel {
  min-height: 320px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 63px,
      rgba(255, 255, 255, 0.03) 64px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 53px,
      rgba(255, 255, 255, 0.03) 54px
    );
  overflow: hidden;
}

#ohlcvChart {
  width: 100%;
  height: 320px;
  display: block;
}

.candles-footer {
  margin-top: 12px;
}

.trade-form {
  display: grid;
  gap: 14px;
}

.input-group {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.input-group input {
  width: 100%;
  padding: 13px 14px;
  font-family: 'JetBrains Mono', monospace;
}

.action-button {
  padding: 13px 16px;
  border: 1px solid transparent;
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.buy-button {
  background: linear-gradient(180deg, #14b86f, #0c8d54);
}

.sell-button {
  background: linear-gradient(180deg, #ef4444, #c83131);
}

.table-wrap {
  overflow: auto;
  max-height: 320px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line-soft);
}

.data-table th {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.64rem;
}

.logs-console {
  background: #0b0c0d;
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  min-height: 230px;
  max-height: 320px;
  overflow: auto;
  padding: 12px 14px;
}

.log-row {
  display: grid;
  grid-template-columns: 160px 80px 1fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
}

.log-time {
  color: var(--muted);
}

.log-level {
  text-transform: uppercase;
}

.log-level-info {
  color: #d6d9de;
}

.log-level-warn {
  color: #fbbf24;
}

.log-level-error {
  color: #f87171;
}

.log-level-debug {
  color: #60a5fa;
}

.placeholder {
  color: var(--muted);
  padding: 18px 0;
}

@media (max-width: 1120px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .panel-large,
  .panel-full {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .workspace {
    height: auto;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
}
