/* gfm-markets-page.css — dashboard Mercados (layout premium 3 colunas) */
:root {
  --bg: #0a0a0f;
  --bg2: #0e0e16;
  --card: #12121c;
  --card2: #161622;
  --border: rgba(255, 255, 255, 0.07);
  --border2: rgba(255, 255, 255, 0.11);
  --text: #e5e7eb;
  --text2: #d1d5db;
  --text3: #9ca3af;
  --green: #00ff88;
  --red: #ff4466;
  --accent: #00ff88;
  --mono: 'Space Mono', monospace;
  --sans: 'Syne', sans-serif;
  --nav-h: 48px;
  --radius: 11px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  padding-top: var(--nav-h);
  font-size: 13px;
  line-height: 1.45;
}

/* ── Top utility bar ── */
.mk-topbar {
  position: sticky;
  top: var(--nav-h);
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 10px 20px;
  background: rgba(10, 10, 15, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.mk-topbar-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 0.04em;
}

.mk-btn-ghost {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text2);
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.mk-btn-ghost:hover {
  color: var(--text);
  border-color: rgba(0, 255, 136, 0.35);
}

/* ── 3-column grid ── */
.mk-dashboard {
  display: grid;
  grid-template-columns: minmax(220px, 22fr) minmax(0, 56fr) minmax(220px, 22fr);
  gap: 14px;
  padding: 14px 16px 20px;
  align-items: start;
}

.mk-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  align-self: start;
}

/* ── Cards ── */
.mk-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.mk-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px 10px;
}

.mk-card-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text2);
}

.mk-card-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 2px;
}

.mk-link {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.85;
}

.mk-link:hover { opacity: 1; }

.mk-card-body { padding: 0 8px 10px; }

.mk-card-foot {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  text-align: right;
}

/* ── Center hero ── */
.mk-hero {
  padding: 4px 2px 8px;
}

.mk-hero h1 {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
}

.mk-hero-sub {
  font-size: 13px;
  color: var(--text2);
  max-width: 520px;
  margin-bottom: 10px;
}

.mk-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
  background: rgba(0, 255, 136, 0.08);
  border: 1px solid rgba(0, 255, 136, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
}

.mk-live-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: mk-pulse 1.8s ease-in-out infinite;
}

@keyframes mk-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ── Chart card ── */
.mk-chart-card .mk-card-body {
  padding: 0 14px 14px;
}

.mk-chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 2px 12px;
}

.mk-chart-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mk-chart-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.norm-source-badge {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.norm-source-badge.live {
  color: var(--green);
  border-color: rgba(0, 255, 136, 0.35);
  background: rgba(0, 255, 136, 0.08);
}

.norm-source-badge.demo {
  color: #ffaa00;
  border-color: rgba(255, 170, 0, 0.35);
  background: rgba(255, 170, 0, 0.08);
}

.period-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.period-pill {
  font-family: var(--mono);
  font-size: 10px;
  padding: 6px 11px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text3);
  cursor: pointer;
  transition: all 0.12s;
  background: var(--bg2);
}

.period-pill:hover {
  color: var(--text2);
  border-color: var(--border2);
}

.period-pill.active {
  color: var(--text);
  border-color: rgba(0, 255, 136, 0.35);
  background: rgba(0, 255, 136, 0.08);
}

.mk-chart-stage {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  min-height: 300px;
}

.chart-body {
  position: relative;
  height: 280px;
  min-height: 240px;
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 4px;
  min-width: 148px;
  border-left: 1px solid var(--border);
  padding-left: 14px;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
  transition: opacity 0.15s;
}

.chart-legend-item.off { opacity: 0.35; }

.chart-legend-dot {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-legend-val {
  font-family: var(--mono);
  font-size: 10px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 4px;
}

.chart-legend-val.up { color: var(--green); }
.chart-legend-val.dn { color: var(--red); }

/* ── Panorama ── */
.mk-panorama {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.mk-pano-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 12px 10px;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}

.mk-pano-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.mk-pano-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--text2);
}

.mk-pano-icon svg,
.mk-pano-icon img {
  width: 17px;
  height: 17px;
  display: block;
  object-fit: contain;
}

.mk-pano-icon .mk-flag {
  width: 17px;
  height: auto;
  border-radius: 2px;
}

