/* 123 Afagamentos: blocos pretos e um bloco laranja, como no logótipo. Uma coluna para o polegar; no computador alarga. */
:root {
  --bg: #f3f2f0; --surface: #ffffff; --ink: #121212; --muted: #5f5b57; --line: #dcd9d5;
  --accent: #ff7a14; --accent-ink: #121212; --accent-soft: #ffe8d4; --accent-text: #8f3f00;
  --hero-bg: #121212; --hero-fg: #ffffff; --hero-num: #ff7a14;
  --ok: #1d6b3a; --ok-soft: #dff3e5; --warn: #6b5200; --warn-soft: #fff3c4; --bad: #b3261e; --bad-soft: #fbe4e1;
  --bar: #cfcac4; --plate: #ffffff;
  --f-text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-head: "Anton", "Arial Narrow", Impact, sans-serif;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0f0f0f; --surface: #1b1b1b; --ink: #f3f1ee; --muted: #a8a39d; --line: #343230;
  --accent-soft: #3b2412; --accent-text: #ffa45e;
  --hero-bg: #ff7a14; --hero-fg: #121212; --hero-num: #121212;
  --ok: #7fd69b; --ok-soft: #173222; --warn: #f0cf62; --warn-soft: #3a3212; --bad: #ff8a80; --bad-soft: #3d1a17;
  --bar: #4b4642; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0f0f0f; --surface: #1b1b1b; --ink: #f3f1ee; --muted: #a8a39d; --line: #343230;
  --accent-soft: #3b2412; --accent-text: #ffa45e;
  --hero-bg: #ff7a14; --hero-fg: #121212; --hero-num: #121212;
  --ok: #7fd69b; --ok-soft: #173222; --warn: #f0cf62; --warn-soft: #3a3212; --bad: #ff8a80; --bad-soft: #3d1a17;
  --bar: #4b4642; color-scheme: dark }

*, *::before, *::after { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--f-text); }
img { max-width: 100% }
[hidden] { display: none !important }
.wrap { max-width: 880px; margin: 0 auto; padding-block: 12px 96px;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--f-head); font-weight: 400; margin: 0; text-wrap: balance; text-transform: uppercase; letter-spacing: .03em; line-height: 1.15 }
h1 { font-size: 1.15rem } h2 { font-size: 1.45rem } h3 { font-size: 1.1rem }
p { margin: 0 }
.num { font-variant-numeric: tabular-nums; white-space: nowrap }
.muted { color: var(--muted) } .small { font-size: .85rem }
.stack { display: flex; flex-direction: column; gap: 14px }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center }
.grow { flex: 1 1 0; min-width: 0 }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 6px 14px }
.top select { width: auto }
.marca { display: flex; align-items: center; gap: 12px; min-width: 0 }
.marca .placa { background: var(--plate); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; flex: none; line-height: 0 }
.marca img { height: 44px; width: auto; display: block }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)); }
nav.tabs button { flex: 1; border: 0; background: none; color: var(--muted); font: 500 .8rem var(--f-text);
  padding: 10px 4px; min-height: 48px; border-radius: 8px; cursor: pointer }
nav.tabs button[aria-current="page"] { color: var(--accent-ink); background: var(--accent); font-weight: 600 }
@media (min-width: 720px) {
  .wrap { padding-block: 20px 40px }
  nav.tabs { position: static; border: 0; background: none; padding: 0; gap: 4px; margin-bottom: 18px }
  nav.tabs button { flex: 0 0 auto; padding: 8px 16px; min-height: 40px; font-size: .95rem }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px }
label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 500; color: var(--muted) }
input, select, textarea { font: 400 16px/1.3 var(--f-text); color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 11px 12px; width: 100%; min-width: 0 }
textarea { resize: vertical; min-height: 60px }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--bad) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }
@media (max-width: 420px) { .grid2 { grid-template-columns: 1fr } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 1rem var(--f-text);
  border-radius: 8px; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) }
.btn.danger { color: var(--bad); border-color: var(--bad) }
.btn.small { padding: 7px 12px; min-height: 40px; font-size: .85rem }
.btn.big { padding: 20px 6px; text-align: center; line-height: 1.2; font: 400 1.05rem/1.2 var(--f-head); text-transform: uppercase; letter-spacing: .04em; flex: 1 1 0; min-width: 0 }
.btn.big:not(.primary) { background: var(--ink); border-color: var(--ink); color: var(--surface) }
.btn:disabled { opacity: .5; cursor: not-allowed }
.filebtn { position: relative; overflow: hidden }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; padding: 0; border: 0 }

