:root {
  color-scheme: dark;
  --bg: #050814;
  --shell: #080d1b;
  --panel: #0d1426;
  --panel-soft: #111b31;
  --panel-hot: #16223a;
  --text: #f3f7ff;
  --muted: #8997af;
  --faint: #5d6a80;
  --line: rgba(148, 163, 184, 0.16);
  --green: #22c55e;
  --mint: #29e6a7;
  --blue: #4f8cff;
  --cyan: #22d3ee;
  --amber: #f59e0b;
  --red: #fb7185;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% -8%, rgba(41, 230, 167, 0.18), transparent 34rem),
    radial-gradient(circle at 92% 4%, rgba(79, 140, 255, 0.16), transparent 34rem),
    linear-gradient(135deg, #050814 0%, #081020 54%, #050814 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, select { font: inherit; }

.app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(5, 8, 20, 0.84);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--mint), var(--blue));
  color: #03110c;
  font-weight: 800;
  box-shadow: 0 14px 34px rgba(34, 197, 94, 0.25);
}

.brand strong, .brand span { display: block; }
.brand strong { font-size: 16px; }
.brand span { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }

.nav {
  display: grid;
  gap: 7px;
  margin-top: 32px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: 180ms ease;
}

.nav a::before {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  opacity: 0.72;
}

.nav a:hover, .nav a.active {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  transform: translateX(2px);
}

.target-card {
  margin-top: 34px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 27, 49, 0.96), rgba(8, 13, 27, 0.96));
  box-shadow: var(--shadow);
}

.kicker, .target-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.target-card strong {
  display: block;
  margin-top: 10px;
  font-size: 27px;
}

.track {
  height: 9px;
  margin: 14px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
}

.track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
  animation: fillTrack 900ms 520ms ease forwards;
}

.target-card small { color: var(--muted); font-weight: 600; }

.main {
  min-width: 0;
  padding: 26px;
}

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

h1, h2, p { margin: 0; }
h1 { margin-top: 6px; font-size: clamp(30px, 4vw, 44px); line-height: 1.05; letter-spacing: 0; }
h2 { margin-top: 5px; font-size: 18px; letter-spacing: 0; }

.subhead {
  max-width: 730px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

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

.button, .select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 27, 49, 0.9);
  color: var(--text);
  font-weight: 800;
}

.button {
  padding: 0 14px;
  cursor: pointer;
  transition: 180ms ease;
}

.button:hover {
  border-color: rgba(41, 230, 167, 0.44);
  background: rgba(41, 230, 167, 0.1);
  transform: translateY(-1px);
}

.select { padding: 0 12px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: 16px;
}

.card, .metric, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(17, 27, 49, 0.95), rgba(11, 17, 32, 0.95));
  box-shadow: var(--shadow);
}

.summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 22px;
  min-height: 220px;
  padding: 22px;
  overflow: hidden;
  animation: rise 520ms ease both;
}

.summary-card strong {
  display: block;
  margin-top: 14px;
  font-size: clamp(44px, 7vw, 74px);
  line-height: 0.95;
  letter-spacing: 0;
}

.summary-card p { margin-top: 15px; color: var(--muted); line-height: 1.65; }

.glance {
  display: grid;
  align-content: end;
  gap: 3px;
}

.glance-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.glance-row:first-child { border-top: 0; }
.glance-row span { color: var(--muted); font-size: 13px; font-weight: 700; }
.glance-row b { font-size: 18px; }

.profit-card {
  display: grid;
  align-content: space-between;
  min-height: 220px;
  padding: 22px;
  animation: rise 620ms 70ms ease both;
}

.score {
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  margin: 8px auto 0;
  border-radius: 50%;
  background: conic-gradient(var(--mint) 0 41%, rgba(148, 163, 184, 0.16) 41% 100%);
}

.score div {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border-radius: inherit;
  background: var(--panel);
}

.score strong { font-size: 26px; }
.profit-card p { color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; }

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

.metric {
  min-height: 136px;
  padding: 17px;
  animation: rise 520ms ease both;
  transition: border-color 180ms ease, transform 180ms ease;
}

.metric:nth-child(2) { animation-delay: 60ms; }
.metric:nth-child(3) { animation-delay: 120ms; }
.metric:nth-child(4) { animation-delay: 180ms; }

.metric:hover, .panel:hover { border-color: rgba(79, 140, 255, 0.38); transform: translateY(-2px); }
.metric span { color: var(--muted); font-size: 13px; font-weight: 800; }
.metric strong { display: block; margin-top: 12px; font-size: 28px; line-height: 1; }
.metric small { display: flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric small::before { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); content: ""; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
  animation: rise 620ms ease both;
  transition: border-color 180ms ease, transform 180ms ease;
}

.wide { grid-column: span 2; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(41, 230, 167, 0.24);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(41, 230, 167, 0.1);
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.blue { border-color: rgba(79, 140, 255, 0.26); background: rgba(79, 140, 255, 0.12); color: var(--blue); }

.chart-wrap { position: relative; height: 326px; }
.chart-wrap.compact { height: 270px; }
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

th, td {
  padding: 14px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

th { color: var(--faint); font-size: 12px; font-weight: 800; text-transform: uppercase; }
td { color: #dde7f7; }
.money, .positive { color: var(--mint); font-weight: 800; }
.negative { color: var(--red); font-weight: 800; }

.order-status {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(41, 230, 167, 0.12);
  color: var(--mint);
  font-size: 12px;
  font-weight: 800;
}

.warning { background: rgba(245, 158, 11, 0.14); color: var(--amber); }
.danger { background: rgba(251, 113, 133, 0.14); color: var(--red); }

.fallback-bars {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: end;
  gap: 10px;
  height: 100%;
  padding-top: 12px;
}

.fallback-bars span { display: block; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--mint), var(--blue)); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fillTrack { to { width: var(--progress); } }

@media (max-width: 1180px) {
  .hero-grid, .content-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 18px; }
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 18px; }
  .nav a { justify-content: center; }
  .nav a::before, .target-card { display: none; }
  .topbar { align-items: stretch; flex-direction: column; }
  .controls { flex-wrap: wrap; }
  .summary-card { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main { padding: 18px; }
  .metrics { grid-template-columns: 1fr; }
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .button, .select { flex: 1 1 150px; }
  .chart-wrap { height: 280px; }
}
