:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #182338;
  --line: rgba(255, 255, 255, 0.12);
  --text: #f8fafc;
  --muted: #a7b0c2;
  --brand: #49d2a6;
  --accent: #6ea8ff;
  --warning: #f4bf50;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(73, 210, 166, 0.18), transparent 32rem),
    radial-gradient(circle at top right, rgba(110, 168, 255, 0.16), transparent 30rem),
    var(--bg);
  color: var(--text);
}

a { color: inherit; }

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

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

.brand {
  font-size: 24px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

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

.user-pill, .range {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}

.ghost-button, .primary-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.primary-button {
  width: 100%;
  background: var(--brand);
  color: #052017;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: end;
  padding: 46px 0 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1, h2, p { margin-top: 0; }

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(42px, 8vw, 88px);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
}

.hero-copy {
  max-width: 620px;
  color: var(--muted);
  font-size: 18px;
}

.hero-card, .panel, .stat-card, .auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  box-shadow: 0 24px 70px rgba(0,0,0,0.25);
}

.hero-card {
  display: grid;
  gap: 6px;
  padding: 20px;
}

.hero-card small, .stat-card span, .auth-copy p {
  color: var(--muted);
}

.pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 8px rgba(73, 210, 166, 0.14);
}

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

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 142px;
  padding: 18px;
}

.stat-card strong {
  font-size: 38px;
}

.stat-card em {
  color: var(--brand);
  font-style: normal;
  font-weight: 800;
}

.panel {
  margin-top: 16px;
  padding: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.chart {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  height: 280px;
  align-items: end;
  padding-top: 28px;
}

.bar-wrap {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  height: 100%;
  color: var(--muted);
  text-align: center;
}

.bar {
  align-self: end;
  min-height: 12px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--brand));
}

.auth-screen {
  min-height: calc(100vh - 140px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 40px;
  align-items: center;
}

.auth-copy h1 {
  font-size: clamp(46px, 7vw, 78px);
}

.auth-card {
  padding: 24px;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  font: inherit;
}

.flash {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px 14px;
}

.flash.alert { background: rgba(244, 63, 94, 0.18); }
.flash.notice { background: rgba(73, 210, 166, 0.16); }

@media (max-width: 780px) {
  .hero, .auth-screen, .stats-grid {
    grid-template-columns: 1fr;
  }

  .chart {
    gap: 6px;
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.chart-value {
  font-size: 32px;
  color: var(--brand);
}

.segmented {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.segmented button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255,255,255,0.05);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.segmented button.active {
  color: #052017;
  background: var(--brand);
  border-color: transparent;
}

.bar {
  position: relative;
  transition: height 260ms ease;
}

.bar::after {
  content: attr(data-value);
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
  transition: opacity 160ms ease;
}

.bar-wrap:hover .bar::after {
  opacity: 1;
}

.news-panel {
  min-height: 430px;
}

.news-status {
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.news-list {
  display: grid;
  gap: 10px;
}

.news-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.045);
}

.news-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.news-item a {
  display: block;
  color: var(--text);
  font-weight: 750;
  text-decoration: none;
}

.news-item a:hover {
  color: var(--brand);
}

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

.live-hero {
  min-height: 520px;
  align-items: center;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 800;
  text-decoration: none;
}

.primary-link {
  background: var(--brand);
  color: #052017;
}

.secondary-link {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255,255,255,0.06);
}

.command-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
    var(--panel);
  box-shadow: 0 30px 90px rgba(0,0,0,0.35);
}

.command-header,
.signal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.command-header time,
.signal-row span {
  color: var(--muted);
}

.radar {
  position: relative;
  height: 180px;
  margin: 20px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle, rgba(73,210,166,0.18) 0 2px, transparent 3px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  overflow: hidden;
}

.radar::after {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  width: 150px;
  height: 150px;
  transform-origin: 0 0;
  background: linear-gradient(45deg, rgba(73,210,166,0.35), transparent 60%);
  animation: sweep 5s linear infinite;
}

.radar span {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 22px var(--brand);
}

.radar span:nth-child(1) { left: 28%; top: 38%; }
.radar span:nth-child(2) { left: 68%; top: 48%; }
.radar span:nth-child(3) { left: 48%; top: 68%; }

@keyframes sweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.signal-row {
  border-top: 1px solid var(--line);
  padding: 12px 0 0;
  margin-top: 12px;
}

.signal-row strong {
  color: var(--brand);
}

.tone-green { background: linear-gradient(180deg, rgba(73,210,166,0.16), rgba(255,255,255,0.04)); }
.tone-blue { background: linear-gradient(180deg, rgba(110,168,255,0.16), rgba(255,255,255,0.04)); }
.tone-violet { background: linear-gradient(180deg, rgba(171,127,255,0.16), rgba(255,255,255,0.04)); }
.tone-amber { background: linear-gradient(180deg, rgba(244,191,80,0.16), rgba(255,255,255,0.04)); }

.panel-copy {
  margin: 8px 0 0;
  color: var(--muted);
}

.sparkline {
  width: 100%;
  height: 110px;
  margin-top: 18px;
}

.sparkline polyline {
  fill: none;
  stroke: var(--brand);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(73,210,166,0.45));
  transition: all 220ms ease;
}

.ticker {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 16px 0;
  background: rgba(255,255,255,0.05);
}

.ticker div {
  display: inline-flex;
  gap: 28px;
  white-space: nowrap;
  padding: 10px 12px;
  color: var(--muted);
  animation: ticker 28s linear infinite;
}

.ticker span::before {
  content: "•";
  color: var(--brand);
  margin-right: 10px;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.featured-news {
  display: block;
  border: 1px solid rgba(73,210,166,0.28);
  border-radius: 8px;
  padding: 16px;
  text-decoration: none;
  background: linear-gradient(135deg, rgba(73,210,166,0.14), rgba(110,168,255,0.08));
}

.featured-news span,
.timeline-item time,
.timeline-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.featured-news strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.25;
}

.news-list.loading {
  opacity: 0.55;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.55fr);
  gap: 16px;
  margin-top: 16px;
}

.timeline {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.045);
}

.timeline-item strong {
  display: block;
  margin-bottom: 4px;
}

.stack-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.stack-list span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  font-weight: 800;
}

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

  .live-hero {
    min-height: auto;
  }
}
