/* RadarZeny — painel de mercado. Identidade de feira/loja de arcade: blocos
 * chunky, borda grossa 3px, sombra dura sem blur. Claro + escuro via
 * [data-theme] no <html>, alternado pelo toggle Claro/Escuro. Origem: handoff
 * final "RadarZeny" (docs/design_handoff_radar_zenyv3/HANDOFF-RadarZeny.md).
 *
 * Regra de tipografia (handoff, decisão 5): Silkscreen SÓ no wordmark grande;
 * todo o resto em Space Grotesk. O pixel é ilegível em corpo pequeno.
 */

/* ===================== Fontes ===================== */
@font-face {
  font-family: "Silkscreen";
  src: url("fonts/silkscreen-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  /* Fonte variável: cobre 400–700 num arquivo só. */
  font-family: "Space Grotesk";
  src: url("fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

/* ===================== Tokens ===================== */
:root {
  --font-pixel: "Silkscreen", "Courier New", monospace;
  --font-grotesk: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --shadow-block: 3px 3px 0 var(--stroke);
  --shadow-block-up: 5px 5px 0 var(--stroke);
  --dur-chip: 90ms;
  --dur-state: 140ms;
  --dur-data: 220ms;
  --dur-enter: 260ms;
  --dur-brand: 280ms;
  --ease-out: cubic-bezier(.2, .8, .25, 1);
  --ease-inout: cubic-bezier(.4, 0, .2, 1);
}

/* Tema escuro */
:root[data-theme="dark"] {
  --bg: #15131e;
  --card: #211d2e;
  --ink: #efeaff;
  --dim: #8b86a3;
  --stroke: #0c0a14;
  --panelBorder: #37324c;
  --track: #2c2740;
  --shadow: rgba(0, 0, 0, 0.55);
  --brand: #ffcf3f;
  --price: #ffcf3f;
  --label: #c4a260;
  --green: #3ddc8a;
  --coral: #ff5d7d;
  --gaugeNeutral: #c4a260;
  --bandFill: rgba(196, 162, 96, 0.20);
  --bandStroke: rgba(196, 162, 96, 0.62);
  --bandChart: rgba(255, 255, 255, 0.12);
  --badgeGreenBg: #3ddc8a;
  --badgeGreenInk: #0c2a1c;
  --badgeRedBg: #ff5d7d;
  --badgeRedInk: #2a0f18;
  --barFill: #4a4566;
}

/* Tema claro. A faixa de referência do medidor NÃO é azul aqui (destoaria do
   pergaminho quente): é uma variação do areia base, dourado-tostado. */
:root[data-theme="light"] {
  --bg: #f6ecd0;
  --card: #ffffff;
  --ink: #23202e;
  --dim: #6a6350;
  --stroke: #23202e;
  --panelBorder: #23202e;
  --track: #efe6d2;
  --shadow: rgba(35, 32, 46, 0.9);
  --brand: #d99a1f;
  --price: #23202e;
  --label: #b07d1e;
  --green: #1f9e59;
  --coral: #ef5d5d;
  --gaugeNeutral: #8a6a3a;
  --bandFill: rgba(198, 161, 92, 0.44);
  --bandStroke: rgba(138, 106, 58, 0.9);
  --bandChart: rgba(35, 32, 46, 0.13);
  --badgeGreenBg: #79d295;
  --badgeGreenInk: #0f3220;
  --badgeRedBg: #ff7a7a;
  --badgeRedInk: #3a1010;
  --barFill: #c9bfa6;
}

/* ===================== Base ===================== */
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 28px 22px 46px;
  min-height: 100vh;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-grotesk);
  transition: background-color 200ms var(--ease-inout),
              color 200ms var(--ease-inout);
}
.wrap { max-width: 1160px; margin: 0 auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* ===================== Masthead ===================== */
.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.masthead-brand { display: flex; align-items: center; gap: 14px; }
.logo-mark { flex: none; }
.wordmark {
  margin: 0;
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 23px;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--brand);
}
.tagline {
  margin: 6px 0 0;
  font-weight: 600;
  font-size: 12px;
  color: var(--dim);
}
.masthead-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 11px;
}

