:root {
  --bg: #07090c;
  --panel: #0d1218;
  --panel-2: #0f151d;
  --text: #f4f7fb;
  --muted: #99a6b8;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #00c805;
  --accent-soft: rgba(0, 200, 5, 0.2);
  --spy: #53a8ff;
  --danger: #ff6a7a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at 15% 5%, #122132 0%, var(--bg) 45%);
  color: var(--text);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, #000 30%, transparent 90%);
  pointer-events: none;
  opacity: 0.2;
}

.app-shell {
  width: min(1220px, 94vw);
  margin: 32px auto 48px auto;
  position: relative;
  z-index: 2;
}

.panel {
  background: linear-gradient(145deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 20px;
  backdrop-filter: blur(12px);
}

.hero h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.hero-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.hero-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.hero-subtitle {
  margin: 14px 0 12px 0;
  color: var(--muted);
  max-width: 78ch;
  line-height: 1.45;
}

.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px 0;
}

.profile-tab {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #dbe4f2;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.profile-tab:hover {
  border-color: rgba(83, 168, 255, 0.45);
  background: rgba(83, 168, 255, 0.12);
  color: #ecf7ff;
}

.profile-tab.active {
  border-color: rgba(0, 200, 5, 0.58);
  background: rgba(0, 200, 5, 0.18);
  color: #cbffd1;
}

.top-link {
  display: inline-flex;
  margin-bottom: 8px;
  color: #c8e4ff;
  text-decoration: none;
  font-size: 0.86rem;
}

.top-link:hover {
  color: #ebf5ff;
  text-decoration: underline;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  margin: 0 0 8px 0;
}

.generated-at {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.health-pill {
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 6px 10px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.health-loading {
  background: rgba(255, 255, 255, 0.04);
}

.health-healthy {
  border-color: rgba(0, 200, 5, 0.5);
  color: #b7ffc0;
  background: rgba(0, 200, 5, 0.12);
}

.health-warning {
  border-color: rgba(255, 191, 86, 0.6);
  color: #ffe4a8;
  background: rgba(255, 191, 86, 0.12);
}

.health-stale {
  border-color: rgba(255, 106, 122, 0.6);
  color: #ffc6cf;
  background: rgba(255, 106, 122, 0.12);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 12px 0;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(83, 168, 255, 0.45);
  border-radius: 999px;
  padding: 6px 11px;
  color: #cae7ff;
  text-decoration: none;
  font-size: 0.82rem;
  background: rgba(83, 168, 255, 0.12);
}

.pill-link:hover {
  color: #eff8ff;
}

.chip {
  border: 1px solid rgba(0, 200, 5, 0.34);
  background: rgba(0, 200, 5, 0.08);
  color: #ceffd0;
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 6px 11px;
  white-space: nowrap;
}

.summary-grid {
  margin-top: 14px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.changes-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.change-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.02);
}

.change-list {
  list-style: none;
  margin: 8px 0 0 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.change-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  font-size: 0.86rem;
}

.change-empty {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 6px 0 0 0;
}

.change-delta {
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(9, 13, 18, 0.75);
}

.summary-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-value {
  margin: 6px 0 0 0;
  font-size: 1.38rem;
  font-weight: 700;
}

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

.pill {
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
}

.chart {
  width: 100%;
  height: 290px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
}

.line {
  fill: none;
  stroke-width: 3;
}

.line-portfolio {
  stroke: var(--accent);
}

.line-spy {
  stroke: var(--spy);
  stroke-dasharray: 7 5;
}

.chart-trade-marker {
  stroke-width: 1.5;
  stroke-dasharray: 4 5;
  opacity: 0.9;
}

.chart-trade-marker-buy {
  stroke: rgba(0, 200, 5, 0.9);
}

.chart-trade-marker-sell {
  stroke: rgba(255, 106, 122, 0.92);
}

.grid-line {
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 1;
}

.detail-trade-marker {
  stroke-width: 1.4;
  stroke-dasharray: 3 5;
}

.detail-trade-marker-buy {
  stroke: rgba(0, 200, 5, 0.88);
}

.detail-trade-marker-sell {
  stroke: rgba(255, 106, 122, 0.9);
}

.chart-label {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  paint-order: stroke;
  stroke: rgba(7, 9, 12, 0.7);
  stroke-width: 3px;
}

.chart-label-portfolio {
  fill: var(--accent);
}

.chart-label-spy {
  fill: var(--spy);
}

.chart-legend {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend-series {
  font-weight: 600;
}

.legend-portfolio {
  color: var(--accent);
}

.legend-spy {
  color: var(--spy);
}

.legend-sep {
  color: var(--muted);
}

.legend-trade {
  font-weight: 600;
}

.legend-trade-buy {
  color: #8ff5a3;
}

.legend-trade-sell {
  color: #ff8d9d;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.table-wrap.narrow {
  max-height: 430px;
  overflow-y: auto;
}

.orders-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 660px;
  font-size: 0.9rem;
}

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

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

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

tr.flow-row-buy td:first-child {
  box-shadow: inset 3px 0 0 rgba(0, 200, 5, 0.85);
}

tr.flow-row-sell td:first-child {
  box-shadow: inset 3px 0 0 rgba(255, 106, 122, 0.85);
}

tr.flow-row-mixed td:first-child {
  box-shadow: inset 3px 0 0 rgba(186, 124, 255, 0.85);
}

tr.flow-row-none td:first-child {
  box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.18);
}

