/* Economio Market - portal (página inicial) */

:root {
  --bg: #f5f4ef;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --ink: #15171b;
  --muted: #5f6672;
  --line: #e2e0d8;
  --brand: #1f3a93;
  --accent: #e0a106;
  --up: #0a7d3b;
  --up-bg: #e3f4ea;
  --down: #c62828;
  --down-bg: #fbe7e7;
  --header: #0b0d10;
  --header-ink: #f2f2f2;
  --skeleton: #e9e7e0;
  --radius: 10px;
  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1013;
    --surface: #161a1f;
    --surface-2: #1c2128;
    --ink: #e9eaec;
    --muted: #9aa1ab;
    --line: #262b33;
    --brand: #93a8ff;
    --accent: #ffc107;
    --up: #34c76f;
    --up-bg: #12301f;
    --down: #ff6464;
    --down-bg: #3a1717;
    --skeleton: #20252c;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

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

.num,
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

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

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

/* ---------- Faixa de cotações ---------- */
.tape {
  background: #000;
  color: #e6e6e6;
  overflow: hidden;
  white-space: nowrap;
  font-size: 13px;
  border-bottom: 1px solid #1d1f23;
}

.tape-track {
  display: inline-flex;
  gap: 28px;
  padding: 7px 0 7px 16px;
  animation: tape-scroll 60s linear infinite;
}

.tape:hover .tape-track {
  animation-play-state: paused;
}

.tape-item {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
}

.tape-item b {
  font-weight: 600;
  color: #fff;
}

.tape-item .up {
  color: #3ddc84;
}

.tape-item .down {
  color: #ff6b6b;
}

@keyframes tape-scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tape {
    overflow-x: auto;
  }

  .tape-track {
    animation: none;
  }
}

/* ---------- Cabeçalho ---------- */
.site-header {
  background: var(--header);
  color: var(--header-ink);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 3px solid var(--accent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  white-space: nowrap;
}

.brand img {
  border-radius: 8px;
}

.brand em {
  font-style: normal;
  color: var(--accent);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.main-nav a {
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: .85;
}

.main-nav a:hover,
.main-nav a.active {
  opacity: 1;
  background: rgba(255, 255, 255, .08);
}

.main-nav .btn-login {
  background: var(--accent);
  color: #111;
  font-weight: 700;
  opacity: 1;
  margin-left: 6px;
}

.main-nav .btn-login:hover {
  background: #ffcf3a;
}

/* ---------- Barra de status ---------- */
.status-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.status-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-height: 40px;
  padding-top: 6px;
  padding-bottom: 6px;
}

#today-label {
  font-weight: 500;
}

.status-sep {
  width: 1px;
  height: 14px;
  background: var(--line);
}

.market-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

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

.market-status.open .dot {
  background: var(--up);
  box-shadow: 0 0 0 3px var(--up-bg);
}

.market-status.closed .dot {
  background: var(--down);
}

/* ---------- Estrutura ---------- */
main.container {
  padding-top: 24px;
  padding-bottom: 48px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.see-all {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
}

.see-all:hover {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  margin-top: 28px;
}

.col-main,
.col-side {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* ---------- Mercados ---------- */
.markets-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 16px;
}

.index-hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.index-hero .name {
  font-weight: 600;
  font-size: 15px;
}

.index-hero .value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-top: 6px;
}

.index-hero .change {
  font-family: var(--font-mono);
  font-weight: 600;
}

.range {
  margin-top: 14px;
}

.range-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-mono);
}

.range-label span:nth-child(2) {
  font-family: var(--font-sans);
}

.range-bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  margin: 6px 0 2px;
}

.range-bar i {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
  border: 2px solid var(--surface);
  transform: translate(-50%, -50%);
}

.index-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
}

.index-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: baseline;
}

.index-item .name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.index-item .price {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 15px;
}

.pill {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.pill.up {
  background: var(--up-bg);
}

.pill.down {
  background: var(--down-bg);
}

/* ---------- Manchete ---------- */
.lead {
  padding: 28px;
  border-top: 4px solid var(--brand);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand);
}

.kicker .tag {
  background: var(--accent);
  color: #111;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: .04em;
}

.lead h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  line-height: 1.15;
  font-weight: 700;
  margin: 12px 0;
  text-wrap: balance;
}

.lead h1 a {
  text-decoration: none;
}

.lead h1 a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.lead p.excerpt {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 70ch;
}

.lead .meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  font-size: 13px;
}

.btn {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn {
    color: #0e1013;
  }
}

.outlook {
  border-left: 4px solid var(--accent);
}

.outlook p {
  white-space: pre-line;
}

/* ---------- Radar ---------- */
.radar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.radar-head {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.radar-head::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: currentColor;
}

.radar-list {
  list-style: none;
}

