:root {
  color-scheme: light;
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-subtle: #f6f8fb;
  --ink: #0b1533;
  --text: #26334f;
  --muted: #5f6c85;
  --line: #d7dfeb;
  --line-strong: #aebbd0;
  --blue: #1555c0;
  --blue-hover: #0d429c;
  --blue-soft: #e9f0fb;
  --green: #3cce00;
  --green-bg: #3cce00;
  --green-bg-strong: #3cce00;
  --red: #d80c0e;
  --red-bg: #d80c0e;
  --red-bg-strong: #d80c0e;
  --amber: #7c5411;
  --amber-bg: #fff3d5;
  --focus: #0b57f0;
  --placeholder: #64718a;
  --warning-text: #56390a;
  --warning-border: #e8cd91;
  --header-bg: rgba(255, 255, 255, 0.98);
  --control-hover-bg: #edf1f6;
  --control-hover-border: #9fb9e4;
  --row-hover: #f5f8fc;
  --tile-hover-border: rgba(11, 21, 51, 0.35);
  --tile-flat: #e8edf3;
  --tile-flat-text: #303d57;
  --tile-gain-text: #07110b;
  --tile-gain-strong-text: #07110b;
  --tile-loss-text: #ffffff;
  --tile-loss-strong-text: #ffffff;
  --key-neutral: #e4e9f0;
  --chart-grid: #dfe6f0;
  --active-shadow: 0 1px 2px rgba(19, 33, 62, 0.08);
  --favorite-active: #8a6117;
  --coin-text: #ffffff;
  --coin-default: #4c5d7e;
  --coin-btc: #b96500;
  --coin-eth: #4a61bd;
  --coin-sol: #286f72;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --z-sticky: 20;
  --z-feedback: 40;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b111d;
  --surface: #111927;
  --surface-subtle: #172235;
  --ink: #f4f7fb;
  --text: #d7deea;
  --muted: #9da9bc;
  --line: #2b3a50;
  --line-strong: #46576f;
  --blue: #8ab4ff;
  --blue-hover: #b6ceff;
  --blue-soft: #18345c;
  --green: #3cce00;
  --green-bg: #3cce00;
  --green-bg-strong: #3cce00;
  --red: #d80c0e;
  --red-bg: #d80c0e;
  --red-bg-strong: #d80c0e;
  --amber: #f0c36b;
  --amber-bg: #3d2c12;
  --focus: #9bc0ff;
  --placeholder: #a8b4c6;
  --warning-text: #f3d08d;
  --warning-border: #6d5320;
  --header-bg: rgba(17, 25, 39, 0.98);
  --control-hover-bg: #202d43;
  --control-hover-border: #5273a6;
  --row-hover: #172235;
  --tile-hover-border: rgba(244, 247, 251, 0.38);
  --tile-flat: #243047;
  --tile-flat-text: #d9e2ef;
  --tile-gain-text: #07110b;
  --tile-gain-strong-text: #07110b;
  --tile-loss-text: #ffffff;
  --tile-loss-strong-text: #ffffff;
  --key-neutral: #344259;
  --chart-grid: #28384f;
  --active-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
  --favorite-active: #f0c36b;
  --coin-text: #ffffff;
  --coin-default: #667898;
  --coin-btc: #c97915;
  --coin-eth: #6f83e6;
  --coin-sol: #32a3a8;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-feedback);
  padding: var(--space-3) var(--space-4);
  color: var(--surface);
  background: var(--ink);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
  transition: transform 180ms var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  width: min(100%, 1600px);
  min-height: 100vh;
  margin-inline: auto;
  background: var(--surface);
  border-inline: 1px solid var(--line);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: grid;
  grid-template-columns: auto minmax(250px, 1fr) minmax(230px, 340px) auto 44px 44px;
  align-items: center;
  gap: var(--space-5);
  min-height: 82px;
  padding: var(--space-3) var(--space-6);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 760;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.data-health {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.data-health > span:last-child {
  min-width: 0;
}

.data-health strong,
.data-health small {
  display: block;
  overflow-wrap: anywhere;
}

.data-health strong {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.data-health small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.refresh-countdown {
  display: grid;
  grid-template-columns: auto minmax(72px, 1fr);
  align-items: center;
  gap: var(--space-2);
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.refresh-countdown-track {
  height: 4px;
  overflow: hidden;
  border-radius: var(--radius-xs);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
}

.refresh-countdown-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--blue);
  transform: scaleX(var(--refresh-scale, 1));
  transform-origin: left center;
  transition: transform 180ms ease-out;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-bg);
}

.data-health[data-status="demo"] .status-dot,
.data-health[data-status="loading"] .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 4px var(--amber-bg);
}

