/* ==========================================================================
   MercadoNow — design system
   ========================================================================== */

:root {
  --brand: #0b3d6b;
  --brand-2: #12558f;
  --brand-3: #1d6fc0;
  --accent: #1565d8;
  --accent-soft: #e8f0fd;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text: #0f2033;
  --text-2: #33465c;
  --muted: #64748b;
  --muted-2: #94a3b8;

  --up: #0f9d63;
  --up-soft: #e6f7ef;
  --down: #d92d20;
  --down-soft: #fdeceb;
  --neutral: #64748b;
  --neutral-soft: #eef2f7;
  --warn: #b45309;
  --warn-soft: #fff6e5;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 32, 51, 0.06);
  --shadow: 0 6px 18px -8px rgba(15, 32, 51, 0.18), 0 1px 2px rgba(15, 32, 51, 0.05);
  --shadow-lg: 0 24px 48px -24px rgba(15, 32, 51, 0.35);

  --header-h: 62px;
  --ticker-h: 38px;
  --max: 1320px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

[data-theme='dark'] {
  --brand: #0f2d4d;
  --brand-2: #133f68;
  --brand-3: #2f86e0;
  --accent: #4f9bf0;
  --accent-soft: #16283d;

  --bg: #080e18;
  --surface: #0f1826;
  --surface-2: #131f30;
  --surface-3: #1a2839;
  --border: #1e2d42;
  --border-strong: #2b3e57;

  --text: #e8eef7;
  --text-2: #c2cfdf;
  --muted: #8b9cb3;
  --muted-2: #6b7d94;

  --up: #2dd394;
  --up-soft: rgba(45, 211, 148, 0.12);
  --down: #ff6b60;
  --down-soft: rgba(255, 107, 96, 0.12);
  --neutral: #8b9cb3;
  --neutral-soft: rgba(139, 156, 179, 0.12);
  --warn: #f0b34a;
  --warn-soft: rgba(240, 179, 74, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.7), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 30px 60px -30px rgba(0, 0, 0, 0.85);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

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

button {
  font: inherit;
  color: inherit;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  padding: 10px 16px;
  z-index: 100;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
  border-radius: var(--radius-sm);
}

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

/* ============================ top bar ============================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar__inner {
  max-width: var(--max);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--brand);
  flex-shrink: 0;
}

[data-theme='dark'] .brand {
  color: #cfe3ff;
}

.brand__mark {
  width: 30px;
  height: 30px;
}

.brand__name {
  font-size: 17.5px;
  letter-spacing: -0.03em;
  font-weight: 500;
  color: var(--text);
}

.brand__name strong {
  font-weight: 750;
  color: var(--brand-3);
}

.nav {
  display: flex;
  gap: 2px;
  flex: 1;
}

.nav a {
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.nav a:hover {
  background: var(--surface-3);
  color: var(--text);
}

.nav a.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search {
  position: relative;
  width: 258px;
}

.search__icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted-2);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: 0 12px 0 32px;
  font-size: 13px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.search input::placeholder {
  color: var(--muted-2);
}

.search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.search__results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 60;
  max-height: 380px;
  overflow-y: auto;
}

.search__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.search__item:hover,
.search__item.is-selected {
  background: var(--surface-3);
}

.search__item strong {
  font-size: 13px;
  font-weight: 650;
}

.search__item span {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search__empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

[data-theme='light'] .icon-sun,
[data-theme='dark'] .icon-moon {
  display: none;
}

.bell__dot {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--down);
  box-shadow: 0 0 0 2px var(--surface);
}

.nav-toggle {
  display: none;
}

.topbar__cta svg {
  width: 15px;
  height: 15px;
}

/* ============================ ticker ============================ */

.ticker {
  height: var(--ticker-h);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent);
}

.ticker__track {
  display: flex;
  align-items: center;
  gap: 26px;
  height: 100%;
  width: max-content;
  padding-left: 20px;
  animation: ticker-scroll 70s linear infinite;
}

.ticker:hover .ticker__track {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker__item {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
}

.ticker__sym {
  font-weight: 650;
  color: var(--text-2);
  letter-spacing: -0.01em;
}

.ticker__price {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.ticker__chg {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
}

/* ============================ layout ============================ */

.main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px 20px 56px;
  min-height: 60vh;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13.5px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid--home {
  grid-template-columns: minmax(0, 1fr) 372px;
  align-items: start;
}

.stack {
  display: grid;
  gap: 16px;
}

.grid--cards {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

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

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

@media (max-width: 1100px) {
  .grid--home { grid-template-columns: 1fr; }
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
}

/* ============================ card ============================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.card__head h2,
.card__head h3 {
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card__head .muted {
  font-size: 12px;
}

.card__body {
  padding: 16px 18px;
}

.card__body--flush {
  padding: 0;
}

.card__link {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 550;
  white-space: nowrap;
}

.card__link:hover {
  text-decoration: underline;
}

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

.small {
  font-size: 12px;
}

/* ============================ buttons ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover {
  background: var(--surface-3);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 1px 2px rgba(21, 101, 216, 0.35);
}

.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.btn--ghost:hover {
  background: var(--surface-3);
}

.btn--danger {
  color: var(--down);
  border-color: color-mix(in srgb, var(--down) 30%, transparent);
  background: var(--down-soft);
}

.btn--sm {
  height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn--xs {
  height: 27px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 8px;
  gap: 5px;
}

.btn--block {
  width: 100%;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ============================ chips / badges ============================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.chip.is-active {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.badge--up { color: var(--up); background: var(--up-soft); }
.badge--down { color: var(--down); background: var(--down-soft); }
.badge--neutral { color: var(--neutral); background: var(--neutral-soft); }
.badge--info { color: var(--accent); background: var(--accent-soft); }
.badge--warn { color: var(--warn); background: var(--warn-soft); }

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 500;
}

/* ============================ numbers ============================ */

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

.pos { color: var(--up); }
.neg { color: var(--down); }
.flat { color: var(--muted); }

.pill-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pill-change svg {
  width: 11px;
  height: 11px;
}

/* ============================ quote cards ============================ */

.quote-card {
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.quote-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.quote-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quote-card__name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quote-card__sym {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.quote-card__price {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.quote-card__change {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.spark {
  height: 38px;
  width: 100%;
}

/* ============================ tables ============================ */

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

table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  text-align: right;
  font-weight: 550;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.table thead th:first-child {
  text-align: left;
}

.table thead th.sortable {
  cursor: pointer;
  user-select: none;
}

.table thead th.sortable:hover {
  color: var(--text-2);
}

.table thead th .sort-ind {
  opacity: 0.5;
  font-size: 9px;
}

.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

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

.table tbody td:first-child {
  text-align: left;
}

.table .cell-asset {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}

.table .cell-asset__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.table .cell-asset__name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.table .cell-asset__sym {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.asset-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-2);
  flex-shrink: 0;
  overflow: hidden;
}

.asset-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.star-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: none;
  color: var(--muted-2);
  cursor: pointer;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.star-btn svg {
  width: 15px;
  height: 15px;
}

.star-btn:hover {
  background: var(--surface-3);
  color: var(--warn);
}

.star-btn.is-on {
  color: var(--warn);
}

.star-btn.is-on svg {
  fill: currentColor;
}

/* ============================ forms ============================ */

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
}

.field input,
.field select,
.field textarea {
  height: 38px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 11px;
  font-size: 13.5px;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.field textarea {
  height: auto;
  min-height: 120px;
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.form-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  align-items: end;
}

/* ============================ news ============================ */

.news-list {
  display: grid;
}

.news-item {
  display: flex;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.news-item:last-child {
  border-bottom: none;
}

.news-item:hover {
  background: var(--surface-2);
}

.news-item__body {
  flex: 1;
  min-width: 0;
}

.news-item__title {
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-item__title:hover {
  color: var(--accent);
}

.news-item__meta {
  margin-top: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.dot-sep::before {
  content: '·';
  margin-right: 8px;
  color: var(--muted-2);
}

.news-item__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}

.news-item:hover .news-item__actions,
.news-item:focus-within .news-item__actions {
  opacity: 1;
}

@media (hover: none) {
  .news-item__actions { opacity: 1; }
}

/* ============================ asset page ============================ */

.asset-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.asset-head__id {
  display: flex;
  gap: 13px;
  align-items: center;
}

.asset-head__logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  flex-shrink: 0;
}

.asset-head__logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.asset-head h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.asset-head__sym {
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
}

.asset-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.asset-price__value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.asset-head__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}

.stat {
  background: var(--surface);
  padding: 11px 14px;
}

.stat__label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat__value {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  background: var(--surface-3);
  padding: 3px;
  border-radius: 9px;
  gap: 2px;
}

.seg button {
  border: none;
  background: none;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 550;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.seg button:hover {
  color: var(--text);
}

.seg button.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.chart-box {
  position: relative;
  padding: 6px 8px 0;
}

.chart-box canvas {
  display: block;
  width: 100%;
  touch-action: pan-y;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 9px 11px;
  font-size: 12px;
  min-width: 132px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.1s;
}

.chart-tooltip.is-visible {
  opacity: 1;
}

.chart-tooltip__row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  line-height: 1.6;
}

.chart-tooltip__row span:first-child {
  color: var(--muted);
}

/* ============================ analysis ============================ */

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1000px) {
  .analysis-grid { grid-template-columns: 1fr; }
}

.sentiment {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sentiment__gauge {
  flex: 1;
  min-width: 0;
}

.sentiment__bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--down) 0%, var(--neutral-soft) 50%, var(--up) 100%);
  opacity: 0.9;
}

.sentiment__marker {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--text);
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow-sm);
}

.sentiment__scale {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--muted);
}

.sentiment__value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.impact-list {
  display: grid;
  gap: 10px;
}

.impact {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.impact:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.impact__head {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}

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

.impact__sym {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.impact__name {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.impact__score {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.impact__bar {
  width: 120px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
  position: relative;
}

.impact__bar span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
}

.impact__bar span.pos { background: var(--up); left: 50%; }
.impact__bar span.neg { background: var(--down); right: 50%; }

.impact__reasons {
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 5px;
}

.impact__reasons li {
  font-size: 12.5px;
  color: var(--text-2);
  padding-left: 15px;
  position: relative;
  line-height: 1.5;
}

.impact__reasons li::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted-2);
}

.evidence {
  margin-top: 9px;
  border-left: 3px solid var(--border-strong);
  padding: 4px 0 4px 11px;
  font-size: 12.5px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.55;
}

.analysis-hero {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 92%, #000), var(--brand-2));
  color: #eaf2fb;
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: grid;
  gap: 14px;
}

.analysis-hero h2 {
  font-size: 18px;
  font-weight: 650;
  line-height: 1.35;
  color: #fff;
}

.analysis-hero a {
  color: #bfe1ff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.analysis-hero__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #b9cfe6;
  align-items: center;
}

.summary-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.summary-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.55;
}

.summary-list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

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

.gauge-ring {
  --size: 116px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--gauge-color, var(--accent)) calc(var(--pct) * 1%), var(--surface-3) 0);
  position: relative;
  flex-shrink: 0;
}

