:root {
  --bg: #f5f7f2;
  --panel: #ffffff;
  --ink: #1f2523;
  --muted: #66706c;
  --line: #dce2dc;
  --green: #1f8a5b;
  --red: #b04535;
  --gold: #b18424;
  --blue: #315f8d;
  --teal: #1c6f75;
  --shadow: 0 14px 34px rgba(31, 37, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(16px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(14px);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 2.7vw, 2.65rem);
  line-height: 1.02;
  font-weight: 760;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.22;
  font-weight: 720;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.74rem;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.status-strip {
  min-width: 164px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
  white-space: nowrap;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--gold);
}

.dot.green {
  background: var(--green);
}

.dot.red {
  background: var(--red);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: 18px;
  padding: 22px clamp(16px, 4vw, 44px) 44px;
  max-width: 1420px;
  margin: 0 auto;
}

section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(280px, 1.1fr) minmax(340px, 1.2fr);
  gap: 22px;
  align-items: end;
  padding: clamp(20px, 3vw, 30px);
}

.strategy-copy {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 56ch;
}

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

.metric {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.metric strong {
  display: block;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1.1;
}

.chart-panel,
.positions-panel,
.report-panel,
.rules-panel {
  padding: 18px;
}

.chart-panel {
  min-height: 360px;
}

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

.icon-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 720;
  background: #fbfcfa;
}

.timestamp {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.chart {
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(to right, rgba(220, 226, 220, 0.52) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(220, 226, 220, 0.58) 1px, transparent 1px),
    #fbfcfa;
  background-size: 25% 100%, 100% 25%;
  overflow: hidden;
}

.chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.swatch {
  width: 16px;
  height: 4px;
  border-radius: 999px;
  display: inline-block;
}

.swatch.portfolio {
  background: var(--green);
}

.swatch.benchmark {
  background: var(--blue);
}

.positions-panel {
  grid-column: 1 / -1;
}

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

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

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.9rem;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #fbfcfa;
}

tbody tr:last-child td {
  border-bottom: none;
}

.symbol {
  font-weight: 780;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.state {
  display: inline-flex;
  min-width: 92px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.74rem;
  font-weight: 760;
  background: #edf7f2;
  color: var(--green);
}

.state.blocked {
  background: #fff6df;
  color: #90690f;
}

.report-summary {
  display: grid;
  gap: 12px;
}

.report-summary p,
.rules-panel li {
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.94rem;
}

.report-summary strong {
  color: var(--ink);
}

.rules-panel ul {
  margin: 14px 0 0;
  padding-left: 18px;
}

.rules-panel li + li {
  margin-top: 8px;
}

.report-body {
  background: var(--bg);
}

.report-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 30px 16px 60px;
}

.back-link {
  color: var(--blue);
  display: inline-flex;
  margin-bottom: 16px;
  font-weight: 740;
  text-decoration: none;
}

.report-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(18px, 4vw, 34px);
}

.report-card h1 {
  margin-bottom: 18px;
}

.report-card h2 {
  margin-top: 24px;
  margin-bottom: 10px;
}

.report-card table {
  min-width: 0;
  margin-top: 12px;
}

.report-line {
  margin: 7px 0;
  color: var(--muted);
  line-height: 1.5;
}

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

@media (max-width: 980px) {
  .layout,
  .hero-panel {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status-strip {
    width: 100%;
  }

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

  .chart {
    height: 220px;
  }
}
