/* Pavio — a mesma família visual do Radar Editorial, de onde nasceu: papel azulado e o lápis azul do editor.
   Uma coluna de leitura calma; o azul só marca o que se pode fazer.

   Regras de legibilidade (revisão de 1/11/2026):
   - texto corrido a 16 px e nada abaixo de 13 px;
   - todo o texto com contraste AA (4,5:1), também nos artigos já lidos;
   - linhas de leitura até cerca de 75 caracteres;
   - campos com contorno visível (3:1) e alvos de toque de 44 px em ecrãs táteis. */

:root {
  color-scheme: light;
  --bg: #edf0f3;
  --surface: #ffffff;
  --surface-2: #f5f7f9;
  --ink: #16202a;
  --ink-2: #333f4a;
  --muted: #535f6a;
  --read: #535f6a;
  --line: #d8dee4;
  --line-strong: #a3aeb8;
  --field: #7d8994;
  --pencil: #1d4fc4;
  --pencil-hover: #173fa0;
  --pencil-ink: #ffffff;
  --pencil-soft: #e4ebfb;
  --red: #b3302a;
  --red-soft: #fbe8e6;
  --green: #1c6f46;
  --overlay: 0 12px 32px rgba(22, 32, 42, .16), 0 2px 6px rgba(22, 32, 42, .08);
  --font: "Schibsted Grotesk Variable", "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --rail: 256px;
  --control: 40px;
  --measure: 60ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121a21;
    --surface: #1a232c;
    --surface-2: #202a34;
    --ink: #e6ebf0;
    --ink-2: #c4cdd5;
    --muted: #9eabb6;
    --read: #9eabb6;
    --line: #2d3944;
    --line-strong: #40505e;
    --field: #687a89;
    --pencil: #86a6ff;
    --pencil-hover: #a6bfff;
    --pencil-ink: #0c1530;
    --pencil-soft: #1f2b4a;
    --red: #ff8c82;
    --red-soft: #3b2222;
    --green: #72d29e;
    --overlay: 0 16px 40px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
  }
}