.data-health[data-status="stale"] .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-bg);
}

.search-field {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-2);
  height: 44px;
  padding-inline: var(--space-3);
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.search-field:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--blue-soft);
}

.search-field svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.search-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.9rem;
}

.search-field input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.search-field kbd {
  min-width: 24px;
  padding: 2px 6px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.72rem;
  text-align: center;
}

.icon-button,
.favorite-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: color 160ms var(--ease-out), border-color 160ms var(--ease-out), background 160ms var(--ease-out);
}

.icon-button:hover,
.favorite-button:hover {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: var(--control-hover-border);
}

.theme-toggle .theme-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .theme-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .theme-moon {
  display: none;
}

.icon-button svg,
.favorite-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button.is-refreshing svg {
  animation: rotate 700ms linear infinite;
}

.offline-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  color: var(--warning-text);
  background: var(--amber-bg);
  border-bottom: 1px solid var(--warning-border);
}

.offline-banner div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.offline-banner button,
.empty-state button {
  min-height: 44px;
  padding-inline: var(--space-4);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-weight: 700;
}

main {
  padding: var(--space-6);
}

.section-context {
  margin: 0 0 var(--space-1);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 760;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 2rem;
  font-weight: 760;
  line-height: 1.15;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.panel-heading p,
.section-heading p {
  margin: var(--space-1) 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.segmented-control,
.range-tabs,
.language-switcher {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.segmented-control button,
.range-tabs button,
.language-switcher button {
  min-width: 48px;
  min-height: 44px;
  padding-inline: var(--space-3);
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 700;
}

.segmented-control button:hover,
.range-tabs button:hover,
.language-switcher button:hover {
  color: var(--ink);
  background: var(--control-hover-bg);
}

.segmented-control button.is-active,
.range-tabs button.is-active,
.language-switcher button.is-active {
  color: var(--blue);
  background: var(--surface);
  box-shadow: var(--active-shadow);
}

.language-switcher button {
  min-width: 44px;
  padding-inline: var(--space-2);
}

.rank-menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.rank-menu > span {
  flex: 0 0 auto;
  padding-inline: var(--space-2);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.rank-menu .sort-field {
  flex: 0 0 auto;
}

.rank-menu .segmented-control,
.rank-menu .range-tabs {
  flex: 0 0 auto;
}

.rank-menu .sort-field select {
  min-width: 148px;
}

.rank-menu .rank-field {
  margin-inline-end: 0;
}

.rank-menu .rank-field select {
  min-width: 156px;
}

.rank-menu .rank-field.is-disabled {
  opacity: 0.58;
}

.rank-menu .rank-field.is-disabled select {
  cursor: not-allowed;
}

.rank-menu .order-field {
  margin-inline-start: auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-5);
  align-items: stretch;
}

.workspace.is-loading {
  pointer-events: none;
}

.workspace.is-loading .heatmap,
.workspace.is-loading .insight-panel > * {
  opacity: 0.55;
}

.assets-section.is-loading .table-scroll {
  pointer-events: none;
  opacity: 0.55;
}

.heatmap-panel,
.insight-panel,
.market-summary,
.assets-section {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.heatmap-panel {
  padding: var(--space-5);
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.panel-heading h2,
.section-heading h2 {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 760;
  line-height: 1.3;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.variation-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  color: var(--muted);
  font-size: 0.72rem;
}

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

.variation-key span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: var(--radius-sm);
  background: var(--line-strong);
}

.variation-key .loss::before {
  background: var(--red-bg-strong);
}

.variation-key .neutral::before {
  background: var(--key-neutral);
}

.variation-key .gain::before {
  background: var(--green-bg-strong);
}

.heatmap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 118px;
  gap: var(--space-2);
  margin-top: var(--space-5);
  contain: layout paint;
}

.heatmap.is-dense {
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  grid-auto-rows: 82px;
}

.market-tile {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  color: var(--ink);
  background: var(--tile-flat);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  text-align: start;
  transition: border-color 160ms var(--ease-out), filter 160ms var(--ease-out);
}

.market-tile:hover {
  border-color: var(--tile-hover-border);
  filter: brightness(0.98);
}

.market-tile.is-selected {
  border-color: var(--ink);
}

.market-tile.tile-primary {
  grid-column: span 2;
  grid-row: span 2;
}

.market-tile.tile-secondary {
  grid-row: span 2;
}

.heatmap.is-dense .market-tile.tile-primary,
.heatmap.is-dense .market-tile.tile-secondary {
  grid-column: auto;
  grid-row: auto;
}

.market-tile.gain {
  color: var(--tile-gain-text);
  background: var(--green-bg);
}

.market-tile.gain-strong {
  color: var(--tile-gain-strong-text);
  background: var(--green-bg-strong);
}

.market-tile.loss {
  color: var(--tile-loss-text);
  background: var(--red-bg);
}

.market-tile.loss-strong {
  color: var(--tile-loss-strong-text);
  background: var(--red-bg-strong);
}

.market-tile.flat {
  color: var(--tile-flat-text);
  background: var(--tile-flat);
}

.tile-symbol {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-tile strong {
  font-size: 1.12rem;
  line-height: 1.1;
}

.market-tile.tile-primary .tile-symbol {
  font-size: 1.25rem;
}

.market-tile.tile-primary strong {
  font-size: 2rem;
}

.heatmap.is-dense .market-tile {
  padding: var(--space-3);
}

.heatmap.is-dense .market-tile strong,
.heatmap.is-dense .market-tile.tile-primary strong {
  font-size: 0.92rem;
}

.heatmap.is-dense .market-tile .tile-symbol,
.heatmap.is-dense .market-tile.tile-primary .tile-symbol {
  font-size: 0.76rem;
}

.heatmap-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: var(--space-5);
  color: var(--muted);
  background: var(--surface-subtle);
  border-radius: var(--radius-sm);
  text-align: center;
}

.insight-panel {
  padding: var(--space-5);
}

.insight-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: var(--space-2);
}

.insight-favorite {
  width: 44px;
  height: 44px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-color: var(--line);
  border-radius: var(--radius-sm);
}

.insight-favorite:hover {
  color: var(--favorite-active);
  background: var(--amber-bg);
  border-color: var(--warning-border);
}

.asset-symbol {
  display: inline-grid;
  min-width: 44px;
  height: 32px;
  place-items: center;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 800;
}

.selected-price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-5) var(--space-2);
}