/* Toggle Claro / Escuro (segmentado, ícones sol/lua). Ativo = fundo --ink,
   texto --card. */
.theme-toggle {
  display: flex;
  border: 3px solid var(--stroke);
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 3px 3px 0 var(--shadow);
}
.theme-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 0;
  cursor: pointer;
  font-family: var(--font-grotesk);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--card);
  color: var(--dim);
  transition: background-color var(--dur-chip) var(--ease-out),
              color var(--dur-chip) var(--ease-out);
}
.theme-toggle button svg { flex: none; }
.theme-toggle button + button { border-left: 3px solid var(--stroke); }
.theme-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--card); }

.stamp {
  margin: 0;
  font-weight: 600;
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.masthead + .banner,
.masthead + .mock-ribbon { margin-top: 0; }
/* Filete abaixo do header */
.masthead { padding-bottom: 20px; border-bottom: 3px solid var(--stroke); }

/* ===================== Banner de aviso ===================== */
.banner {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 36px));
  padding: 11px 14px;
  font-weight: 600;
  font-size: 13.5px;
  border: 3px solid var(--coral);
  border-radius: 12px;
  background: var(--card);
  color: var(--coral);
  box-shadow: 4px 4px 0 var(--shadow);
}
@keyframes rz-fade-in { from { opacity: 0; } }
.banner:not([hidden]) { animation: rz-fade-in 160ms var(--ease-out) both; }
.banner-action {
  min-height: 44px;
  margin-left: 12px;
  padding: 7px 11px;
  cursor: pointer;
  border: 2px solid currentColor;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: 700 12px var(--font-grotesk);
}

/* ===================== Prévia (mock) ===================== */
.mock-ribbon {
  margin-top: 16px;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  background: var(--card);
  border: 3px solid var(--brand);
  border-radius: 12px;
  color: var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
}
.mock-ribbon a { color: inherit; }

/* ===================== Toolbar: busca + controles ===================== */
.toolbar { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  background: var(--card);
  border: 3px solid var(--panelBorder);
  border-radius: 13px;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: border-color var(--dur-chip) var(--ease-out);
}
.search:focus-within { border-color: var(--brand); }
.search-ico { width: 14px; height: 14px; border: 2.5px solid var(--dim); border-radius: 50%; flex: none; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-family: var(--font-grotesk);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink);
}
.search input::placeholder { color: var(--dim); }

.view-controls { display: flex; gap: 12px; flex-wrap: wrap; }
.control-menu { position: relative; }
.control-menu-trigger {
  display: grid;
  grid-template-columns: auto auto 12px;
  align-items: center;
  min-height: 48px;
  padding: 8px 13px;
  gap: 7px;
  cursor: pointer;
  font-family: var(--font-grotesk);
  border: 3px solid var(--stroke);
  border-radius: 11px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--shadow);
}
.control-menu-caption {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
}
.control-menu-trigger strong { font-size: 12.5px; }
.control-menu-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--dur-state) var(--ease-out);
}
.control-menu-trigger[aria-expanded="true"] .control-menu-chevron {
  transform: translateY(2px) rotate(225deg);
}
.control-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  min-width: 220px;
  padding: 7px;
  border: 3px solid var(--stroke);
  border-radius: 12px;
  background: var(--card);
  box-shadow: 4px 4px 0 var(--shadow);
}
.control-popover[hidden] { display: none; }
@keyframes rz-popover-in {
  from { opacity: 0; transform: translateY(-4px); }
}
.control-popover:not([hidden]) {
  animation: rz-popover-in var(--dur-state) var(--ease-out) both;
}
.control-popover.is-leaving {
  animation: none;
  opacity: 0;
  transition: opacity 120ms var(--ease-out);
}
.control-menu-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  cursor: pointer;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: 600 13px var(--font-grotesk);
  text-align: left;
  transition: background-color var(--dur-chip) var(--ease-out),
              border-color var(--dur-chip) var(--ease-out),
              color var(--dur-chip) var(--ease-out);
}
.control-menu-option::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border: 2px solid var(--dim);
  border-radius: 50%;
}
.control-menu-option[aria-checked="true"] {
  background: var(--ink);
  color: var(--card);
}
.control-menu-option[aria-checked="true"]::before {
  border-color: var(--brand);
  background: var(--brand);
}
.control-menu-trigger:focus-visible,
.control-menu-option:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