/* Em ecrãs táteis, todos os controlos ficam com 44 px de altura. */
@media (pointer: coarse) {
  :root { --control: 44px; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
::placeholder { color: var(--muted); opacity: 1; }
:focus-visible { outline: 3px solid var(--pencil); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -56px; background: var(--pencil); color: var(--pencil-ink); padding: 10px 14px; border-radius: var(--r-sm); z-index: 10; font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 20px 14px; border-right: 1px solid var(--line); background: var(--surface-2);
  display: flex; flex-direction: column; gap: 18px;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 0 6px; }
.logo { width: 30px; height: 30px; fill: none; stroke: var(--pencil); stroke-width: 2.4; stroke-linecap: round; flex: none; }
.logo circle { fill: var(--pencil); stroke: none; }
.brand h1 { margin: 0; font-size: 18px; line-height: 1.2; letter-spacing: -.01em; }
.brand p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.3; color: var(--muted); }

.views { display: flex; flex-direction: column; gap: 2px; }
.view {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  min-height: 38px; border: 0; background: none; text-align: left; padding: 6px 10px; border-radius: var(--r-sm);
  cursor: pointer; color: var(--ink-2); font-size: 15.5px; font-weight: 500;
}
.view .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view:hover { background: var(--surface); color: var(--ink); }
.view[aria-current="page"] { background: var(--pencil-soft); color: var(--pencil); font-weight: 600; }
.view .count { font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.view[aria-current="page"] .count { color: var(--pencil); }
.view.folder { margin-top: 4px; font-weight: 600; color: var(--ink); }
.view.source { padding-left: 22px; font-weight: 400; font-size: 15px; min-height: 36px; }
.view.source.off .label { text-decoration: line-through; color: var(--muted); }
.view.source.failing .label::after { content: " · erro"; color: var(--red); font-size: 13px; font-weight: 600; }
.nav-label { margin: 14px 10px 4px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.manage { margin-top: auto; }

main { padding: 28px clamp(16px, 4vw, 48px) 80px; max-width: 880px; width: 100%; outline: none; }

/* ---------- Barra ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.toolbar-title h2 { margin: 0; font-size: 28px; line-height: 1.15; letter-spacing: -.02em; }
.status { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; min-height: 22px; }
.controls { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search input, .select select, .add-form input, .source-row input:not([type="checkbox"]) {
  height: var(--control); padding: 0 12px; border: 1px solid var(--field); border-radius: var(--r-sm); background: var(--surface);
  font-size: 16px;
}
.search { flex: 1 1 180px; min-width: 0; }
.search input { width: 100%; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: var(--control); font-size: 15px; color: var(--ink-2); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--pencil); flex: none; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control); padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.button.primary { background: var(--pencil); color: var(--pencil-ink); }
.button.primary:hover { background: var(--pencil-hover); }
.button.ghost { background: var(--surface); border-color: var(--field); color: var(--ink); }
.button.ghost:hover { border-color: var(--pencil); color: var(--pencil); }
.button.danger:hover { border-color: var(--red); color: var(--red); }
.button:disabled { opacity: .7; cursor: default; }
.link-button { border: 0; background: none; padding: 2px 0; min-height: 24px; color: var(--pencil); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-button.warn { color: var(--red); }

/* ---------- Boas-vindas ---------- */
.welcome { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(20px, 4vw, 36px); max-width: 640px; }
.welcome h2 { margin: 0 0 10px; font-size: 26px; line-height: 1.2; letter-spacing: -.02em; }
.welcome > p { color: var(--ink-2); margin: 0 0 20px; font-size: 17px; max-width: 60ch; }
.welcome .welcome-alt { margin-top: 20px; font-size: 15.5px; }
.welcome .privacy { margin: 14px 0 0; font-size: 14.5px; color: var(--muted); }
.add-form { display: flex; gap: 8px; flex-wrap: wrap; }
.add-form input { flex: 1 1 220px; min-width: 0; }
.add-form #addFolder { flex: 1 1 140px; max-width: 220px; }

.candidates:empty { display: none; }
.candidates { margin-top: 14px; }
.candidates .hint { margin: 0 0 8px; font-size: 15px; color: var(--ink-2); }
.candidates ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.candidates li { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.candidates li div { display: grid; min-width: 0; gap: 2px; }
.candidates .muted, .muted { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.error { color: var(--red); background: var(--red-soft); padding: 10px 14px; border-radius: var(--r-sm); margin: 0; font-size: 15px; line-height: 1.45; }

/* ---------- Lista ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.story article {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 20px;
}
.thumb { width: 120px; height: 80px; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-2); display: block; grid-column: 1; grid-row: 1 / span 2; }
.story-body { min-width: 0; grid-column: 2; grid-row: 1; }
.story-actions { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; gap: 8px; }
.story article:not(:has(.thumb)) .story-body,
.story article:not(:has(.thumb)) .story-actions { grid-column: 1 / -1; }

.story h3 { margin: 0; max-width: var(--measure); font-size: 18px; line-height: 1.35; font-weight: 650; letter-spacing: -.01em; }
.story h3 a { text-decoration: none; padding-block: 2px; }
.story h3 a:hover { color: var(--pencil); text-decoration: underline; text-underline-offset: 3px; }
.story h3 a:visited { color: inherit; }
/* Por ler: um ponto azul antes do título (com texto para leitores de ecrã). Lido: título mais leve. */
.unread-dot { display: inline-block; width: 9px; height: 9px; margin: 0 8px 2px 0; border-radius: 50%; background: var(--pencil); vertical-align: middle; }
.meta { margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.meta .source { color: var(--ink-2); font-weight: 600; }
.meta .also { font-size: 14px; }
.excerpt {
  margin: 8px 0 0; max-width: var(--measure); color: var(--ink-2); font-size: 15.5px; line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.also-list { margin: 10px 0 0; padding: 10px 0 0 0; list-style: none; border-top: 1px dashed var(--line); font-size: 15px; display: grid; gap: 6px; max-width: var(--measure); }
.also-list a { font-weight: 600; color: var(--pencil); }
.also-list span { color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; min-height: 34px;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px;
  padding: 4px 14px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--pencil); color: var(--pencil); }
.chip.on { background: var(--pencil-soft); border-color: var(--pencil); color: var(--pencil); }
.story.read h3 { font-weight: 500; }
.story.read h3 a { color: var(--read); }
.story.read .excerpt { color: var(--read); }
.story.read .thumb { opacity: .7; }
.empty { color: var(--muted); padding: 32px 0; text-align: center; font-size: 16px; }
.more { margin: 20px auto 0; display: flex; }

/* ---------- Fontes ---------- */
.sheet {
  width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: var(--overlay);
}
.sheet::backdrop { background: rgba(12, 18, 24, .5); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0; font-size: 22px; }
.sheet-head p { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }
.icon-button { width: 44px; height: 44px; border: 0; background: none; border-radius: var(--r-sm); cursor: pointer; display: grid; place-items: center; }
.icon-button:hover { background: var(--surface-2); }
.icon-button svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.sheet-block { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sheet-block:last-child { border-bottom: 0; }
.sheet-block h3 { margin: 0 0 12px; font-size: 17px; }
.options .row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.source-group + .source-group { margin-top: 16px; }
.source-group h4 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.source-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 170px auto auto; gap: 10px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--line);
}
.source-main { display: grid; min-width: 0; gap: 2px; }
.source-name { width: 100%; font-weight: 600; }
.source-row .source-name { border-color: transparent !important; background: transparent !important; padding-left: 4px !important; height: 34px !important; font-size: 16.5px !important; }
.source-row .source-name:hover, .source-row .source-name:focus { border-color: var(--field) !important; background: var(--surface) !important; }
.source-url { font-size: 14px; color: var(--muted); padding: 2px 0 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health { font-size: 14px; padding-left: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.health.ok { color: var(--green); }
.health.err { color: var(--red); white-space: normal; }
.health.off, .health.idle { color: var(--muted); }
.source-folder { width: 100%; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 14px; align-items: center; width: max-content; max-width: calc(100vw - 32px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--r-md); box-shadow: var(--overlay); font-size: 15px;
}
.toast .link-button { color: var(--bg); }

/* ---------- Telemóvel ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: sticky; top: 0; z-index: 5; height: auto; overflow: visible;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px;
    padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand p { display: none; }
  .brand h1 { font-size: 17px; }
  .logo { width: 26px; height: 26px; }
  .manage { margin: 0 0 0 auto; }
  .views {
    order: 3; flex-direction: row; width: 100%; overflow-x: auto; gap: 6px; padding-bottom: 2px;
    scrollbar-width: none;
  }
  .views::-webkit-scrollbar { display: none; }
  .view { width: auto; flex: none; min-height: var(--control); border: 1px solid var(--line-strong); background: var(--surface); padding: 4px 14px; border-radius: 999px; font-size: 15px; }
  .view.source, .nav-label { display: none; }
  .view.folder { margin: 0; font-weight: 500; color: var(--ink-2); }
  .no-sources .views { display: none; }
  main { padding: 16px 14px 80px; }
  .toolbar { margin-bottom: 16px; gap: 12px; }
  .toolbar-title h2 { font-size: 24px; }
  .search { flex: 1 1 100%; }
  .controls .button.primary { margin-left: auto; }
  .story article { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 14px; }
  .story article > .thumb { grid-column: 2; grid-row: 1; width: 84px; height: 60px; }
  .story-body, .story article:not(:has(.thumb)) .story-body { grid-column: 1; grid-row: 1; }
  .story article:not(:has(.thumb)) .story-body { grid-column: 1 / -1; }
  .story-actions, .story article:not(:has(.thumb)) .story-actions { grid-column: 1 / -1; grid-row: 2; }
  .story h3 { font-size: 17.5px; }
  .excerpt { font-size: 16px; }
  .chip { min-height: var(--control); padding: 4px 16px; font-size: 15px; }
  .source-row { grid-template-columns: minmax(0, 1fr) auto; }
  .source-folder { grid-column: 1; }
  .source-row .check { grid-column: 2; grid-row: 1; }
  .source-row .danger { grid-column: 2; grid-row: 2; }
}

/* ==========  Temas e destaque (1/11/2026)  ==========
   Vem da maqueta de UX (design/maquetes/temas.css). Mesmas regras de legibilidade do topo.
   O azul continua reservado ao que se pode fazer: o destaque usa tinta neutra, nunca azul. */

/* ---------- Navegação: Tudo + temas, depois Não lidas e Guardadas ---------- */
.theme-group { display: flex; flex-direction: column; gap: 2px; }
.views .nav-sep { height: 1px; background: var(--line); margin: 10px 10px 8px; border: 0; }
.edit-themes { align-self: flex-start; margin: 4px 10px 0; font-size: 14px; min-height: 32px; }

/* ---------- Destaque fixo (Tecnologia) ---------- */
.featured {
  margin: 0 0 22px; padding: 10px 12px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2);
}
.featured-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 6px 10px; }
.featured-label {
  margin: 0; display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2);
}
.featured-label svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.featured-head .link-button { font-size: 14.5px; }
.featured .list { gap: 10px; }
.featured .excerpt { -webkit-line-clamp: 2; }
/* Destaque já lido: fica no topo, mas sem excerto. */
.featured .story.read .excerpt { display: none; }
.featured .story.read article { padding-block: 12px; }
.list-label { margin: 0 0 10px; padding: 0 2px; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }

/* ---------- Tema de um artigo: botão e janela pequena ---------- */
.theme-pick { position: relative; display: inline-flex; }
.chip svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-chip svg { margin: 0 7px 0 -3px; }
.chip[aria-expanded="true"] { border-color: var(--pencil); color: var(--pencil); }
.popover {
  position: absolute; z-index: 6; top: calc(100% + 6px); left: 0; width: 272px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md);
  box-shadow: var(--overlay); padding: 12px 14px 12px;
}
.popover fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 0; }
.popover legend { padding: 0; margin: 0 0 6px; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.radio { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 6px; border-radius: var(--r-sm); font-size: 15.5px; color: var(--ink); cursor: pointer; }
.radio:hover { background: var(--surface-2); }
.radio input { width: 20px; height: 20px; margin: 0; accent-color: var(--pencil); flex: none; }
.radio .now { margin-left: auto; font-size: 13.5px; color: var(--muted); }
.popover-note { margin: 8px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.45; color: var(--muted); }

/* ---------- Primeira utilização: escolher temas ---------- */
.welcome.wide { max-width: 720px; }
.welcome > .step { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.theme-options { border: 0; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 12px; align-items: start; align-content: start;
  min-height: 44px; padding: 14px 16px; border: 1px solid var(--field); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer;
}
.theme-option:hover { border-color: var(--pencil); }
.theme-option input { grid-row: 1 / span 2; width: 20px; height: 20px; margin: 3px 0 0; accent-color: var(--pencil); }
.theme-option strong { font-size: 17px; line-height: 1.3; }
.theme-option span { font-size: 15px; line-height: 1.45; color: var(--ink-2); }
.theme-option:has(input:checked) { border-color: var(--pencil); box-shadow: inset 0 0 0 1px var(--pencil); background: var(--pencil-soft); }
.welcome-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.welcome-actions p { margin: 0; font-size: 15px; color: var(--muted); }

/* ---------- Gerir fontes: tema de cada fonte ---------- */
.sheet.wide { width: min(880px, calc(100vw - 24px)); }
.source-head, .sheet .source-row { grid-template-columns: minmax(0, 1fr) 180px 150px 84px 104px; }
/* Com a sugestão por baixo do tema, os campos alinham pelo topo. */
.sheet .source-row { align-items: start; }
.sheet .source-row .check { min-height: var(--control); }
.source-head {
  display: grid; gap: 10px; padding: 0 0 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.field { display: grid; gap: 4px; min-width: 0; }
.field-label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.sheet .field .field-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.source-row select {
  width: 100%; height: var(--control); padding: 0 10px; border: 1px solid var(--field); border-radius: var(--r-sm);
  background: var(--surface); font-size: 16px;
}
.suggested { font-size: 13.5px; line-height: 1.3; color: var(--muted); }
.theme-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.theme-toggles .chip svg { margin: 0 6px 0 -2px; }
.sheet-block .hint { margin: -4px 0 12px; font-size: 15px; color: var(--ink-2); max-width: 62ch; }
.sheet-block .note { margin: 0; font-size: 14.5px; color: var(--muted); max-width: 66ch; }
.sheet .button.danger { width: 100%; }

/* "Porque vejo isto?" */
.sheet.small { width: min(480px, calc(100vw - 24px)); }
.sheet-body { padding: 18px 20px 6px; }
.sheet-body p { margin: 0 0 12px; font-size: 16px; color: var(--ink-2); max-width: 60ch; }
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 8px 20px 20px; }

/* Aviso para quem já usa o Pavio */
.notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0 0 16px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); font-size: 15.5px;
}
.notice p { margin: 0; flex: 1 1 260px; }

.story-actions { align-items: center; }

/* ---------- Telemóvel ---------- */
@media (max-width: 820px) {
  .theme-group { flex-direction: row; flex: none; gap: 6px; }
  .views .nav-sep, .edit-themes { display: none; }
  .featured { margin: 0 -4px 18px; padding: 8px 8px 10px; }
  .featured-head { padding: 2px 4px 8px; }
  .featured .story article { padding: 12px 14px; }
  .featured .excerpt { display: none; }
  .featured .thumb { display: none; }
  /* No telemóvel não cabem três botões com texto: o do tema fica só com o ícone (nome acessível: "Tema deste artigo: …"). */
  .theme-chip { width: var(--control); padding: 0; justify-content: center; }
  .theme-chip svg { width: 20px; height: 20px; margin: 0; }
  .theme-chip .chip-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .popover { left: auto; right: 0; width: min(272px, calc(100vw - 60px)); }
  .radio { min-height: 44px; }
  .theme-options { grid-template-columns: minmax(0, 1fr); }
  .source-head { display: none; }
  .sheet .source-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; }
  .sheet .source-row .source-main { grid-column: 1 / -1; grid-row: 1; }
  .sheet .source-row .field.theme { grid-column: 1; grid-row: 2; }
  .sheet .source-row .field.folder { grid-column: 2; grid-row: 2; }
  .sheet .source-row .check { grid-column: 1; grid-row: 3; }
  .sheet .source-row .danger { grid-column: 2; grid-row: 3; width: auto; justify-self: end; }
  .sheet .field .field-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .sheet-head p { display: none; }
  .sheet-head h2 { flex: 1; }
  .sheet .source-row .field { align-self: start; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .chip, .view { transition: background-color .12s, border-color .12s, color .12s; }
}

/* ==========  Explorar fontes e painel de leitura (1/11/2026)  ========== */

/* ---------- Rail: Explorar fontes + Gerir fontes ---------- */
.rail-actions { margin-top: auto; display: grid; gap: 8px; }
.rail-actions .manage { margin-top: 0; }
.welcome-or { margin: 18px 0 8px; color: var(--ink-2); font-size: 15.5px; }
.add-alt { margin: 12px 0 0 !important; }
.empty .link-button { font-size: inherit; }

/* ---------- Catálogo ---------- */
/* Altura fixa (e não só max-height): no Safari do iPhone, sem altura definida, a lista com flex: 1 ficava com 0 px. */
#catalogDialog { height: min(820px, calc(100vh - 48px)); height: min(820px, calc(100dvh - 48px)); }
#catalogDialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.catalog-tabs { display: flex; gap: 6px; padding: 12px 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.catalog-tabs::-webkit-scrollbar { display: none; }
.catalog-tab {
  flex: none; min-height: var(--control); padding: 4px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 15.5px; font-weight: 500;
}
.catalog-tab:focus-visible { outline-offset: -4px; }
.catalog-tab:hover { border-color: var(--pencil); color: var(--pencil); }
.catalog-tab[aria-selected="true"] { background: var(--pencil-soft); border-color: var(--pencil); color: var(--pencil); font-weight: 600; }
.catalog-panel { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 20px 16px; outline: none; flex: 1 1 auto; height: 0; min-height: 120px; }
.catalog-tabs, .catalog-note, #catalogDialog .sheet-head { flex: none; }
.catalog-group h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.catalog-group h3 .muted { font-size: 13px; }
.catalog-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.catalog-list li {
  display: flex; gap: 10px; align-items: center; justify-content: space-between; min-width: 0;
  padding: 10px 10px 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2);
}
.catalog-list li div { display: grid; gap: 2px; min-width: 0; }
.catalog-list strong { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-list .button { flex: none; min-width: 96px; }
.catalog-list .follow { color: var(--pencil); border-color: var(--pencil); }
.catalog-list .follow:hover { background: var(--pencil-soft); }
.catalog-list .following { color: var(--green); border-color: transparent; background: none; cursor: default; gap: 4px; }
.catalog-list .following svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.catalog-note { margin: 0; padding: 12px 20px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* ---------- Painel de leitura ---------- */
.reader[hidden] { display: none; }
.reader { display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.reader-head { flex: none;
   display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface); }
.reader-titles { flex: 1; min-width: 0; }
.reader-source { margin: 0; font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-titles h2 {
  margin: 2px 0 0; font-size: 16px; line-height: 1.3; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.reader-head .button { flex: none; text-decoration: none; }
.reader-body { flex: 1 1 auto; height: 0; min-height: 0; display: flex; flex-direction: column; }
.reader-frame { flex: 1 1 auto; height: 0; min-height: 240px; width: 100%; border: 0; background: #fff; }
.reader-foot { margin: 0; padding: 8px 14px; font-size: 14px; color: var(--muted); border-top: 1px solid var(--line); }
.reader-wait { margin: auto; color: var(--muted); }
.reader-card { margin: 40px auto; padding: 0 24px; max-width: 56ch; display: grid; gap: 16px; justify-items: start; }
.reader-card .excerpt { margin: 0; font-size: 17px; color: var(--ink-2); }
.reader-why { margin: 0; font-size: 14.5px; color: var(--muted); }
.story.current article { border-color: var(--pencil); box-shadow: inset 3px 0 0 var(--pencil); }

/* Ecrã largo: lista e artigo lado a lado. */
@media (min-width: 1180px) {
  body.reading .app { grid-template-columns: var(--rail) minmax(380px, 1fr) minmax(520px, 1.25fr); }
  .reader { position: sticky; top: 0; height: 100vh; border-left: 1px solid var(--line); }
}
/* Ecrã médio: o artigo por cima da lista, à direita. */
@media (min-width: 821px) and (max-width: 1179px) {
  .reader { position: fixed; top: 0; right: 0; bottom: 0; z-index: 15; width: min(760px, 88vw); border-left: 1px solid var(--line); box-shadow: var(--overlay); }
}
/* Telemóvel: o artigo ocupa o ecrã; o X fecha e «Voltar» também. */
@media (max-width: 820px) {
  .reader { position: fixed; inset: 0; z-index: 30; height: 100vh; height: 100dvh; }
  .reader-head { padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); }
  .reader-head .button { padding: 0 12px; }
  .reader-titles h2 { font-size: 15px; }
  .rail-actions { order: 2; margin: 0 0 0 auto; display: flex; gap: 6px; }
  .rail-actions .button { padding: 0 12px; }
  .catalog-list { grid-template-columns: minmax(0, 1fr); }
  #catalogDialog { width: calc(100vw - 16px); height: calc(100vh - 16px); height: calc(100dvh - 16px); max-height: none; }
  .catalog-tabs, .catalog-panel { padding-left: 14px; padding-right: 14px; }
}

/* ---------- Instalar como app ---------- */
.install { display: grid; gap: 6px; justify-items: start; margin: 4px 0 14px; }
.install .hint { margin: 0 !important; }
/* App instalada no iPhone: o conteúdo não fica por baixo da barra de estado. */
@media (display-mode: standalone) {
  .rail { padding-top: max(10px, env(safe-area-inset-top)); }
}

/* ==========  Revisão de UX (2/11/2026)  ========== */

/* Barra: a pesquisa encolhe para tudo caber numa linha no computador */
.controls .search { flex: 1 1 160px; min-width: 0; }
.controls .search input { width: 100%; }

/* Ícones dentro de botões */
.button .icon, .chip svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chip[data-act="save"].on svg { fill: currentColor; }
.chip[data-act="read"] svg circle { fill: currentColor; stroke: none; }
.icon-chip { gap: 6px; }
.button.busy .icon { animation: pavio-spin 1s linear infinite; }
@keyframes pavio-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .button.busy .icon { animation: none; } }
.rail-actions .button { justify-content: flex-start; gap: 10px; }

/* Passo 1: cartões mais baixos; «Marcar todas» ao lado de Continuar */
.theme-option { padding: 12px 14px; }
.theme-option strong { font-size: 16.5px; }
.theme-option span { font-size: 14.5px; }
.welcome-actions .button + .link-button { min-height: var(--control); }
.welcome .welcome-actions { margin-bottom: 4px; }
.welcome .welcome-or { margin-top: 20px; }

/* Catálogo: barra «Seguir todas» e cabeçalhos dos grupos */
.catalog-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.catalog-bar p { margin: 0; font-size: 15px; color: var(--ink-2); }
.catalog-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 18px 0 8px; }
.catalog-group-head h3 { margin: 0 !important; }
.catalog-group-head .link-button { font-size: 14.5px; }

/* ---------- Telemóvel: menos altura antes da primeira notícia ---------- */
@media (max-width: 820px) {
  /* Topo: logótipo + dois botões só com ícone */
  .rail-actions .button { width: var(--control); padding: 0; justify-content: center; }
  .rail-actions .btn-label, .controls .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rail-actions .icon, .controls .button .icon { width: 22px; height: 22px; }
  /* Barra: título e estado numa linha; pesquisa; ordem, só não lidas e os dois botões de ícone numa linha */
  .toolbar { margin-bottom: 12px; gap: 8px; }
  .toolbar-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .toolbar-title h2 { font-size: 22px; }
  .status { margin: 0; font-size: 14px; min-height: 0; }
  .controls { gap: 8px; }
  .controls .search { flex: 1 1 100%; }
  .controls .select { flex: 1 1 0; min-width: 0; }
  .controls .select select { width: 100%; }
  .controls .check { flex: none; font-size: 15px; white-space: nowrap; }
  .controls .button { width: var(--control); padding: 0; flex: none; }
  .controls .button.primary { margin-left: 0; }
  /* Notícias: ações só com ícone, alinhadas à direita */
  .icon-chip { width: var(--control); padding: 0; justify-content: center; }
  .icon-chip .chip-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .icon-chip svg { width: 20px; height: 20px; }
  .story-actions { justify-content: flex-end; }
  /* Catálogo: linhas em vez de cartões, para caberem mais */
  .catalog-list { gap: 0; }
  .catalog-list li { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; padding: 10px 0; }
  .catalog-bar { padding: 8px 14px; }
  .catalog-bar p { font-size: 14px; }
  .catalog-note { display: none; }
  /* Passo 1: duas colunas compactas, sem descrições longas */
  .theme-options { grid-template-columns: 1fr 1fr; gap: 8px; }
  .theme-option { padding: 10px 12px; gap: 2px 10px; }
  .theme-option span { display: none; }
  .theme-option strong { font-size: 16px; }
}

/* Painel: outra fonte da mesma notícia e imagem no resumo */
.reader-alt { margin: 0; padding: 10px 14px; font-size: 14.5px; color: var(--ink-2); background: var(--pencil-soft); border-bottom: 1px solid var(--line); }
.reader-image { width: 100%; max-height: 280px; object-fit: cover; border-radius: var(--r-md); }

/* ---------- Página de privacidade ---------- */
.doc-page { background: var(--bg); }
.doc { max-width: 68ch; margin: 0 auto; padding: 32px 20px 80px; }
.doc h1 { font-size: 30px; margin: 8px 0 4px; letter-spacing: -.02em; }
.doc h2 { font-size: 19px; margin: 28px 0 8px; }
.doc p, .doc li { font-size: 16.5px; line-height: 1.6; color: var(--ink-2); }
.doc ul { padding-left: 20px; }
.doc a { color: var(--pencil); }
.doc-updated, .doc-back { color: var(--muted); font-size: 14.5px; margin: 0; }
.welcome .privacy a, .options-links a { color: var(--pencil); }

/* ==========  Estudo de UX (4/11/2026): teclado, gestos, vista compacta, fontes no painel  ========== */
/* Cursor do teclado (j/k) */
.story.cursor article { outline: 2px solid var(--pencil); outline-offset: 2px; }
/* Vista compacta: só título, fonte e hora */
body.compact .story .excerpt, body.compact .story .thumb, body.compact .story .also-list { display: none; }
body.compact .story article { padding: 10px 14px; gap: 4px 12px; }
body.compact .story h3 { font-size: 16px; }
body.compact .story .meta { margin-bottom: 0; }
body.compact .story-actions { opacity: 0; transition: opacity .12s; }
body.compact .story:hover .story-actions, body.compact .story:focus-within .story-actions, body.compact .story.cursor .story-actions { opacity: 1; }
body.compact .list { gap: 6px; }
@media (max-width: 820px) {
  body.compact .story-actions { display: none; }
}
#densityBtn[aria-pressed="true"] { background: var(--pencil-soft); border-color: var(--pencil); color: var(--pencil); }
/* Gestos */
.story article { touch-action: pan-y; transition: transform .15s ease-out; position: relative; }
.story article[data-swipe="read"] { box-shadow: inset 4px 0 0 var(--green); }
.story article[data-swipe="save"] { box-shadow: inset -4px 0 0 var(--pencil); }
@media (prefers-reduced-motion: reduce) { .story article { transition: none; } }
/* Painel: fontes da mesma história */
.reader-sources[hidden] { display: none; }
.reader-sources { flex: none; display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 8px 14px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.reader-sources::-webkit-scrollbar { display: none; }
.reader-sources .chip { flex: none; min-height: 34px; padding: 2px 12px; font-size: 14px; }
.reader-sources-label { flex: none; font-size: 13.5px; color: var(--muted); }
/* Ajuda dos atalhos */
.keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 12px; font-size: 15.5px; }
.keys dt { white-space: nowrap; color: var(--ink-2); }
.keys dd { margin: 0; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); font: 600 13.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; }
@media (max-width: 820px) { #densityBtn { width: var(--control); padding: 0; } }

/* ---------- Lenis (deslocação suave) — CSS recomendado pela biblioteca ---------- */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent], .lenis dialog, .lenis .reader, .lenis .rail { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }
/* O Lenis faz a animação; o scroll-behavior: smooth do CSS iria somar-se a ela. */
html.lenis { scroll-behavior: auto !important; }

/* ---------- Menu de fontes: fechado mostra 5 (favoritas ou com mais por ler) ---------- */
.nav-toggle { display: flex; align-items: center; justify-content: space-between; width: calc(100% - 20px); border: 0; background: none; padding: 6px 0; cursor: pointer; font: inherit; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-radius: 6px; }
.nav-toggle:hover { color: var(--text); }
.nav-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.nav-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.nav-more { margin: 4px 10px 0; font-size: 14px; text-align: left; }
.source-title { display: flex; align-items: center; gap: 2px; min-width: 0; }
.source-title .source-name { flex: 1; min-width: 0; }
.star { width: 34px; height: 34px; flex: none; }
.star svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linejoin: round; }
.star[aria-pressed="true"] svg { fill: #e0a100; stroke: #e0a100; }
@media (max-width: 820px) { .nav-toggle, .nav-more { display: none; } }
@media (prefers-reduced-motion: reduce) { .nav-toggle svg { transition: none; } }
/* Opções só úteis com rato/trackpad e teclado. */
@media not (any-pointer: fine) { .fine-pointer { display: none !important; } }
#settingsDialog .options { display: grid; gap: 10px; }
#settingsDialog .options .hint { margin: 0; max-width: none; width: 100%; text-wrap: wrap; grid-column: 1 / -1; }

/* =====================================================================
   Visual 2 (4/11/2026) — «de fio a pavio».
   A lista é um fio: cada notícia por ler tem a chama acesa; lida, apaga-se.
   Títulos em Newsreader (serifada desenhada para notícias), interface em Schibsted Grotesk.
   Azul azulejo para o que se pode fazer; âmbar só para a chama (por ler).
   ===================================================================== */
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Schibsted Grotesk Variable"; src: url("/fonts/schibsted-grotesk.woff2") format("woff2"); font-weight: 400 900; font-style: normal; font-display: swap; }

:root {
  --bg: #f3f5f8;
  --rail-bg: #e9edf2;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #13202f;
  --ink-2: #344150;
  --muted: #5a6574;
  --read: #5a6574;
  --line: #dde2e8;
  --line-strong: #b9c2cc;
  --pencil: #1f46b0;
  --pencil-hover: #183a94;
  --pencil-soft: #e3e9f8;
  --flame: #e0830a;
  --flame-glow: rgba(224, 131, 10, .2);
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --thread: 18px;
  --gap: 24px;
  --r-sm: 8px;
  --r-md: 12px;
  --measure: 64ch;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1620;
    --rail-bg: #0b1119;
    --surface: #17212d;
    --surface-2: #1b2633;
    --ink: #e8edf3;
    --ink-2: #c3ccd6;
    --muted: #9aa7b5;
    --read: #9aa7b5;
    --line: #253242;
    --line-strong: #3a4a5c;
    --pencil: #92afff;
    --pencil-hover: #b3c7ff;
    --pencil-soft: #1d2a47;
    --flame: #ffb23e;
    --flame-glow: rgba(255, 178, 62, .22);
  }
}

/* Marca: a chama sobre o fio. */
.logo { width: 30px; height: 30px; stroke: none; }
.logo .flame { fill: var(--flame); }
.logo .wick { fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.brand h1 { font-family: var(--serif); font-size: 25px; font-weight: 650; letter-spacing: -.01em; }
.brand p { font-size: 13.5px; }

/* Menu lateral: mais calmo, títulos de secção sem maiúsculas. */
.rail { background: var(--rail-bg); border-right-color: transparent; }
.view { border-radius: var(--r-sm); }
.view:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.view[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: inset 3px 0 0 var(--pencil); }
.view[aria-current="page"] .count { color: var(--pencil); }
.nav-label, .nav-toggle { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 650; color: var(--ink-2); }
.views .nav-sep { background: var(--line-strong); opacity: .5; }

/* Cabeçalho da vista. */
main { max-width: 900px; padding-top: 34px; }
.toolbar { margin-bottom: 8px; }
.toolbar-title h2 { font-family: var(--serif); font-size: 38px; font-weight: 600; letter-spacing: -.015em; line-height: 1.1; }
.status { font-size: 14.5px; margin-top: 8px; }
.controls {
  display: grid; gap: 10px 8px; align-items: center;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  grid-template-areas: "search search search search refresh" "sort unread . density markall";
}
.controls .search { grid-area: search; }
.controls .select { grid-area: sort; }
.controls .check { grid-area: unread; }
.controls #densityBtn { grid-area: density; }
.controls #markAllBtn { grid-area: markall; }
.controls #refreshBtn { grid-area: refresh; }
.search input { height: 46px; border-radius: 999px; padding: 0 20px; border-color: var(--line-strong); font-size: 16.5px; }
.search input:focus { border-color: var(--pencil); }
.controls #refreshBtn { height: 46px; border-radius: 999px; padding: 0 20px; }
.controls .select select { border-color: transparent; background-color: transparent; padding-left: 6px; font-weight: 600; color: var(--ink-2); }
.controls .select select:hover { background-color: var(--surface); }
.controls .button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); padding: 0 10px; }
.controls .button.ghost:hover { background: var(--surface); color: var(--pencil); }
.controls #densityBtn[aria-pressed="true"] { background: var(--pencil-soft); color: var(--pencil); }
.button { border-radius: var(--r-sm); }

