:root {
  color-scheme: light dark;

  --bg: #fbfbfa;
  --surface: #ffffff;
  --line: #e4e4e1;
  --line-strong: #d0d0cc;
  --text: #16161a;
  --muted: #6b6b73;
  --faint: #93939c;
  --accent: #1a5cff;
  --accent-soft: #eaf0ff;
  --good: #0f7a4d;
  --good-soft: #e6f4ed;
  --warn: #9a5b00;
  --warn-soft: #fdf1de;

  --radius: 7px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 12px rgba(0, 0, 0, .03);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e10;
    --surface: #17171a;
    --line: #26262b;
    --line-strong: #34343b;
    --text: #ececf0;
    --muted: #9a9aa4;
    --faint: #6e6e78;
    --accent: #6f9bff;
    --accent-soft: #18233d;
    --good: #55c493;
    --good-soft: #12261e;
    --warn: #d9a355;
    --warn-soft: #2a2013;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 12px rgba(0, 0, 0, .2);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- cabecalho */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  font-weight: 660;
  font-size: 17px;
  letter-spacing: -.02em;
  color: var(--text);
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }

.nav { display: flex; gap: 16px; margin-left: auto; font-size: 14px; }
.nav a { color: var(--muted); }
.nav a.on { color: var(--text); font-weight: 550; }

/* -------------------------------------------------------------------- busca */

.search-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0 14px;
  box-shadow: var(--shadow);
}
.search-box:focus-within { border-color: var(--accent); }

.search-box svg { flex-shrink: 0; color: var(--faint); }

#q {
  flex: 1;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 13px 0;
}
#q::placeholder { color: var(--faint); }

.clear-q {
  border: 0; background: none; cursor: pointer;
  color: var(--faint); font-size: 20px; line-height: 1; padding: 4px;
}
.clear-q:hover { color: var(--text); }

/* Atalhos de intencao: o utilizador tipico nao sabe filtrar, sabe o que quer. */
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.quick button {
  font: inherit;
  font-size: 13px;
  padding: 5px 11px;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.quick button:hover { border-color: var(--accent); color: var(--accent); }
.quick button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ------------------------------------------------------------------ layout */

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  /* minmax(0, 1fr) e nao 1fr: o minimo implicito de `1fr` e `auto`, o que deixa
     um titulo longo ou uma etiqueta sem espacos empurrar a coluna para fora do
     ecra em vez de a fazer quebrar. */
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

@media (max-width: 860px) {
  .main { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .filters { position: static; max-height: none; }
  .filters-toggle { display: block; }
  .filters[hidden] { display: none; }
}

.filters-toggle {
  display: none;
  width: 100%;
  font: inherit;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.filters {
  position: sticky;
  top: 74px;
  max-height: calc(100vh - 94px);
  overflow-y: auto;
  padding-right: 4px;
}

.fgroup { margin-bottom: 22px; }

.fgroup h3 {
  margin: 0 0 9px;
  font-size: 11px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--faint);
}

.fopt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
}
.fopt:hover { color: var(--text); }
.fopt input { accent-color: var(--accent); margin: 0; cursor: pointer; }
.fopt .n { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.fopt.checked { color: var(--text); font-weight: 500; }

.fgroup select,
.fgroup input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--text);
}

.more {
  border: 0; background: none; cursor: pointer; padding: 3px 0;
  color: var(--accent); font: inherit; font-size: 13px;
}

/* ---------------------------------------------------------------- listagem */

.bar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.count { font-size: 14px; color: var(--muted); }
.count b { color: var(--text); font-variant-numeric: tabular-nums; }

.bar select {
  margin-left: auto;
  font: inherit;
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
}

.jobs { display: flex; flex-direction: column; gap: 9px; }

.job {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .12s;
}
.job:hover { border-color: var(--line-strong); }

.job-head { display: flex; align-items: baseline; gap: 10px; }

.job h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 590;
  letter-spacing: -.01em;
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
}

.job-head .entry { flex-shrink: 0; }

.job .co { font-size: 13.5px; color: var(--muted); margin-top: 2px; }

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  align-items: center;
}