/* ===================== Cabeçalho da lista ===================== */
.section { margin-top: 26px; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 15px; }
.section-title {
  margin: 0;
  white-space: nowrap;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dim);
}
.section-rule { flex: 1; height: 2px; border-radius: 2px; background: var(--panelBorder); }

.placeholder-note { margin: 26px 0 0; font-size: 14px; color: var(--dim); }

/* Estado vazio de filtro/busca */
.filter-empty {
  margin-top: 26px;
  padding: 40px 20px;
  text-align: center;
  border: 3px dashed var(--panelBorder);
  border-radius: 14px;
  background: var(--card);
}
.filter-empty-title { margin-bottom: 8px; font-weight: 700; font-size: 15px; letter-spacing: 0.02em; color: var(--ink); }
.filter-empty-body { margin: 0; font-weight: 500; font-size: 13px; color: var(--dim); }
.filter-empty-action {
  min-height: 44px;
  margin-top: 18px;
  padding: 9px 14px;
  cursor: pointer;
  border: 3px solid var(--stroke);
  border-radius: 10px;
  background: var(--brand);
  color: var(--stroke);
  box-shadow: var(--shadow-block);
  font: 700 12px var(--font-grotesk);
  transition: transform var(--dur-state) var(--ease-out),
              box-shadow var(--dur-state) var(--ease-out);
}
.filter-empty-action:active { transform: translate(2px, 2px); box-shadow: none; }

.catalog-explainer {
  margin: -3px 0 12px;
  color: var(--dim);
  font: 500 13px/1.5 var(--font-grotesk);
}
.catalog-list { display: grid; gap: 8px; }
.catalog-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 10px 14px;
  border: 2px solid var(--panelBorder);
  border-radius: 10px;
  background: var(--card);
}
.catalog-item-name { color: var(--ink); font: 700 14px var(--font-grotesk); }
.catalog-item-state {
  flex: 0 0 auto;
  color: var(--dim);
  font: 700 10px var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ===================== Board / cards ===================== */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.zcard {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 19px;
  border: 3px solid var(--panelBorder);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow-block);
}
/* Card com dado é clicável e levanta no hover. "Em observação" não é clicável.
   Nenhum card é promovido sobre outro — isso seria classificação de valor. */
.zcard.is-clickable {
  cursor: pointer;
  transition: transform var(--dur-state) var(--ease-out),
              box-shadow var(--dur-state) var(--ease-out);
}
@media (hover: hover) {
  .zcard.is-clickable:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-block-up);
  }
}
.zcard.is-clickable:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--stroke); }
.zcard.is-clickable:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Tag de variação no topo. Cor carrega o sinal (subiu/caiu), texto carrega o
   número. Verde = alta, coral = queda — direção do movimento, não veredito. */
.badge {
  flex: none;
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  padding: 5px 9px;
  border: 3px solid var(--stroke);
  border-radius: 7px;
  font-variant-numeric: tabular-nums;
  background: var(--track);
  color: var(--dim);
  transition: background-color var(--dur-chip) var(--ease-out),
              border-color var(--dur-chip) var(--ease-out),
              color var(--dur-chip) var(--ease-out);
}
.badge-alta { background: var(--badgeGreenBg); color: var(--badgeGreenInk); }
.badge-queda { background: var(--badgeRedBg); color: var(--badgeRedInk); }
.badge-brand { background: var(--brand); color: var(--stroke); }