/* ---------- O fio ---------- */
#list { position: relative; gap: 0; padding-left: calc(var(--thread) + var(--gap)); margin-top: 6px; }
#list::before { content: ""; position: absolute; left: var(--thread); top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--line); }
#list > li { position: relative; }
.day-sep { padding: 26px 0 4px; }
.day-sep:first-child { padding-top: 12px; }
.day-sep span { font-size: 14px; font-weight: 700; color: var(--ink); }
.day-sep::before { content: ""; position: absolute; left: calc(1px - var(--gap) - 7px); top: calc(26px + 3px); width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line-strong); box-sizing: border-box; }
.day-sep:first-child::before { top: calc(12px + 3px); }

.story article { background: transparent; border: 0; border-radius: 0; padding: 18px 0 20px; border-bottom: 1px solid var(--line); grid-template-columns: minmax(0, 1fr) auto; gap: 8px 22px; }
#list > .story:last-child article, #list > .story:has(+ .day-sep) article { border-bottom-color: transparent; }
.story-body { grid-column: 1; grid-row: 1; }
.story-actions { grid-column: 1; grid-row: 2; gap: 2px; margin-left: -10px; justify-content: flex-start; }
.thumb { grid-column: 2; grid-row: 1 / span 2; width: 112px; height: 76px; border-radius: var(--r-sm); }

