:root {
  --bg: #07111e;
  --panel: #0c1a2b;
  --panel-2: #102238;
  --panel-3: #0b2037;
  --border: rgba(122, 161, 205, 0.18);
  --text: #e8f2ff;
  --muted: #8ca6c6;
  --up: #16d78a;
  --down: #ff5c7c;
  --neutral: #9db4cf;
  --accent: #54a6ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(62, 127, 255, 0.18), transparent 26%),
    radial-gradient(circle at top left, rgba(44, 197, 159, 0.14), transparent 24%),
    linear-gradient(180deg, #091320 0%, #050c15 100%);
  color: var(--text);
}
body { overflow: auto; }
body.modal-open { overflow: auto; }
button, input { font: inherit; }
button { border: 0; }
[hidden] { display: none !important; }

.app-shell {
  width: 100vw;
  min-height: 100vh;
  height: auto;
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.topbar {
  min-height: 84px;
  background: linear-gradient(180deg, rgba(13, 29, 49, 0.96), rgba(9, 20, 35, 0.96));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
}
.topbar__left, .topbar__right { display: flex; align-items: center; gap: 14px; }
.logo-badge {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-badge img { width: 100%; height: 100%; object-fit: cover; }

.news-strip {
  min-width: 0;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(12, 28, 47, 0.88);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}
.news-strip:hover { border-color: rgba(84, 166, 255, 0.4); }
.news-strip__label {
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #9cc4ff;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.news-strip__viewport { min-width: 0; overflow: hidden; position: relative; }
.news-strip__track {
  display: inline-block;
  white-space: nowrap;
  will-change: transform;
  padding-left: 100%;
  animation: ticker 40s linear infinite;
  color: #eef6ff;
  font-size: 13px;
}

.status-box, .clock-box {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(12, 28, 47, 0.82);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 12px rgba(22, 215, 138, 0.9);
  animation: pulse-live 1.4s infinite;
}

.main-layout {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 10px;
  overflow: visible;
  align-content: start;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(12, 28, 47, 0.7);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px 14px;
}
.board-toolbar__left, .board-toolbar__right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.board-toolbar__left span { color: var(--muted); font-size: 12px; }
.legend {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
}
.legend.up { color: var(--up); }
.legend.down { color: var(--down); }
.legend.neutral { color: var(--neutral); }

.period-switcher,
.view-switcher,
.chart-mode-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(8, 18, 31, 0.9);
  border: 1px solid var(--border);
}
.period-btn,
.view-btn,
.chart-mode-btn,
.modal-utility-btn,
.card-open-btn {
  min-width: 48px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: .2s ease;
}
.period-btn.is-active,
.view-btn.is-active,
.chart-mode-btn.is-active,
.modal-utility-btn:hover,
.card-open-btn:hover {
  background: rgba(84, 166, 255, 0.18);
  border-color: rgba(84, 166, 255, 0.3);
  color: #eef6ff;
}
.view-switcher .view-btn { min-width: 92px; }
.chart-mode-btn { min-width: 74px; }
.modal-utility-btn { min-width: 118px; }

.market-overview {
  min-height: 0;
  display: grid;
  grid-template-columns: 1.05fr 1.15fr 1fr;
  gap: 10px;
}
.overview-card,
.heatmap-section,
.view-panel,
.table-shell {
  background: linear-gradient(180deg, rgba(14, 28, 46, 0.98), rgba(9, 19, 32, 0.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.overview-card {
  padding: 18px;
  min-height: 170px;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h3 {
  margin: 0;
  font-size: 17px;
}
.section-head span {
  color: var(--muted);
  font-size: 12px;
}
.market-now__pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 0 rgba(22, 215, 138, 0.55);
  animation: pulse-live 1.6s infinite;
}
.market-now__value {
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}
.market-now__value.up { color: var(--up); }
.market-now__value.down { color: var(--down); }
.market-now__sub { color: var(--muted); margin-top: 6px; font-size: 13px; }
.market-now__grid,
.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.mini-metric,
.compare-metric {
  min-height: 76px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
.mini-metric span,
.compare-metric span {
  color: var(--muted);
  font-size: 12px;
}
.mini-metric strong,
.compare-metric strong {
  font-size: 22px;
  letter-spacing: -0.03em;
}
.compare-metric.up strong { color: var(--up); }
.compare-metric.down strong { color: var(--down); }

.leaders-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.leaders-subtitle {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.leaders-subtitle.up { color: var(--up); }
.leaders-subtitle.down { color: var(--down); }
.leader-row {
  width: 100%;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
}
.leader-row:hover { border-color: rgba(84, 166, 255, 0.36); }
.leader-row.up .leader-row__value { color: var(--up); }
.leader-row.down .leader-row__value { color: var(--down); }
.leader-row__name { color: #edf6ff; }
.leader-row__value { font-weight: 700; }

.heatmap-section {
  min-height: 180px;
  padding: 18px;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}
.heatmap-tile {
  position: relative;
  min-height: 104px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(8, 22, 38, 0.96), rgba(8, 18, 31, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  text-align: left;
}
.heatmap-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--heat);
  opacity: 1;
  pointer-events: none;
}
.heatmap-tile > * { position: relative; z-index: 1; }
.heatmap-tile strong {
  font-size: 24px;
  letter-spacing: -0.03em;
}
.heatmap-tile.up strong { color: #d9ffef; }
.heatmap-tile.down strong { color: #ffe0e7; }
.heatmap-tile__top { font-size: 12px; color: #b8d4f8; text-transform: uppercase; }
.heatmap-tile__name { font-size: 13px; color: #eef6ff; }
.heatmap-tile__meta { font-size: 11px; color: #d6e6ff; opacity: 0.85; }

.view-panel {
  min-height: 0;
  padding: 14px;
  overflow: visible;
}

.metals-grid {
  min-height: 0;
  height: auto;
  overflow: visible;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
  align-content: start;
  padding-right: 4px;
}

.metal-card {
  position: relative;
  background: linear-gradient(180deg, rgba(14, 28, 46, 0.98), rgba(9, 19, 32, 0.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px 14px 12px;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto 146px auto auto auto;
  gap: 10px;
  min-height: 340px;
  cursor: grab;
}
.metal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent 22%);
  pointer-events: none;
}
.metal-card.dragging { opacity: 0.45; transform: scale(0.98); }
.metal-card.drag-over { outline: 2px dashed rgba(84, 166, 255, 0.58); outline-offset: -6px; }
.metal-card.updating-up { animation: flash-up 0.7s ease; }
.metal-card.updating-down { animation: flash-down 0.7s ease; }

.metal-card__header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metal-card__symbol {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: #d7ebff;
  background: rgba(84, 166, 255, 0.08);
  flex: 0 0 auto;
}
.metal-card__title { min-width: 0; flex: 1; }
.metal-card__title h3 { margin: 0; font-size: 16px; }
.metal-card__title p {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.atomic-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  color: #b9d4f8;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
}

.metal-card__price-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.price-side { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.price-value {
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.price-currency { color: var(--muted); font-size: 13px; }
.trend-badge {
  min-width: 84px;
  padding: 9px 12px;
  text-align: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.trend-badge.up { color: var(--up); }
.trend-badge.down { color: var(--down); }
.trend-badge.flat { color: var(--neutral); }

.chart-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.05);
}
.chart-wrap canvas { display: block; width: 100%; height: 146px; }

.metal-card__signals {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.signal-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.signal-up { color: var(--up); background: rgba(22,215,138,0.10); }
.signal-down { color: var(--down); background: rgba(255,92,124,0.10); }
.signal-soft { color: #c8dbf4; }
.signal-medium { color: #90c6ff; background: rgba(84,166,255,0.10); }
.signal-strong { color: #ffe88d; background: rgba(255,211,71,0.10); }

.metal-card__footer {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.metric-box {
  min-height: 58px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.metric-box__label { font-size: 11px; color: var(--muted); }
.metric-box__value { font-size: 14px; font-weight: 700; }

.metal-card__source {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  color: var(--muted);
}
.metal-card__source a {
  color: #8fc0ff;
  text-decoration: none;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metal-card__source a:hover { text-decoration: underline; }
.fetch-state {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
}
.fetch-state.ok { color: var(--up); }
.fetch-state.wait { color: var(--neutral); }
.fetch-state.err { color: var(--down); }

.metal-card__actions { display: flex; justify-content: flex-end; }
.card-open-btn {
  min-width: 140px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(84, 166, 255, 0.22);
  color: #dfeeff;
}

.table-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.search-chip {
  min-width: 320px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  padding: 0 16px;
}
.search-chip input {
  width: 100%;
  height: 42px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
}
.table-shell {
  min-height: calc(100% - 54px);
  overflow: auto;
}
.metals-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}
.metals-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0d2136;
  color: #b2c9e7;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.metals-table tbody tr {
  cursor: pointer;
  transition: background .18s ease;
}
.metals-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.metals-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: middle;
}
.table-metal {
  display: flex;
  align-items: center;
  gap: 12px;
}
.table-metal__symbol {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(84, 166, 255, 0.10);
  border: 1px solid rgba(255,255,255,0.08);
  font-weight: 800;
}
.table-metal strong { display: block; }
.table-metal span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.table-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  font-weight: 700;
}
.table-pill.up { color: var(--up); }
.table-pill.down { color: var(--down); }
.table-pill.neutral, .table-pill.soft { color: var(--neutral); }
.table-pill.medium { color: #90c6ff; }
.table-pill.strong { color: #ffe88d; }

.price-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
}
.price-modal[hidden] { display: none; }
.price-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 10, 18, 0.72);
  backdrop-filter: blur(7px);
}
.price-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1280px, calc(100vw - 26px));
  max-height: calc(100vh - 26px);
  overflow-y: auto;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid rgba(122, 161, 205, 0.22);
  background: linear-gradient(180deg, rgba(6, 19, 40, 0.98), rgba(4, 14, 28, 0.98));
  box-shadow: 0 40px 80px rgba(0, 0, 0, 0.52);
}
.price-modal.is-fullscreen .price-modal__dialog {
  width: calc(100vw - 18px);
  max-height: calc(100vh - 18px);
  height: calc(100vh - 18px);
}
.price-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  color: #dbe8f6;
  font-size: 28px;
  cursor: pointer;
}
.price-modal__head,
.price-modal__summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.price-modal__head h2 {
  margin: 4px 0 0;
  font-size: 34px;
  letter-spacing: -0.04em;
}
.price-modal__head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.price-modal__eyebrow {
  color: #9cc4ff;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
.price-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.modal-inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.modal-source-link {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  color: #dfeeff;
  border: 1px solid rgba(84, 166, 255, 0.22);
  background: rgba(255,255,255,0.02);
}
.modal-source-link:hover { background: rgba(84, 166, 255, 0.12); }

.price-modal__summary {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.price-modal__pricebox {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.price-modal__price {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.05em;
}
.price-modal__unit { color: var(--muted); font-size: 22px; }
.price-modal__summary-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.price-modal__delta,
.price-modal__compare {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: rgba(255,255,255,0.03);
}
.price-modal__delta { font-size: 24px; }
.price-modal__compare { font-size: 13px; color: var(--muted); }
.price-modal__delta.up, .price-modal__compare.up { color: var(--up); }
.price-modal__delta.down, .price-modal__compare.down { color: var(--down); }
.price-modal__delta.neutral, .price-modal__compare.neutral { color: var(--neutral); }

.price-modal__chart {
  position: relative;
  margin-top: 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  padding: 12px;
}
.price-modal__body {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}
.price-modal__visual { min-width: 0; }
.price-modal__insights {
  min-width: 0;
  display: grid;
  gap: 12px;
}
.insight-panel {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.025);
}
.insight-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.insight-panel__head h4 {
  margin: 0;
  font-size: 15px;
}
.insight-panel__head span {
  color: var(--muted);
  font-size: 11px;
}
.insight-summary {
  margin: 0;
  color: #dfeeff;
  font-size: 14px;
  line-height: 1.6;
}
.factor-feed {
  display: grid;
  gap: 10px;
}
.factor-chip {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
.factor-chip strong {
  display: block;
  font-size: 13px;
}
.factor-chip span {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: #c8daef;
}
.factor-chip.up { border-color: rgba(22,215,138,0.22); background: rgba(22,215,138,0.08); }
.factor-chip.down { border-color: rgba(255,92,124,0.22); background: rgba(255,92,124,0.08); }
.factor-chip.neutral { border-color: rgba(122,161,205,0.18); background: rgba(255,255,255,0.02); }
.news-cards {
  display: grid;
  gap: 10px;
}
.news-card {
  display: block;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  text-decoration: none;
  color: inherit;
  transition: .2s ease;
}
.news-card:hover {
  border-color: rgba(84,166,255,0.3);
  background: rgba(84,166,255,0.08);
}
.news-card strong {
  display: block;
  font-size: 13px;
  line-height: 1.45;
  color: #eef6ff;
}
.news-card__impact {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  margin-bottom: 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.news-card__impact.impact-up { color: var(--up); }
.news-card__impact.impact-down { color: var(--down); }
.news-card__impact.impact-neutral { color: var(--neutral); }
.news-card__meta {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
}
.price-modal__chart canvas {
  display: block;
  width: 100%;
  height: min(46vh, 420px);
}
.price-modal.is-fullscreen .price-modal__chart canvas {
  height: min(62vh, 620px);
}
.price-modal__labels {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 6px;
  margin-top: 10px;
  padding: 0 8px;
}
.modal-label {
  font-size: 11px;
  color: transparent;
  text-align: center;
}
.modal-label.is-visible { color: var(--muted); }
.price-modal__stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.empty-state {
  color: var(--muted);
  margin: 8px 0 0;
}

@keyframes pulse-live {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.24); opacity: 0.75; }
}
@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes flash-up {
  0% { box-shadow: inset 0 0 0 1px rgba(22,215,138,0), 0 18px 48px rgba(0,0,0,0.32); }
  20% { box-shadow: inset 0 0 0 1px rgba(22,215,138,0.65), 0 18px 48px rgba(0,0,0,0.32), 0 0 25px rgba(22,215,138,0.2); }
  100% { box-shadow: inset 0 0 0 1px rgba(22,215,138,0), 0 18px 48px rgba(0,0,0,0.32); }
}
@keyframes flash-down {
  0% { box-shadow: inset 0 0 0 1px rgba(255,92,124,0), 0 18px 48px rgba(0,0,0,0.32); }
  20% { box-shadow: inset 0 0 0 1px rgba(255,92,124,0.65), 0 18px 48px rgba(0,0,0,0.32), 0 0 25px rgba(255,92,124,0.18); }
  100% { box-shadow: inset 0 0 0 1px rgba(255,92,124,0), 0 18px 48px rgba(0,0,0,0.32); }
}

@media (max-width: 1440px) {
  .market-overview { grid-template-columns: 1fr 1fr; }
  .compare-card { grid-column: 1 / -1; }
}
@media (max-width: 1200px) {
  .topbar { grid-template-columns: 1fr; }
  .topbar__left, .topbar__right { justify-content: space-between; }
  .market-overview { grid-template-columns: 1fr; }
  .metals-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .metal-card__footer { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .price-modal__body { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; }
  .main-layout { grid-template-rows: auto auto auto auto; }
  .metals-grid { height: auto; }
  .search-chip { min-width: 0; width: 100%; }
  .leaders-columns,
  .market-now__grid,
  .compare-grid,
  .price-modal__stats,
  .price-modal__body { grid-template-columns: 1fr; }
  .price-modal__head,
  .price-modal__summary {
    flex-direction: column;
    align-items: stretch;
  }
  .price-modal__summary-right { align-items: flex-start; }
  .price-modal__head h2 { font-size: 30px; }
  .price-modal__price { font-size: 44px; }
}
@media (max-width: 640px) {
  .app-shell { padding: 8px; }
  .board-toolbar { padding: 10px; }
  .metals-grid { grid-template-columns: 1fr; }
  .price-value { font-size: 26px; }
  .price-modal__dialog { width: calc(100vw - 12px); padding: 16px; border-radius: 18px; }
  .price-modal__labels { grid-template-columns: repeat(12, 1fr); }
}


/* === analytics page === */
.filter-switcher {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-btn,
.analytics-metal-chip {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  cursor: pointer;
  transition: .2s ease;
}
.filter-btn.is-active,
.analytics-metal-chip.is-selected,
.analytics-leader-row:hover {
  background: rgba(84, 166, 255, 0.18);
  border-color: rgba(84, 166, 255, 0.34);
  color: #eef6ff;
}
.analytics-shell {
  display: grid;
  gap: 12px;
}
.analytics-card {
  background: linear-gradient(180deg, rgba(14, 28, 46, 0.98), rgba(9, 19, 32, 0.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.analytics-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.analytics-toolbar__group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.analytics-toolbar__group strong {
  font-size: 13px;
  color: #d9e9ff;
}
.analytics-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.95fr);
  gap: 12px;
  align-items: start;
}
.analytics-side-grid {
  display: grid;
  gap: 12px;
}
.analytics-card--chart {
  min-height: 560px;
}
.analytics-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 14px;
}
.analytics-metal-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 14px;
}
.analytics-metal-chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chip-color, var(--accent));
  box-shadow: 0 0 12px color-mix(in srgb, var(--chip-color, var(--accent)) 58%, transparent);
}
.analytics-metal-chip__type {
  color: var(--muted);
  font-size: 11px;
}
.analytics-compare-chart {
  position: relative;
  width: 100%;
  min-height: 430px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.06);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01)),
    radial-gradient(circle at top left, rgba(84, 166, 255, 0.08), transparent 30%),
    rgba(3, 10, 18, 0.55);
  overflow: hidden;
}
#analyticsChart {
  width: 100%;
  height: 430px;
  display: block;
}
#analyticsChartTooltip {
  position: absolute;
  min-width: 210px;
  max-width: 320px;
  pointer-events: none;
  z-index: 4;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(84,166,255,0.28);
  background: rgba(6, 15, 26, 0.95);
  box-shadow: 0 12px 30px rgba(0,0,0,0.32);
  backdrop-filter: blur(10px);
}
.analytics-tooltip__date {
  color: #d9e9ff;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 8px;
}
.analytics-tooltip__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--text);
  margin-top: 6px;
}
.analytics-tooltip__name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.analytics-tooltip__name::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--tooltip-color, var(--accent));
}
.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.analytics-summary-card {
  min-height: 92px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.analytics-summary-card span {
  color: var(--muted);
  font-size: 12px;
}
.analytics-summary-card strong {
  font-size: 26px;
  line-height: 1;
}
.analytics-summary-card strong.up { color: var(--up); }
.analytics-summary-card strong.down { color: var(--down); }
.analytics-summary-card strong.neutral { color: #eef6ff; }
.analytics-leaders-list {
  display: grid;
  gap: 8px;
}
.analytics-leader-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  cursor: pointer;
  transition: .2s ease;
}
.analytics-leader-row__meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}
.analytics-leader-row__meta strong {
  font-size: 14px;
}
.analytics-leader-row__meta span {
  color: var(--muted);
  font-size: 12px;
}
.analytics-leader-row__value {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}
.analytics-leader-row__value strong.up { color: var(--up); }
.analytics-leader-row__value strong.down { color: var(--down); }
.analytics-leader-row__value span {
  color: var(--muted);
  font-size: 11px;
}
.analytics-table-shell {
  overflow: auto;
}
.analytics-table td:nth-child(2),
.analytics-table td:nth-child(8),
.analytics-table td:nth-child(9),
.analytics-table td:nth-child(10) {
  white-space: nowrap;
}
.analytics-type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--muted);
  font-size: 11px;
}
.analytics-empty {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 16px;
  background: rgba(255,255,255,0.02);
}
@media (max-width: 1220px) {
  .analytics-top-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .analytics-summary-grid {
    grid-template-columns: 1fr;
  }
  .analytics-card--chart,
  .analytics-compare-chart,
  #analyticsChart {
    min-height: 340px;
    height: 340px;
  }
}