.gauge-ring::before {
  content: '';
  position: absolute;
  inset: 9px;
  background: var(--surface);
  border-radius: 50%;
}

.gauge-ring__label {
  position: relative;
  text-align: center;
  line-height: 1.1;
}

.gauge-ring__label strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.gauge-ring__label span {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============================ misc ============================ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}

.kpi__label {
  font-size: 11.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi__value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.kpi__hint {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.section {
  margin-top: 26px;
}

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

.section__head h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.empty {
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.empty__icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  color: var(--muted-2);
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.sk-line {
  height: 12px;
  margin: 6px 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ============================ footer ============================ */

.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 30px;
}

.footer__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px 20px 34px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1.4fr 1fr;
}

.footer__brand p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  max-width: 440px;
}

.footer__cols {
  display: flex;
  gap: 40px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.footer__cols > div {
  display: grid;
  gap: 5px;
  align-content: start;
}

.footer__cols h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 3px;
}

.footer__cols a {
  font-size: 13px;
  color: var(--text-2);
}

.footer__cols a:hover {
  color: var(--accent);
}

.footer__status {
  font-size: 12.5px;
  color: var(--up);
  font-weight: 550;
}

.footer__muted {
  font-size: 11.5px;
  color: var(--muted-2);
}

.footer__disclaimer {
  grid-column: 1 / -1;
  margin: 8px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--muted-2);
  line-height: 1.6;
}