.story h3 { font-family: var(--serif); font-size: 22px; line-height: 1.25; font-weight: 600; letter-spacing: -.005em; }
.story h3 a:hover { color: var(--pencil); text-decoration-thickness: 1px; }
.story.read h3 { font-weight: 450; }
.meta { font-size: 14px; margin-top: 8px; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; row-gap: 2px; }
.meta .source { color: var(--ink-2); }
.meta .when { margin-left: -12px; }
.meta .also { font-size: 14px; font-weight: 600; }
.excerpt { font-size: 16px; line-height: 1.6; margin-top: 8px; }

/* A chama: acesa por ler, apagada depois de lida. */
#list .unread-dot, #featuredList .unread-dot { position: absolute; margin: 0; width: 12px; height: 12px; background: var(--flame); box-shadow: 0 0 0 5px var(--flame-glow); }
#list .unread-dot { left: calc(1px - var(--gap) - 6px); top: 28px; }
#list > .story.read::before { content: ""; position: absolute; left: calc(1px - var(--gap) - 4px); top: 30px; width: 8px; height: 8px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line-strong); box-sizing: border-box; }
#featuredList .unread-dot { position: static; display: inline-block; width: 9px; height: 9px; margin: 0 10px 2px 0; box-shadow: 0 0 0 4px var(--flame-glow); }

