:root {
  --bg: #f2efe8;
  --ink: #1f2530;
  --muted: #56606f;
  --panel: rgba(255, 255, 255, 0.86);
  --line: rgba(20, 32, 48, 0.14);
  --teal: #0f7f7c;
  --orange: #cf6330;
  --blue: #315f9c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Manrope, sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    radial-gradient(circle at 0% 0%, #f4c58d 0, transparent 30%),
    radial-gradient(circle at 100% 20%, #8bc2c0 0, transparent 28%),
    linear-gradient(160deg, #f8f2e7, #d4e2ea);
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.2rem 1rem 2.4rem;
}

.hero {
  border-radius: 18px;
  background: linear-gradient(120deg, #1c2d46, #245f7a);
  color: #f5f8fb;
  padding: 1.2rem;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.top-nav {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.top-nav a {
  color: #d9e7f5;
  text-decoration: none;
  border: 1px solid rgba(212, 229, 245, 0.4);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
}

.top-nav a:hover,
.top-nav a[aria-current="page"] {
  color: #17314f;
  background: #deecfa;
}

.label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.78rem;
  color: #a7c1d9;
}

h1 { margin: 0.25rem 0; }
#meta { margin: 0; color: #d2dfeb; }

.hero-controls {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.65rem;
  align-items: end;
  flex-wrap: wrap;
}

.hero-controls label {
  display: grid;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: #c3d8eb;
}

.hero-controls input,
.hero-controls select {
  border: 1px solid rgba(201, 220, 238, 0.5);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.12);
  color: #f2f8fe;
  padding: 0.35rem 0.5rem;
  min-width: 116px;
  font-family: "JetBrains Mono", monospace;
}

.helper {
  margin-top: 0.9rem;
}

.helper h2 {
  margin: 0;
}

.helper p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-controls button {
  border: 1px solid rgba(201, 220, 238, 0.58);
  border-radius: 10px;
  color: #f2f8fe;
  background: rgba(222, 236, 250, 0.2);
  padding: 0.42rem 0.72rem;
  cursor: pointer;
}

.hero-controls button:hover {
  background: rgba(222, 236, 250, 0.34);
}

.status-message {
  margin: 0.55rem 0 0;
  min-height: 1.1rem;
  font-size: 0.84rem;
  color: #d7e8f8;
}

.status-message.error {
  color: #ffd9d2;
}

.cards {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card,
.panel {
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 0.9rem;
}

.card h3 {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.83rem;
  color: var(--muted);
}

.big {
  margin-top: 0.4rem;
  font-size: 1.9rem;
  font-weight: 800;
}

.sub {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 1fr 1fr;
}

.panel h2 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
}

.timeline,
.trend,
.position {
  display: grid;
  gap: 0.5rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 0.5rem;
}

.timeline-week {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
  color: var(--blue);
}

.timeline-content {
  font-size: 0.9rem;
  color: var(--ink);
}

.trend-row {
  display: grid;
  grid-template-columns: minmax(0, 90px) minmax(0, 1fr) 72px;
  gap: 0.5rem;
  align-items: center;
}

.trend-label,
.trend-value,
.position-label,
.position-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  min-width: 0;
}

.trend-label {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.trend-track {
  height: 10px;
  border-radius: 999px;
  background: #dbe3eb;
  overflow: hidden;
}

.trend-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal), #57b7a9);
}

.position-row {
  display: grid;
  grid-template-columns: 1fr auto;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
}

.position-value.positive { color: var(--teal); }
.position-value.negative { color: var(--orange); }

@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .trend-row { grid-template-columns: 82px 1fr 64px; }
  .hero-controls button { width: 100%; }
}