/* ── Asset icons in tables ── */
.dt-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.dt-icon {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text2);
}

.dt-icon svg,
.dt-icon img {
  width: 17px;
  height: 17px;
  display: block;
  object-fit: contain;
}

.dt-icon .mk-flag {
  width: 17px;
  height: auto;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.dt-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mk-ticker-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #fff;
}

.mk-ticker-badge.sp { background: #1a4fd6; font-size: 6px; }
.mk-ticker-badge.nd { background: #0099da; }
.mk-ticker-badge.dj { background: #003087; }
.mk-ticker-badge.ru { background: #5c3d8f; font-size: 6px; }
.mk-ticker-badge.nv { background: #76b900; }
.mk-ticker-badge.sm { background: #0066cc; font-size: 6px; }
.mk-ticker-badge.avgo { background: #cc0000; font-size: 6px; }
.mk-ticker-badge.sam { background: #1428a0; font-size: 6px; }
.mk-ticker-badge.hynix { background: #e4002b; font-size: 6px; }
.mk-ticker-badge.aapl { background: #555; }
.mk-ticker-badge.msft { background: #00a4ef; font-size: 6px; }
.mk-ticker-badge.tsla { background: #cc0000; }
.mk-ticker-badge.amzn { background: #ff9900; color: #111; }
.mk-ticker-badge.meta { background: #0668e1; font-size: 6px; }
.mk-ticker-badge.asml { background: #003da5; font-size: 6px; }
.mk-ticker-badge.gen { background: rgba(255, 255, 255, 0.1); color: var(--text2); font-size: 6px; }

.dt-icon svg.mk-flag-svg,
.dt-icon > svg[viewBox="0 0 21 15"] {
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.mk-logo-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--text2);
}

/* ── Linha inferior: Agenda (esq.) + Market Movers (dir.) ── */
.mk-bottom-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.mk-movers-card .mk-card-body,
.mk-agenda-card .mk-card-body {
  padding-top: 0;
  overflow-x: auto;
}

.agenda-dt {
  table-layout: fixed;
  width: 100%;
}

.agenda-dt thead th:nth-child(1) { width: auto; }
.agenda-dt thead th:nth-child(2) { width: 52px; }
.agenda-dt thead th:nth-child(3) { width: 44px; }

.agenda-dt tbody td {
  white-space: normal;
  vertical-align: middle;
}

.agenda-dt tbody td:first-child {
  padding-right: 6px;
}

.agenda-dt .dt-name {
  align-items: flex-start;
}

.agenda-dt .dt-label {
  white-space: normal;
  line-height: 1.35;
  font-size: 11px;
}

.agenda-dt .agenda-time {
  font-size: 10px;
  white-space: nowrap;
}

.agenda-dt .impact-badge {
  font-size: 7px;
  padding: 3px 5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.mk-fav-badge {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffaa44;
  background: rgba(255, 170, 68, 0.1);
  border: 1px solid rgba(255, 170, 68, 0.35);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.mk-mover-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--border);
}

.mk-mover-tab {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text3);
  background: var(--bg2);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 11px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}

.mk-mover-tab:hover {
  color: var(--text2);
  border-color: var(--border2);
}

.mk-mover-tab.active {
  color: var(--text);
  border-color: rgba(0, 255, 136, 0.35);
  background: rgba(0, 255, 136, 0.08);
}

.movers-dt tbody tr,
.agenda-dt tbody tr {
  cursor: default;
}

.agenda-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
}

.impact-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid transparent;
}

.impact-high {
  color: #ff6b6b;
  background: rgba(255, 68, 102, 0.12);
  border-color: rgba(255, 68, 102, 0.35);
}

.impact-medium {
  color: #ffaa44;
  background: rgba(255, 170, 68, 0.1);
  border-color: rgba(255, 170, 68, 0.3);
}

.impact-low {
  color: var(--text2);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.news-source-link {
  color: var(--accent);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.12s;
}

.news-source-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.mk-pano-name {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-left: auto;
}

.mk-pano-val {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.mk-pano-chg {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.mk-pano-chg.up { color: var(--green); }
.mk-pano-chg.dn { color: var(--red); }
.mk-pano-chg.neu { color: var(--text3); }

.mk-pano-spark {
  margin-top: auto;
  height: 28px;
  width: 100%;
}

.mk-pano-spark svg {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 960px) {
  .mk-bottom-row { grid-template-columns: 1fr; }
  .mk-mover-tabs { gap: 4px; }
  .mk-mover-tab { padding: 6px 8px; font-size: 8px; }
}

@media (max-width: 520px) {
  .mk-panorama { grid-template-columns: 1fr 1fr; }
  .mk-hero h1 { font-size: 22px; }
}

/* ── Tables ── */
.dt {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.dt thead th {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 8px 10px 6px;
  text-align: right;
  font-weight: 400;
  white-space: nowrap;
}

.dt thead th:first-child { text-align: left; }

.dt tbody tr {
  cursor: pointer;
  transition: background 0.12s;
  border-radius: 6px;
}

.dt tbody tr:hover { background: rgba(255, 255, 255, 0.04); }

.dt tbody td {
  padding: 9px 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.dt tbody td:first-child {
  text-align: left;
  color: var(--text);
  font-weight: 500;
}

.dt .up { color: var(--green); }
.dt .dn { color: var(--red); }
.dt .neu { color: var(--text2); }
.dt tbody td.chg { font-weight: 600; }

.dt .section-row td {
  font-family: var(--mono);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  padding: 10px 10px 4px;
  background: transparent;
  border-bottom: none;
  cursor: default;
}

.dt .section-row:hover { background: transparent !important; }

/* ── Heatmap ── */
.heatmap-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 6px;
  font-size: 11px;
}

.heatmap-table th {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  padding: 4px 6px;
  text-align: center;
  font-weight: 400;
}

.heatmap-table th:first-child { text-align: left; }

.heatmap-table td {
  padding: 0;
  border: none;
  text-align: center;
}

.heatmap-table td:first-child {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text2);
  padding: 8px 6px;
  text-align: left;
  background: none;
}

.hm-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px;
  min-height: 52px;
  border-radius: 8px;
  font-family: var(--mono);
}

.hm-val { font-size: 12px; font-weight: 700; }
.hm-lbl { font-size: 8px; margin-top: 2px; opacity: 0.75; }

/* ── News ── */
.news-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.12s;
}

.news-item:last-child { border-bottom: none; }
.news-item:hover { background: rgba(255, 255, 255, 0.03); }

.news-headline {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  font-weight: 500;
}

.news-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 5px;
}

.news-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  white-space: nowrap;
}

.loading-placeholder {
  padding: 24px 14px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
}

/* ── Footer ── */
.mk-footer {
  border-top: 1px solid var(--border);
  padding: 14px 20px;
  text-align: center;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  background: var(--bg2);
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .mk-panorama { grid-template-columns: repeat(3, 1fr); }
  .mk-chart-stage { grid-template-columns: 1fr; }
  .chart-legend {
    flex-direction: row;
    flex-wrap: wrap;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 12px 0 0;
    min-width: 0;
  }
}

@media (max-width: 960px) {
  .mk-dashboard {
    grid-template-columns: 1fr;
  }
  .mk-panorama { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .mk-panorama { grid-template-columns: 1fr 1fr; }
  .mk-hero h1 { font-size: 22px; }
}

.mk-widget-hidden { display: none !important; }
.mk-col-empty { display: none !important; }
.mk-row-empty { display: none !important; }

/* ── Personalizar overlay ── */
.mk-customize-overlay {
  position: fixed;
  inset: 0;
  z-index: 5400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.72);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.mk-customize-overlay[hidden] { display: none !important; }
.mk-customize-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.mk-customize-sheet {
  width: min(420px, 100%);
  max-height: min(88vh, 640px);
  background: var(--card);
  border: 1px solid var(--border2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.mk-customize-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.mk-customize-head h2 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.mk-customize-close {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 22px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.mk-customize-hint {
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  padding: 12px 18px 0;
}
.mk-customize-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mk-customize-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.mk-customize-item:hover { background: rgba(255, 255, 255, 0.04); }
.mk-customize-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.mk-customize-foot {
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  text-align: center;
}

@media (max-width: 768px) {
  .mk-topbar {
    position: static;
    top: auto;
    padding: 8px 56px 8px 14px;
    z-index: auto;
  }
  .mk-btn-ghost {
    min-height: 44px;
    padding: 10px 14px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 101;
  }
  .mk-customize-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .mk-customize-sheet {
    width: 100%;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
  }
}

