[hidden] { display: none !important; }
:root {
  --bg: #EEF1F4; --surface: #FFFFFF; --ink: #1B2733; --muted: #5B6875; --line: #D5DBE1;
  --accent: #0E5A6F; --ok: #1F7A4D; --low: #B25E09; --err: #B42318; --na: #6B7785;
  --radius: 6px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
h1 { font-size: 1.35rem; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .6rem; }
.muted { color: var(--muted); margin: .15rem 0 0; font-size: .9rem; }
button, input, select { font: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.top { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: end; padding: 1.4rem clamp(1rem, 4vw, 2.5rem) 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; }
.tabs [role=tab] { background: none; border: 0; padding: .55rem .8rem; border-bottom: 3px solid transparent; color: var(--muted); cursor: pointer; }
.tabs [role=tab][aria-selected=true] { color: var(--ink); border-color: var(--accent); font-weight: 600; }
main { padding: 1.2rem clamp(1rem, 4vw, 2.5rem) 3rem; max-width: 1200px; }

.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: .5rem .9rem; border-radius: var(--radius); cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #0B4959; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.small { padding: .25rem .55rem; font-size: .85rem; }
.btn.danger { color: var(--err); }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: .55rem .5rem; }

.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .8rem; }
.toolbar input, .toolbar select, .inline-form input, .settings input, dialog input, dialog select {
  border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .7rem; background: var(--surface); min-width: 0;
}
.toolbar input { flex: 1 1 220px; }
.counts { color: var(--muted); font-size: .9rem; margin-bottom: 1rem; display: flex; gap: 1.2rem; flex-wrap: wrap; }
.counts b { color: var(--ink); }

