/* Financeiro Renato & Suelen — "Seu dinheiro, em uma visão". Cores com função: violeta = ação e destaque,
   azul e verde petróleo = apoio, âmbar = atenção, vermelho = erro, verde = confirmado. */
:root {
  --bg: #F5F7FB; --surface: #FFFFFF; --ink: #0F172A; --ink2: #475569; --ink3: #64748B; --line: #E2E8F0; --line2: #EEF2F7;
  --primary: #6D5EF7; --primary-strong: #5646E0; --primary-soft: #EEEBFE; --primary-ink: #FFFFFF;
  --blue: #2563EB; --blue-soft: #DBEAFE; --teal: #0F766E; --teal-soft: #CCFBF1;
  --warn: #B45309; --warn-soft: #FEF3C7; --bad: #B91C1C; --bad-soft: #FEE2E2; --good: #166534; --good-soft: #DCFCE7;
  --r-renato: #6D5EF7; --r-suelen: #0F766E; --r-casal: #2563EB; --r-misto: #B45309; --r-indef: #64748B; --r-prof: #9333EA; --r-terc: #94A3B8;
  --radius: 14px; --radius-sm: 9px; --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05); --shadow-lg: 0 10px 40px rgba(15, 23, 42, .18);
  /* superfícies e tintas que mudam com o tema (os valores abaixo são a aparência clara de sempre) */
  --card-bg: var(--surface); --side-bg: var(--surface); --hover: #F8FAFC; --head-bg: #F8FAFC; --field-bg: var(--surface); --field-line: #CBD5E1; --overlay: rgba(15, 23, 42, .45);
  --tip-bg: #0F172A; --tip-ink: #FFFFFF; --tip-accent: #C7D2FE; --primary-text: #5646E0; --primary-soft-hover: #E0DBFD; --sel: rgba(109, 94, 247, .13); --sel-hover: rgba(109, 94, 247, .07); --axis: #94A3B8; --sub-track: #A5B4FC;
  --good-text: #166534; --warn-text: #B45309; --bad-text: #B91C1C; --info-text: #2563EB; --credit-text: #0F766E; --danger-line: #FCA5A5;
  --notice-ink: #1E3A8A; --notice-warn-ink: #7C2D12; --notice-bad-ink: #7F1D1D; --notice-good-ink: #14532D; --page-bg: var(--bg);
  --side: 248px;
  font-family: Inter, "Inter Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.5; color: var(--ink); color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page-bg); color: var(--ink); }
html { background-attachment: fixed; }
body { -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 1.55rem; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: .95rem; font-weight: 650; }
a { color: var(--primary-text); text-decoration: none; } a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--ink2); } .small { font-size: .85rem; } .tiny { font-size: .78rem; }
.neg { color: var(--credit-text); } .strong { font-weight: 650; }
.boot { padding: 3rem; color: var(--ink2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* casca: navegação lateral no computador, barra superior em telas menores */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--side-bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 1.1rem .8rem; gap: .25rem; }
.brand { display: flex; align-items: center; gap: .6rem; padding: .2rem .5rem 1rem; }
.brand.brand-logo { padding: .15rem .35rem .95rem; }
.brand.brand-logo img { display: block; width: min(188px, 100%); height: auto; object-fit: contain; }
.auth .brand.brand-logo img { width: min(300px, 88vw); }
.topbar .brand.brand-logo img { width: 150px; max-height: 48px; object-fit: contain; object-position: left center; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--blue)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85rem; letter-spacing: -.02em; flex: none; }
.brand strong { display: block; font-size: .95rem; line-height: 1.15; letter-spacing: -.01em; } .brand span { font-size: .76rem; color: var(--ink2); }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .65rem; border-radius: var(--radius-sm); color: var(--ink2); font-weight: 550; font-size: .93rem; text-decoration: none; }
.nav a:hover { background: var(--line2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-text); }
.nav a .badge { margin-left: auto; }
.nav svg { width: 19px; height: 19px; flex: none; }
.side .foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.side .who { display: flex; align-items: center; gap: .55rem; padding: 0 .4rem; font-size: .88rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; }
.main { min-width: 0; padding: 1.5rem clamp(1rem, 3vw, 2.2rem) 4rem; max-width: 1320px; width: 100%; margin: 0 auto; }
.topbar { display: none; }
@media (max-width: 1023px) {
  .shell { display: block; }
  .side { display: none; }
  .topbar { display: block; position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); }
  .topbar .row1 { display: flex; align-items: center; justify-content: space-between; padding: .55rem .9rem; }
  .topbar .brand { padding: 0; }
  .topbar .nav { display: flex; gap: .2rem; overflow-x: auto; padding: 0 .6rem .5rem; scrollbar-width: none; }
  .topbar .nav::-webkit-scrollbar { display: none; }
  .topbar .nav a { flex: none; flex-direction: column; gap: .15rem; font-size: .72rem; padding: .35rem .6rem; }
  .main { padding: 1rem .9rem 4rem; }
  h1 { font-size: 1.3rem; }
}
.demo-banner { background: var(--warn-soft); color: var(--warn-text); text-align: center; padding: .35rem; font-weight: 650; font-size: .85rem; }