.selected-price strong {
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.trend-chart-shell {
  margin-top: var(--space-4);
  padding-bottom: var(--space-4);
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.trend-chart-shell.is-positive {
  color: var(--green);
}

.trend-chart-shell.is-negative {
  color: var(--red);
}

.trend-chart-shell.is-neutral {
  color: var(--muted);
}

.trend-chart-heading,
.trend-chart-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.trend-chart-heading span,
.trend-chart-scale {
  color: var(--muted);
  font-size: 0.76rem;
}

.trend-chart-heading strong {
  color: currentColor;
  font-size: 0.78rem;
  font-weight: 760;
}

.trend-chart-shell svg {
  width: 100%;
  height: 74px;
  margin-top: var(--space-2);
  overflow: visible;
}

.trend-grid,
.trend-area,
.trend-line {
  vector-effect: non-scaling-stroke;
}

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

.trend-area {
  fill: currentColor;
  opacity: 0.12;
}

.trend-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-end-dot {
  fill: var(--surface);
  stroke: currentColor;
  stroke-width: 3;
}

.trend-chart-scale {
  margin-top: var(--space-1);
}

.trend-chart-scale span:last-child {
  color: currentColor;
  font-weight: 760;
}

.change-positive,
.change-negative,
.change-neutral {
  font-weight: 760;
  white-space: nowrap;
}

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

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

.change-neutral {
  color: var(--muted);
}

.asset-facts {
  margin: 0;
}

.asset-facts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--line);
}

