:root {
  --bg: #0d0f12;
  --surface: #15181d;
  --surface-2: #1d2128;
  --line: #2a3039;
  --text: #f4f6f8;
  --muted: #8e98a7;
  --red: #e23d4f;
  --gold: #f5b642;
  --green: #36d17f;
  --blue: #58a6ff;
  --amber: #f0a020;
  --danger: #ff5c68;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(226, 61, 79, 0.13), transparent 34%),
    linear-gradient(315deg, rgba(245, 182, 66, 0.12), transparent 38%),
    var(--bg);
}

button {
  font: inherit;
  cursor: pointer;
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 44px;
}

.topbar,
.status-strip,
.panel,
.metric-card,
.signal-card {
  background: rgba(21, 24, 29, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 48px var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand h1,
.brand p,
.section-head h2,
.panel-head h2,
.table-head h2,
.table-head p {
  margin: 0;
}

.brand h1 {
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0;
}

.brand p,
.table-head p,
.panel-head span,
.section-head span,
.muted {
  color: var(--muted);
}

.brand p {
  margin-top: 3px;
  font-size: 13px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(54, 209, 127, 0.32);
  color: var(--green);
  background: rgba(54, 209, 127, 0.1);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.live-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.top-summary {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: 150px;
}

.top-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.top-summary strong {
  font-size: 14px;
  color: var(--green);
}

.status-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1.4fr;
  gap: 1px;
  margin-top: 14px;
  overflow: hidden;
}

.status-strip > div {
  min-width: 0;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.015);
}

.status-strip span,
.status-strip strong {
  display: block;
}

.status-strip strong {
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-up {
  color: var(--green);
}

.service-down {
  color: var(--danger);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.metric-card {
  position: relative;
  min-height: 136px;
  padding: 18px;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--gold));
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 13px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1;
  font-weight: 850;
}

.metric-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--danger);
}

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

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 18px;
}

.chart-panel {
  min-height: 346px;
}

.panel-head,
.section-head,
.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel h2,
.section-head h2,
.table-head h2 {
  font-size: 18px;
  line-height: 1.2;
}

canvas {
  width: 100%;
  max-width: 100%;
  height: 260px;
  display: block;
}

.compact .panel {
  min-height: 252px;
}

.winbar {
  display: flex;
  height: 30px;
  overflow: hidden;
  border-radius: 8px;
  background: #101318;
  border: 1px solid var(--line);
}

.winbar div:first-child {
  background: var(--green);
}

.winbar div:last-child {
  background: var(--danger);
}

.split-stats,
.origin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.mini-stat,
.origin-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101318;
  padding: 12px;
}

.mini-stat strong,
.origin-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 18px;
}

.mini-stat span,
.origin-row span {
  color: var(--muted);
  font-size: 12px;
}

.dist-list {
  display: grid;
  gap: 9px;
}

.dist-row {
  display: grid;
  grid-template-columns: 72px 1fr 32px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.dist-track {
  height: 24px;
  overflow: hidden;
  border-radius: 7px;
  background: #101318;
  border: 1px solid var(--line);
}

.dist-fill {
  height: 100%;
  min-width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(54, 209, 127, 0.25), rgba(54, 209, 127, 0.82));
}

.dist-fill.loss {
  background: linear-gradient(90deg, rgba(255, 92, 104, 0.25), rgba(255, 92, 104, 0.82));
}

.section-block {
  margin-top: 20px;
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.signal-card {
  padding: 15px;
}

.signal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.signal-symbol {
  font-size: 22px;
  font-weight: 850;
}

.rows {
  display: grid;
  gap: 8px;
}

.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.row span:first-child {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
}

.badge.buy,
.badge.tp {
  color: var(--green);
  border-color: rgba(54, 209, 127, 0.35);
  background: rgba(54, 209, 127, 0.1);
}

.badge.sl {
  color: var(--danger);
  border-color: rgba(255, 92, 104, 0.35);
  background: rgba(255, 92, 104, 0.1);
}

.badge.open {
  color: var(--blue);
  border-color: rgba(88, 166, 255, 0.35);
  background: rgba(88, 166, 255, 0.1);
}

.table-panel {
  margin-top: 20px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  min-width: 58px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101318;
  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  color: #fff;
  border-color: rgba(226, 61, 79, 0.9);
  background: var(--red);
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 11px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
  color: var(--muted);
  background: #101318;
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.symbol-cell {
  font-weight: 850;
  font-size: 14px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.page-btn {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101318;
  color: var(--text);
  font-weight: 800;
}

.page-btn.active {
  background: var(--gold);
  color: #16120a;
  border-color: var(--gold);
}

.page-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.empty,
.error-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.loading {
  position: relative;
  overflow: hidden;
  min-height: 120px;
}

.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 960px) {
  .topbar,
  .table-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-summary {
    justify-items: start;
  }

  .status-strip,
  .panel-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 600px) {
  .shell {
    width: min(100% - 20px, 1240px);
    padding-top: 10px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand h1 {
    font-size: 20px;
  }

  .live-pill {
    display: none;
  }

  .metric-grid,
  .split-stats,
  .origin-grid {
    grid-template-columns: 1fr;
  }
}
