:root {
  color-scheme: light;
  --bg: #f5f3ef;
  --panel: #ffffff;
  --panel-soft: #f9f7f2;
  --ink: #1f2523;
  --muted: #6d746f;
  --line: #ded8cd;
  --green: #157f62;
  --rose: #bd3e55;
  --amber: #b57219;
  --blue: #315f87;
  --shadow: 0 12px 28px 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;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #6ee7ca;
  box-shadow: 0 0 20px rgba(21, 127, 98, 0.28);
  flex: 0 0 auto;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.market-strip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.market-strip span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.market-strip strong {
  color: var(--green);
}

.market-strip .kimchi {
  color: var(--muted);
}

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

.market-strip .kimchi.negative {
  color: var(--rose);
}

.refresh-time {
  font-variant-numeric: tabular-nums;
}

.sectionbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.tabbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  padding: 5px;
  box-shadow: 0 10px 24px rgba(31, 37, 35, 0.04);
}

.tabbar button {
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: default;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.tabbar button.active {
  background: #d7f6eb;
  color: #163d33;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(22px, 3vw, 32px);
  line-height: 1.05;
}

h2 {
  font-size: 16px;
}

.status-pill,
.collector-status {
  min-width: 190px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf1;
  color: var(--amber);
  padding: 8px 13px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.ok,
.collector-status.ok {
  background: #eef9f2;
  color: var(--green);
}

.status-pill.bad,
.collector-status.bad {
  background: #fff0f1;
  color: var(--rose);
}

.controls {
  display: grid;
  grid-template-columns: 150px 170px minmax(260px, 1fr) 150px 140px;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.controls.shares-mode {
  grid-template-columns: 150px 150px 150px minmax(220px, 1fr) 150px 140px;
}

.controls.read-only {
  grid-template-columns: 150px 170px minmax(260px, 1fr) 150px;
}

.controls.shares-mode.read-only {
  grid-template-columns: 150px 150px 150px minmax(220px, 1fr) 150px;
}

.field,
.check {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field span,
.check span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input[type="number"] {
  height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 12px;
}

[hidden] {
  display: none !important;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.mode-segments {
  height: 42px;
}

.period-segments {
  grid-template-columns: repeat(4, 1fr);
}

.chart-periods {
  width: min(310px, 100%);
  flex: 0 0 auto;
}

.chart-periods .segment {
  min-height: 36px;
}

.segment {
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 12px;
  white-space: normal;
}

.segment + .segment {
  border-left: 1px solid var(--line);
}

.segment.active {
  background: #20352f;
  color: #ffffff;
}

.check {
  min-height: 42px;
  justify-content: end;
  flex-direction: row;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0 12px;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.sizing-readout {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.primary {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
}

.primary:disabled {
  opacity: 0.6;
  cursor: wait;
}

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

.metric,
.market-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 118px;
  padding: 17px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric span,
.metric small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1;
}

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

.metric.negative strong,
.negative {
  color: var(--rose);
}

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

.market-card {
  padding: 28px;
}

.focus-card {
  min-height: 340px;
  display: flex;
  flex-direction: column;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 26px;
}

.card-top h2 {
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mini-chip {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--green);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.funding-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.funding-hero span {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.funding-hero strong {
  font-size: clamp(40px, 6vw, 56px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 0;
}

.funding-hero em {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid #acdcca;
  border-radius: 999px;
  background: #eef9f2;
  color: var(--green);
  padding: 0 9px;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.card-divider {
  border-top: 1px dashed var(--line);
  margin: 26px 0 18px;
}

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

.placeholder-grid dd {
  color: var(--muted);
}

.ticker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  height: 30px;
  border-radius: 999px;
  background: #20352f;
  color: #ffffff;
  font-weight: 800;
  margin-right: 8px;
}

.asset-name {
  color: var(--muted);
  font-size: 13px;
}

dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

dd {
  margin: 5px 0 0;
  font-size: 19px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.panel {
  min-width: 0;
  padding: 16px;
}

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

.funding-head {
  align-items: flex-start;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.chart-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  min-height: 78px;
}

.chart-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.chart-stats strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

canvas {
  width: 100%;
  height: 300px;
  display: block;
  background: var(--panel-soft);
  border: 1px solid #ece6dc;
  border-radius: 8px;
}

.period-summary {
  margin-top: 12px;
  overflow-x: auto;
}

.period-summary table {
  min-width: 0;
}

.period-summary th,
.period-summary td {
  padding: 9px 8px;
}

.period-summary .selected-row {
  background: #eef4ef;
}

.table-panel {
  padding-bottom: 8px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-top: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
}

td {
  font-variant-numeric: tabular-nums;
}

.empty-row td {
  color: var(--muted);
  text-align: center;
  padding: 28px 8px;
}

@media (max-width: 1040px) {
  .controls,
  .metrics,
  .market-grid,
  .charts {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .topbar,
  .sectionbar,
  .panel-head,
  .funding-head {
    align-items: stretch;
    flex-direction: column;
  }

  .controls,
  .metrics,
  .market-grid,
  .charts {
    grid-template-columns: 1fr;
  }

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

  .chart-stats {
    grid-template-columns: 1fr;
  }

  .segment + .segment {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  dl {
    grid-template-columns: 1fr;
  }
}