/* Ações discretas: texto e ícone, sem caixa. */
.story .chip { border-color: transparent; background: transparent; color: var(--muted); font-weight: 600; padding: 4px 10px; min-height: 34px; }
.story .chip:hover { background: var(--surface); color: var(--pencil); border-color: transparent; }
.story .chip.on { background: transparent; color: var(--pencil); }
.story .chip[aria-expanded="true"] { background: var(--surface); color: var(--pencil); }

/* Seleção pelo teclado (j/k): uma faixa do lado do fio em vez de uma caixa. */
.story.cursor article { outline: none; box-shadow: inset 0 0 0 2px var(--pencil); border-radius: var(--r-sm); padding-inline: 14px; margin-inline: -14px; }

/* Destaque do Conectado.pt e rótulos. */
.featured { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 18px 6px; margin-bottom: 18px; }
.featured-label { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.featured .story article { border-bottom: 1px solid var(--line); padding: 12px 0 14px; }
.featured .story:last-child article { border-bottom: 0; }
.featured .story h3 { font-size: 19px; }
.list-label { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 700; color: var(--ink-2); margin: 6px 0 0; }

/* Vista compacta: o fio fica, as linhas apertam. */
body.compact .story article { padding: 9px 0; gap: 2px 12px; }
body.compact .story h3 { font-size: 17.5px; }
body.compact #list .unread-dot { top: 17px; width: 10px; height: 10px; left: calc(1px - var(--gap) - 5px); box-shadow: 0 0 0 4px var(--flame-glow); }
body.compact #list > .story.read::before { top: 19px; }
body.compact .meta { margin-top: 2px; }
body.compact .list { gap: 0; }

/* Janelas e painel com a mesma voz. */
.sheet-head h2, .welcome h2, .reader-titles h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.005em; }
.sheet-head h2 { font-size: 26px; }
.welcome h2 { font-size: 32px; }
.reader-titles h2 { font-size: 19px; line-height: 1.3; }
.welcome { border-radius: var(--r-md); }