/* cabeçalho de página e filtros */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .sub { color: var(--ink2); margin-top: .2rem; }
.filters { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; display: flex; gap: .9rem 1.2rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; box-shadow: var(--shadow); }
.field { display: flex; flex-direction: column; gap: .25rem; font-size: .78rem; color: var(--ink2); font-weight: 600; min-width: 0; }
.field > span.lbl { text-transform: uppercase; letter-spacing: .04em; font-size: .7rem; }
.seg { display: inline-flex; background: var(--line2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: .38rem .7rem; border-radius: 8px; font: inherit; font-size: .86rem; font-weight: 600; color: var(--ink2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary-text); box-shadow: 0 1px 2px rgba(15,23,42,.12); }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--line2); color: var(--ink2); border-radius: 999px; padding: .12rem .6rem; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good-text); } .chip.warn { background: var(--warn-soft); color: var(--warn-text); } .chip.bad { background: var(--bad-soft); color: var(--bad-text); }
.chip.info { background: var(--blue-soft); color: var(--info-text); } .chip.primary { background: var(--primary-soft); color: var(--primary-text); }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 0 0 .15rem; font: inherit; font-weight: 700; line-height: 1; }
.badge { background: var(--primary); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: .05rem .45rem; }

/* superfícies */
.card { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.15rem; box-shadow: var(--shadow); min-width: 0; }
.card + .card, .stack > * + * { margin-top: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head p { color: var(--ink2); font-size: .85rem; margin-top: .15rem; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g32 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid > .card + .card { margin-top: 0; }
@media (max-width: 900px) { .g2, .g3, .g32 { grid-template-columns: minmax(0, 1fr); } }
.kpi { display: flex; flex-direction: column; gap: .2rem; }
.kpi .label { color: var(--ink2); font-size: .8rem; font-weight: 600; }
.kpi .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .value.sm { font-size: 1.2rem; }
.kpi .hint { color: var(--ink2); font-size: .82rem; }
.kpi .source { margin-top: auto; padding-top: .5rem; }
.delta.up { color: var(--warn-text); } .delta.down { color: var(--good-text); }
.notice { border-radius: var(--radius-sm); padding: .6rem .8rem; background: var(--blue-soft); color: var(--notice-ink); font-size: .88rem; }
.notice.warn { background: var(--warn-soft); color: var(--notice-warn-ink); } .notice.bad { background: var(--bad-soft); color: var(--notice-bad-ink); } .notice.good { background: var(--good-soft); color: var(--notice-good-ink); } .notice.plain { background: var(--line2); color: var(--ink2); }
.error { color: var(--bad-text); }

/* controles */
button, .btn { font: inherit; font-size: .88rem; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); padding: .45rem .8rem; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; }
button:hover, .btn:hover { background: var(--line2); text-decoration: none; }
button.primary, .btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); } button.primary:hover, .btn.primary:hover { background: var(--primary-strong); }
button.danger { color: var(--bad-text); border-color: var(--danger-line); } button.danger:hover { background: var(--bad-soft); }
button.danger.solid { background: var(--bad); color: #fff; border-color: var(--bad); }
button.link { border: 0; background: none; padding: 0; color: var(--primary-text); font-weight: 600; } button.link:hover { text-decoration: underline; background: none; }
button.ghost { border-color: transparent; background: transparent; color: var(--ink2); }
button:disabled { opacity: .5; cursor: not-allowed; }
button svg, .btn svg { width: 16px; height: 16px; }
input, select, textarea { font: inherit; font-size: .9rem; color: var(--ink); background: var(--field-bg); border: 1px solid var(--field-line); border-radius: var(--radius-sm); padding: .42rem .6rem; min-width: 0; max-width: 100%; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--primary); padding: 0; }
textarea { width: 100%; }
label.check { display: inline-flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--ink); font-weight: 500; }
.row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: flex-end; }
.row.center { align-items: center; } .row.between { justify-content: space-between; }
.form { display: grid; gap: .8rem; } .form .row > .field { flex: 1 1 160px; } .form .field input, .form .field select { width: 100%; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; margin-top: .4rem; }

/* abas */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: .55rem .8rem; color: var(--ink2); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--ink); } .tabs a[aria-current="page"] { color: var(--primary-text); border-bottom-color: var(--primary); }

/* tabelas: rolagem dentro do componente, nunca na página */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink2); font-weight: 700; background: var(--head-bg); padding: .55rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
th button.sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
td { padding: .55rem .7rem; border-bottom: 1px solid var(--line2); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: var(--hover); }
tr.total td, tfoot td { font-weight: 700; background: var(--head-bg); border-top: 1px solid var(--line); }
tr.sub td:first-child { padding-left: 1.6rem; color: var(--ink2); }
td .desc { font-weight: 550; } td .meta { color: var(--ink2); font-size: .8rem; }
table.plain th { position: static; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-top: .7rem; flex-wrap: wrap; font-size: .85rem; color: var(--ink2); }