/* ============================ modal & toast ============================ */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.modal-root.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 26, 0.55);
  backdrop-filter: blur(3px);
  animation: fade 0.15s ease-out;
}

.modal {
  position: relative;
  margin: 6vh auto 0;
  width: min(560px, calc(100% - 32px));
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes fade {
  from { opacity: 0; }
}

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
}

.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal__head h3 {
  font-size: 16px;
  font-weight: 650;
}

.modal__body {
  padding: 18px 20px;
  display: grid;
  gap: 14px;
}

.modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 90;
  max-width: 360px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 11px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: slide-in 0.2s ease-out;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}

.toast--ok { border-left-color: var(--up); }
.toast--err { border-left-color: var(--down); }
.toast__close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(12px); }
}

/* ============================ responsive ============================ */

@media (max-width: 980px) {
  .search { width: 200px; }
  .nav a { padding: 7px 8px; font-size: 13px; }
}

@media (max-width: 860px) {
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 10px 14px;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    z-index: 50;
  }
  .nav.is-open { display: grid; }
  .nav-toggle { display: grid; }
  .topbar__cta { display: none; }
  .search { width: 150px; }
  .grid--home { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr; }
  .footer__cols { justify-content: flex-start; }
}

@media (max-width: 620px) {
  .main { padding: 16px 14px 44px; }
  .topbar__inner { padding: 0 14px; gap: 10px; }
  .brand__name { font-size: 16px; }
  .search { width: 100%; }
  .search input { height: 34px; }
  .asset-price__value { font-size: 26px; }
  .page-head h1 { font-size: 21px; }
  .hide-sm { display: none; }
}