.symbol-link {
  color: var(--text);
  text-decoration: none;
}

.symbol-link:hover {
  color: #c9ffd8;
  text-decoration: underline;
}

.weight-cell {
  min-width: 180px;
}

.weight-bar-wrap {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  position: relative;
}

.weight-bar {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
}

.weight-label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.ret-pos {
  color: #82f0a4;
}

.ret-neg {
  color: var(--danger);
}

.split-grid {
  margin-top: 14px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 12px;
}

.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

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

.news-item a {
  color: var(--text);
  text-decoration: none;
  line-height: 1.4;
}

.news-item a:hover {
  color: #c2ffd3;
}

.news-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
}

.badge-boost {
  border-color: rgba(0, 200, 5, 0.5);
  color: #c6ffca;
  background: rgba(0, 200, 5, 0.12);
}

.flow-pill,
.delta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.flow-buy {
  border-color: rgba(0, 200, 5, 0.5);
  color: #bcffc5;
  background: rgba(0, 200, 5, 0.14);
}

.flow-sell {
  border-color: rgba(255, 106, 122, 0.55);
  color: #ffc8d0;
  background: rgba(255, 106, 122, 0.14);
}

.flow-mixed {
  border-color: rgba(186, 124, 255, 0.6);
  color: #e7ceff;
  background: rgba(186, 124, 255, 0.16);
}

.flow-none {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.delta-up {
  border-color: rgba(0, 200, 5, 0.5);
  color: #bcffc5;
  background: rgba(0, 200, 5, 0.12);
}

.delta-down {
  border-color: rgba(255, 106, 122, 0.55);
  color: #ffc8d0;
  background: rgba(255, 106, 122, 0.14);
}

.delta-flat {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.delta-new {
  border-color: rgba(83, 168, 255, 0.6);
  color: #c7e6ff;
  background: rgba(83, 168, 255, 0.15);
}

.reveal {
  opacity: 1;
  transform: translateY(0);
  animation: rise 0.6s ease both;
}

.reveal:nth-of-type(2) {
  animation-delay: 0.05s;
}
.reveal:nth-of-type(3) {
  animation-delay: 0.1s;
}
.reveal:nth-of-type(4) {
  animation-delay: 0.16s;
}
.reveal:nth-of-type(5) {
  animation-delay: 0.22s;
}

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

@media (max-width: 960px) {
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .hero-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-meta {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: 95vw;
    margin-top: 16px;
    margin-bottom: 24px;
  }

  .panel {
    padding: 14px;
    border-radius: 14px;
  }

  .hero h1 {
    font-size: clamp(1.35rem, 7vw, 1.85rem);
  }

  .hero-subtitle {
    font-size: 0.92rem;
  }

  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .profile-tab {
    font-size: 0.8rem;
    padding: 7px 10px;
  }

  .quick-links {
    gap: 8px;
  }

  .pill-link {
    width: 100%;
    justify-content: center;
    min-height: 38px;
  }

  .chip {
    font-size: 0.78rem;
    padding: 5px 9px;
  }

  .chart {
    height: 240px;
  }

  .chart-label {
    font-size: 12px;
  }

  table {
    min-width: 600px;
    font-size: 0.84rem;
  }

  th,
  td {
    padding: 9px 10px;
  }

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

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