.zcard-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.zcard-name { margin: 2px 0 0; font-weight: 700; font-size: 21px; line-height: 1.2; color: var(--ink); }

.zcard-price-label {
  display: block;
  margin-bottom: 3px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--label);
}
.zcard-price {
  margin: 0;
  font-weight: 700;
  font-size: 33px;
  line-height: 1.02;
  letter-spacing: 0.005em;
  font-variant-numeric: tabular-nums;
  color: var(--price);
}
.unit { font-size: 13px; color: var(--dim); font-weight: 600; }

/* ===================== Medidor preço-vs-normal ===================== */
.gauge-title {
  margin: 18px 0 0;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--label);
}
.gauge {
  position: relative;
  height: 14px;
  margin: 18px 0 28px;
  background: var(--track);
  border-radius: 7px;
}
.gauge-band {
  position: absolute;
  inset: 0 auto;
  left: 20%;
  width: 60%;
  background: var(--bandFill);
  border: 1px solid var(--bandStroke);
  border-radius: 7px;
}
.gauge-marker {
  position: absolute;
  top: -4px;
  bottom: -4px;
  transform: translateX(-50%);
  width: 4px;
  border-radius: 2px;
  color: var(--gaugeNeutral);
  background: currentColor;
  transition: left var(--dur-data) var(--ease-out),
              background-color var(--dur-data) var(--ease-out);
}
.gauge-marker[data-dir="below"] { color: var(--green); }
.gauge-marker[data-dir="above"] { color: var(--coral); }
.gauge-marker[data-clamped="true"]::after {
  content: "›";
  position: absolute;
  top: 50%;
  left: 7px;
  transform: translateY(-50%);
  font: 700 10px var(--font-grotesk);
  color: currentColor;
}
.gauge-marker[data-dir="below"][data-clamped="true"]::after {
  content: "‹";
  left: auto;
  right: 7px;
}
.gauge-min,
.gauge-max {
  position: absolute;
  top: 20px;
  font-weight: 600;
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gauge-max { transform: translateX(-100%); }
.gauge.labels-stacked { margin-bottom: 42px; }
.gauge.labels-stacked .gauge-max { top: 36px; }
.gauge-cap { margin: 0; font-weight: 600; font-size: 12.5px; line-height: 1.45; }
.gauge-cap b { font-weight: 700; }
.gauge-cap span { color: var(--dim); }

/* ===================== Divisor + métricas do card ===================== */
.zcard-divider { height: 2px; background: var(--panelBorder); border-radius: 2px; margin: 15px 0 13px; }
.zcard-metrics { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; color: var(--dim); }
.metric { display: flex; justify-content: space-between; }
.metric-value { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* "Ver histórico" — afordância neutra; o card inteiro é o alvo de clique. */
.zcard-cta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label);
}

/* Card em observação: sem medidor, com nota do porquê. */
.obs-label {
  display: block;
  margin: 8px 0 6px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--label);
}
.obs-note {
  margin: 6px 0 0;
  padding: 18px 14px;
  text-align: center;
  font-weight: 500;
  font-size: 13px;
  color: var(--dim);
  background: var(--track);
  border: 2.5px dashed var(--panelBorder);
  border-radius: 10px;
}

/* ===================== Loading ===================== */
.loading-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  margin-top: 26px;
}
@keyframes rz-pulse {
  from { opacity: .5; }
  to { opacity: 1; }
}
.skeleton {
  display: block;
  background: var(--barFill);
  border-radius: 6px;
  animation: rz-pulse 1200ms var(--ease-inout) infinite alternate;
}
.skeleton-card { min-height: 320px; gap: 14px; }
.skeleton-badge { width: 112px; height: 28px; }
.skeleton-name { width: 68%; height: 24px; }
.skeleton-label { width: 38%; height: 11px; margin-top: 8px; }
.skeleton-price { width: 72%; height: 38px; }
.skeleton-gauge { width: 100%; height: 14px; margin: 16px 0 12px; }
.skeleton-line { width: 100%; height: 13px; }
.skeleton-line-short { width: 76%; }