.banner { border-left: 4px solid var(--low); background: #FFF6EC; padding: .7rem 1rem; margin-bottom: .8rem; border-radius: 0 var(--radius) var(--radius) 0; }
.banner.err { border-color: var(--err); background: #FDEEEC; }

.client-group { margin-bottom: 1.4rem; }
.client-group > h3 { font-size: 1rem; margin: 0 0 .4rem; }
.acc { display: grid; grid-template-columns: 6px minmax(0, 1.6fr) minmax(0, 1.1fr) minmax(0, 1.3fr); gap: 0 1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .4rem; overflow: hidden; }
.acc > .bar { align-self: stretch; background: var(--na); }
.acc.s-ok > .bar { background: var(--ok); }
.acc.s-low > .bar { background: var(--low); }
.acc.s-error > .bar { background: var(--err); }
.acc > div { padding: .7rem 0; }
.acc > div:last-child { padding-right: 1rem; }
.acc .name { font-weight: 600; overflow-wrap: anywhere; }
.acc .meta { color: var(--muted); font-size: .85rem; }
.amount { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; line-height: 1.2; }
.amount.na { font-size: 1rem; font-weight: 600; color: var(--na); }
.amount.err { font-size: 1rem; font-weight: 600; color: var(--err); }
.kind { font-size: .8rem; color: var(--muted); }
.tag { display: inline-block; font-size: .78rem; font-weight: 600; padding: .05rem .45rem; border-radius: 3px; margin-right: .3rem; }
.tag.low { background: #FCE9D4; color: #7A3F04; }
.tag.err { background: #FBDDD9; color: #8A1B12; }
.tag.warn { background: #EEF0F2; color: var(--ink); }
.reason { font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.budget { font-size: .85rem; margin-top: .25rem; }
.meter { height: 5px; background: var(--line); border-radius: 3px; position: relative; margin-top: .25rem; max-width: 220px; }
.meter > span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; }
.meter > i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 2rem; text-align: center; color: var(--muted); }

.inline-form { display: flex; gap: .6rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.inline-form input { flex: 1 1 260px; }
.client-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: .8rem; }
.client-card header { display: flex; justify-content: space-between; gap: .6rem; align-items: center; flex-wrap: wrap; }
.client-card header h3 { margin: 0; font-size: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table-wrap { overflow-x: auto; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .82rem; }
td.num { font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.settings { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; max-width: 640px; display: grid; gap: .9rem; margin-bottom: 1rem; }
.settings label, dialog label { display: grid; gap: .3rem; font-weight: 500; font-size: .92rem; }
.preview { white-space: pre-wrap; background: #E7F4EC; border-radius: var(--radius); padding: 1rem; font: .88rem/1.5 "Public Sans", system-ui, sans-serif; margin: 0; }
.form-error { color: var(--err); min-height: 1.2em; margin: 0; font-size: .9rem; }

dialog { border: 1px solid var(--line); border-radius: 8px; padding: 1.3rem; width: min(460px, 92vw); }
dialog::backdrop { background: rgb(27 39 51 / .45); }
dialog form { display: grid; gap: .8rem; }
dialog h2 { margin: 0; }
.check { display: flex !important; align-items: center; gap: .5rem; font-weight: 400 !important; }

.login { min-height: 100vh; display: grid; place-items: center; }
.login-box { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 2rem; display: grid; gap: .7rem; width: min(360px, 92vw); }
.login-box input { border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem .7rem; }

@media (max-width: 760px) {
  .acc { grid-template-columns: 6px minmax(0, 1fr); }
  .acc > div { grid-column: 2; padding: .15rem 1rem .15rem 0; }
  .acc > div:nth-child(2) { padding-top: .7rem; }
  .acc > div:last-child { padding-bottom: .7rem; }
  .acc > .bar { grid-row: 1 / span 3; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Visão de verbas (grade) ---------- */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: .5rem .9rem; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed=true] { background: var(--ink); color: #fff; font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .82rem; color: var(--muted); margin-bottom: .7rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ok { background: #3FB27F; } .dot.slow { background: #5B9BEA; } .dot.fast { background: #E8914A; } .dot.over { background: #E5534B; }
.legend .tick { width: 2px; height: 12px; background: var(--ink); display: inline-block; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.gcard { background: #18212C; color: #E8EDF2; padding: 1rem 1.1rem .9rem; display: flex; flex-direction: column; min-height: 250px; border-radius: 10px; }
.gcard .gname { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard .gspend { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: .1rem; }
.gcard .gsub { font-size: .76rem; color: #93A1B0; margin-top: .1rem; min-height: 1.1em; }
.gcard svg { width: 100%; max-width: 170px; display: block; margin: .5rem auto 0; overflow: visible; }
.gcard .track { stroke: #2B3746; }
.gcard .val { transition: stroke-dasharray .4s ease; }
.gcard .gpct { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gcard .gtick { stroke: #E8EDF2; stroke-width: 2.5; }
.gcard .gmeta { text-align: center; font-size: .76rem; line-height: 1.45; color: #93A1B0; margin-top: .15rem; font-variant-numeric: tabular-nums; }
.gflag.st { background: #222D3A; }
.gcard .gflags { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: center; margin-top: auto; padding-top: .5rem; }
.gflag { font-size: .7rem; font-weight: 600; padding: .05rem .4rem; border-radius: 3px; background: #2B3746; color: #E8EDF2; }
.gflag.low { background: #5A3A12; color: #FFD9A8; } .gflag.err { background: #5C1F1B; color: #FFC2BC; }
/* cores do ritmo: só dentro da grade, para não tingir a visão em lista */
.gcard .s-ok { stroke: #3FB27F; color: #3FB27F; } .gcard .s-slow { stroke: #5B9BEA; color: #5B9BEA; }
.gcard .s-fast { stroke: #E8914A; color: #E8914A; } .gcard .s-over { stroke: #E5534B; color: #E5534B; } .gcard .s-none { stroke: #6B7785; color: #93A1B0; }
.gcard text.gpct { fill: currentColor; stroke: none; }
@media (prefers-reduced-motion: reduce) { .gcard .val { transition: none; } }

.gcard .plats { margin-top: .7rem; display: grid; gap: .55rem; border-top: 1px solid #2B3746; padding-top: .6rem; }
.prow { font-size: .78rem; }
.prow .ptop { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.prow .pname { color: #C9D3DD; font-weight: 600; }
.prow .pspend { font-variant-numeric: tabular-nums; font-weight: 600; }
.prow .pspend b { margin-left: .25rem; }
.prow .pbar { position: relative; height: 5px; background: #2B3746; border-radius: 3px; margin: .3rem 0 .25rem; }
.prow .pbar span { position: absolute; inset: 0 auto 0 0; border-radius: 3px; }
.prow .pbar span.s-ok { background: #3FB27F; } .prow .pbar span.s-slow { background: #5B9BEA; }
.prow .pbar span.s-fast { background: #E8914A; } .prow .pbar span.s-over { background: #E5534B; } .prow .pbar span.s-none { background: transparent; }
.prow .pbar i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #E8EDF2; }
.prow .pbot { white-space: nowrap; display: flex; justify-content: space-between; gap: .5rem; color: #93A1B0; font-variant-numeric: tabular-nums; }
.pbal { color: #C9D3DD; } .pbal.low { color: #FFB866; font-weight: 600; } .pbal.err { color: #FF8F85; font-weight: 600; } .pbal.na { color: #6F7D8C; }
.prow b.s-ok, .prow b.s-slow, .prow b.s-fast, .prow b.s-over, .prow b.s-none { stroke: none; }

/* velocímetro por plataforma */
.grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.pgs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-top: .6rem; }
.pgs-1 { grid-template-columns: minmax(0, 1fr); max-width: 170px; margin-left: auto; margin-right: auto; width: 100%; }
.pg { text-align: center; background: #1F2935; border-radius: 8px; padding: .55rem .4rem .6rem; }
.pg .pname { font-size: .78rem; font-weight: 600; color: #C9D3DD; }
.pg svg { max-width: 140px; margin-top: .25rem; }
.pg .pspend { font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; margin-top: .1rem; }
.pg .pverba { font-size: .74rem; color: #93A1B0; font-variant-numeric: tabular-nums; }
.pg .pbal { font-size: .74rem; margin-top: .2rem; font-variant-numeric: tabular-nums; }

.pg .pbals { margin: .35rem 0 .1rem; min-height: 2.1rem; display: flex; flex-direction: column; justify-content: center; gap: .1rem; }
.pg .bline { font-variant-numeric: tabular-nums; }
.pg .bline .bval { font-size: 1rem; font-weight: 700; color: #E8EDF2; }
.pg .bline .bval small { font-size: .7rem; font-weight: 600; color: #93A1B0; text-transform: uppercase; letter-spacing: .04em; }
.pg .bline.multi { display: flex; justify-content: space-between; gap: .4rem; font-size: .74rem; text-align: left; }
.pg .bline.multi .bval { font-size: .8rem; }
.pg .bline .bname { color: #93A1B0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg .bval.low { color: #FFB866; } .pg .bval.err { color: #FF8F85; font-size: .8rem; } .pg .bval.na { color: #6F7D8C; font-size: .74rem; font-weight: 500; }
.pg .plabel { font-size: .68rem; color: #93A1B0; text-transform: uppercase; letter-spacing: .05em; margin-top: .1rem; }
.pg .pstatus { font-size: .72rem; font-weight: 600; margin-top: .3rem; stroke: none; }
.pg .pbal { display: none; }

.pg .bkind { display: block; font-size: .66rem; font-weight: 600; color: #93A1B0; text-transform: uppercase; letter-spacing: .05em; }
.pg .bline .bval { white-space: nowrap; }
.pg .pexp { color: #C9D3DD; font-weight: 600; }

/* duração do saldo e abastecimento */
.pg .prun { font-size: .72rem; color: #93A1B0; margin-top: .15rem; line-height: 1.35; font-variant-numeric: tabular-nums; }
.pg .prun.bad { color: #FFB866; font-weight: 600; }
.pg .prun .prun-t { color: #6FCF9A; }
.pg .bline.multi + .prun { text-align: right; margin-top: -.05rem; }
.gcard .grech { margin-left: .5rem; font-size: .72rem; font-weight: 500; color: #93A1B0; background: #222D3A; padding: .05rem .4rem; border-radius: 3px; vertical-align: 2px; }
.counts .cnt-warn b { color: var(--low); } .counts .cnt-err b { color: var(--err); }
.rech { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); }
.rech input { width: 4.2rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .25rem .4rem; transition: border-color .3s; }
.rech input.saved { border-color: var(--ok); }
.rech select { border: 1px solid var(--line); border-radius: var(--radius); padding: .25rem .4rem; background: var(--surface); transition: border-color .3s; }
.rech select.saved { border-color: var(--ok); }
.pg .prun .prun-b { font-weight: 500; color: #93A1B0; font-size: .68rem; }
.pg .prun .prun-w { font-weight: 600; color: #FFB866; font-size: .68rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline dotted; }

/* usuários e perfis */
.whoami { color: var(--muted); font-size: .85rem; padding: .55rem .2rem .55rem .8rem; border-left: 1px solid var(--line); margin-left: .3rem; }
body.role-gestor .admin-only { display: none !important; }
.login-box input#email::placeholder { font-size: .85rem; }
.settings select, #users select { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .7rem; background: var(--surface); font: inherit; max-width: 100%; }
#users select { padding: .25rem .4rem; }

/* logos das plataformas (arquivos em public/logos/) */
.plogo { height: 1.05em; width: auto; vertical-align: -0.18em; margin-right: .35em; }
.pg .pname { display: inline-flex; align-items: center; justify-content: center; gap: 0; }
.pg .pname .plogo { height: 18px; vertical-align: middle; }

/* marca Vêneto */
.brand { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.brand-logo { height: 38px; width: auto; display: block; }
.brand-text { border-left: 1px solid var(--line); padding-left: 1.1rem; }
.login-logo { height: 40px; width: auto; display: block; margin: 0 auto .4rem; }
.login-box h1 { text-align: center; font-size: 1.05rem; color: var(--muted); font-weight: 600; margin-bottom: .4rem; }
@media (max-width: 760px) {
  .brand-logo { height: 30px; }
  .brand-text { border-left: 0; padding-left: 0; }
}
