:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #627080;
  --line: #dde2e8;
  --accent: #1d5fa8;
  --accent-text: #ffffff;
  --error-bg: #fdecec;
  --error-text: #9b1c1c;
  --notice-bg: #e8f3ec;
  --notice-text: #1d5c36;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181d;
    --surface: #1d232a;
    --text: #e6eaef;
    --muted: #9aa6b2;
    --line: #2e3640;
    --accent: #5b9bdc;
    --accent-text: #0e141b;
    --error-bg: #3a1c1c;
    --error-text: #f5b5b5;
    --notice-bg: #1b3326;
    --notice-text: #a8dcbc;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
}
a { color: var(--accent); }
.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; gap: 1rem; flex: 1; }
.topbar nav a { text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; }
.session { display: flex; align-items: center; gap: 0.75rem; margin: 0; }
.who { color: var(--muted); }
main { max-width: 64rem; margin: 0 auto; padding: 1.5rem; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem;
}
.narrow { max-width: 26rem; margin-left: auto; margin-right: auto; }
form.narrow { padding: 0; border: 0; margin: 1rem 0 0; }
label { display: block; margin-bottom: 1rem; font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.625rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}
input:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button {
  font: inherit;
  padding: 0.5rem 1rem;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
button.link {
  padding: 0;
  color: var(--accent);
  background: none;
  text-decoration: underline;
}
.aside { margin-top: 1rem; }
.error, .notice { padding: 0.625rem 0.75rem; border-radius: 6px; }
.error { background: var(--error-bg); color: var(--error-text); }
.notice { background: var(--notice-bg); color: var(--notice-text); }
.muted { color: var(--muted); }
.qr svg { width: 12rem; height: 12rem; background: #fff; padding: 0.5rem; border-radius: 6px; }
code { overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; }
th { font-weight: 600; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.page-head { display: flex; align-items: baseline; gap: 1rem; justify-content: space-between; }
.page-head h1 { margin-bottom: 0.5rem; }
h2 { font-size: 1.125rem; margin: 0 0 0.75rem; }
.card + .card { margin-top: 1rem; }
.scroll { overflow-x: auto; }
.badge { padding: 0.125rem 0.625rem; border-radius: 999px; background: var(--line); color: var(--text); font-size: 0.875rem; }
.badge.status-quitado { background: var(--notice-bg); color: var(--notice-text); }
tr.meu td { background: var(--notice-bg); font-weight: 600; }
tfoot th { border-bottom: 0; color: var(--text); }
/* Saldo = Parte - Pago: positivo = deve pagar (cor de alerta); negativo = tem a receber. */
.saldo.deve { color: var(--error-text); }
.saldo.recebe { color: var(--notice-text); }
.notas { white-space: pre-wrap; }
.filtro { max-width: 20rem; margin-bottom: 1rem; }
canvas { max-height: 20rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 0.5rem; }
textarea { display: block; width: 100%; margin-top: 0.25rem; padding: 0.5rem 0.625rem; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
a.botao { padding: 0.5rem 1rem; color: var(--accent-text); background: var(--accent); border-radius: 6px; text-decoration: none; }
button.perigo { background: var(--error-text); color: var(--surface); }
.destaque { margin-bottom: 1rem; border-left: 4px solid var(--notice-text); }
.destaque ul { margin: 0; padding-left: 1.25rem; }
.despesa { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 0.75rem; align-items: end; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.despesa label { margin: 0; font-size: 0.875rem; }
.despesa.somente-leitura { align-items: center; }
.acoes { display: flex; gap: 0.5rem; }
.grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; align-items: end; }
.check { display: inline-block; margin-right: 1rem; }
ul.plain { list-style: none; margin: 0; padding: 0; }
form.inline { display: flex; gap: 0.5rem; align-items: center; margin: 0; }
form.inline input[type="date"] { width: auto; }
#erro-admin { position: sticky; top: 0; z-index: 1; }
#erro-admin:empty { display: none; }
@media (max-width: 40rem) { .despesa { grid-template-columns: 1fr 1fr; } }
.badge.status-inativo { background: var(--error-bg); color: var(--error-text); }
#link-convite { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 40rem) { .topbar { flex-wrap: wrap; } .topbar nav { flex-wrap: wrap; } }
.badge.importado { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