@keyframes rz-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
#panel.is-first-paint .zcard { animation: rz-enter var(--dur-enter) var(--ease-out) both; }
#panel.is-first-paint .zcard:nth-child(1) { animation-delay: 0ms; }
#panel.is-first-paint .zcard:nth-child(2) { animation-delay: 40ms; }
#panel.is-first-paint .zcard:nth-child(3) { animation-delay: 80ms; }
#panel.is-first-paint .zcard:nth-child(4) { animation-delay: 120ms; }
#panel.is-first-paint .zcard:nth-child(5) { animation-delay: 160ms; }
#panel.is-first-paint .zcard:nth-child(6) { animation-delay: 200ms; }
#panel.is-first-paint .zcard:nth-child(n + 7) { animation-delay: 200ms; }
#panel.is-swapping { opacity: 0; transition: opacity 120ms var(--ease-inout); }

@keyframes rz-tag-drop {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
.masthead-brand .logo-mark.is-greeting {
  animation: rz-tag-drop var(--dur-brand) var(--ease-out) both;
}

/* ===================== Rodapé ===================== */
.colophon { margin-top: 34px; font-weight: 500; font-size: 12px; line-height: 1.6; color: var(--dim); }
.colophon p { margin: 0; max-width: 70ch; }

/* ===================== Modal de detalhe ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 34px 20px;
  overflow: auto;
  background: rgba(8, 6, 14, 0.55);
  backdrop-filter: blur(2px);
  animation: modal-backdrop-in 160ms var(--ease-out) both;
}
.modal {
  width: 100%;
  max-width: 880px;
  background: var(--card);
  overflow: hidden;
  border: 3px solid var(--stroke);
  border-radius: 18px;
  box-shadow: 10px 10px 0 var(--shadow);
  animation: modal-in var(--dur-enter) var(--ease-out) both;
}
@keyframes modal-in { from { transform: translateY(16px); opacity: 0; } }
@keyframes modal-backdrop-in { from { opacity: 0; } }
.modal.is-leaving,
.modal-overlay.is-leaving {
  animation: none;
  opacity: 0;
  transition: opacity 160ms var(--ease-out);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 3px solid var(--panelBorder);
}
.modal-head { display: flex; align-items: center; gap: 12px; }
.modal-title { font-weight: 700; font-size: 21px; line-height: 1; color: var(--ink); }
.modal-eyebrow {
  margin-top: 5px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.modal-close {
  flex: none;
  width: 40px;
  height: 40px;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  background: var(--card);
  border: 3px solid var(--stroke);
  border-radius: 11px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--shadow);
}
.modal-close:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--shadow); }
.modal-body { padding: 18px; }
.modal-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 11px; margin-bottom: 14px; }
.modal-tile {
  padding: 12px 13px;
  background: var(--card);
  border: 3px solid var(--stroke);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.modal-tile-label { font-weight: 700; font-size: 10px; letter-spacing: 0.06em; line-height: 1.4; color: var(--dim); }
.modal-tile-value { margin-top: 8px; font-weight: 700; font-size: 24px; font-variant-numeric: tabular-nums; }
.modal-tile-value .unit { font-size: 11px; }
.modal-tile.tone-ink .modal-tile-value { color: var(--ink); }
.modal-tile.tone-green .modal-tile-value { color: var(--green); }
.modal-tile.tone-label .modal-tile-value { color: var(--label); }
.modal-tile.tone-coral .modal-tile-value { color: var(--coral); }

.modal-subline { margin: 0 0 16px; font-weight: 500; font-size: 13px; color: var(--dim); }
.modal-subline b { color: var(--ink); font-variant-numeric: tabular-nums; }
.modal-subline .delta-up { color: var(--green); }
.modal-subline .delta-down { color: var(--coral); }

/* ===================== Histórico / gráficos ===================== */
.modal-hist { padding: 15px 15px 12px; border: 3px solid var(--panelBorder); border-radius: 13px; background: var(--card); }
.modal-hist-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}
.modal-hist-label { font-weight: 700; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.modal-hist-range { font-weight: 600; font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.modal-hist-body { margin: 0; max-width: 60ch; font-weight: 500; font-size: 13px; color: var(--dim); }

/* Altura fixa + preserveAspectRatio:none no SVG: o gráfico estica na largura
   disponível sem deformar a espessura dos traços (todo stroke usa
   vector-effect: non-scaling-stroke). */
.chart-wrap { width: 100%; }
.chart-interactive { position: relative; }
.chart-interactive:focus-visible {
  border-radius: 8px;
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
.chart { display: block; width: 100%; height: 190px; overflow: visible; }
.chart-interactive .chart {
  cursor: crosshair;
  touch-action: pan-y;
}
.chart-vol { height: 56px; }
.chart-grid { stroke: var(--panelBorder); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.chart-normal {
  stroke: var(--dim);
  stroke-width: 2;
  stroke-dasharray: 7 5;
  vector-effect: non-scaling-stroke;
}
.chart-line {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.chart-dot { fill: var(--brand); stroke: var(--card); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-guide {
  stroke: var(--brand);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.chart-active-dot {
  fill: var(--card);
  stroke: var(--brand);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.chart-tooltip {
  position: absolute;
  top: 8px;
  z-index: 2;
  display: grid;
  min-width: 174px;
  padding: 9px 11px;
  border: 2px solid var(--panelBorder);
  border-radius: 9px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-block);
  transform: translateX(-50%);
  pointer-events: none;
  font-size: 11px;
  line-height: 1.4;
}
.chart-tooltip.is-start { transform: translateX(0); }
.chart-tooltip.is-end { transform: translateX(-100%); }
.chart-tooltip-date {
  margin-bottom: 2px;
  color: var(--dim);
  font-family: var(--font-pixel);
  font-size: 9px;
  letter-spacing: .04em;
}
.chart-tooltip-price { color: var(--brand); font-weight: 800; }
.chart-tooltip-detail { color: var(--dim); }
.chart-bar { fill: var(--barFill); }
.chart-tick { font-family: var(--font-grotesk); font-size: 12px; font-weight: 600; fill: var(--dim); }
.chart-caption { margin: 14px 0 6px; font-weight: 700; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; font-weight: 600; font-size: 11px; color: var(--dim); }
.chart-key { display: inline-flex; align-items: center; gap: 6px; }
.chart-key-line { width: 16px; height: 3px; border-radius: 2px; background: var(--brand); }
.chart-key-normal {
  width: 16px;
  height: 0;
  border-top: 2px dashed var(--dim);
}

/* ===================== Responsivo ===================== */
@media (max-width: 780px) {
  body { padding: 20px 14px 40px; }
  .masthead { flex-direction: column; align-items: flex-start; }
  .masthead-meta { align-items: flex-start; }
  .board { grid-template-columns: 1fr; }
  .view-controls { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .control-menu-trigger { width: 100%; grid-template-columns: 1fr 12px; justify-items: start; }
  .control-menu-caption { grid-column: 1; }
  .control-menu-trigger strong { grid-column: 1; }
  .control-menu-chevron { grid-column: 2; grid-row: 1 / span 2; }
  .control-popover { width: max(100%, 210px); }
  .control-menu:last-child .control-popover { right: 0; left: auto; }
  .loading-board { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .modal-overlay,
  .modal,
  #panel.is-swapping {
    transition-duration: 120ms !important;
  }
  .skeleton { animation: none !important; opacity: .7; }
}