/* carregamento, vazio e erro */
.loading { color: var(--ink2); padding: 1.2rem 0; display: flex; align-items: center; gap: .6rem; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--primary); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.stale { position: relative; } .stale > .stale-body { opacity: .38; pointer-events: none; filter: saturate(.4); }
.stale > .updating { position: absolute; top: .2rem; right: .2rem; z-index: 2; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; font-size: .8rem; display: inline-flex; align-items: center; gap: .4rem; box-shadow: var(--shadow); }
.empty { text-align: center; padding: 1.6rem 1rem; color: var(--ink2); } .empty strong { display: block; color: var(--ink); margin-bottom: .2rem; } .empty .actions { justify-content: center; }
.skeleton { height: 1rem; border-radius: 6px; background: linear-gradient(90deg, var(--line2), var(--hover), var(--line2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; margin: .5rem 0; }
@keyframes sk { to { background-position: -200% 0; } }

/* gráficos */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-size: 11px; fill: var(--ink2); font-family: inherit; }
.chart .bar-g { cursor: pointer; outline: none; }
.chart .bar-g:focus-visible .hit, .chart .bar-g:hover .hit { fill: var(--sel-hover); }
.chart .bar-g[aria-pressed="true"] .hit { fill: var(--sel); stroke: var(--primary); stroke-width: 1; }
.chart .bar-g.dim rect.seg-r { opacity: .35; }
.chart .tot { font-weight: 700; fill: var(--ink); font-size: 10.5px; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink); border-radius: 10px; padding: .5rem .65rem; font-size: .8rem; box-shadow: var(--shadow-lg); min-width: 170px; transform: translate(-50%, -100%); }
.tip b { display: block; margin-bottom: .2rem; } .tip div { display: flex; justify-content: space-between; gap: .8rem; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.legend button { border-radius: 999px; padding: .2rem .65rem; font-size: .8rem; }
.legend button[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.rank { display: grid; gap: .15rem; }
.rank button.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .8rem; width: 100%; text-align: left; border: 0; border-radius: var(--radius-sm); padding: .45rem .55rem; background: none; font-weight: 500; }
.rank button.item:hover { background: var(--hover); } .rank button.item[aria-pressed="true"], .rank button.item[aria-expanded="true"] { background: var(--primary-soft); }
.rank .name { display: flex; gap: .4rem; align-items: center; min-width: 0; font-weight: 600; } .rank .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .val { font-variant-numeric: tabular-nums; font-weight: 650; }
.rank .track { grid-column: 1 / -1; height: 7px; border-radius: 5px; background: var(--line2); overflow: hidden; }
.rank .track i { display: block; height: 100%; border-radius: 5px; background: var(--primary); } .rank .track i.credit { background: var(--teal); }
.rank .subs { margin: .1rem 0 .4rem 1.1rem; border-left: 2px solid var(--primary-soft); padding-left: .5rem; }
.rank .subs button.item { font-size: .88rem; padding: .3rem .5rem; } .rank .subs .track i { background: var(--sub-track); }
.compbar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: var(--line2); }
.compbar i { display: block; height: 100%; min-width: 2px; }
.complist { display: grid; gap: .35rem; margin-top: .7rem; }
.complist button { display: flex; justify-content: space-between; gap: .6rem; width: 100%; border: 0; background: none; padding: .3rem .4rem; font-weight: 500; text-align: left; border-radius: 8px; }
.complist button:hover { background: var(--hover); } .complist button[aria-pressed="true"] { background: var(--primary-soft); }
.complist .l { display: flex; align-items: center; gap: .45rem; min-width: 0; }
.progress { height: 8px; border-radius: 5px; background: var(--line2); overflow: hidden; } .progress i { display: block; height: 100%; background: var(--primary); } .progress.over i { background: var(--bad); }

/* painel lateral (detalhes) e diálogos: "Fechar" fica dentro do painel; encerrar a sessão fica na navegação */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 40; animation: fade .15s ease; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 100vw); background: var(--bg); z-index: 41; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease; }
.drawer.wide { width: min(980px, 100vw); }
.drawer > header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.drawer > .body { overflow-y: auto; padding: 1rem 1.1rem 3rem; flex: 1; }
.modal { position: fixed; z-index: 51; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 1.2rem; }
.modal h2 { margin-bottom: .5rem; } .modal p { color: var(--ink2); }
.overlay.top { z-index: 50; }
.choices { display: grid; gap: .5rem; margin: .9rem 0; }
.choices button { justify-content: flex-start; text-align: left; padding: .7rem .8rem; display: block; } .choices button small { display: block; color: var(--ink2); font-weight: 500; margin-top: .1rem; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--tip-bg); color: var(--tip-ink); padding: .65rem 1rem; border-radius: 12px; z-index: 60; box-shadow: var(--shadow-lg); display: flex; gap: .8rem; align-items: center; max-width: calc(100vw - 2rem); font-size: .9rem; }
.toast button { background: transparent; color: var(--tip-accent); border: 0; padding: 0; font-weight: 700; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem 1rem; font-size: .9rem; } .dl dt { color: var(--ink2); } .dl dd { margin: 0; }
details > summary { cursor: pointer; color: var(--primary-text); font-weight: 600; font-size: .88rem; } details[open] > summary { margin-bottom: .6rem; }
.list { display: grid; gap: .6rem; } .list .item { display: flex; justify-content: space-between; gap: .8rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--line2); } .list .item:last-child { border-bottom: 0; padding-bottom: 0; } .list .item:first-child { padding-top: 0; }
.drop { border: 2px dashed var(--field-line); border-radius: var(--radius); padding: 1.6rem; text-align: center; color: var(--ink2); background: var(--hover); } .drop.over { border-color: var(--primary); background: var(--primary-soft); }
.auth { max-width: 420px; margin: 8vh auto; padding: 0 1rem; } .auth .card { padding: 1.6rem; } .auth .brand { justify-content: center; padding-bottom: 1.2rem; }
pre { background: var(--line2); border-radius: var(--radius-sm); padding: .7rem; overflow-x: auto; font-size: .85rem; }
.covgrid td, .covgrid th { text-align: center; padding: .4rem .45rem; } .covgrid td:first-child, .covgrid th:first-child { text-align: left; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--line); } .dot.ok { background: var(--good); } .dot.miss { background: var(--warn); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .side, .topbar, .filters, .no-print { display: none !important; } .shell { display: block; } .card { box-shadow: none; } }

