:root {
  color-scheme: light;
  --field: #f7f9f4;
  --paper: #ffffff;
  --ink: #17201b;
  --muted: #64736a;
  --line: #d9e3da;
  --green: #196c5e;
  --red: #b43b44;
  --blue: #2f5eaa;
  --brass: #b96d2b;
  --shadow: 0 20px 50px rgba(35, 48, 40, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(25, 108, 94, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(25, 108, 94, 0.08) 1px, transparent 1px),
    var(--field);
  background-size: 34px 34px;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.panel-button,
.holding-row,
.group-header,
.allocation-segment {
  appearance: none;
  color: inherit;
  font: inherit;
  text-align: left;
}

.app-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.hero {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.topline,
.hero-grid,
.access-row,
.holding-row,
.group-header,
.holding-metrics,
.mini-stat-row {
  display: flex;
  align-items: center;
}

.topline {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.metric-label,
.update-line,
.holding-ticker,
.holding-sub,
.mini-label,
.schedule-line {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 6vw, 5rem);
  line-height: 0.92;
  font-weight: 700;
}

.icon-button {
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
}

.icon-button:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 94, 170, 0.32);
  outline-offset: 2px;
}

.hero-grid {
  align-items: stretch;
  gap: 14px;
  margin-top: 28px;
}

.total-panel,
.stake-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.panel-button:hover,
.holding-row:hover,
.group-header:hover,
.panel-button:focus-visible,
.holding-row:focus-visible,
.group-header:focus-visible {
  border-color: rgba(25, 108, 94, 0.48);
}

.total-panel {
  flex: 1.7;
}

.stake-panel {
  flex: 1;
}

.metric-label {
  margin: 0 0 8px;
  font-size: 0.86rem;
}

.total-value {
  margin: 0;
  font-size: clamp(2.4rem, 10vw, 5.8rem);
  line-height: 0.96;
  font-weight: 850;
}

.stake-value {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 1;
  font-weight: 800;
}

.profit-line,
.update-line {
  margin: 10px 0 0;
}

.profit-line {
  font-size: 1.1rem;
  font-weight: 800;
}

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

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

.allocation-strip {
  display: flex;
  width: 100%;
  height: 22px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--line);
}

.allocation-segment {
  min-width: 3px;
  height: 100%;
  padding: 0;
  border: 0;
}

.access-panel,
.status-panel,
.trend-panel,
.group {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.access-panel,
.status-panel {
  padding: 16px;
}

.trend-panel {
  padding: 16px;
}

.access-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
}

.access-row {
  gap: 8px;
}

.access-row input {
  min-width: 0;
  flex: 1;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.access-row button,
.secondary-button {
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: var(--paper);
  font-weight: 800;
}

.hidden {
  display: none;
}

.group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.group {
  overflow: hidden;
}

.group-header {
  width: 100%;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.group-title {
  display: block;
  margin: 0;
  font-size: 1.2rem;
  font-weight: 850;
}

.group-total {
  display: block;
  margin: 0;
  text-align: right;
  font-weight: 850;
}

.holding-list {
  display: grid;
}

.holding-row {
  width: 100%;
  gap: 12px;
  min-height: 84px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.holding-row:last-child {
  border-bottom: 0;
}

.swatch {
  flex: 0 0 10px;
  width: 10px;
  height: 46px;
  border-radius: 999px;
}

.holding-main {
  min-width: 0;
  flex: 1;
}

.holding-name {
  display: block;
  margin: 0;
  overflow: hidden;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-sub {
  display: block;
  margin: 4px 0 0;
  font-size: 0.86rem;
}

.holding-metrics {
  justify-content: flex-end;
  gap: 16px;
  min-width: 178px;
  text-align: right;
}

.mini-stat {
  min-width: 72px;
}

.mini-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.74rem;
}

.mini-value {
  display: block;
  font-weight: 850;
}

.schedule-line {
  margin: 16px 0 0;
  font-size: 0.86rem;
}

.selected {
  background: rgba(25, 108, 94, 0.08);
}

.trend-header,
.trend-stats {
  display: flex;
  align-items: center;
}

.trend-header {
  justify-content: space-between;
  gap: 16px;
}

.trend-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1;
}

.trend-return {
  margin: 0;
  text-align: right;
  font-size: 1.2rem;
  font-weight: 850;
}

.trend-chart-wrap {
  min-height: 220px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf9;
}

.trend-chart {
  display: block;
  width: 100%;
  height: 220px;
}

.chart-grid {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.chart-area {
  opacity: 0.14;
}

.positive-area {
  fill: var(--green);
}

.negative-area {
  fill: var(--red);
}

.chart-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.positive-line {
  stroke: var(--green);
}

.negative-line {
  stroke: var(--red);
}

.chart-dot {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2;
}

.chart-empty {
  fill: var(--muted);
  font-size: 18px;
  font-weight: 750;
}

.trend-stats {
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 12px;
}

.trend-stats span {
  display: block;
}

.trend-stats strong {
  display: block;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 520px);
    padding-top: 10px;
  }

  .hero {
    padding: 16px;
  }

  .hero-grid,
  .group-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .holding-row {
    align-items: flex-start;
  }

  .trend-header {
    align-items: flex-start;
  }

  .trend-return {
    min-width: 92px;
    font-size: 1rem;
  }

  .holding-metrics {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 96px;
  }

  .holding-name {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .group,
  .hero {
    animation: settle 360ms ease both;
  }

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