:root {
  color-scheme: light;
  --bg: #f2ede2;
  --bg-accent: #e4dcc6;
  --panel: rgba(252, 249, 242, 0.88);
  --panel-strong: #fffdf7;
  --ink: #1f2a1f;
  --muted: #687368;
  --line: rgba(31, 42, 31, 0.12);
  --profit: #0b7a53;
  --loss: #b3472f;
  --flat: #7f765d;
  --shadow: 0 18px 40px rgba(66, 53, 24, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(190, 168, 110, 0.22), transparent 32%),
    linear-gradient(180deg, #f7f2e8 0%, #efe6d1 100%);
}

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

.hero,
.panel {
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 28px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--muted);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  font-weight: 700;
}

h1 {
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.98;
  max-width: 10ch;
}

.hero-copy {
  max-width: 56ch;
  color: var(--muted);
  line-height: 1.6;
  margin: 14px 0 0;
}

.top-nav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.top-nav a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.72);
  padding: 10px 14px;
  border-radius: 999px;
}

.top-nav a.is-active {
  background: #1f2a1f;
  color: #fff8ee;
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 240px;
  justify-content: center;
}

.primary-button,
.file-button,
.ghost-button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 14px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.primary-button {
  background: #1f2a1f;
  color: #fff8ee;
}

.file-button {
  background: var(--bg-accent);
  color: var(--ink);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.ghost-button {
  background: rgba(228, 220, 198, 0.4);
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary-button:hover,
.file-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(31, 42, 31, 0.12);
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dashboard {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border-radius: 24px;
  padding: 22px;
}

.summary-panel,
.trades-panel {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

.meta-block,
.chart-caption {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: right;
}

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

.metric-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}

.metric-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.metric-value {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
}

.metric-value.profit {
  color: var(--profit);
}

.metric-value.loss {
  color: var(--loss);
}

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

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

.chart-area {
  min-height: 320px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.3)),
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent 84px,
      rgba(31, 42, 31, 0.045) 84px,
      rgba(31, 42, 31, 0.045) 85px
    );
  border: 1px solid var(--line);
  padding: 14px;
}

.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.chart-svg {
  width: 100%;
  height: 100%;
}

.chart-label {
  fill: var(--muted);
  font-size: 12px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

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

.breakdown-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}

.stat-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.stat-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-strong);
}

.detail-card {
  min-height: 200px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.78);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

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

.kv-grid div {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(228, 220, 198, 0.2);
}

.kv-grid span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.kv-grid strong {
  font-size: 16px;
}

.log-box {
  margin: 0;
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #1f241f;
  color: #edf3e9;
  font-family: "SFMono-Regular", "Menlo", monospace;
  line-height: 1.5;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 14px;
  align-items: start;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 6px;
  background: var(--flat);
}

.timeline-content {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
}

.timeline-title {
  font-weight: 700;
}

.timeline-meta,
.timeline-copy {
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

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

th,
td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

thead th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(228, 220, 198, 0.35);
}

tbody tr:hover {
  background: rgba(228, 220, 198, 0.24);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge.long,
.badge.win {
  background: rgba(11, 122, 83, 0.12);
  color: var(--profit);
}

.badge.short,
.badge.loss {
  background: rgba(179, 71, 47, 0.12);
  color: var(--loss);
}

.badge.open {
  background: rgba(127, 118, 93, 0.14);
  color: var(--flat);
}

.empty-cell {
  text-align: center;
  color: var(--muted);
}

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

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

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 20px;
  }

  .hero,
  .panel-header {
    flex-direction: column;
    align-items: start;
  }

  .hero-actions,
  .meta-block,
  .chart-caption {
    width: 100%;
    text-align: left;
  }

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