/* celular: indicadores em duas colunas, gráfico com largura mínima e rolagem dentro do próprio quadro */
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .kpis > .kpi:first-child { grid-column: 1 / -1; }
  .kpi .value { font-size: 1.2rem; } .kpi .value.sm { font-size: 1.05rem; }
  .card { padding: .9rem; }
  .chart { overflow-x: auto; } .chart svg { min-width: 560px; }
  .filters { gap: .7rem; padding: .7rem; } .filters select, .filters input { max-width: 100%; }
  .page-head { margin-bottom: .7rem; }
}

/* calendário de vencimentos: a coluna da conta tem espaço e a situação quebra linha em vez de espremer o resto */
table.cal td:nth-child(2) { min-width: 17rem; } table.cal td:nth-child(5) { max-width: 24rem; } table.cal .chip { white-space: normal; border-radius: .8rem; text-align: left; }

/* Merlyn — assistente consultivo: botão flutuante (abaixo de painéis e diálogos) e painel de conversa */
.merlyn-fab { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 30; display: inline-flex; align-items: center; gap: .45rem; border: 0; border-radius: 999px; padding: .65rem 1rem .65rem .8rem;
  background: linear-gradient(135deg, var(--primary), var(--blue)); color: #fff; font-weight: 650; box-shadow: var(--shadow-lg); cursor: pointer; }
.merlyn-fab:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--primary), var(--blue)); } .merlyn-fab svg { width: 20px; height: 20px; } .merlyn-fab.hidden { display: none; }
.main { padding-bottom: 5.5rem; } /* o fim de cada página rola para cima do botão: nada fica coberto */
.merlyn { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 35; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease; }
.merlyn > header { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .7rem .9rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.merlyn .who { display: flex; gap: .6rem; align-items: center; } .merlyn .mk { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--blue)); color: #fff; display: grid; place-items: center; flex: none; } .merlyn .mk svg { width: 20px; height: 20px; }
.merlyn > header button { padding: .35rem .6rem; font-size: .85rem; }
.merlyn .ctx { padding: .5rem .9rem; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; }
.merlyn .msgs { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .8rem; overscroll-behavior: contain; }
.merlyn .hello p { color: var(--ink2); font-size: .9rem; margin-bottom: .7rem; }
.merlyn .sugg { display: grid; gap: .4rem; } .merlyn .sugg button { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .7rem; font-weight: 550; color: var(--ink); } .merlyn .sugg button:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.merlyn .msg.user { display: flex; justify-content: flex-end; } .merlyn .msg.user .bubble { background: var(--primary); color: #fff; border-radius: 14px 14px 4px 14px; padding: .5rem .75rem; max-width: 88%; white-space: pre-wrap; overflow-wrap: anywhere; }
.merlyn .msg.bot { display: grid; gap: .6rem; min-width: 0; }
.mrl-text { background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: .6rem .8rem; font-size: .93rem; overflow-wrap: anywhere; } .mrl-text p + p, .mrl-text ul + p, .mrl-text p + ul { margin-top: .45rem; } .mrl-text ul { margin: 0; padding-left: 1.1rem; }
.mrl-text strong { white-space: nowrap; font-variant-numeric: tabular-nums; background: var(--primary-soft); color: var(--primary-text); border-radius: 5px; padding: 0 .25rem; font-weight: 700; }
.mrl-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .8rem; box-shadow: var(--shadow); display: grid; gap: .6rem; min-width: 0; }
.mrl-block .head strong { display: block; margin-bottom: .3rem; } .mrl-block .fl { display: flex; gap: .3rem; flex-wrap: wrap; } .mrl-block .chip { white-space: normal; }
.mrl-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; } .mrl-kpis > div { display: flex; flex-direction: column; } .mrl-kpis .label { font-size: .74rem; color: var(--ink2); font-weight: 600; } .mrl-kpis .value { font-size: 1.08rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.mrl-bars { display: grid; gap: .1rem; } .mrl-bars .item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .6rem; width: 100%; text-align: left; border: 0; background: none; border-radius: var(--radius-sm); padding: .3rem .35rem; font-size: .86rem; font-weight: 500; color: var(--ink); }
.mrl-bars .item:not(:disabled):hover { background: var(--primary-soft); } .mrl-bars .item:disabled { cursor: default; opacity: 1; } .mrl-bars .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; } .mrl-bars .val { font-variant-numeric: tabular-nums; font-weight: 650; }
.mrl-bars .track { grid-column: 1 / -1; height: 6px; border-radius: 4px; background: var(--line2); overflow: hidden; } .mrl-bars .track i { display: block; height: 100%; border-radius: 4px; background: var(--primary); } .mrl-bars .track i.credit { background: var(--teal); }
.mrl-pairs { display: grid; gap: .15rem; font-size: .82rem; } .mrl-pairs .legend, .mrl-block .legend { display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; } .mrl-pairs .legend i, .mrl-block .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; }
.mrl-pairs i.a { background: var(--primary); } .mrl-pairs i.b { background: var(--teal); }
.mrl-pairs .row { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr) auto; gap: .5rem; align-items: center; border: 0; background: none; padding: .2rem .3rem; border-radius: var(--radius-sm); text-align: left; font-weight: 500; color: var(--ink); } .mrl-pairs .row:hover { background: var(--primary-soft); }
.mrl-pairs .bars { display: grid; gap: 2px; } .mrl-pairs .bars i { display: block; height: 7px; border-radius: 4px; min-width: 2px; } .mrl-pairs .v { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.2; font-size: .78rem; }
.mrl-block table { font-size: .8rem; } .mrl-block td, .mrl-block th { padding: .35rem .45rem; } .mrl-block td.desc { max-width: 11rem; overflow-wrap: anywhere; } .mrl-block tr.click { cursor: pointer; } .mrl-block tr.click:hover td, .mrl-block tr.click:focus-visible td { background: var(--primary-soft); } .mrl-block .pos { color: var(--good-text); }
.mrl-block .chart svg { min-width: 0; } .mrl-block .chart text { font-size: 20px; } .mrl-block .chart .tot { font-size: 19px; } .mrl-block .chart svg > g > text[text-anchor="end"] { display: none; } /* no painel estreito valem os totais sobre as barras */
.mrl-block .links { display: flex; gap: .4rem; flex-wrap: wrap; } .btn-open { display: inline-flex; align-items: center; gap: .2rem; background: var(--primary-soft); color: var(--primary-text); border: 0; border-radius: 999px; padding: .3rem .7rem; font-size: .82rem; font-weight: 650; } .btn-open:hover { background: var(--primary-soft-hover); } .btn-open svg { width: 14px; height: 14px; }
.merlyn .ask { display: flex; gap: .5rem; align-items: flex-end; padding: .7rem .9rem .3rem; background: var(--surface); border-top: 1px solid var(--line); } .merlyn .ask textarea { resize: none; flex: 1; min-height: 2.9rem; max-height: 8rem; } .merlyn .ask button { white-space: nowrap; } .merlyn .ask .stop { border-color: var(--bad); color: var(--bad-text); }
.merlyn > footer { display: flex; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .2rem .9rem max(.6rem, env(safe-area-inset-bottom)); background: var(--surface); }
/* no computador o painel fica ao lado: a página encolhe em vez de ficar coberta */
@media (min-width: 1280px) { body.merlyn-open .shell { margin-right: 440px; } }
@media (max-width: 700px) { .merlyn { width: 100vw; border-left: 0; } .merlyn > header .ghost { font-size: 0; gap: 0; } .merlyn > header .ghost svg { width: 18px; height: 18px; } .merlyn-fab span { display: none; } .merlyn-fab { padding: .8rem; } }