.msg { border-radius: 8px; padding: 10px 12px; font-size: .92rem; font-weight: 500 }
.msg.ok { background: var(--ok-soft); color: var(--ok) }
.msg.warn { background: var(--warn-soft); color: var(--warn) }
.msg.bad { background: var(--bad-soft); color: var(--bad) }

.thumbs { display: flex; gap: 10px; flex-wrap: wrap }
.thumb { position: relative; width: 84px; height: 108px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600; color: var(--muted) }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block }
.thumb .ver { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in;
  display: flex; align-items: center; justify-content: center; color: var(--muted); font: 600 .85rem var(--f-text) }
.thumb .ver .lbl { position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 0; background: #121212; color: #fff;
  font-size: .75rem; font-weight: 600; text-align: center }
.thumb .tirar { position: absolute; top: 3px; right: 3px; z-index: 1; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: var(--ink); color: var(--bg); font-size: 15px; line-height: 1; cursor: pointer }
.anexo-pdf { width: 100%; height: min(70vh, 720px); border: 1px solid var(--line); border-radius: 8px; background: #fff }

.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface) }
.seg label { flex: 1; flex-direction: row; justify-content: center; text-align: center; padding: 11px 6px; cursor: pointer;
  color: var(--ink); font-size: .88rem; border-left: 1px solid var(--line); position: relative }
.seg label:first-child { border-left: 0 }
.seg input { position: absolute; opacity: 0; inset: 0; padding: 0 }
.seg label:has(input:checked) { background: var(--ink); color: var(--surface); font-weight: 600 }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px }
.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: .95rem }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--accent) }

.linha { display: grid; grid-template-columns: 88px 1fr 1fr 36px; gap: 8px; align-items: end }
.linha .x { height: 44px; border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 18px }
.totais { display: flex; gap: 18px; flex-wrap: wrap; font-size: .92rem }
.totais b { font-family: var(--f-head); font-weight: 400; font-size: 1.2rem; letter-spacing: .02em }

.filtros { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px }
#l-filtros label:last-child { grid-column: 1 / -1 }
.lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column }
.lista li + li { border-top: 1px solid var(--line) }
.item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left; border: 0; background: none;
  color: inherit; font: inherit; padding: 12px 4px; cursor: pointer }
.item .f { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0 }
.item .t { font-family: var(--f-head); font-size: 1.1rem; letter-spacing: .02em; text-align: right }
.item .m, .item .i { font-size: .82rem; color: var(--muted) } .item .i { text-align: right }
.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); margin-left: 6px }

.hero { background: var(--hero-bg); color: var(--hero-fg); border-radius: 26px 26px 6px 6px; padding: 22px 20px }
.hero .lbl { font-size: .8rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .85 }
.hero .big { font: 400 clamp(2.6rem, 12vw, 3.8rem)/1.05 var(--f-head); letter-spacing: .02em; color: var(--hero-num); margin-top: 6px }
.hero .sub { font-size: .88rem; opacity: .9; margin-top: 8px }
table { border-collapse: collapse; width: 100%; font-size: .92rem }
th, td { padding: 7px 4px; text-align: right; border-bottom: 1px solid var(--line) }
th:first-child, td:first-child { text-align: left }
th { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em }
tr:last-child td { border-bottom: 0 }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: .95rem }
.kv .v { font-weight: 600; text-align: right }
.barras { display: flex; flex-direction: column; gap: 10px }
.barra .cab { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem }
.barra .trilho { height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; margin-top: 4px }
.barra .cheio { height: 100%; background: var(--accent); border-radius: 5px; min-width: 2px }
.meses { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 150px }
.mes { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; min-width: 0 }
.mes .col { background: var(--bar); border-radius: 3px 3px 0 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden }
.mes .col i { display: block; background: var(--accent) }
.meses-l { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; font-size: .68rem; color: var(--muted); text-align: center; margin-top: 4px }
.leg { display: flex; gap: 14px; font-size: .8rem; color: var(--muted) }
.leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px }

dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); padding: 0;
  width: min(560px, calc(100vw - 24px)); max-height: calc(100% - 24px) }
dialog::backdrop { background: rgb(0 0 0 / .5) }
.dlg { padding: 18px; display: flex; flex-direction: column; gap: 14px }
.anexo-img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block }
.vazio { text-align: center; padding: 32px 12px; color: var(--muted) }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 99px; font-weight: 600; font-size: .92rem; max-width: calc(100vw - 32px) }
.catrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center }
@media (prefers-reduced-motion: no-preference) { .barra .cheio, .mes .col { transition: all .25s ease } }

/* Entrada */
.entrada { max-width: 420px; margin: 0 auto; padding: max(40px, env(safe-area-inset-top, 0px)) 16px 40px }
.entrada .marca { justify-content: center; margin-bottom: 22px }