@media (max-width: 820px) {
  :root { --thread: 7px; --gap: 20px; }
  main { padding-top: 18px; }
  .rail { background: var(--rail-bg); }
  .brand h1 { font-size: 22px; }
  .toolbar-title h2 { font-size: 30px; }
  .view { border-color: transparent; background: var(--surface); }
  .view[aria-current="page"] { background: var(--ink); color: var(--bg); box-shadow: none; }
  .view[aria-current="page"] .count { color: var(--bg); }
  .rail-actions .button.ghost { border-color: transparent; background: transparent; }
  .rail-actions .button.ghost:hover { background: var(--surface); }
  .search input { height: 44px; }
  .controls #refreshBtn { height: var(--control); padding: 0; width: var(--control); border-radius: 50%; }
  .controls .select select { padding-right: 26px; }
  .story article { padding: 16px 0 16px; grid-template-columns: minmax(0, 1fr) auto; }
  .story article > .thumb { width: 76px; height: 56px; grid-row: 1; }
  .story-actions, .story article:not(:has(.thumb)) .story-actions { grid-column: 1 / -1; margin-left: -12px; }
  .story h3 { font-size: 20px; }
  .story .chip { min-height: var(--control); padding: 4px 12px; }
  .featured { padding: 6px 14px 2px; }
}
/* Compacta: as ações passam para a direita da linha, sem ocupar altura. */
body.compact .story article { grid-template-columns: minmax(0, 1fr) auto; }
body.compact .story-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; margin-left: 0; flex-wrap: nowrap; }
body.compact .story .chip-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.compact .story .chip { padding: 4px 8px; }
.story.cursor article, body.compact .story.cursor article { padding-inline: 14px; margin-inline: -14px; }
/* Com o artigo aberto ao lado, a barra fica só com ícones. */
.controls .check { white-space: nowrap; }
.app:has(.reader:not([hidden])) .controls .button .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.app:has(.reader:not([hidden])) .controls #refreshBtn { width: 46px; padding: 0; }
.app:has(.reader:not([hidden])) .toolbar-title h2 { font-size: 32px; }
body.compact .story article .story-body, body.compact .story article:not(:has(.thumb)) .story-body { grid-column: 1; grid-row: 1 / span 2; }
body.compact .story article .story-actions, body.compact .story article:not(:has(.thumb)) .story-actions { grid-column: 2; grid-row: 1 / span 2; }
/* «Mover para»: com as ações à esquerda, a janela abre para a direita do botão. */
@media (max-width: 820px) { .popover { left: 0; right: auto; } }
.popover legend { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--ink-2); }
/* Sem maiúsculas nos rótulos: frase normal, a hierarquia vem do peso. */
.source-group h4, .catalog-group h3, .source-head { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 700; color: var(--ink-2); }
