/* Antenado — estilos (mobile first) */
:root {
  --fs: 1;
  --bg: #F5F4F0;
  --surface: #FFFFFF;
  --surface-2: #EEECE6;
  --text: #16181D;
  --muted: #565C66;
  --faint: #868B94;
  --line: #E3E0D9;
  --accent: #D93A22;
  --accent-ink: #FFFFFF;
  --accent-soft: #FCE7E2;
  --chip-bg: #FFFFFF;
  --chip-line: #DCD9D1;
  --chip-on-bg: #16181D;
  --chip-on-text: #FFFFFF;
  --topbar-bg: rgba(245, 244, 240, .88);
  --shadow: 0 1px 2px rgba(22, 24, 29, .05);
  --sheet-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
  --radius: 14px;
  --gutter: 16px;
  --topbar-h: 52px;
  --tabbar-h: 60px;

  --t-politica: #6D28D9;
  --t-economia: #0F766E;
  --t-imoveis: #B45309;
  --t-tecnologia: #1D4ED8;
  --t-saude: #DC2626;
  --t-ciencia: #0E7490;
  --t-educacao: #A16207;
  --t-seguranca: #475569;
  --t-meioambiente: #4D7C0F;
  --t-esportes: #C2410C;
  --t-cultura: #BE185D;
  --t-kw: #D93A22;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1116;
    --surface: #161A21;
    --surface-2: #1E232C;
    --text: #E8EAED;
    --muted: #A9B0BA;
    --faint: #7A818D;
    --line: #262C36;
    --accent: #FF6A4D;
    --accent-ink: #14161A;
    --accent-soft: #3A1E19;
    --chip-bg: #161A21;
    --chip-line: #2C323D;
    --chip-on-bg: #E8EAED;
    --chip-on-text: #0E1116;
    --topbar-bg: rgba(14, 17, 22, .88);
    --shadow: none;
    --sheet-shadow: 0 -8px 30px rgba(0, 0, 0, .5);
    --t-politica: #B79CFF;
    --t-economia: #4FD1C5;
    --t-imoveis: #F6AD55;
    --t-tecnologia: #7AA7FF;
    --t-saude: #FF8A8A;
    --t-ciencia: #5CC8E0;
    --t-educacao: #E9C46A;
    --t-seguranca: #A0AEC0;
    --t-meioambiente: #A3D977;
    --t-esportes: #FF9F66;
    --t-cultura: #F48FB1;
    --t-kw: #FF6A4D;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0E1116;
  --surface: #161A21;
  --surface-2: #1E232C;
  --text: #E8EAED;
  --muted: #A9B0BA;
  --faint: #7A818D;
  --line: #262C36;
  --accent: #FF6A4D;
  --accent-ink: #14161A;
  --accent-soft: #3A1E19;
  --chip-bg: #161A21;
  --chip-line: #2C323D;
  --chip-on-bg: #E8EAED;
  --chip-on-text: #0E1116;
  --topbar-bg: rgba(14, 17, 22, .88);
  --shadow: none;
  --sheet-shadow: 0 -8px 30px rgba(0, 0, 0, .5);
  --t-politica: #B79CFF;
  --t-economia: #4FD1C5;
  --t-imoveis: #F6AD55;
  --t-tecnologia: #7AA7FF;
  --t-saude: #FF8A8A;
  --t-ciencia: #5CC8E0;
  --t-educacao: #E9C46A;
  --t-seguranca: #A0AEC0;
  --t-meioambiente: #A3D977;
  --t-esportes: #FF9F66;
  --t-cultura: #F48FB1;
  --t-kw: #FF6A4D;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  font-size: calc(16px * var(--fs));
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.ic { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.fill { fill: currentColor; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.14rem; letter-spacing: -.01em; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; flex: none; }
.status { flex: 1; min-width: 0; text-align: right; font-size: .76rem; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.warn { color: var(--accent); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 12px; color: var(--muted); flex: none;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn[aria-pressed="true"] { color: var(--accent); }
#btnRefresh .ic { width: 1.3em; height: 1.3em; }
.spinning .ic { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease, opacity .4s ease; }

/* ---------- Estrutura ---------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 12px var(--gutter) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px);
}
.page-title { font-size: 1.6rem; letter-spacing: -.02em; margin: 6px 0 4px; }
.page-sub { color: var(--muted); margin: 0 0 16px; font-size: .92rem; }

/* ---------- Barra de abas ---------- */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabbar button {
  flex: 1;
  max-width: 180px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: .7rem; font-weight: 600; color: var(--faint);
  position: relative;
}
.tabbar button .ic { width: 1.45rem; height: 1.45rem; }
.tabbar button[aria-current="page"] { color: var(--text); }
.tabbar button[aria-current="page"]::before {
  content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.tabbar .badge {
  position: absolute; top: 7px; left: calc(50% + 6px);
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: .64rem; line-height: 17px; text-align: center;
}

/* ---------- Chips e segmentos ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter);
  scroll-padding: 0 var(--gutter);
}
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
  flex: none;
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: 17px;
  background: var(--chip-bg); border: 1px solid var(--chip-line);
  font-size: .86rem; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.chip.on { background: var(--chip-on-bg); border-color: var(--chip-on-bg); color: var(--chip-on-text); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--faint)); }
.chip .ic { width: 1rem; height: 1rem; }
.chip .x { margin-right: -5px; opacity: .7; }
.chip.ghost { border-style: dashed; }

.seg {
  display: flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--surface-2);
  overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: 1 0 auto; height: 34px; padding: 0 12px; border-radius: 9px;
  font-size: .86rem; font-weight: 650; color: var(--muted); white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.small button { height: 28px; padding: 0 10px; font-size: .78rem; }
.seg.regions button { padding: 0 6px; font-size: .84rem; }

/* ---------- Filtros (aba Notícias) ---------- */
.filters {
  position: sticky;
  top: calc(var(--topbar-h) + env(safe-area-inset-top));
  z-index: 20;
  margin: -12px calc(var(--gutter) * -1) 10px;
  padding: 10px var(--gutter) 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: grid; gap: 8px;
  transition: transform .22s ease;
}
.filters.tucked { transform: translateY(-100%); }
.meta-row { display: flex; align-items: center; gap: 6px; }
.meta-row .count { font-size: .8rem; color: var(--faint); margin-right: auto; white-space: nowrap; }
.meta-row .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
.search-row { display: flex; gap: 8px; }
.search-row input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--chip-line); background: var(--surface); font-size: 1rem;
}
.notice { font-size: .82rem; color: var(--muted); padding: 6px 2px 10px; display: flex; gap: 8px; align-items: center; }
.notice .ic { width: 1rem; height: 1rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  overflow: hidden;
}
.card-link { display: flex; gap: 12px; padding: 14px 14px 6px; }
.card-body { flex: 1; min-width: 0; }
.kicker { display: flex; align-items: center; gap: 8px; min-height: 16px; margin-bottom: 4px; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .68rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--c, var(--faint));
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.new { font-size: .64rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 5px; }
.title { font-size: 1.04rem; line-height: 1.32; font-weight: 680; margin: 0; letter-spacing: -.005em; overflow-wrap: anywhere; }
.summary {
  margin: 6px 0 0; font-size: .9rem; line-height: 1.45; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.also { margin: 6px 0 0; font-size: .8rem; color: var(--faint); }
.thumb { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); }
.meta {
  display: flex; align-items: center; gap: 6px; padding: 0 6px 6px 14px;
  font-size: .78rem; color: var(--faint); min-height: 40px;
}
.meta .src { font-weight: 650; color: var(--muted); max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .spacer { flex: 1; }
.meta .icon-btn { width: 36px; height: 36px; color: var(--faint); }
.meta .icon-btn[aria-pressed="true"] { color: var(--accent); }
.more {
  font-size: .76rem; font-weight: 650; color: var(--muted); background: var(--surface-2);
  padding: 3px 8px; border-radius: 10px; white-space: nowrap;
}
.card.read .title, .row.read .title { color: var(--faint); font-weight: 600; }

/* Lista compacta */
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; align-items: flex-start; gap: 10px; padding: 12px 6px 10px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .row-link { flex: 1; min-width: 0; display: flex; gap: 12px; }
.row .title { font-size: .98rem; font-weight: 640; }
.row .meta { padding: 4px 0 0; min-height: 0; }
.row .num { font-size: 1.5rem; font-weight: 800; color: var(--accent); line-height: 1.1; min-width: 1.1em; font-variant-numeric: tabular-nums; }
.row .icon-btn { width: 36px; height: 36px; margin-top: -6px; color: var(--faint); }
.row .icon-btn[aria-pressed="true"] { color: var(--accent); }
.empty-row { margin: 0; padding: 14px; color: var(--faint); font-size: .88rem; }

/* ---------- Início ---------- */
.hello { margin: 4px 0 12px; }
.hello small { display: block; color: var(--faint); font-size: .85rem; font-weight: 600; }
.hello h1 { margin: 2px 0 0; font-size: 1.5rem; letter-spacing: -.02em; line-height: 1.2; }
.quick { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1) 14px; padding: 2px var(--gutter); }
.quick::-webkit-scrollbar { display: none; }
.pill {
  flex: none; display: flex; flex-direction: column; gap: 1px; text-align: left;
  padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 112px;
}
.pill small { font-size: .7rem; color: var(--faint); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.pill strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.pill .up { color: #16A34A; font-size: .76rem; font-weight: 700; }
.pill .down { color: #DC2626; font-size: .76rem; font-weight: 700; }
.label { font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin: 0 0 6px; }
.home-bar { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 700; font-size: .9rem;
  background: var(--surface); border: 1px solid var(--chip-line); color: var(--text);
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { height: 34px; padding: 0 12px; font-size: .84rem; }
.btn.block { width: 100%; }
.btn .ic { width: 1.05rem; height: 1.05rem; }
.newcount { font-size: .82rem; color: var(--accent); font-weight: 700; }
.hsec { margin-top: 22px; }
.hsec-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 8px; }
.hsec-head h2 { margin: 0; font-size: 1.12rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.hsec-head h2 .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); }
.link-btn { display: inline-flex; align-items: center; gap: 2px; font-size: .84rem; font-weight: 700; color: var(--accent); }
.link-btn .ic { width: 1rem; height: 1rem; }

.welcome {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 14px 14px 12px; margin-bottom: 14px;
}
.welcome h2 { margin: 0 0 6px; font-size: 1.05rem; }
.welcome ul { margin: 0 0 10px; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.welcome li { margin: 3px 0; }

.empty {
  text-align: center; padding: 36px 16px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--chip-line); border-radius: var(--radius);
}
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 1.05rem; }
.empty p { margin: 0 0 14px; font-size: .9rem; }

/* Esqueleto de carregamento */
.skel { height: 96px; border-radius: var(--radius); margin-bottom: 10px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; border: 1px solid var(--line); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* ---------- Ajustes ---------- */
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.group h2 { margin: 0 0 4px; font-size: 1.05rem; }
.group h3 { margin: 16px 0 8px; font-size: .9rem; color: var(--muted); }
.hint { margin: 0 0 8px; font-size: .86rem; color: var(--muted); }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.fav-topic {
  display: flex; align-items: center; gap: 8px; padding: 10px 10px; border-radius: 12px;
  background: var(--bg); border: 1px solid var(--line); font-size: .88rem; font-weight: 650; text-align: left;
}
.fav-topic .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.fav-topic span { flex: 1; min-width: 0; }
.fav-topic .ic { color: var(--faint); width: 1.1rem; height: 1.1rem; }
.fav-topic[aria-pressed="true"] { border-color: var(--accent); }
.fav-topic[aria-pressed="true"] .ic { color: var(--accent); fill: currentColor; }
.kw-form { display: flex; gap: 8px; margin-bottom: 10px; }
.kw-form input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--chip-line); background: var(--bg); font-size: 1rem; }
.suggest { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.suggest .chip { height: 30px; font-size: .8rem; padding: 0 10px; }
.sc-list { display: grid; gap: 6px; }
.sc-item { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); font-size: .88rem; font-weight: 600; }
.sc-item span { flex: 1; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.switch-row:first-of-type { border-top: 0; }
.grp-label { font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); margin: 14px 0 2px; }
.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--chip-line); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.setting { margin-top: 12px; }
.setting > .label { margin-bottom: 6px; }
.fs-row { display: flex; align-items: center; gap: 10px; }
.fs-row output { min-width: 3.5em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fail-list { margin: 8px 0 0; padding-left: 18px; font-size: .82rem; color: var(--muted); }
.about { font-size: .82rem; color: var(--faint); text-align: center; padding: 6px 12px 0; }
.text-input { width: 100%; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--chip-line); background: var(--bg); font-size: .95rem; }

/* ---------- Folha inferior (fontes da notícia) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .38); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-width: 720px; margin: 0 auto; max-height: 82vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0; box-shadow: var(--sheet-shadow);
  padding: 8px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--chip-line); margin: 2px auto 12px; }
.sheet h3 { margin: 0 0 6px; font-size: 1.12rem; line-height: 1.3; }
.sheet .summary { -webkit-line-clamp: unset; display: block; margin-bottom: 12px; }
.src-list { list-style: none; margin: 8px 0 14px; padding: 0; border-top: 1px solid var(--line); }
.src-list li { border-bottom: 1px solid var(--line); }
.src-list a { display: block; padding: 10px 2px; }
.src-list b { font-size: .86rem; }
.src-list span { display: block; font-size: .86rem; color: var(--muted); margin-top: 2px; }
.src-list time { font-size: .76rem; color: var(--faint); margin-left: 6px; }

/* ---------- Aviso rápido ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); z-index: 50;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--chip-on-bg); color: var(--chip-on-text); padding: 10px 16px; border-radius: 12px;
  font-size: .88rem; font-weight: 600; max-width: calc(100% - 32px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 760px) {
  .filters { margin-left: 0; margin-right: 0; border-radius: 0 0 14px 14px; }
  .chips { margin: 0; padding: 2px 0; }
  .quick { margin: 0 0 14px; padding: 2px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