.radar-list li {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.radar-list li:first-child {
  border-top: 0;
}

.radar-list .row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.radar-list .reason {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

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

/* ---------- Ativo (logo + ticker) ---------- */
.asset {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--surface-2);
  object-fit: contain;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.asset .t {
  font-weight: 700;
  font-size: 14px;
}

.asset .n {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* ---------- Notícias ---------- */
.news-list {
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.news-list li+li {
  border-top: 1px solid var(--line);
}

.news-list a {
  display: block;
  padding: 16px 20px;
  text-decoration: none;
}

.news-list a:hover h3 {
  text-decoration: underline;
}

.news-list .when {
  font-size: 12px;
  color: var(--muted);
}

.news-list .when b {
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 6px;
}

.news-list h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 4px 0;
}

.news-list p {
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Maiores variações ---------- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 13px var(--font-sans);
  padding: 7px;
  border-radius: 6px;
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

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

.movers-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  text-align: left;
  padding: 6px 0;
}

.movers-table td {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.movers-table .num {
  text-align: right;
  padding-left: 8px;
  white-space: nowrap;
}

.movers-table .asset .n {
  max-width: 130px;
}

/* ---------- Agenda ---------- */
.agenda-day+.agenda-day {
  margin-top: 14px;
}

.agenda-day h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.agenda-day ul {
  list-style: none;
}

.agenda-day li {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  font-size: 13px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}

.agenda-day .time {
  font-family: var(--font-mono);
  color: var(--muted);
}

.impact {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  padding: 0 5px;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: 1px;
}

.impact.alto {
  background: var(--down-bg);
  color: var(--down);
}

.impact.medio {
  background: var(--surface-2);
  color: var(--accent);
}

/* ---------- Proventos ---------- */
.div-list {
  list-style: none;
}

.div-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.div-list li:first-child {
  border-top: 0;
}

.div-list .right {
  text-align: right;
  white-space: nowrap;
}

.div-list .type {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

/* ---------- Chamada do app ---------- */
.app-cta {
  background: var(--header);
  color: #f2f2f2;
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.app-cta img {
  border-radius: 12px;
}

.app-cta h2 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  margin: 10px 0 6px;
}

.app-cta p {
  font-size: 14px;
  color: #b9bec6;
  margin-bottom: 16px;
}

.store-btn {
  display: inline-block;
  background: var(--accent);
  color: #111;
  font-weight: 700;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 6px;
}

/* ---------- Rodapé ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 28px 0 20px;
  font-size: 14px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-inner p {
  max-width: 460px;
  margin-top: 4px;
  font-size: 13px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.footer-links a {
  text-decoration: none;
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--ink);
}

.copyright {
  font-size: 12px;
  margin-top: 20px;
}

/* ---------- Carregando / vazio ---------- */
.skeleton {
  background: var(--skeleton);
  border-radius: 6px;
  list-style: none;
  animation: pulse 1.4s ease-in-out infinite;
}

.news-list .skeleton {
  margin: 12px;
}

@keyframes pulse {
  50% {
    opacity: .5;
  }
}

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

/* ---------- Responsivo ---------- */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

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

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding-top: 10px;
    padding-bottom: 6px;
  }

  .main-nav {
    margin: 0 -16px;
    padding: 0 12px;
  }

  .main-nav a {
    padding: 8px 9px;
    font-size: 13px;
  }

  .main-nav .btn-login {
    margin-left: auto;
  }

  .site-header {
    position: static;
  }

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

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

  .lead {
    padding: 20px;
  }

  .index-hero .value {
    font-size: 1.7rem;
  }
}

/* ---------- Página de proventos ---------- */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  line-height: 1.15;
  margin: 6px 0 4px;
}

.week-nav {
  display: flex;
  gap: 6px;
}

.week-nav button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 600 14px var(--font-sans);
  min-width: 40px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  cursor: pointer;
}

.week-nav button:first-child,
.week-nav button:last-child {
  font-size: 22px;
  line-height: 1;
}

.week-nav button:hover:not(:disabled) {
  border-color: var(--brand);
}

.week-nav button:disabled {
  opacity: .45;
  cursor: default;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.toolbar .tabs {
  margin: 0;
  min-width: 240px;
}

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

.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font: 600 13px var(--font-sans);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.search {
  margin-left: auto;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 500 14px var(--font-sans);
  padding: 8px 12px;
  border-radius: 8px;
  width: 180px;
  text-transform: uppercase;
}

.search::placeholder {
  text-transform: none;
  color: var(--muted);
}

#days {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.day-group {
  padding: 0;
  overflow: hidden;
}

.day-group.past {
  opacity: .72;
}

.day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.day-head h2 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--line);
  color: var(--muted);
}

.day-tag.today {
  background: var(--accent);
  color: #111;
}

.div-rows {
  list-style: none;
}

.div-row {
  display: grid;
  grid-template-columns: 200px 240px minmax(0, 1fr) 120px;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: 14px;
}

.div-row+.div-row {
  border-top: 1px solid var(--line);
}

.div-kind {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}

.div-date {
  font-size: 13px;
}

.div-value {
  text-align: right;
  display: flex;
  flex-direction: column;
  white-space: nowrap;
}

.div-value .mono {
  font-weight: 600;
}

.div-value .muted {
  font-size: 11px;
}

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--brand);
}

.badge-fii {
  background: var(--up-bg);
  color: var(--up);
}

.badge-bdr {
  background: var(--surface-2);
  color: var(--muted);
}

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

@media (max-width: 640px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .stat {
    padding: 10px 12px;
  }

  .stat-value {
    font-size: 1.15rem;
  }

  .stat-label {
    font-size: 11px;
  }

  .toolbar .tabs {
    min-width: 0;
    width: 100%;
  }

  .search {
    margin-left: 0;
    width: 100%;
  }

  .day-head,
  .div-row {
    padding-left: 14px;
    padding-right: 14px;
  }

  .div-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
  }

  .div-kind {
    grid-column: 1;
    grid-row: 2;
  }

  .div-date {
    grid-column: 1;
    grid-row: 3;
    font-size: 12px;
  }

  .div-value {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}