.tag {
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.tag.pay { color: var(--good); background: var(--good-soft); border-color: transparent; font-variant-numeric: tabular-nums; }
.tag.rem { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.tag.pt::before { content: "🇵🇹 "; }

.entry {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}
.entry.hi { background: var(--good-soft); color: var(--good); }
.entry.mid { background: var(--warn-soft); color: var(--warn); }

.excerpt {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty, .loading {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }

.load-more {
  margin: 18px auto 0;
  display: block;
  font: inherit;
  padding: 9px 22px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.load-more:hover { border-color: var(--accent); color: var(--accent); }
.load-more[disabled] { opacity: .5; cursor: default; }

/* ---------------------------------------------------------------- detalhe */

.sheet-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 40;
}

.sheet {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(680px, 100%);
  background: var(--bg);
  border-left: 1px solid var(--line);
  z-index: 41;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Titulo e empresa ficam sempre visiveis: numa descricao de 200 linhas,
   perder de vista a que vaga se esta a ler e desorientador. */
.sheet-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 26px 14px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.sheet-titles { min-width: 0; flex: 1; }

.sheet h1 {
  font-size: 20px;
  margin: 0 0 3px;
  letter-spacing: -.02em;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.sheet .co { color: var(--muted); font-size: 14.5px; }

.sheet-close {
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  padding: 5px 10px;
}
.sheet-close:hover { color: var(--text); border-color: var(--line-strong); }

.sheet-body { padding: 18px 26px 70px; }

.sheet-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.apply {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 550;
  font-size: 14.5px;
}
.apply:hover { text-decoration: none; opacity: .9; }

.via { font-size: 13px; color: var(--faint); }

/* Ficha de factos: duas colunas, rotulo pequeno em cima do valor. */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  margin: 0 0 22px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.facts > div { background: var(--surface); padding: 9px 13px; }
.facts dt {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--faint);
  font-weight: 600;
  margin-bottom: 2px;
}
.facts dd { margin: 0; font-size: 13.5px; overflow-wrap: anywhere; }

.sheet-body section { margin-bottom: 22px; }

.sheet-body section > h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--faint);
  font-weight: 620;
  margin: 0 0 9px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.signals {
  border-radius: var(--radius);
  padding: 13px 15px;
  border: 1px solid transparent;
}
.signals.hi { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 22%, transparent); }
.signals.mid { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.signals.lo { background: var(--surface); border-color: var(--line); }

.signals > h3 { margin-bottom: 7px; }
.signals.hi > h3 { color: var(--good); }
.signals.mid > h3 { color: var(--warn); }

.signals .score {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.signals ul { margin: 0; padding-left: 17px; }
.signals li { font-size: 13.5px; color: var(--text); margin-bottom: 2px; }

/* --- corpo da descricao: e aqui que se le o anuncio, por isso leva o
   cuidado tipografico todo. --- */

.desc-box .desc {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.desc > *:first-child { margin-top: 0; }
.desc > *:last-child { margin-bottom: 0; }

.desc p { margin: 0 0 13px; }

.desc h2, .desc h3, .desc h4, .desc h5 {
  font-size: 14.5px;
  font-weight: 620;
  color: var(--text);
  margin: 22px 0 8px;
  letter-spacing: -.01em;
}

.desc ul, .desc ol { margin: 0 0 14px; padding-left: 20px; }
.desc li { margin-bottom: 6px; }
.desc li::marker { color: var(--faint); }

.desc strong, .desc b { color: var(--text); font-weight: 600; }
.desc em, .desc i { font-style: italic; }

.desc a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.desc hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.desc blockquote {
  margin: 0 0 14px;
  padding-left: 13px;
  border-left: 2px solid var(--line-strong);
}

.desc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}

.desc pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  overflow-x: auto;
  margin: 0 0 14px;
}
.desc pre code { background: none; border: 0; padding: 0; }

/* Paragrafos vazios que os feeds trazem aos molhos, e imagens ja removidas
   pela sanitizacao, nao devem abrir buracos no texto. */
.desc p:empty, .desc div:empty { display: none; }

.desc .vazio { color: var(--faint); font-style: italic; }

/* ------------------------------------------------------------ paginas texto */

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}
.page h1 { font-size: 27px; letter-spacing: -.025em; margin: 0 0 6px; }
.page .lede { color: var(--muted); font-size: 16px; margin: 0 0 30px; }
.page h2 { font-size: 18px; margin: 34px 0 10px; letter-spacing: -.015em; }
.page h3 { font-size: 15px; margin: 22px 0 6px; }
.page p, .page li { color: var(--muted); }
.page table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 14px 0; }
.page th, .page td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
.page th { color: var(--faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.page td:not(:first-child) { font-variant-numeric: tabular-nums; }
.page .note { font-size: 13px; color: var(--faint); border-left: 2px solid var(--line-strong); padding-left: 12px; }

/* -------------------------------------------------------------- simulador */

.calc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: start;
}
@media (max-width: 760px) { .calc { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select {
  width: 100%;
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
}
.field input:focus, .field select:focus { outline: 0; border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 4px; }

.seg { display: flex; gap: 0; border: 1px solid var(--line-strong); border-radius: 5px; overflow: hidden; }
.seg button {
  flex: 1;
  font: inherit;
  font-size: 13.5px;
  padding: 9px 6px;
  border: 0;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.seg button.on { background: var(--accent); color: #fff; font-weight: 550; }

.result-big {
  font-size: 34px;
  font-weight: 640;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.result-lbl { font-size: 13px; color: var(--muted); margin-bottom: 2px; }

.lines { margin-top: 18px; font-size: 14px; }
.line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line span:first-child { color: var(--muted); }
.line span:last-child { font-variant-numeric: tabular-nums; }
.line.neg span:last-child { color: var(--warn); }
.line.total { border-top: 1px solid var(--line-strong); margin-top: 6px; padding-top: 11px; font-weight: 620; }
.line.total span:first-child { color: var(--text); }

.foot {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 40px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 13px;
}
.foot a { color: var(--muted); }

/* ---------------------------------------------------------------- fontes */

.src-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  margin: 16px 0 8px;
}

.src {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.src-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 7px; }

.src h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.src h3 a { color: var(--text); }
.src h3 a:hover { color: var(--accent); text-decoration: none; }

.src-n {
  margin-left: auto;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 100px;
  padding: 1px 9px;
  font-weight: 550;
}

.src-what { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); }
.src-why { margin: 0 0 12px; font-size: 13px; color: var(--faint); }

.src-site { margin-top: auto; font-size: 12.5px; color: var(--muted); }
.src-site:hover { color: var(--accent); }

.src-total { margin-top: 4px; }

.links { list-style: none; padding: 0; margin: 12px 0 4px; }

.links li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.links li:last-child { border-bottom: 0; }

.links li a { font-weight: 550; }
.links li span { color: var(--muted); font-size: 13.5px; }
.links li span::before { content: " · "; color: var(--faint); }

.page code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
