/* Visual minimalista, pensado primeiro para o celular.
   Alvos de toque com 48px (Lei de Fitts), poucos elementos por tela (Lei de Hick),
   resultado em destaque (efeito Von Restorff) e cálculo instantâneo (Limite de Doherty). */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --line: #e7e5e4;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 4px 16px rgb(0 0 0 / .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0a09;
    --surface: #1c1917;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --line: #292524;
    --accent: #2dd4bf;
    --accent-soft: #134e4a;
    --danger: #f87171;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent); }
main { max-width: 680px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 8px 0 6px; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 36px 0 8px; }
.sub { color: var(--muted); margin: 0 0 20px; }
code { font-size: .9em; }

/* Cabeçalho */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 680px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: .95rem; padding: 12px 8px; }

/* Barra de navegação dos grupos (trabalhista, documentos) */
.tabs { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.tabs .inner { max-width: 680px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.tabs .inner::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 10px 16px; border-radius: 999px; text-decoration: none; white-space: nowrap;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); font-size: .95rem;
}
.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .tabs a[aria-current="page"] { color: #042f2e; } }

/* Ferramenta */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 16px; box-shadow: var(--shadow); }
.tool + .tool { margin-top: 16px; }
.tool h2 { margin-top: 0; }
.fields { display: grid; gap: 14px; }
@media (min-width: 560px) { .fields.two { grid-template-columns: 1fr 1fr; } }
label { display: grid; gap: 6px; font-size: .9rem; font-weight: 500; color: var(--muted); }
input, select, textarea, button, .btn {
  font: inherit; font-size: 17px; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; min-height: 48px; padding: 10px 14px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
textarea { min-height: 140px; resize: vertical; }
textarea.mono, .mono { font-family: ui-monospace, Consolas, monospace; font-size: 15px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 400; min-height: 48px; }
.check input { width: 22px; min-height: 22px; height: 22px; accent-color: var(--accent); }
button, .btn { cursor: pointer; background: var(--surface); font-weight: 600; text-align: center; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { button.primary, .btn.primary { color: #042f2e; } }
.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.seg button { border: 0; min-height: 40px; padding: 6px 4px; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: transparent; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Resultado em destaque */
.result { margin-top: 18px; padding: 18px 16px; border-radius: 12px; background: var(--accent-soft); }
.result .label { font-size: .85rem; color: var(--muted); margin: 0; }
@media (prefers-color-scheme: dark) { .result .label { color: #99f6e4; } }
.result .big { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: 2px 0 0; font-variant-numeric: tabular-nums; word-break: break-word; }
.rows { width: 100%; border-collapse: collapse; margin-top: 12px; font-variant-numeric: tabular-nums; }
.rows td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.rows td:last-child { text-align: right; padding-left: 12px; white-space: nowrap; }
.rows tr.total td { font-weight: 700; }
.note { font-size: .85rem; color: var(--muted); margin: 10px 0 0; }
.err { color: var(--danger); }
.hidden { display: none !important; }

/* Anúncios: espaço reservado para não deslocar a página quando o banner carrega */
.ad { margin: 28px 0; min-height: 280px; display: flex; align-items: center; justify-content: center; }
.ad::before { content: "Publicidade"; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ad.filled::before { content: none; }
@media (min-width: 728px) { .ad { min-height: 120px; } }

/* Texto e perguntas frequentes */
article p, article li { color: var(--text); }
article .rows td:last-child { white-space: normal; }
details { border-bottom: 1px solid var(--line); }
summary { cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
summary::after { content: "+"; color: var(--muted); font-weight: 400; }
details[open] summary::after { content: "−"; }
details p { margin: 0 0 14px; }

/* Página inicial */
.group { margin-top: 28px; }
.group h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 10px; }
.list { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list li + li { border-top: 1px solid var(--line); }
.list a { display: flex; flex-direction: column; padding: 14px 16px; text-decoration: none; color: var(--text); min-height: 56px; }
.list a:hover { background: var(--bg); }
.list strong { font-weight: 600; }
.list span { font-size: .9rem; color: var(--muted); }

/* Rodapé */
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.footer .inner { max-width: 680px; margin: 0 auto; padding: 20px 16px 32px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer a { color: var(--muted); text-decoration: none; padding: 6px 0; }

/* Impressão (recibo) */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .tabs, .footer, .ad, .no-print, article { display: none !important; }
  main { padding: 0; max-width: none; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
.qr { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 18px; }
.qr canvas { width: 240px; height: 240px; image-rendering: pixelated; border-radius: 8px; border: 1px solid var(--line); }
.copybox { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13px; word-break: break-all; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.recibo { margin-top: 18px; background: #fff; color: #111; border: 1px solid var(--line); border-radius: 12px; padding: 24px 20px; font-size: 16px; line-height: 1.7; }
.recibo .topo { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 16px; }
.recibo .topo strong { font-size: 1.4rem; letter-spacing: .1em; }
.recibo .topo span { font-size: 1.2rem; font-weight: 700; }
.recibo .assin { margin-top: 48px; text-align: center; }
.recibo .assin div { border-top: 1px solid #111; margin: 0 auto; max-width: 320px; padding-top: 4px; }
@media print { .recibo { border: 0; padding: 0; font-size: 14pt; } }
@media print { .tool { border: 0; box-shadow: none; padding: 0; } }
.grid3 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.grid3 .full { grid-column: 1 / -1; }
.steps { margin: 12px 0 0; padding-left: 20px; font-size: .95rem; }
.steps li { margin: 4px 0; }
.mini { min-height: 40px; padding: 6px 10px; font-size: .9rem; width: auto; }
.reveal { text-align: center; margin-bottom: 24px; }
.reveal .nome { font-size: 2.2rem; font-weight: 700; color: var(--accent); margin: 4px 0 8px; }
.people { list-style: none; padding: 0; margin: 16px 0 0; }
.people li { padding: 12px 0; border-top: 1px solid var(--line); }
.people strong { display: block; margin-bottom: 8px; }
.people .actions { margin-top: 0; }
.par { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 8px; align-items: end; }
.par input { min-width: 0; padding-left: 10px; padding-right: 6px; }
.par + .par { margin-top: 10px; }
.par .rem { padding: 0; min-width: 0; font-size: 1.4rem; font-weight: 400; color: var(--muted); }
.hora { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.rows.cols td + td { text-align: right; padding-left: 12px; white-space: nowrap; }
.aparelho { padding: 12px 0; border-top: 1px solid var(--line); }
.ap-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.ap-topo .rem { width: 40px; min-height: 40px; padding: 0; font-size: 1.3rem; font-weight: 400; color: var(--muted); }
.grid3 input { min-width: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.stats div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: .8rem; color: var(--muted); }
.stats span { display: block; font-size: 1.4rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.lim { margin: 10px 0; }
.lim-t { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.lim-t span:last-child { color: var(--muted); white-space: nowrap; }
.lim-t span.err { color: var(--danger); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.over { background: var(--danger); }
.rows.mark td + td { text-align: center; white-space: normal; padding: 10px 6px; font-size: .9rem; }
.label-m { font-size: .9rem; font-weight: 500; color: var(--muted); margin: 16px 0 6px; }
.plano { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px; gap: 8px 8px; align-items: end; padding: 12px 0; border-top: 1px solid var(--line); }
.plano:first-child { border-top: 0; padding-top: 4px; }
.plano input, .plano select { min-width: 0; padding-left: 10px; padding-right: 6px; }
.plano .rem { padding: 0; min-width: 0; font-size: 1.4rem; font-weight: 400; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { width: auto; min-height: 40px; padding: 6px 12px; border-radius: 999px; font-size: .9rem; font-weight: 500; gap: 8px; }
.chip span { color: var(--muted); font-size: 1.1rem; }
.tabela-scroll { overflow: auto; max-height: 460px; margin-top: 4px; }
.parcelas { min-width: 460px; margin-top: 0; }
.parcelas th { position: sticky; top: 0; background: var(--surface); text-align: right; padding: 10px 0 10px 12px; border-bottom: 1px solid var(--line); font-size: .9rem; z-index: 1; }
.parcelas th:first-child { text-align: left; padding-left: 0; }
.parcelas tr[data-m] { cursor: pointer; }
.parcelas tr[data-m]:hover td { background: var(--bg); }
.parcelas td.ex { color: var(--accent); font-weight: 600; }
.parcelas tr[aria-selected="true"] td { background: var(--accent-soft); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) auto 48px; gap: 8px; align-items: end; margin: 10px 0; padding: 12px; border-radius: 12px; background: var(--accent-soft); }
.editor button { width: auto; }
.editor #av-rem { padding: 0; font-size: 1.4rem; font-weight: 400; color: var(--muted); }
.editor input { min-width: 0; background: var(--surface); }
.result .rows.cols { font-size: 14px; }
.result .rows.cols td + td { padding-left: 6px; }
