:root {
  --ink: #111111;
  --paper: #f7f2e8;
  --panel: #fffdf8;
  --muted: #676158;
  --line: #111111;
  --yellow: #ffd84d;
  --green: #91ef6b;
  --blue: #8ac7ff;
  --coral: #ff7d59;
  --violet: #b8a7ff;
  --shadow: 7px 7px 0 #111111;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(17, 17, 17, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(17, 17, 17, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 6px;
  background: var(--yellow);
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.caption,
.metric-label,
dt,
.eyebrow {
  color: var(--muted);
}

.view-tabs,
.segmented,
.period-switch {
  display: inline-flex;
  padding: 4px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ece4d6;
}

.tab,
.segmented button,
.period-switch button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
}

.tab.is-active,
.segmented button.is-active,
.period-switch button.is-active {
  border: 2px solid var(--line);
  background: var(--green);
}

.account-box {
  justify-self: end;
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: var(--blue);
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

main {
  margin-top: 34px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(2.3rem, 5vw, 5rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.1rem;
  line-height: 1.15;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-strip span,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 9px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.86rem;
  font-weight: 800;
}

.pill {
  min-height: 28px;
  background: #ece4d6;
}

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

.pill.yellow {
  background: var(--yellow);
}

.pill.blue {
  background: var(--blue);
}

.primary-grid,
.market-grid,
.portfolio-grid {
  display: grid;
  gap: 18px;
}

.primary-grid {
  grid-template-columns: minmax(260px, 0.9fr) minmax(420px, 1.8fr);
}

.market-grid {
  grid-template-columns: minmax(280px, 340px) 1fr;
}

.portfolio-grid {
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.5fr) minmax(260px, 0.8fr);
}

.auction-panel,
.listings-panel,
.performance-panel,
.holdings-panel {
  grid-row: span 2;
}

.panel {
  border: 3px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-title-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.body-copy,
.caption {
  line-height: 1.45;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.fact-grid.compact {
  margin-bottom: 0;
}

.fact-grid div,
.stacked-stats div,
.rule-card {
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: #fff7d6;
}

dt {
  margin-bottom: 4px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 900;
}

.document-stack,
.stacked-stats,
.feed-list,
.insight-list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

.link-button {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--blue);
  font-weight: 900;
  text-align: left;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  border: 3px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--line);
  font-weight: 900;
}

.button:hover,
.link-button:hover,
thead button:hover {
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 0 var(--line);
}

.button.small {
  min-height: 32px;
  padding: 0 10px;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--line);
}

.button.secondary {
  background: var(--green);
}

.button.ghost {
  background: var(--panel);
}

.auction-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.auction-metrics > div {
  min-height: 114px;
  padding: 14px;
  border: 3px solid var(--line);
  border-radius: 7px;
  background: #f3f0ff;
}

.auction-metrics strong {
  display: block;
  margin: 7px 0 3px;
  font-size: clamp(1.35rem, 2vw, 2.3rem);
}

.auction-metrics small {
  color: var(--muted);
  font-weight: 800;
}

.curve-wrap {
  position: relative;
  margin: 16px 0;
  padding: 12px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: #dff4ff;
}

.chart-head,
.change-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-weight: 900;
}

.auction-chart,
.portfolio-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.auction-chart text,
.portfolio-chart text {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.chart-grid {
  stroke: rgba(17, 17, 17, 0.18);
  stroke-width: 1;
}

.curve-line,
.portfolio-line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.jump-line {
  stroke: var(--coral);
  stroke-width: 4;
}

.hover-zone {
  fill: transparent;
  cursor: crosshair;
}

.hover-tip {
  position: fixed;
  z-index: 40;
  max-width: 230px;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--line);
  font-size: 0.86rem;
  font-weight: 800;
  pointer-events: none;
}

.bid-strip,
.toolbar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 850;
}

.feed-list li,
.insight-list li {
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: #e8ffd7;
  line-height: 1.35;
}

.feed-list strong,
.insight-list strong {
  display: block;
}

.filter-panel {
  align-self: start;
}

.filter-panel label,
.deposit-panel label {
  margin-bottom: 12px;
}

hr {
  margin: 20px 0;
  border: 0;
  border-top: 3px solid var(--line);
}

.rule-card {
  margin-top: 12px;
  line-height: 1.35;
  font-weight: 800;
}

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

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  padding: 12px;
  border-bottom: 2px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--yellow);
  font-size: 0.76rem;
  text-transform: uppercase;
}

thead button {
  border: 0;
  background: transparent;
  font-weight: 950;
  text-align: left;
}

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

tbody tr:nth-child(even) {
  background: #f7fbff;
}

td strong {
  display: block;
}

td small {
  color: var(--muted);
  font-weight: 800;
}

.mini-action {
  min-height: 34px;
  padding: 0 10px;
  border: 2px solid var(--line);
  border-radius: 6px;
  background: var(--green);
  font-weight: 900;
}

.deposit-panel {
  align-self: start;
}

.performance-panel {
  min-height: 454px;
}

.performance-panel #portfolioValue {
  font-size: clamp(1.6rem, 3vw, 3rem);
}

.period-switch {
  margin: 10px 0 14px;
}

.change-line {
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: #e8ffd7;
}

.small-table table {
  min-width: 650px;
}

.info {
  position: relative;
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--yellow);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  text-transform: none;
}

.info:hover::after,
.info:focus::after {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 60;
  width: min(260px, 80vw);
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 7px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 4px 4px 0 var(--yellow);
  content: attr(data-tip);
  font-size: 0.78rem;
  line-height: 1.35;
  text-transform: none;
  transform: translateX(-50%);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--green);
  box-shadow: var(--shadow);
  font-weight: 900;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .topbar,
  .primary-grid,
  .market-grid,
  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .account-box,
  .view-tabs {
    justify-self: stretch;
  }

  .view-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .section-head {
    display: grid;
  }

  .status-strip {
    justify-content: flex-start;
  }

  .auction-panel,
  .listings-panel,
  .performance-panel,
  .holdings-panel {
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 18px, 1480px);
    padding-top: 9px;
  }

  .topbar {
    top: 8px;
    box-shadow: 4px 4px 0 var(--line);
  }

  h1 {
    font-size: 2.25rem;
  }

  .auction-metrics,
  .fact-grid,
  .bid-strip,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .status-strip span {
    width: 100%;
    justify-content: space-between;
  }

  .panel {
    padding: 14px;
    box-shadow: 4px 4px 0 var(--line);
  }

  .panel-title-row {
    display: grid;
  }

  .tab {
    padding: 0 8px;
  }
}