/* ------------------------------------------------------------------ temas (só aparência das superfícies; valem só na tela)
   As cores das séries dos gráficos, categorias, beneficiários e indicadores (--r-*, --primary, --blue, --teal, --good, --warn, --bad)
   não mudam. Mudam fundo, cartões, campos, bordas e as tintas de texto necessárias para a leitura. Impressão usa sempre o claro. */
@media screen {
  /* prévia do Claro dentro de uma tela escura (Configurações › Layout e apresentação): repete os valores padrão */
  [data-theme="claro"] { color-scheme: light; --bg: #F5F7FB; --page-bg: #F5F7FB; --surface: #FFFFFF; --card-bg: #FFFFFF; --side-bg: #FFFFFF; --ink: #0F172A; --ink2: #475569; --line: #E2E8F0; --line2: #EEF2F7; }
  [data-theme="escuro"], [data-theme="tec"] { color-scheme: dark; color: var(--ink);
    --ink: #ECEEF3; --ink2: #A9B0BD; --ink3: #8C94A3; --overlay: rgba(0, 0, 0, .62); --tip-ink: #F4F5F8; --tip-accent: #C7D2FE;
    --primary-text: #B9B0FF; --primary-soft: rgba(124, 108, 255, .2); --primary-soft-hover: rgba(124, 108, 255, .3); --sel: rgba(140, 126, 255, .26); --sel-hover: rgba(140, 126, 255, .14); --axis: #6B7385; --sub-track: #8F85F0;
    --good-text: #6EE7A0; --warn-text: #F3B861; --bad-text: #F79A9A; --info-text: #8DB8FF; --credit-text: #5FD4C6; --danger-line: #7A3434;
    --good-soft: rgba(34, 197, 94, .16); --warn-soft: rgba(245, 158, 11, .16); --bad-soft: rgba(239, 68, 68, .18); --blue-soft: rgba(59, 130, 246, .2); --teal-soft: rgba(20, 184, 166, .18);
    --notice-ink: #BCD3FF; --notice-warn-ink: #F6CF91; --notice-bad-ink: #F9B4B4; --notice-good-ink: #A7EFC2; }
  [data-theme="escuro"] {
    --bg: #0A0B0D; --page-bg: #0A0B0D; --surface: #15171B; --card-bg: #15171B; --side-bg: #101114; --line: #262A31; --line2: #1D2026; --hover: #1B1E24; --head-bg: #1A1C21; --field-bg: #1A1C21; --field-line: #353A44; --tip-bg: #2A2E37;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6); }
  [data-theme="tec"] {
    --bg: #181A26; --page-bg: radial-gradient(1200px 700px at 85% -10%, rgba(124, 108, 255, .16), transparent 60%), radial-gradient(900px 600px at -10% 110%, rgba(96, 82, 220, .12), transparent 60%), #171925;
    --surface: #222435; --card-bg: rgba(152, 138, 255, .075); --side-bg: rgba(152, 138, 255, .055); --line: rgba(190, 180, 255, .13); --line2: rgba(190, 180, 255, .075); --hover: rgba(190, 180, 255, .07); --head-bg: rgba(190, 180, 255, .06);
    --field-bg: rgba(190, 180, 255, .06); --field-line: rgba(190, 180, 255, .24); --tip-bg: #2E3046; --ink: #EEEEF6; --ink2: #A8ABC2; --ink3: #8B8EA8;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset; --shadow-lg: 0 14px 44px rgba(8, 8, 20, .55); }
  /* superfícies que ficam por cima do conteúdo são sempre opacas; no Tec/slim o menu ganha desfoque suave onde o navegador permite */
  [data-theme="tec"] .side { background: #1C1E2C; }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { [data-theme="tec"] .side { background: rgba(34, 36, 56, .72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); } }
  [data-theme="tec"] .drawer, [data-theme="tec"] .merlyn { background: #1B1D2A; }
  [data-theme="tec"] th { background: #262839; }
  [data-theme="tec"] select option, [data-theme="escuro"] select option { background: var(--surface); color: var(--ink); }
  [data-theme="escuro"] .seg button[aria-pressed="true"], [data-theme="tec"] .seg button[aria-pressed="true"] { background: rgba(255, 255, 255, .1); box-shadow: none; }
  [data-theme="escuro"] .stale > .stale-body, [data-theme="tec"] .stale > .stale-body { opacity: .5; }
  [data-theme="escuro"] .mrl-text strong, [data-theme="tec"] .mrl-text strong { color: #D5CFFF; }
}

/* escolha de aparência: menu lateral (recolhível, acima do nome) e Configurações › Layout e apresentação */
.look { padding: .5rem .2rem .7rem; }
.look > button.tog { width: 100%; justify-content: space-between; border: 0; background: none; color: var(--ink2); padding: .3rem .4rem; font-size: .85rem; } .look > button.tog:hover { background: var(--line2); }
.look > button.tog svg { transition: transform .15s ease; } .look > button.tog[aria-expanded="true"] svg { transform: rotate(90deg); }
.swatches { display: flex; gap: .4rem; padding: .5rem .2rem .1rem; } .swatches button { flex: 1; flex-direction: column; gap: .25rem; padding: .35rem .2rem; font-size: .72rem; font-weight: 600; color: var(--ink2); border-color: transparent; background: none; }
.swatches .sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--field-line); display: block; } .swatches button[aria-checked="true"] { color: var(--ink); border-color: var(--primary); background: var(--primary-soft); }
.sw.claro { background: #FFFFFF; } .sw.escuro { background: #15171B; border-color: #4B5160; } .sw.tec { background: linear-gradient(135deg, #2A2C44, #7C6CFF); border-color: #8F85F0; }
.side .look { margin-top: auto; border-top: 1px solid var(--line); } .side .look + .foot { margin-top: 0; }
.top-actions { display: flex; align-items: center; gap: .9rem; flex: none; } .topbar .row1 { gap: .6rem; } .topbar .brand { min-width: 0; } .topbar .brand > div { min-width: 0; } .topbar .brand strong, .topbar .brand span:not(.mark) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.topbar .look { padding: 0; position: relative; } .topbar .look > button.tog { width: auto; gap: .3rem; } .topbar .look .swatches { position: absolute; right: -1rem; top: calc(100% + .5rem); z-index: 25; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: .5rem; width: 220px; }
.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .9rem; }
.themes > button { flex-direction: column; align-items: stretch; gap: .55rem; padding: .7rem; text-align: left; border-width: 2px; } .themes > button[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.themes .prev { border-radius: 10px; border: 1px solid var(--line); background: var(--page-bg); padding: .55rem; display: grid; grid-template-columns: 30% 1fr; gap: .4rem; min-height: 92px; color: var(--ink); }
.themes .prev .pv-side { background: var(--side-bg); border: 1px solid var(--line); border-radius: 6px; } .themes .prev .pv-main { display: grid; gap: .35rem; }
.themes .prev .pv-card { background: var(--card-bg); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .4rem; font-size: .68rem; display: flex; justify-content: space-between; align-items: center; gap: .3rem; } .themes .prev .pv-card b { font-size: .78rem; }
.themes .prev .pv-bars { display: flex; align-items: flex-end; gap: 3px; height: 26px; } .themes .prev .pv-bars i { width: 9px; border-radius: 2px 2px 0 0; display: block; }
.themes .nm { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-weight: 650; } .themes .ds { font-size: .8rem; font-weight: 400; color: var(--ink2); }
@media (max-width: 480px) { .topbar .row1 button.ghost { font-size: 0; gap: 0; padding: .4rem; } .topbar .row1 button.ghost svg { width: 20px; height: 20px; } .topbar .look > button.tog { font-size: .82rem; padding: .3rem .2rem; } }

/* Contas por instituição e titular: mesmas colunas em todos os grupos */
table.grp { table-layout: fixed; min-width: 860px; } table.grp th:nth-child(1) { width: 25%; } table.grp th:nth-child(2) { width: 14%; } table.grp th:nth-child(3) { width: 13%; } table.grp th:nth-child(4) { width: 13%; } table.grp th:nth-child(5) { width: 14%; } table.grp th:nth-child(6) { width: 13%; } table.grp th:nth-child(7) { width: 8%; }
table.grp th { white-space: normal; } table.grp td { overflow-wrap: anywhere; } table.grp td .chip { white-space: normal; border-radius: .8rem; } table.grp td:last-child button, table.grp td:last-child .btn { padding: .3rem .5rem; font-size: .8rem; }

/* ------------------------------------------------------------------ ambientes (Pessoal, empresa) */
/* O ambiente ativo aparece na marca, no seletor junto do nome e numa faixa fina no topo; a diferenciação é discreta e
   usa as mesmas variáveis dos três temas. */
:root { --env-biz: #0E7C86; --env-biz-soft: #E0F4F5; --env-biz-ink: #0A5A61; }
@media screen { [data-theme="escuro"], [data-theme="tec"] { --env-biz: #3DB8C2; --env-biz-soft: rgba(61, 184, 194, .16); --env-biz-ink: #9FE3E9; } }
.env { display: flex; flex-direction: column; gap: .3rem; padding: 0 .4rem .2rem; }
.env .lbl { font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink3, var(--ink2)); font-weight: 700; }
.env-opts { display: flex; gap: .25rem; background: var(--line2); border-radius: 10px; padding: .2rem; }
.env-opts button { flex: 1; border: 0; background: transparent; color: var(--ink2); border-radius: 8px; padding: .34rem .5rem; font-size: .82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.env-opts button[aria-checked="true"] { background: var(--surface); color: var(--primary-text, var(--primary)); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.env-opts button.biz[aria-checked="true"] { color: var(--env-biz-ink); box-shadow: 0 0 0 1.5px var(--env-biz) inset; }
.env-opts button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
/* na barra lateral, um ambiente embaixo do outro (o nome cabe inteiro) */
.side .env-opts { flex-direction: column; }
.side .env-opts button { flex: none; text-align: left; padding: .42rem .6rem; }
.env-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: .1rem .6rem; font-size: .76rem; font-weight: 700; background: var(--primary-soft); color: var(--primary-text, var(--primary)); white-space: nowrap; }
.env-tag.biz { background: var(--env-biz-soft); color: var(--env-biz-ink); }
.env.one { flex-direction: row; align-items: center; gap: .5rem; }
.brand .mark.biz { background: linear-gradient(135deg, var(--env-biz), #2563EB); }
[data-env="business"] .side { box-shadow: inset 3px 0 0 var(--env-biz); }
[data-env="business"] .topbar { box-shadow: inset 0 3px 0 var(--env-biz); }
[data-env="business"] .nav a[aria-current="page"] { box-shadow: inset 0 0 0 1px var(--env-biz-soft); }
.topbar .row-env { display: none; }
@media (max-width: 1023px) { .topbar .row-env { display: block; padding: 0 .9rem .45rem; } .topbar .row-env .env { flex-direction: row; align-items: center; gap: .6rem; padding: 0; } .topbar .row-env .env-opts { flex: 1; } }
.env-line { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
@media print { .env, .row-env { display: none !important; } }
.biz-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1200px) { .biz-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .biz-kpis { grid-template-columns: minmax(0, 1fr); } .kpis.biz-kpis > .kpi:first-child { grid-column: auto; } }

.backup-status { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .65rem; margin-top: .2rem; }
.backup-status > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; background: var(--surface2); min-width: 0; }
.backup-status strong { display: block; margin-top: .2rem; font-size: .9rem; line-height: 1.25; overflow-wrap: anywhere; }
@media (max-width: 900px) { .backup-status { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .backup-status { grid-template-columns: 1fr; } }

.covgrid .waived, p .waived { display: inline-block; min-width: .8rem; text-align: center; font-weight: 700; color: var(--ink2); }

/* ------------------------------------------------------------------ aplicativo instalável (PWA) e celular
   Áreas seguras do iPhone (recorte/Dynamic Island em cima, barra de início embaixo): no computador os valores são zero,
   então nada muda lá. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.topbar { padding-top: env(safe-area-inset-top); }
.auth { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.main { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
.drawer > header { padding-top: calc(.9rem + env(safe-area-inset-top)); } .drawer > .body { padding-bottom: calc(3rem + env(safe-area-inset-bottom)); }
.merlyn > header { padding-top: calc(.7rem + env(safe-area-inset-top)); }
.toast { bottom: calc(1.2rem + env(safe-area-inset-bottom)); }
@supports (height: 100dvh) { .modal { max-height: calc(100dvh - 2rem - env(safe-area-inset-top) - env(safe-area-inset-bottom)); } }
/* no celular, campo com letra menor que 16px faz o iPhone dar zoom sozinho ao tocar */
@media (pointer: coarse) and (max-width: 1023px) { input, select, textarea { font-size: 16px; } }
/* ajuda de instalação: uma linha discreta, só fora do aplicativo instalado */
.install-hint { display: flex; align-items: center; justify-content: center; gap: .3rem .7rem; flex-wrap: wrap; margin: .9rem 0; padding: .5rem .8rem; border-radius: var(--radius-sm); background: var(--line2); color: var(--ink2); font-size: .82rem; text-align: center; }
.install-hint .x { font-size: 1.1rem; line-height: 1; padding: 0 .3rem; color: var(--ink2); }
@media (display-mode: standalone) { .install-hint { display: none; } }

/* fechamento mensal guiado */
.closing-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.closing-card h2 { margin: 0; font-size: 1rem; }
.checklist { list-style: none; margin: .4rem 0 0; padding: 0; }
.checklist li { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .6rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--line2); }
.checklist li:first-child { border-top: 0; }
.checklist .mark { font-weight: 700; text-align: center; color: var(--ink2); }
.checklist .mark.good { color: var(--good-text); } .checklist .mark.warn { color: var(--warn-text); } .checklist .mark.bad { color: var(--bad-text, var(--notice-bad-ink)); }
.checklist li.na .desc, .checklist li.na .meta { color: var(--ink2); }
@media (max-width: 640px) { .checklist li { grid-template-columns: 1.4rem 1fr; } .checklist li .btn { grid-column: 2; justify-self: start; } }

/* Recolhíveis: bloco Ambiente e card Merlyn Insights (começam fechados; o cabeçalho continua dizendo o estado) */
.env.fold { gap: .35rem; }
.env-head, .ins-toggle { display: flex; align-items: center; gap: .5rem; width: 100%; border: 0; background: transparent; color: inherit; padding: .3rem .2rem; border-radius: 8px; text-align: left; cursor: pointer; font: inherit; }
.env-head:hover, .ins-toggle:hover { background: var(--line2); }
.env-head:focus-visible, .ins-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.env-head .env-tag { margin-right: auto; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chev { display: inline-flex; flex: 0 0 auto; color: var(--ink2); transition: transform .12s ease; }
.chev svg { width: 1rem; height: 1rem; }
.env.fold .chev { transform: rotate(90deg); } .env.fold.open .chev { transform: rotate(-90deg); }
.insights-card.open .chev { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .chev { transition: none; } }
@media (max-width: 1023px) { .topbar .row-env .env.fold { flex-direction: column; align-items: stretch; gap: .3rem; } .topbar .row-env .env-head { padding: .2rem 0; } .topbar .row-env .env.fold .env-opts { flex-wrap: wrap; } }
.ins-toggle { justify-content: space-between; padding: .1rem 0; }
.ins-toggle.static { cursor: default; } .ins-toggle.static:hover { background: transparent; }
.ins-title { display: flex; align-items: baseline; gap: .3rem .8rem; flex-wrap: wrap; min-width: 0; }
.ins-sum { font-size: .88rem; color: var(--ink2); } .ins-sum.bad { color: var(--bad-text); font-weight: 700; }
.insights-card.has-critical { box-shadow: inset 3px 0 0 var(--bad-text); }
.ins-card-body { margin-top: .6rem; }
.insights-card .ins-card-body .ins-head { align-items: center; }

/* Patrimônio */
.pat-kpis .kpi:first-child .value { font-size: 1.7rem; }
.pat-bars { display: grid; gap: .5rem; }
.pat-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .8rem; font-size: .88rem; }
.pat-bar .val { font-weight: 600; text-align: right; } .pat-bar .track { grid-column: 1 / -1; height: .45rem; background: var(--line2); border-radius: 999px; overflow: hidden; } .pat-bar .track i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.pat-item { padding: .7rem 0; border-top: 1px solid var(--line2); } .pat-item:first-of-type { border-top: 0; }
.pat-item.archived { opacity: .75; }
.pat-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.pat-info { min-width: 0; flex: 1; } .pat-info .desc, .pat-info .meta { overflow-wrap: anywhere; }
.pat-value { display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; text-align: right; flex: 0 0 auto; }
.pat-date { font-size: .74rem; color: var(--ink2); }
.pat-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.pat-hist { list-style: none; margin: .5rem 0 0; padding: .5rem .7rem; background: var(--line2); border-radius: .6rem; display: grid; gap: .3rem; font-size: .84rem; }
.pat-hist li { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pat-notes { margin: 0; padding-left: 1.1rem; }
@media (max-width: 640px) { .pat-main { flex-direction: column; gap: .3rem; } .pat-value { align-items: flex-start; text-align: left; } .pat-actions button { flex: 1 1 auto; } }

/* Merlyn Insights (etapa 1) */
.insights-card { margin-bottom: 1rem; }
.insights-card .ins-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.insights-card h2 { margin: 0; font-size: 1rem; }
.ins-list { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .35rem; }
.ins-list li, .ins-none { display: flex; align-items: baseline; gap: .5rem; font-size: .9rem; margin: 0; }
.ins-none { margin-top: .6rem; }
.ins-list a { color: var(--ink); text-decoration: none; } .ins-list a:hover { text-decoration: underline; }
.ins-mark { flex: 0 0 1.1rem; text-align: center; font-weight: 700; color: var(--info-text); }
.ins-mark.bad { color: var(--bad-text); } .ins-mark.warn { color: var(--warn-text); } .ins-mark.good { color: var(--good-text); }
.ins-group { margin: 1rem 0 .3rem; font-size: .74rem; letter-spacing: .06em; color: var(--ink2); }
.ins-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--line2); }
.ins-item .ins-body { min-width: 0; flex: 1; }
.ins-nums { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; margin: .5rem 0 0; }
.ins-nums dt { font-size: .72rem; color: var(--ink2); } .ins-nums dd { margin: 0; font-size: .88rem; font-weight: 600; }
.ins-ev { margin: .4rem 0 0; padding-left: 1.1rem; }
.ins-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-top: .6rem; }
.ins-side { border: 1px solid var(--line2); border-radius: .6rem; padding: .6rem .7rem; min-width: 0; }
.ins-side .desc { overflow-wrap: anywhere; }
.ins-side dl { margin: .4rem 0 .5rem; display: grid; gap: .2rem; }
.ins-side dl div { display: flex; justify-content: space-between; gap: .8rem; font-size: .82rem; }
.ins-side dt { color: var(--ink2); flex: 0 0 auto; } .ins-side dd { margin: 0; text-align: right; overflow-wrap: anywhere; min-width: 0; }
@media (max-width: 640px) { .ins-pair { grid-template-columns: 1fr; } }
.ins-actions { display: flex; flex-direction: column; align-items: stretch; gap: .4rem; flex: 0 0 auto; }
.ins-actions .btn, .ins-actions button { text-align: center; white-space: nowrap; }
@media (max-width: 640px) { .ins-item { flex-direction: column; } .ins-actions { width: 100%; } .ins-actions .btn, .ins-actions button { white-space: normal; } }

/* pagamento informado da fatura */
.pay-informed { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line2); }
.pay-form { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--line2); display: grid; gap: .6rem; }
.pay-form h3 { margin: 0; font-size: .95rem; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
label.btn { cursor: pointer; } label.btn[aria-disabled="true"] { opacity: .6; pointer-events: none; }
@media (max-width: 640px) { .pay-grid { grid-template-columns: 1fr; } }
