/* Layout: uma coluna no celular; no desktop, clima/câmbio/juros/feriados à esquerda e o hortifrúti numa coluna alta à direita. */
:root {
  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-2: #f4f7f5;
  --ink: #142019;
  --muted: #5b6b62;
  --line: #dbe3de;
  --accent: #c95a14;        /* laranja-cenoura */
  --accent-soft: #fbeadf;
  --alta: #b8322a;
  --alta-soft: #fae6e3;
  --baixa: #127a57;
  --baixa-soft: #def2ea;
  --sol: #df960c;
  --nuvem: #8a9a91;
  --chuva: #2a6fbd;
  --chuva-soft: #e3edf9;
  --frio: #4b8bd3;
  --quente: #e0702a;
  --skeleton: #e4eae6;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-texto: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;

  --raio: 16px;
  --raio-p: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1411; --surface: #151d19; --surface-2: #1b2520; --ink: #e6ede9; --muted: #97a69e;
    --line: #26322c; --accent: #f08a3c; --accent-soft: #3a2416; --alta: #f17d70; --alta-soft: #3a1e1b;
    --baixa: #4fc795; --baixa-soft: #12301f; --sol: #f2b63c; --nuvem: #8d9c94; --chuva: #6aa8f0;
    --chuva-soft: #172a40; --frio: #6aa8f0; --quente: #f08a3c; --skeleton: #212c26;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1411; --surface: #151d19; --surface-2: #1b2520; --ink: #e6ede9; --muted: #97a69e;
  --line: #26322c; --accent: #f08a3c; --accent-soft: #3a2416; --alta: #f17d70; --alta-soft: #3a1e1b;
  --baixa: #4fc795; --baixa-soft: #12301f; --sol: #f2b63c; --nuvem: #8d9c94; --chuva: #6aa8f0;
  --chuva-soft: #172a40; --frio: #6aa8f0; --quente: #f08a3c; --skeleton: #212c26;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 116px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.45 var(--f-texto);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: inherit; }
h2, h3 { margin: 0; text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg { display: block; }

/* ---------- Cabeçalho ---------- */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 11; background: var(--bg);
}
.topo {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topo-linha, .atalhos {
  max-width: 1180px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.topo-linha { display: flex; align-items: center; gap: 12px; padding-block: 10px 6px; }
.marca {
  font: 700 26px/1 var(--f-display); letter-spacing: -0.04em; text-decoration: none;
  font-variation-settings: "opsz" 96;
}
.marca span { color: var(--accent); }
.topo-local { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.topo-local strong { font-size: 14px; font-weight: 600; }
.topo-local span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icone {
  width: 42px; height: 42px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer;
}
.btn-icone svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-icone:hover { border-color: var(--muted); }
.btn-icone.girando svg { animation: girar 0.9s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.atalhos { display: flex; gap: 6px; overflow-x: auto; padding-block: 4px 10px; scrollbar-width: none; }
.atalhos::-webkit-scrollbar { display: none; }
.atalhos a {
  flex: none; text-decoration: none; font-size: 13.5px; font-weight: 500; color: var(--muted);
  padding: 7px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
}
.atalhos a:hover { color: var(--ink); }

/* ---------- Grade ---------- */
.grade {
  max-width: 1180px; margin: 0 auto;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  padding-block: 14px 8px;
  display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 960px) {
  .grade {
    gap: 18px; padding-block: 22px 12px;
    padding-left: max(24px, env(safe-area-inset-left, 0px));
    padding-right: max(24px, env(safe-area-inset-right, 0px));
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    grid-template-areas: "tempo horti" "moedas horti" "juros horti" "feriados horti";
    grid-template-rows: auto auto auto 1fr;
    align-items: start;
  }
  .area-tempo { grid-area: tempo; }
  .area-horti { grid-area: horti; }
  .area-moedas { grid-area: moedas; }
  .area-juros { grid-area: juros; }
  .area-feriados { grid-area: feriados; }
}

.painel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--raio);
  padding: 16px; min-width: 0;
}
@media (min-width: 600px) { .painel { padding: 20px 22px; } }
.painel-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.painel-cab h2 { font: 650 19px/1.2 var(--f-display); letter-spacing: -0.015em; }
.painel-sub { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.selo-fonte {
  flex: none; font-size: 10.5px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; margin-top: 2px;
}
.subtitulo {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin: 18px 0 6px;
}
.nota { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); }

/* Estados de carregamento e erro */
.esqueleto {
  display: block; height: 14px; border-radius: 6px; background: var(--skeleton);
  animation: pulsar 1.4s ease-in-out infinite;
}
@keyframes pulsar { 50% { opacity: 0.55; } }
.painel[data-estado="erro"] .corpo { display: none; }
.erro {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: var(--raio-p); background: var(--surface-2); color: var(--muted); font-size: 14px;
}
.erro[hidden] { display: none; }
.erro button {
  font: 600 13.5px var(--f-texto); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; min-height: 38px;
}

/* ---------- Tempo ---------- */
.agora { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px; }
.agora-icone { width: 64px; height: 64px; }
.agora-icone svg { width: 100%; height: 100%; }
.agora-temp {
  font: 600 52px/0.95 var(--f-display); letter-spacing: -0.04em;
  font-variation-settings: "opsz" 96;
}
.agora-desc { font-size: 15px; color: var(--muted); margin-top: 4px; }
.agora-minmax { text-align: right; font-size: 13.5px; color: var(--muted); line-height: 1.6; }
.agora-minmax b { color: var(--ink); font-weight: 600; }

.medidas {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 16px 0 0;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--raio-p); overflow: hidden;
}
.medidas div { background: var(--surface-2); padding: 9px 11px; min-width: 0; }
.medidas dt { font-size: 11.5px; color: var(--muted); }
.medidas dd { margin: 1px 0 0; font-weight: 600; font-size: 15px; white-space: nowrap; }
@media (max-width: 420px) {
  .medidas div { padding: 8px 9px; }
  .medidas dd { font-size: 14px; }
}
.medidas dd small { font-weight: 400; color: var(--muted); font-size: 12px; }

.horas {
  display: flex; gap: 4px; overflow-x: auto; margin: 14px -16px 0; padding: 4px 16px 6px;
  scroll-snap-type: x proximity; scrollbar-width: thin; overscroll-behavior-x: contain;
}
@media (min-width: 600px) { .horas { margin-inline: -22px; padding-inline: 22px; } }
.hora {
  flex: none; width: 54px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0; border-radius: 12px; font-size: 13px;
}
.hora.agora-h { background: var(--accent-soft); }
.hora .h { color: var(--muted); font-size: 12px; }
.hora svg { width: 26px; height: 26px; }
.hora .t { font-weight: 600; }
.hora .p { font-size: 11.5px; color: var(--chuva); font-weight: 600; min-height: 1.2em; }

.dias { list-style: none; margin: 0; padding: 0; }
.dia {
  display: grid; grid-template-columns: 4.6em 26px 3.6em 2.4em minmax(40px, 1fr) 2.4em;
  align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px;
}
.dia:first-child { border-top: 0; }
.dia > .esqueleto { grid-column: 1 / -1; }
.dia .nome { font-weight: 500; }
.dia svg { width: 24px; height: 24px; }
.dia .chuva { font-size: 12px; color: var(--chuva); font-weight: 600; }
.dia .min { color: var(--muted); text-align: right; }
.dia .max { font-weight: 600; }
.faixa { position: relative; height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.faixa i {
  position: absolute; top: -1px; bottom: -1px; border-radius: 999px;
  background: linear-gradient(90deg, var(--frio), var(--quente));
}

/* Ícones do tempo */
.ic-sol { fill: var(--sol); stroke: var(--sol); stroke-width: 2; stroke-linecap: round; }
.ic-lua { fill: var(--nuvem); }
.ic-nuvem { fill: var(--surface-2); stroke: var(--nuvem); stroke-width: 1.6; }
.ic-chuva { stroke: var(--chuva); stroke-width: 1.8; stroke-linecap: round; fill: none; }
.ic-raio { fill: var(--sol); }
.ic-nevoa { stroke: var(--nuvem); stroke-width: 1.8; stroke-linecap: round; fill: none; }

/* ---------- Listas (hortifrúti e câmbio) ---------- */
.filtros { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px 8px; padding: 0 16px 4px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
@media (min-width: 600px) { .filtros { flex-wrap: wrap; margin-inline: 0; padding-inline: 0; } }
.filtros button {
  flex: none; font: 500 13.5px var(--f-texto); color: var(--muted); cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; min-height: 36px;
}
.filtros button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.lista { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) 72px auto; align-items: center; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.item:first-child { border-top: 0; }
.item-nome { min-width: 0; }
.item-nome strong { display: block; font-weight: 600; font-size: 15px; }
.item-nome span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-valor { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.item-valor b { font: 600 17px/1.1 var(--f-display); letter-spacing: -0.01em; white-space: nowrap; }
.codigo {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); font-weight: 700; font-size: 12px; letter-spacing: 0.03em;
}
.item.moeda { grid-template-columns: 40px minmax(0, 1fr) 72px auto; }

.var {
  font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.var.alta { background: var(--alta-soft); color: var(--alta); }
.var.baixa { background: var(--baixa-soft); color: var(--baixa); }

.spark { width: 72px; height: 30px; overflow: visible; }
.spark .linha { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: var(--muted); opacity: 0.1; }
.spark .ponto { fill: var(--muted); }

@media (max-width: 380px) {
  .item { grid-template-columns: minmax(0, 1fr) auto; }
  .item.moeda { grid-template-columns: minmax(0, 1fr) auto; }
  .item .spark { display: none; }
}
@media (max-width: 440px) { .item.moeda .codigo { display: none; } }
@media (min-width: 381px) and (max-width: 440px) {
  .item.moeda { grid-template-columns: minmax(0, 1fr) 64px auto; }
  .item.moeda .spark { width: 64px; }
}

/* ---------- Juros ---------- */
.taxas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.taxas div { background: var(--surface-2); border-radius: var(--raio-p); padding: 12px; min-width: 0; }
.taxas dt { font-size: 12.5px; color: var(--muted); }
.taxas dd { margin: 2px 0 0; font: 600 24px/1.15 var(--f-display); letter-spacing: -0.02em; }
.taxas dd small { display: block; font: 400 11.5px/1.3 var(--f-texto); color: var(--muted); letter-spacing: 0; margin-top: 2px; }

/* ---------- Feriados ---------- */
.feriados { list-style: none; margin: 0; padding: 0; }
.feriado {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.feriado:first-child { border-top: 0; }
.calendario {
  width: 48px; border-radius: 10px; overflow: hidden; text-align: center; border: 1px solid var(--line);
  background: var(--surface);
}
.calendario span { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; background: var(--accent); color: var(--surface); padding: 2px 0; }
.calendario b { display: block; font: 600 19px/1.4 var(--f-display); }
.feriado-nome strong { display: block; font-weight: 600; }
.feriado-nome span { font-size: 12.5px; color: var(--muted); }
.pill {
  display: block; width: fit-content; margin-top: 4px;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent);
}
.pill.neutra { background: var(--surface-2); color: var(--muted); }

/* ---------- Rodapé ---------- */
.rodape {
  max-width: 1180px; margin: 0 auto; color: var(--muted); font-size: 12.5px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 8px 28px;
}
@media (min-width: 960px) { .rodape { padding-left: max(24px, env(safe-area-inset-left, 0px)); } }
.rodape p { margin: 6px 0; max-width: 72ch; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .esqueleto, .btn-icone.girando svg { animation: none; }
}
