:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #17212b;
  --muted: #5d6874;
  --line: #dfe3e8;
  --brand: #1f6f6b;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ef;
  --ok: #1d7a46;
  --ok-soft: #e4f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --err: #b42318;
  --err-soft: #fde8e6;
  --info-soft: #e8effc;
  --info: #2c5cc5;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161b;
    --surface: #182027;
    --surface-2: #1f2932;
    --ink: #e6ebef;
    --muted: #9aa6b1;
    --line: #2b3640;
    --brand: #4fb3aa;
    --brand-ink: #0c1a19;
    --brand-soft: #173431;
    --ok: #5fcf8c;
    --ok-soft: #173325;
    --warn: #f0b252;
    --warn-soft: #3a2c13;
    --err: #ff8a7f;
    --err-soft: #3d1c19;
    --info-soft: #1b2a45;
    --info: #8fb0f5;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3, h4 { margin: 1rem 0 .4rem; }
h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p { margin: 0 0 .6rem; }
ul { margin: 0 0 .6rem; padding-left: 1.2rem; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.accent { color: var(--brand); font-weight: 600; }
.pre { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Topo */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-size: .8rem; letter-spacing: .02em; }
.brand-lg { font-size: 1.3rem; margin-bottom: .5rem; }
.nav { display: flex; gap: .2rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { padding: .4rem .7rem; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.who { display: flex; align-items: center; gap: .5rem; }
.who form { margin: 0; }
.viewas select { max-width: 180px; padding: .3rem .5rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2); font-weight: 700; }
.viewing { background: var(--info-soft); color: var(--info); text-align: center; padding: .4rem 16px; font-size: .9rem; }
@media (max-width: 720px) {
  .topbar-inner { gap: .5rem; }
  .nav { order: 3; flex-basis: 100%; }
}

/* Página */
.page { max-width: 1120px; margin: 0 auto; padding: 1.5rem 16px 4rem; }
.page-center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head p { max-width: 70ch; }
.back { margin-bottom: .75rem; }
.back a { text-decoration: none; }

/* Botões e campos */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem 1rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; min-height: 40px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: .3rem .65rem; min-height: 32px; font-size: .88rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: .5rem .65rem; width: 100%; min-height: 40px;
}
input[type="checkbox"] { width: auto; min-height: 0; accent-color: var(--brand); }
input[type="file"] { padding: .4rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible, .toggle:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
legend { font-weight: 600; font-size: .92rem; padding: 0 .3rem; }
.stack { display: flex; flex-direction: column; gap: .8rem; }
.stack-lg { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.narrow { max-width: 460px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* Cartões e avisos */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.card-warn { border-color: var(--warn); background: var(--warn-soft); }
.flash { border-radius: 8px; padding: .7rem 1rem; margin-bottom: 1rem; font-weight: 500; }
.flash-ok { background: var(--ok-soft); color: var(--ok); }
.flash-erro { background: var(--err-soft); color: var(--err); }
.note { background: var(--info-soft); color: var(--info); border-radius: 8px; padding: .55rem .8rem; }
.secret { border-color: var(--warn); background: var(--warn-soft); margin-bottom: 1rem; }
code.big { font-size: 1.25rem; user-select: all; }
.empty { text-align: center; padding: 2.5rem 1rem; }

/* Login */
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 2rem 1.6rem; box-shadow: var(--shadow); }
.login-card form { margin-top: 1.2rem; }
.login-card .flash { margin-top: 1rem; }
.page-center > .flash { position: fixed; top: 16px; left: 16px; right: 16px; max-width: 380px; margin: 0 auto; }

/* Resumo */
.scan-status { margin-bottom: 1rem; }
.scan-status p:last-child { margin-bottom: 0; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; display: flex; flex-direction: column; }
.stat-n { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: .85rem; }
.stat-warn .stat-n { color: var(--warn); }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(3, 1fr); } .stat-n { font-size: 1.2rem; } }

/* Filtros */
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters label { flex: 0 1 170px; }
.filters .grow { flex: 1 1 260px; }
@media (max-width: 720px) { .filters label { flex: 1 1 40%; } .filters .grow { flex-basis: 100%; } }

/* Vagas */
.job-list { display: flex; flex-direction: column; gap: .6rem; }
.job { display: grid; grid-template-columns: auto 1fr auto; gap: 1rem; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.job.htmx-swapping { opacity: .5; }
.job-main { min-width: 0; }
.job-title { font-size: 1.02rem; margin: 0 0 .2rem; }
.job-title a { color: var(--ink); text-decoration: none; }
.job-title a:hover { color: var(--brand); text-decoration: underline; }
.job-meta { display: flex; flex-wrap: wrap; gap: .3rem .8rem; color: var(--muted); font-size: .9rem; margin-bottom: .35rem; align-items: center; }
.job-why { font-size: .92rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: .4rem; }
.job-links { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .9rem; font-weight: 600; }
.job-links a { text-decoration: none; }
.job-side { display: flex; flex-direction: column; gap: .3rem; align-items: flex-end; min-width: 150px; }
.status-select { min-height: 34px; padding: .3rem .5rem; font-size: .88rem; font-weight: 600; }
@media (max-width: 720px) {
  .job { grid-template-columns: auto 1fr; }
  .job-side { grid-column: 1 / -1; align-items: stretch; }
}

.score { width: 54px; height: 54px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; background: var(--surface-2); color: var(--muted); }
.score small { font-size: .65rem; font-weight: 700; margin-left: 1px; }
.score-alta { background: var(--ok-soft); color: var(--ok); }
.score-media { background: var(--info-soft); color: var(--info); }
.score-baixa { background: var(--warn-soft); color: var(--warn); }

.chip { display: inline-block; padding: .05rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .8rem; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.badge-inscrito, .status-inscrito { background: var(--ok-soft); color: var(--ok); }
.badge-cv_gerado, .status-cv_gerado, .badge-na_fila, .status-na_fila { background: var(--info-soft); color: var(--info); }
.badge-requer_acao, .status-requer_acao, .badge-falhou, .status-falhou { background: var(--warn-soft); color: var(--warn); }

/* Detalhe */
.detail-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.2rem; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; margin: 0 0 1rem; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; padding: 0; margin: 1rem 0 0; border-left: 2px solid var(--line); }
.timeline li { padding: 0 0 .6rem .8rem; position: relative; font-size: .9rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.profile-name { margin-top: .4rem; font-size: 1.2rem; }
.exp { margin-bottom: .6rem; }
.exp p { margin-bottom: .2rem; }

/* Admin */
.table-wrap { overflow-x: auto; padding: 0; margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
td form { margin: 0; }
tr:last-child td { border-bottom: 0; }
.toggle { font: inherit; font-size: .85rem; font-weight: 700; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: .25rem .75rem; cursor: pointer; min-height: 32px; }
.toggle.on { background: var(--ok-soft); color: var(--ok); border-color: transparent; }

/* Perguntas */
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--warn); color: var(--surface); font-size: .75rem; font-weight: 700; }
.q-list { display: flex; flex-direction: column; gap: .7rem; }
.q-card { display: flex; flex-direction: column; gap: .6rem; }
.q-pending { border-left: 4px solid var(--warn); }
.q-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.q-title { font-size: 1rem; margin: 0; }
.q-card p { margin: 0; }
.q-options { flex-direction: row; flex-wrap: wrap; gap: .4rem 1.2rem; border: 0; padding: 0; }
.q-actions { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.q-msg { font-size: .88rem; font-weight: 600; }
.q-ok { color: var(--ok); }
.q-err { color: var(--err); }
.warn-note { background: var(--warn-soft); color: var(--ink); border-left: 4px solid var(--warn); margin-bottom: 1rem; }