.asset-facts dt,
.asset-facts dd {
  margin: 0;
  font-size: 0.82rem;
}

.asset-facts dt {
  color: var(--muted);
}

.asset-facts dd {
  color: var(--ink);
  font-weight: 700;
  text-align: end;
}

.exchange-markets {
  margin-top: var(--space-3);
  padding-block: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line);
}

.exchange-markets-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  color: var(--muted);
  font-size: 0.76rem;
}

.exchange-markets-heading span {
  font-weight: 700;
}

.exchange-markets-heading small {
  font-size: 0.72rem;
}

.exchange-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.exchange-logo,
.exchange-more {
  position: relative;
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 800;
}

.exchange-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.exchange-logo span {
  position: relative;
  z-index: 0;
}

.exchange-more {
  color: var(--blue);
  background: var(--blue-soft);
}

.exchange-skeleton {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-subtle), var(--surface), var(--surface-subtle));
  background-size: 180% 100%;
  animation: skeleton-sweep 1.2s ease-in-out infinite;
}

@keyframes skeleton-sweep {
  from {
    background-position: 100% 0;
  }

  to {
    background-position: -80% 0;
  }
}

.decision-note {
  margin-top: var(--space-5);
  padding: var(--space-4);
  color: var(--text);
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
}

.decision-note strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.decision-note p,
.method-note {
  margin: var(--space-2) 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.method-note {
  margin-top: var(--space-4);
}

.market-summary,
.assets-section {
  margin-top: var(--space-5);
  padding: var(--space-5);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: var(--space-5) 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.summary-grid > div {
  min-width: 0;
  padding: var(--space-4);
  border-inline-start: 1px solid var(--line);
}

.summary-grid > div:first-child {
  border-inline-start: 0;
}

.summary-grid dt,
.summary-grid dd {
  margin: 0;
}

.summary-grid dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.summary-grid dd {
  margin-top: var(--space-2);
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 760;
}

.summary-grid small {
  display: block;
  margin-top: var(--space-1);
  color: var(--muted);
  font-size: 0.74rem;
}

.summary-grid small.change-positive {
  color: var(--green);
}

.summary-grid small.change-negative {
  color: var(--red);
}

.sentiment-label {
  margin-inline-start: var(--space-2);
  color: var(--amber);
  font-size: 0.76rem;
  font-weight: 700;
}

.assets-heading {
  align-items: flex-end;
}

.sort-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.sort-field select {
  min-height: 44px;
  padding: 0 36px 0 var(--space-3);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
}

.table-scroll {
  margin-top: var(--space-4);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  height: 64px;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--line);
  text-align: end;
  white-space: nowrap;
}

thead th {
  height: 42px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 0.74rem;
  font-weight: 700;
}

th:first-child,
td:first-child {
  width: 52px;
  text-align: center;
}

th:nth-child(2),
td:nth-child(2) {
  width: 74px;
  color: var(--muted);
  text-align: center;
}

th:nth-child(3),
td:nth-child(3) {
  text-align: start;
}

.rank-cell {
  font-size: 0.78rem;
  font-weight: 760;
}

tbody tr {
  transition: background 150ms var(--ease-out);
}

tbody tr:hover,
tbody tr.is-selected {
  background: var(--row-hover);
}

.favorite-button {
  width: 44px;
  height: 44px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.favorite-button[aria-pressed="true"] {
  color: var(--favorite-active);
  background: var(--amber-bg);
}

.favorite-button[aria-pressed="true"] svg {
  fill: currentColor;
}

.asset-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: var(--space-3);
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  text-align: start;
}

.asset-button > span:last-child {
  min-width: 0;
}

.asset-button strong,
.asset-button small {
  display: block;
}

.asset-button strong {
  max-width: 92px;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
}

.asset-button small {
  max-width: 170px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-overflow: ellipsis;
}

.coin-mark {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--coin-text);
  background: var(--coin-default);
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 800;
}

.coin-btc {
  background: var(--coin-btc);
}

.coin-eth {
  background: var(--coin-eth);
}

