:root {
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #ffffff;
  --text: #000000;
  --muted: #666666;
  --border: #e5e5e5;
  --grid: #f0f0f0;
  --hover: #f7f7f7;
  --active: #efefef;
  --green: #00c805;
  --red: #ff5000;
  --line-price: #000000;
  --line-inav: #00c805;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #ffffff;
    --muted: #a3a3a3;
    --border: #242424;
    --grid: #151515;
    --hover: #0d0d0d;
    --active: #171717;
    --line-price: #ffffff;
    --line-inav: #00c805;
  }
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
}

button,
table {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(420px, 34vw) 1fr;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
}

.table-pane {
  min-width: 0;
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.table-head,
.chart-header {
  min-height: 72px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: 0;
}

p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.error-line {
  color: var(--red);
  font-size: 12px;
  line-height: 1.4;
}

.table-pane > .error-line {
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}

.etf-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.etf-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg);
}

.etf-table th,
.etf-table td {
  height: 36px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.etf-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.etf-table th:first-child,
.etf-table td:first-child {
  width: 30%;
  text-align: left;
  padding-left: 18px;
}

.etf-table th:nth-child(4),
.etf-table td:nth-child(4) {
  width: 16%;
}

.etf-table tbody {
  display: block;
  height: calc(100vh - 108px);
  overflow-y: auto;
}

.etf-table thead,
.etf-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.etf-table tbody tr {
  cursor: pointer;
}

.etf-table tbody tr:hover {
  background: var(--hover);
}

.etf-table tbody tr.active {
  background: var(--active);
}

.etf-table tbody tr.stale {
  color: var(--muted);
}

.symbol-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: 650;
  letter-spacing: 0;
}

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

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

.chart-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quote-strip {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.quote-strip span:first-child {
  color: var(--text);
  font-weight: 650;
}

.chart-area {
  position: relative;
  flex: 1;
  min-height: 0;
}

.legend {
  position: absolute;
  top: 12px;
  left: 18px;
  z-index: 2;
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 18px;
  height: 2px;
  display: inline-block;
}

.line-price {
  background: var(--line-price);
}

.line-inav {
  background: var(--line-inav);
}

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

.chart-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  color: var(--muted);
  font-size: 13px;
  pointer-events: none;
}

@media (max-width: 900px) {
  html,
  body,
  #root {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-shell {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(320px, 42vh) minmax(520px, 58vh);
  }

  .table-pane {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .etf-table tbody {
    height: calc(42vh - 108px);
  }

  .etf-table {
    font-size: 11px;
  }

  .etf-table th,
  .etf-table td {
    padding: 0 6px;
  }

  .etf-table th:first-child,
  .etf-table td:first-child {
    width: 30%;
    padding-left: 12px;
  }

  .etf-table th:nth-child(2),
  .etf-table td:nth-child(2),
  .etf-table th:nth-child(3),
  .etf-table td:nth-child(3) {
    width: 19%;
  }

  .etf-table th:nth-child(5),
  .etf-table td:nth-child(5) {
    width: 16%;
  }

  .chart-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .quote-strip {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