/* ============================ ajustes finos ============================ */

.analysis-hero .badge {
  background: rgba(255, 255, 255, 0.16);
  color: #e8f2ff;
  backdrop-filter: blur(2px);
}

.analysis-hero .badge--warn {
  background: rgba(240, 179, 74, 0.22);
  color: #ffe2a8;
}

.analysis-hero .btn {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.analysis-hero .btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.footer__cols {
  align-items: start;
}

/* Tabelas com muitas linhas: respiro entre nome e ações */
.table tbody tr td:last-child {
  white-space: nowrap;
}

/* Scrollbar discreta */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

@media (max-width: 620px) {
  .analysis-hero {
    padding: 16px 16px;
  }
  .analysis-hero h2 {
    font-size: 16px;
  }
  .kpi__value {
    font-size: 19px;
  }
}

/* URL longa no campo de lote não deve estourar o layout */
#news-batch {
  white-space: pre;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

/* ============================ radar de manchetes ============================ */

.radar-item {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.radar-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.radar-item__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.radar-item__headline {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================ calendário ============================ */

.cal-day {
  border-bottom: 1px solid var(--border);
}

.cal-day:last-child {
  border-bottom: none;
}

.cal-day__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: calc(var(--header-h) + var(--ticker-h));
  z-index: 2;
  backdrop-filter: blur(6px);
}

.cal-day__head strong {
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.cal-event {
  display: grid;
  grid-template-columns: 52px 10px 40px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 38px;
}

.cal-event:last-child {
  border-bottom: none;
}

.cal-event:hover {
  background: var(--surface-2);
}

.cal-time {
  font-size: 12px;
  color: var(--muted);
  padding-top: 2px;
}

.cal-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  justify-self: center;
}

.cal-dot--high {
  background: var(--down);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--down) 18%, transparent);
}

.cal-dot--mid {
  background: var(--warn);
}

.cal-dot--low {
  background: var(--muted-2);
}

.cal-country {
  justify-self: start;
  margin-top: 1px;
}

.cal-main {
  min-width: 0;
}

.cal-title {
  font-size: 12.8px;
  font-weight: 550;
  line-height: 1.35;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}



.cal-values {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  overflow: hidden;
}

.cal-value {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.cal-value em {
  font-style: normal;
  color: var(--muted);
  margin-right: 2px;
}

@media (max-width: 1240px) {
  .nav {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav a {
    padding: 7px 8px;
    font-size: 13px;
  }
  .search {
    width: 210px;
  }
}

@media (max-width: 980px) {
  .cal-values {
    display: none;
  }
}

@media (max-width: 720px) {
  .cal-event {
    grid-template-columns: 46px 9px minmax(0, 1fr);
    gap: 9px;
    padding: 9px 14px;
  }
  .cal-country {
    display: none;
  }
  .cal-day__head {
    padding: 9px 14px;
  }
}

/* Cabeçalho em telas estreitas: busca flexível, ações sempre visíveis */
@media (max-width: 720px) {
  .topbar__inner {
    gap: 8px;
    padding: 0 12px;
  }
  .brand__name {
    display: none;
  }
  .search {
    width: auto;
    flex: 1;
    min-width: 0;
  }
  .search input {
    width: 100%;
    padding-right: 10px;
  }
  .topbar__actions {
    flex-shrink: 0;
    gap: 6px;
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
}