.coin-sol {
  background: var(--coin-sol);
}

.empty-state {
  display: grid;
  min-height: 300px;
  place-items: center;
  align-content: center;
  gap: var(--space-2);
  padding: var(--space-6);
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  margin-bottom: var(--space-2);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state p {
  margin: 0 0 var(--space-3);
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  color: var(--muted);
  background: var(--surface-subtle);
  border-top: 1px solid var(--line);
  font-size: 0.76rem;
}

.noscript-message {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  left: var(--space-4);
  z-index: var(--z-feedback);
  padding: var(--space-4);
  color: var(--warning-text);
  background: var(--amber-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  text-align: center;
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .app-header {
    grid-template-columns: auto minmax(0, 1fr) auto 44px 44px;
  }

  .search-field {
    grid-column: 1 / -1;
    grid-row: 2;
  }

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

  .insight-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 var(--space-6);
  }

  .insight-panel > .panel-heading,
  .insight-panel > .selected-price,
  .insight-panel > .trend-chart-shell {
    grid-column: 1 / -1;
  }

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

  .summary-grid > div:nth-child(3) {
    border-inline-start: 0;
    border-top: 1px solid var(--line);
  }

  .summary-grid > div:nth-child(4) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-shell {
    border-inline: 0;
  }

  .app-header {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto 44px 44px;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
  }

  .brand {
    font-size: 1.05rem;
  }

  .brand img {
    width: 42px;
    height: 42px;
  }

  .data-health {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .refresh-countdown {
    grid-template-columns: auto minmax(96px, 180px);
    justify-content: start;
  }

  .search-field {
    grid-row: 3;
  }

  .language-switcher {
    justify-self: end;
  }

  main {
    padding: var(--space-4);
  }

  .segmented-control,
  .range-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }

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

  .rank-menu {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "rank order"
      "period view";
    gap: var(--space-2);
  }

  .rank-menu > span {
    padding-inline: var(--space-1);
  }

  .rank-menu .sort-field,
  .rank-menu .segmented-control,
  .rank-menu .range-tabs {
    width: 100%;
  }

  .rank-menu .rank-field {
    grid-area: rank;
  }

  .rank-menu .segmented-control {
    grid-area: view;
  }

  .rank-menu .range-tabs {
    grid-area: period;
  }

  .rank-menu .order-field {
    grid-area: order;
    margin-inline-start: 0;
  }

  .heatmap-panel,
  .insight-panel,
  .market-summary,
  .assets-section {
    padding: var(--space-4);
  }

  .panel-heading {
    display: grid;
  }

  .variation-key {
    justify-content: flex-start;
  }

  .heatmap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 108px;
  }

  .heatmap.is-dense {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 78px;
  }

  .market-tile.tile-primary {
    grid-column: span 2;
    grid-row: span 1;
  }

  .market-tile.tile-secondary {
    grid-row: span 1;
  }

  .market-tile.tile-primary .tile-symbol {
    font-size: 0.9rem;
  }

  .market-tile.tile-primary strong {
    font-size: 1.3rem;
  }

  .insight-panel {
    display: block;
  }

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

  .summary-grid > div {
    border-inline-start: 0;
    border-top: 1px solid var(--line);
  }

  .summary-grid > div:first-child {
    border-top: 0;
  }

  .assets-heading {
    display: grid;
  }

  .sort-field {
    display: grid;
    gap: var(--space-2);
  }

  .sort-field select {
    width: 100%;
  }

  .offline-banner {
    align-items: stretch;
    padding-inline: var(--space-4);
  }

  .offline-banner div {
    display: grid;
  }

  .app-footer {
    display: grid;
    padding-inline: var(--space-4);
  }
}

@media (max-width: 440px) {
  .selected-price strong {
    font-size: 1.45rem;
  }

  .range-tabs button,
  .segmented-control button {
    min-width: 0;
    padding-inline: var(--space-2);
  }

  .rank-menu .range-tabs button {
    padding-inline: var(--space-1);
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .status-dot,
  .variation-key span::before {
    border: 1px solid CanvasText;
  }

  .market-tile.is-selected {
    outline: 3px solid Highlight;
  }
}
