:root {
  color-scheme: dark;
  --bg: #080c10;
  --panel: #111820;
  --panel-2: #151f29;
  --line: #263544;
  --text: #edf4f8;
  --muted: #91a0ae;
  --green: #27c087;
  --red: #ef5f6c;
  --amber: #eec45f;
  --cyan: #59c6dd;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar,
.statusbar {
  border-bottom: 1px solid var(--line);
  background: #0d1319;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 24px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #315061;
  background: #142634;
  color: var(--cyan);
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
}

.brand p,
.panel-heading p,
.statusbar,
.summary-card span,
.coin-stats span,
.eyebrow,
td span {
  color: var(--muted);
}

.top-controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.search-wrap,
.select-wrap {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

input,
select,
.icon-button {
  height: 38px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}

input,
select {
  min-width: 180px;
  padding: 0 11px;
}

.icon-button {
  width: 38px;
  display: grid;
  place-items: center;
  font-size: 20px;
  cursor: pointer;
}

.main {
  padding: 18px 24px;
  min-width: 0;
}

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

.summary-card,
.market-panel,
.detail-panel,
.dataset-strip {
  border: 1px solid var(--line);
  background: var(--panel);
}

.summary-card {
  padding: 14px;
}

.summary-card span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.dataset-strip {
  margin-bottom: 10px;
  overflow: hidden;
}

.dataset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dataset-head h2 {
  font-size: 16px;
}

.dataset-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.dataset-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.dataset-stats div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  background: #0f171f;
}

.dataset-stats div:last-child {
  border-right: 0;
}

.dataset-stats span,
.dataset-stats strong {
  display: block;
  overflow-wrap: anywhere;
}

.dataset-stats span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.dataset-stats strong {
  margin-top: 6px;
  font-size: 16px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(460px, 0.9fr);
  gap: 10px;
  min-height: 650px;
}

.market-panel,
.detail-panel {
  min-width: 0;
  overflow: hidden;
}

.panel-heading,
.coin-head,
.chart-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.panel-heading {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2,
.coin-head h2 {
  font-size: 18px;
}

.panel-heading p {
  margin-top: 4px;
  font-size: 13px;
}

.status-pill {
  border: 1px solid var(--line);
  padding: 6px 10px;
  white-space: nowrap;
  font-size: 12px;
}

.status-pill.ok {
  color: var(--green);
  border-color: #245d47;
  background: #10271f;
}

.status-pill.warn {
  color: var(--amber);
  border-color: #5e4f25;
  background: #271f10;
}

.status-pill.danger {
  color: var(--red);
  border-color: #62323a;
  background: #281419;
}

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

.table-wrap {
  overflow: auto;
  max-height: 590px;
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #101720;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: var(--panel-2);
}

td strong {
  display: block;
}

td span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

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

.detail-panel {
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto auto minmax(360px, 1fr);
  gap: 14px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.coin-price {
  text-align: right;
}

.coin-price strong {
  display: block;
  font-size: 26px;
}

.change {
  display: inline-block;
  margin-top: 5px;
  font-weight: 700;
}

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

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

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

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

.coin-stats div {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 10px;
  min-width: 0;
}

.coin-stats span,
.coin-stats strong {
  display: block;
  overflow-wrap: anywhere;
}

.coin-stats span {
  font-size: 12px;
}

.coin-stats strong {
  margin-top: 6px;
}

.intervals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.intervals button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  padding: 6px 10px;
  cursor: pointer;
}

.intervals button.active,
.intervals button:hover {
  color: var(--text);
  border-color: #37616f;
  background: #15303b;
}

.status-text {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.chart {
  min-height: 360px;
  height: 100%;
  border: 1px solid var(--line);
  background: #0b1117;
}

.statusbar {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
}

@media (max-width: 1160px) {
  .workspace,
  .summary-grid,
  .dataset-stats {
    grid-template-columns: 1fr;
  }

  .workspace {
    min-height: auto;
  }

  .dataset-stats div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dataset-stats div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 720px) {
  .topbar,
  .top-controls,
  .statusbar,
  .coin-head,
  .chart-toolbar,
  .dataset-head {
    display: grid;
    align-items: stretch;
  }

  .topbar,
  .main {
    padding: 14px;
  }

  input,
  select {
    width: 100%;
    min-width: 0;
  }

  .coin-price {
    text-align: left;
  }

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

  .chart {
    min-height: 320px;
  }
}
