:root {
  --bg: #0a1014;
  --bg-soft: #121a1f;
  --panel: rgba(13, 19, 24, 0.94);
  --panel-alt: rgba(17, 24, 29, 0.98);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 209, 102, 0.26);
  --text: #edf4f7;
  --muted: #98aab4;
  --muted-strong: #c9d4da;
  --gold: #ffd166;
  --gold-deep: #f4a261;
  --cyan: #57d7ff;
  --green: #44d39b;
  --red: #ff786d;
  --white-glow: rgba(255, 255, 255, 0.55);
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --radius: 1.4rem;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 209, 102, 0.15), transparent 24%),
    radial-gradient(circle at bottom right, rgba(87, 215, 255, 0.1), transparent 28%),
    linear-gradient(180deg, #05080b 0%, #0b1116 48%, #0e1419 100%);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.backdrop {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(42px);
  opacity: 0.18;
  pointer-events: none;
}

.backdrop-left {
  top: -9rem;
  left: -8rem;
  background: #e9c46a;
}

.backdrop-right {
  right: -12rem;
  bottom: -10rem;
  background: #219ebc;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.4rem 0 2rem;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(18, 24, 29, 0.98), rgba(11, 16, 21, 0.98)),
    radial-gradient(circle at top right, rgba(255, 209, 102, 0.08), transparent 24%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.8rem;
  margin-bottom: 1.4rem;
}

.hero-copy {
  max-width: 54rem;
}

.eyebrow {
  display: block;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.7rem;
  margin-bottom: 0.7rem;
}

.hero h1,
.card-head h2,
.auth-card h2 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  letter-spacing: -0.05em;
}

.hero h1 {
  font-size: clamp(2.9rem, 7vw, 5.4rem);
  line-height: 0.9;
}

.hero-text {
  margin-top: 0.95rem;
  color: var(--muted-strong);
  max-width: 50rem;
  line-height: 1.6;
}

.hero-meta {
  min-width: 16rem;
  display: grid;
  gap: 0.95rem;
  align-content: start;
}

.meta-block {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.02);
}

.meta-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
}

.status-badge,
.pill,
.source-chip,
.impact-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-open,
.source-ok,
.source-ready,
.impact-bullish {
  color: #071711;
  background: rgba(68, 211, 155, 0.92);
}

.status-degraded,
.source-warning,
.source-partial,
.source-received,
.impact-neutral {
  color: #241600;
  background: rgba(255, 209, 102, 0.92);
}

.status-closed,
.source-not-configured,
.source-empty {
  color: #f2e7ce;
  background: rgba(112, 96, 64, 0.38);
}

.status-offline,
.source-error,
.impact-bearish,
.impact-risk {
  color: #240705;
  background: rgba(255, 120, 109, 0.92);
}

.auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
  gap: 1.3rem;
  padding: 1.4rem 1.6rem;
  margin-bottom: 1.4rem;
}

.token-form {
  display: grid;
  gap: 0.8rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field span {
  color: var(--muted);
  font-size: 0.8rem;
}

.field input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.token-actions {
  display: flex;
  gap: 0.7rem;
}

.primary-button,
.ghost-button {
  border-radius: 0.9rem;
  padding: 0.85rem 1rem;
  font: inherit;
  cursor: pointer;
}

.primary-button {
  border: 0;
  color: #091016;
  font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--gold-deep));
}

.ghost-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.02);
}

.form-status {
  color: var(--muted);
  min-height: 1.2rem;
}

.hidden {
  display: none !important;
}

.grid-top {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(19rem, 0.95fr);
  gap: 1.4rem;
}

.grid-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 1.4rem;
  margin-top: 1.4rem;
}

.chart-card,
.summary-card {
  padding: 1.3rem;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1rem;
}

.card-head h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.chart-head-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 0.55rem;
}

.pill {
  color: var(--muted-strong);
  background: rgba(255, 255, 255, 0.03);
}

.timeframe-rail {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
  margin-bottom: 0.95rem;
}

.timeframe-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted-strong);
  border-radius: 999px;
  padding: 0.52rem 0.88rem;
  white-space: nowrap;
  cursor: pointer;
}

.timeframe-button.active {
  color: #111;
  border-color: rgba(255, 209, 102, 0.55);
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.96), rgba(244, 162, 97, 0.96));
}

.chart-shell {
  position: relative;
  min-height: 33rem;
  border-radius: 1.15rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(9, 14, 18, 0.95), rgba(10, 15, 20, 0.98)),
    radial-gradient(circle at top right, rgba(87, 215, 255, 0.06), transparent 22%);
}

.chart-canvas {
  width: 100%;
  height: 100%;
  min-height: 33rem;
  display: block;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: rgba(8, 12, 15, 0.56);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.95rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend-swatch {
  width: 0.82rem;
  height: 0.82rem;
  border-radius: 0.25rem;
  display: inline-block;
  margin-right: 0.4rem;
}

.legend-bull {
  background: var(--green);
}

.legend-bear {
  background: var(--red);
}

.legend-forecast {
  background: rgba(255, 255, 255, 0.66);
}

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

.metric {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  margin-bottom: 0.35rem;
}

.metric-value {
  display: block;
  font-size: 1.02rem;
  font-weight: 700;
}

.subsection {
  margin-top: 1.25rem;
}

.subsection h3 {
  margin-bottom: 0.7rem;
  font-size: 1rem;
}

.sources-list,
.performance-panel {
  display: grid;
  gap: 0.7rem;
}

.performance-panel {
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.source-card,
.performance-card {
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.position-row,
.performance-row {
  display: flex;
  justify-content: space-between;
  gap: 0.9rem;
  color: var(--muted-strong);
  font-size: 0.88rem;
}

.position-row + .position-row,
.performance-row + .performance-row {
  margin-top: 0.35rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.78rem 0.55rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
}

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

.summary-copy,
.muted {
  color: var(--muted);
}

.subtle-copy {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.empty-state {
  color: var(--muted);
  padding: 0.7rem 0;
}

@media (max-width: 1120px) {
  .auth-card,
  .grid-top,
  .grid-bottom {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
  }

  .hero-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
    width: 100%;
  }

}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 1rem, 100%);
    padding-top: 0.7rem;
  }

  .hero,
  .chart-card,
  .summary-card,
  .card {
    padding: 1rem;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 12vw, 3.4rem);
  }

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

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

  .chart-shell,
  .chart-canvas {
    min-height: 23rem;
  }

  .data-table th:nth-child(2),
  .data-table td:nth-child(2) {
    display: none;
  }
}
