/* Meu Financeiro — estilos. Paleta oficial (Paleta de cores.docx). */
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../assets/fonts/manrope-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../assets/fonts/manrope-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --primary: #123B4A;      /* azul petróleo profundo */
  --primary-2: #1F6475;    /* azul petróleo médio */
  --pos: #21A179;          /* verde esmeralda */
  --pos-2: #5BC49A;        /* verde claro */
  --gold: #D9A441;         /* dourado suave */
  --warn: #E7A83B;         /* âmbar */
  --neg: #D95C5C;          /* coral discreto */
  --bg: #F5F8F9;           /* off-white azulado */
  --card: #FFFFFF;
  --text: #17252B;         /* azul quase preto */
  --muted: #65757C;        /* cinza azulado */
  --line: #E1E8EB;
  --soft: #EDF3F5;
  --side-bg: #123B4A;
  --shadow: 0 1px 2px rgba(18, 59, 74, .06), 0 4px 16px rgba(18, 59, 74, .06);
  --radius: 14px;
  --pos-bg: #E3F4EE; --neg-bg: #FBEAEA; --warn-bg: #FCF2E0; --info-bg: #E5EFF2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #2A7A8E; --primary-2: #5FB0C4; --pos: #3DBB8F; --pos-2: #6FD3AA; --gold: #E2B458; --warn: #EDB453; --neg: #E57373;
    --bg: #0B1C22; --card: #12272F; --text: #E4EDF0; --muted: #93A6AD; --line: #21404A; --soft: #183540; --side-bg: #123B4A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    --pos-bg: #143A30; --neg-bg: #3D2023; --warn-bg: #3B2F17; --info-bg: #17323B;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: #2A7A8E; --primary-2: #5FB0C4; --pos: #3DBB8F; --pos-2: #6FD3AA; --gold: #E2B458; --warn: #EDB453; --neg: #E57373;
  --bg: #0B1C22; --card: #12272F; --text: #E4EDF0; --muted: #93A6AD; --line: #21404A; --soft: #183540; --side-bg: #123B4A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --pos-bg: #143A30; --neg-bg: #3D2023; --warn-bg: #3B2F17; --info-bg: #17323B;
  color-scheme: dark;
}
/* logos claro/escuro */
.on-dark { display: none !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .on-dark { display: inline-block !important; } :root:not([data-theme="light"]) .on-light { display: none !important; } }
:root[data-theme="dark"] .on-dark { display: inline-block !important; }
:root[data-theme="dark"] .on-light { display: none !important; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 800; }
h2 { font-size: 1.02rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }
h4 { font-size: .9rem; font-weight: 700; margin: 14px 0 6px; }
p { margin: 0 0 8px; }
a { color: var(--primary-2); }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.pos { color: var(--pos) !important; }
.neg { color: var(--neg) !important; }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.ic.tiny { width: 14px; height: 14px; vertical-align: -2px; }
:focus-visible { outline: 2px solid var(--pos); outline-offset: 2px; }

/* ------------------------------------------------------------------ splash / login */
.splash { min-height: 100vh; display: grid; place-items: center; background: var(--primary); }
.splash img { border-radius: 22px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .8; } }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, rgba(91, 196, 154, .18), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 22px; padding: 30px 26px 22px; box-shadow: var(--shadow); text-align: center; }
.login-card .logo-img { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; }
.login-card .logo { display: block; }
.slogan { color: var(--muted); font-weight: 600; margin: 8px 0 22px; }
.login-card form { text-align: left; display: grid; gap: 14px; }
.login-card label { display: grid; gap: 6px; font-weight: 600; font-size: .88rem; }
.login-card .link { margin-top: 16px; }
.login-foot { color: var(--muted); font-size: .8rem; margin-top: 18px; }

/* ------------------------------------------------------------------ inputs e botões */
input, select, textarea { width: 100%; border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; min-height: 44px; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--pos); outline: none; box-shadow: 0 0 0 3px rgba(33, 161, 121, .15); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--pos); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid transparent; border-radius: 11px; padding: 9px 16px; font-weight: 700; cursor: pointer; background: var(--soft); color: var(--text); min-height: 42px; white-space: nowrap; text-decoration: none; }
.btn:hover { filter: brightness(.97); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.gold { background: var(--gold); color: #17252B; }
.btn.danger { background: var(--neg); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost.on { border-color: var(--pos); color: var(--pos); }
.btn.sm { padding: 6px 12px; min-height: 36px; font-size: .86rem; }
.btn.block { width: 100%; }
.danger-text { color: var(--neg) !important; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: inherit; }
.icon-btn:hover { background: var(--soft); }
.icon-btn.sm { width: 32px; height: 32px; }
.link { background: none; border: 0; color: var(--primary-2); font-weight: 700; cursor: pointer; padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ------------------------------------------------------------------ shell */
#app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--side-bg); color: #DDE9EC; display: flex; flex-direction: column; padding: 18px 14px; z-index: 30; }
.side-logo { padding: 2px 6px 16px; }
.side-logo .logo-img { width: 100%; height: auto; display: block; }
.side-new { margin-bottom: 14px; }
.sidebar nav { display: grid; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #C8DADF; text-decoration: none; font-weight: 600; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar nav a.active { background: rgba(91, 196, 154, .16); color: #fff; box-shadow: inset 3px 0 0 var(--pos-2); }
.sidebar nav a.active .ic { color: #5BC49A; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; font-size: .85rem; padding: 10px 6px 0; border-top: 1px solid rgba(255, 255, 255, .1); }
.main-col { margin-left: 248px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-mark { display: none; width: 36px; height: 36px; border-radius: 9px; }
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-label { background: none; border: 0; font-weight: 800; font-size: 1.05rem; cursor: pointer; padding: 6px 8px; border-radius: 8px; min-width: 150px; }
.month-label:hover { background: var(--soft); }
.year-sel { width: auto; min-height: 36px; padding: 4px 8px; margin-left: 6px; font-weight: 700; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sync-ind { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 12px; font-size: .8rem; font-weight: 700; cursor: pointer; }
.sync-ind .ic { width: 16px; height: 16px; }
.sync-ind.ok { color: var(--pos); } .sync-ind.pend, .sync-ind.busy { color: var(--warn); } .sync-ind.off, .sync-ind.local { color: var(--muted); } .sync-ind.err { color: var(--neg); }
.sync-ind.busy .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#view { padding: 24px 28px 60px; max-width: 1320px; width: 100%; outline: none; }
.bottombar { display: none; }
.loading { display: flex; gap: 12px; align-items: center; color: var(--muted); padding: 40px 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--pos); animation: spin .8s linear infinite; }
body.readonly [data-new], body.readonly [data-new-menu], body.readonly .fab { display: none !important; }

/* ------------------------------------------------------------------ páginas */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); border: 1px solid var(--line); min-width: 0; }
.card h2 { margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.sec-title { margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; font-size: 1rem; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.sub-head p { margin: 0; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.quick button, .new-grid button { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); text-align: left; }
.quick button:hover, .new-grid button:hover { border-color: var(--pos); }
.ni { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--info-bg); color: var(--primary-2); flex: none; }
.ni.pos { background: var(--pos-bg); color: var(--pos); } .ni.neg { background: var(--neg-bg); color: var(--neg); } .ni.gold { background: var(--warn-bg); color: var(--gold); }
.new-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.new-grid button { box-shadow: none; padding: 16px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: grid; gap: 2px; min-width: 0; border-top: 3px solid var(--line); }
.kpi-l { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi-l .ic { width: 15px; height: 15px; }
.kpi b { font-size: 1.28rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { color: var(--muted); font-size: .76rem; }
.kpi.hero { background: var(--primary); color: #fff; border-color: transparent; border-top-color: var(--gold); }
.kpi.hero .kpi-l, .kpi.hero small { color: #BFD7DD; }
.kpi.pos { border-top-color: var(--pos); } .kpi.neg { border-top-color: var(--neg); } .kpi.warn { border-top-color: var(--warn); } .kpi.proj { border-top-color: var(--primary-2); }
.kpi.pos b { color: var(--pos); } .kpi.neg b { color: var(--neg); }
.alert-bar { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--neg-bg); color: var(--neg); border: 1px solid color-mix(in srgb, var(--neg) 30%, transparent); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; cursor: pointer; text-align: left; font-weight: 600; }
.alert-bar span { flex: 1; color: var(--text); }
.alert-bar.static { cursor: default; }
.big { font-size: 1.6rem; font-weight: 800; }
.stack-bar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--soft); margin: 10px 0 12px; }
.stack-bar i { display: block; height: 100%; }
.meter { height: 10px; background: var(--soft); border-radius: 99px; overflow: hidden; margin: 10px 0; }
.meter i { display: block; height: 100%; background: var(--pos); border-radius: 99px; }
.meter i.warn { background: var(--warn); } .meter i.neg { background: var(--neg); }
.commit-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.commit-row div { background: var(--soft); border-radius: 10px; padding: 8px 10px; display: grid; }
.commit-row span { font-size: .72rem; color: var(--muted); font-weight: 700; }
.commit-row b { font-size: .9rem; font-variant-numeric: tabular-nums; }

/* listas */
.legend-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.legend-list li { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 8px; align-items: center; font-size: .88rem; }
.legend-list.compact li { grid-template-columns: 12px 1fr auto; }
.legend-list i { width: 12px; height: 12px; border-radius: 4px; display: block; }
.legend-list i.st-vencida { background: var(--neg); } .legend-list i.st-pendente { background: var(--warn); } .legend-list i.st-parcial { background: var(--primary-2); }
.legend-list b { font-variant-numeric: tabular-nums; }
.legend-list em { color: var(--muted); font-style: normal; font-size: .78rem; min-width: 34px; text-align: right; }
.due-group h3 { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 4px; }
.due-list, .mini-list, .acc-list, .reg-list, .hbars, .bills, .invoices, .audit { list-style: none; margin: 0; padding: 0; }
.due-list li, .mini-list li, .acc-list li { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.due-list li:last-child, .mini-list li:last-child, .acc-list li:last-child { border-bottom: 0; }
.due-list li > span:nth-child(2), .mini-list li > span:first-child, .acc-list li > span:nth-child(2) { flex: 1; min-width: 0; display: grid; }
.due-list small, .mini-list small, .acc-list small, .reg-list small { color: var(--muted); font-size: .78rem; }
.due-list b, .mini-list b, .acc-list b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mini-list a { display: inline-flex; align-items: center; gap: 6px; flex: 1; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--neg); flex: none; }
.dot.fatura { background: var(--gold); }
.acc-dot, .cat-dot { width: 12px; height: 12px; border-radius: 4px; flex: none; background: var(--line); display: inline-block; }
.clickable { cursor: pointer; }
.clickable:hover { background: var(--soft); }
.hbars li { margin-bottom: 11px; }
.hb-top { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; }
.hb-top b { font-variant-numeric: tabular-nums; }
.hb-track { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.hb-track div { height: 100%; border-radius: 99px; }
.hbars small { color: var(--muted); font-size: .75rem; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--primary-2); color: #fff; font-weight: 800; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: .8rem; background: var(--pos); }

/* gráficos */
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--muted); stroke-dasharray: 3 3; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; font-size: .8rem; color: var(--muted); margin-top: 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-wrap { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: center; }
.donut-wrap svg { width: 100%; height: auto; }
.donut-k { fill: var(--muted); font-size: 11px; font-weight: 700; }
.donut-v { fill: var(--text); font-size: 17px; font-weight: 800; }

/* tabs e toolbar */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--soft); padding: 4px; border-radius: 12px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 8px 14px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.seg-mini { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg-mini button { border: 0; background: none; padding: 7px 11px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-weight: 600; font-size: .85rem; color: var(--muted); }
.seg-mini button[aria-pressed="true"] { background: var(--primary); color: #fff; }
.seg-mini .ic { width: 17px; height: 17px; }
.search-in { display: flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--card); }
.search-in input { border: 0; min-height: 38px; padding: 0; box-shadow: none !important; width: 160px; }
.filters { display: none; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.filters.open { display: grid; }
.filters label { display: grid; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.filters input, .filters select { min-height: 38px; padding: 6px 10px; font-size: .9rem; color: var(--text); }
.filters-actions { display: flex; align-items: end; }
.totals-bar { display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; font-size: .9rem; }
.totals-bar b { font-variant-numeric: tabular-nums; }

/* tabelas */
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); margin-bottom: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 800; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--soft); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tr.current td { background: color-mix(in srgb, var(--pos) 7%, transparent); }
.tbl tr.total td { font-weight: 800; background: var(--soft); }
.tbl tr.inactive td, .reg-list .inactive, .cat-card.inactive { opacity: .55; }
.desc { display: flex; gap: 10px; align-items: center; }
.desc > span:last-child { display: grid; }
.desc small { color: var(--muted); font-size: .76rem; }
.inst { font-style: normal; font-size: .74rem; font-weight: 700; color: var(--primary-2); background: var(--info-bg); padding: 1px 6px; border-radius: 6px; }
.show-sm { display: none; }

/* badges */
.badge { display: inline-block; font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 99px; white-space: nowrap; background: var(--soft); color: var(--muted); }
.st-paga { background: var(--pos-bg); color: var(--pos); }
.st-pendente, .st-aberta { background: var(--warn-bg); color: #A26E10; }
.st-parcial { background: var(--info-bg); color: var(--primary-2); }
.st-vencida { background: var(--neg-bg); color: var(--neg); }
.st-cancelada { background: var(--soft); color: var(--muted); text-decoration: line-through; }
.st-fechada { background: var(--info-bg); color: var(--primary); }
.st-info { background: var(--info-bg); color: var(--primary-2); }
:root[data-theme="dark"] .st-pendente, :root[data-theme="dark"] .st-aberta { color: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .st-pendente, :root:not([data-theme="light"]) .st-aberta { color: var(--warn); } :root:not([data-theme="light"]) .st-fechada { color: var(--primary-2); } }

/* contas */
.bills { display: grid; gap: 8px; }
.bill { display: grid; grid-template-columns: 52px 1fr auto auto; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.bill-date { text-align: center; background: var(--soft); border-radius: 10px; padding: 6px 0; line-height: 1.1; }
.bill-date b { font-size: 1.15rem; display: block; }
.bill-date small { font-size: .7rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.bill-date.neg { background: var(--neg-bg); } .bill-date.warn { background: var(--warn-bg); }
.bill-main { display: grid; min-width: 0; }
.bill-main small { color: var(--muted); font-size: .78rem; }
.bill-val { display: grid; justify-items: end; gap: 3px; font-variant-numeric: tabular-nums; }

/* cartões */
.card-tabs { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 6px; }
.ccard { --cc: #123B4A; flex: none; width: 230px; height: 132px; border-radius: 16px; border: 0; color: #fff; text-align: left; padding: 14px 16px; display: grid; grid-template-rows: auto auto 1fr auto; cursor: pointer; background: linear-gradient(135deg, var(--cc), color-mix(in srgb, var(--cc) 55%, #000)); opacity: .72; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.ccard::after { content: ''; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.ccard.sel { opacity: 1; outline: 3px solid var(--gold); outline-offset: 2px; }
.cc-bank { font-size: .72rem; opacity: .8; text-transform: uppercase; letter-spacing: .06em; }
.cc-num { font-family: ui-monospace, monospace; opacity: .85; align-self: end; }
.cc-lim { font-size: .78rem; font-weight: 700; color: #CDEFE1; }
.limit-card { margin-bottom: 14px; }
.limit-top { display: flex; justify-content: space-between; }
.limit-top div { display: grid; }
.limit-top b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.limit-top .r { text-align: right; }
.invoices { display: grid; gap: 8px; }
.invoices li { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.invoices li.current { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.invoices li > div { display: grid; }
.invoices small { color: var(--muted); font-size: .78rem; }
.invoices .r { text-align: right; font-variant-numeric: tabular-nums; }

/* calendário */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { text-align: center; font-size: .72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.cal-c { min-height: 96px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 5px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; overflow: hidden; }
.cal-c:hover { border-color: var(--pos); }
.cal-c.empty { background: transparent; border: 0; cursor: default; }
.cal-c.off { background: var(--soft); }
.cal-c.today { border: 2px solid var(--gold); }
.cal-n { font-size: .8rem; font-weight: 800; color: var(--muted); }
.cal-i { display: flex; align-items: center; gap: 3px; font-size: .7rem; white-space: nowrap; overflow: hidden; border-radius: 5px; padding: 1px 4px; }
.cal-i span { overflow: hidden; text-overflow: ellipsis; }
.cal-more { font-size: .68rem; color: var(--muted); font-weight: 700; }
.cal-legend .k-receita, .cal-i.k-receita { color: var(--pos); } .cal-i.k-receita { background: var(--pos-bg); }
.cal-legend .k-despesa, .cal-i.k-despesa { color: var(--neg); } .cal-i.k-despesa { background: var(--neg-bg); }
.cal-legend .k-fatura, .cal-i.k-cartao, .cal-i.k-fatura { color: #A87A22; } .cal-i.k-fatura, .cal-i.k-cartao { background: var(--warn-bg); }
.cal-legend .k-pagamento, .cal-i.k-pagamento { color: var(--primary-2); } .cal-i.k-pagamento { background: var(--info-bg); }
.cal-i.k-transferencia { color: var(--muted); background: var(--soft); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; margin-bottom: 8px; font-weight: 600; }
.month-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.month-grid button { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 12px 0; font-weight: 700; cursor: pointer; }
.month-grid button.on { background: var(--primary); color: #fff; }

/* relatórios */
.report-bar { display: grid; gap: 10px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; font-weight: 600; font-size: .84rem; cursor: pointer; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.off { opacity: .5; text-decoration: line-through; }
.chip.add { color: var(--pos); }
.chip-check { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: .84rem; font-weight: 600; cursor: pointer; }
.period { display: flex; gap: 10px; flex-wrap: wrap; }
.period label { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: .85rem; }
.period input { width: auto; min-height: 38px; }
.report-total { font-size: 1rem; margin: 6px 0 10px; }

/* cadastros */
.reg-list { display: grid; gap: 6px; }
.reg-list li { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.reg-list li > span:nth-child(2) { flex: 1; display: grid; min-width: 0; }
.reg-list b { font-variant-numeric: tabular-nums; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.cat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.cat-card header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cat-card header b { flex: 1; }
.sub-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.sub-chips .chip { padding: 3px 10px; font-size: .78rem; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches i { display: block; width: 28px; height: 28px; border-radius: 8px; border: 3px solid transparent; }
.swatches input:checked + i { border-color: var(--text); }

/* configurações */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.settings .card { display: grid; gap: 10px; align-content: start; }
.settings .card h2 { margin: 0; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.check input { width: 18px; height: 18px; }
.inline { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.inline input, .inline select { width: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 700; font-size: .85rem; }
.kv dd { margin: 0; }
.push-box { border-top: 1px solid var(--line); padding-top: 10px; }
.about { text-align: center; justify-items: center; }
.about-logo { max-width: 260px; width: 100%; height: auto; }

/* ------------------------------------------------------------------ modais e formulários */
body.modal-open { overflow: hidden; }
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(10, 30, 38, .45); display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .16s; }
.modal-wrap.open { opacity: 1; }
.modal-wrap.closing { opacity: 0; }
.modal { background: var(--card); width: 100%; max-width: 560px; max-height: calc(100vh - 40px); border-radius: 18px; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); transform: translateY(8px); transition: transform .16s; }
.modal.wide { max-width: 760px; }
.modal-wrap.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px 22px; }
.modal-head h2 { font-size: 1.1rem; }
.modal-body { padding: 4px 22px 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-msg { font-size: .98rem; }
.choice-list { display: grid; gap: 8px; }
.choice { display: grid; text-align: left; gap: 2px; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.choice:hover { border-color: var(--pos); }
.choice.danger:hover { border-color: var(--neg); }
.choice small { color: var(--muted); }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.field label, .field .lbl { font-weight: 700; font-size: .84rem; }
.field label i { color: var(--neg); font-style: normal; }
.hint { color: var(--muted); font-size: .76rem; }
.money-input { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; background: var(--card); }
.money-input:focus-within { border-color: var(--pos); box-shadow: 0 0 0 3px rgba(33, 161, 121, .15); }
.money-input span { padding-left: 12px; color: var(--muted); font-weight: 700; }
.money-input input { border: 0; box-shadow: none !important; font-weight: 700; font-variant-numeric: tabular-nums; }
.segmented { display: flex; background: var(--soft); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 8px 10px; border-radius: 9px; font-weight: 700; font-size: .86rem; color: var(--muted); white-space: nowrap; }
.segmented input:checked + span { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.adv-toggle { display: flex; align-items: center; gap: 6px; background: none; border: 0; border-top: 1px dashed var(--line); padding: 10px 0 0; color: var(--primary-2); font-weight: 700; cursor: pointer; }
.adv-toggle .ic { transition: transform .15s; }
.adv-toggle[aria-expanded="true"] .ic { transform: rotate(180deg); }
.adv-box { display: none; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form.show-adv .adv-box { display: grid; }
.adv-box .full { grid-column: 1 / -1; }
.form-error { color: var(--neg); font-weight: 700; margin: 0; }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--info-bg); border-radius: 10px; padding: 10px 12px; font-size: .85rem; margin: 0 0 4px; }
.note .ic { color: var(--primary-2); margin-top: 1px; }
.preview { display: flex; gap: 8px; align-items: center; background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; margin: 0; font-size: .88rem; }
.preview:empty { display: none; }
.detail-head { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; background: var(--soft); margin-bottom: 14px; border-left: 4px solid var(--neg); }
.detail-head.receita { border-left-color: var(--pos); }
.detail-head.fatura { border-left-color: var(--gold); }
.detail-head h3 { font-size: 1.15rem; margin: 2px 0 6px; }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; }
.detail-amount { text-align: right; display: grid; }
.detail-amount small { color: var(--muted); font-size: .75rem; font-weight: 700; }
.detail-amount b { font-size: 1.4rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 14px; margin-bottom: 12px; }
.kv-grid div { display: grid; }
.kv-grid span { font-size: .74rem; color: var(--muted); font-weight: 700; }
.kv-grid b { font-weight: 700; font-size: .92rem; }
.notes-box { background: var(--warn-bg); border-radius: 10px; padding: 10px 12px; font-size: .9rem; white-space: pre-wrap; }
.sub-sec { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.sub-sec h4 { margin: 0 0 8px; display: flex; gap: 8px; align-items: baseline; }
.sub-sec .sub-head { margin-bottom: 6px; }
.sub-sec .sub-head h4 { margin: 0; }
.history summary { cursor: pointer; font-weight: 700; display: flex; gap: 6px; align-items: center; color: var(--muted); }
.audit li { font-size: .82rem; padding: 6px 0; border-bottom: 1px solid var(--line); }
.audit time { color: var(--muted); margin-right: 6px; }
.search-big { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--pos); border-radius: 12px; padding: 0 12px; margin-bottom: 12px; }
.search-big input { border: 0; box-shadow: none !important; font-size: 1.05rem; }
.more-nav { display: grid; gap: 4px; }
.more-nav a { display: flex; gap: 12px; align-items: center; padding: 14px 10px; border-radius: 12px; text-decoration: none; color: var(--text); font-weight: 700; }
.more-nav a:hover { background: var(--soft); }

.empty { text-align: center; padding: 34px 16px; display: grid; justify-items: center; gap: 6px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); margin-bottom: 16px; }
.empty .logo-mark { width: 56px; height: 56px; border-radius: 14px; opacity: .9; margin-bottom: 4px; }
.empty p { color: var(--muted); max-width: 460px; }

#toasts { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 10px; align-items: center; background: var(--primary); color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-weight: 600; animation: tin .2s ease-out; }
.toast .ic { color: var(--pos-2); }
.toast-erro { background: #8E2F2F; }
.toast-erro .ic { color: #FFD1D1; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .3s; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
#print-area { display: none; }

/* ------------------------------------------------------------------ responsivo */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .main-col { margin-left: 0; }
  .topbar { padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); gap: 6px; }
  .top-mark { display: block; width: 34px; height: 34px; }
  .top-mark.on-dark { display: none; }
  .month-label { min-width: 0; font-size: .98rem; padding: 6px 4px; }
  .year-sel { display: none; }
  #view { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottombar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); align-items: end; }
  .bottombar a, .bottombar > button:not(.fab) { display: grid; justify-items: center; gap: 2px; font-size: .68rem; font-weight: 700; color: var(--muted); text-decoration: none; background: none; border: 0; padding: 4px 0; cursor: pointer; }
  .bottombar a.active { color: var(--pos); }
  .fab { justify-self: center; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--gold); color: #17252B; display: grid; place-items: center; margin-top: -24px; box-shadow: 0 8px 20px rgba(217, 164, 65, .45); cursor: pointer; }
  .fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }
  .grid-2, .grid-3, .settings { grid-template-columns: 1fr; }
  .modal-wrap { padding: 0; place-items: end center; }
  .modal, .modal.wide { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  #toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
}
@media (min-width: 901px) { .topbar .top-mark { display: none !important; } }
@media (max-width: 900px) and (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top-mark.on-dark { display: block !important; } }
@media (max-width: 640px) {
  h1 { font-size: 1.3rem; }
  .hide-sm { display: none !important; }
  .show-sm { display: block; }
  .kpis, .kpis.three, .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi.hero { grid-column: 1 / -1; }
  .kpi { padding: 11px 12px; }
  .kpi b { font-size: 1.08rem; }
  .quick { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .quick button { padding: 10px; font-size: .88rem; }
  .form, .adv-box { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .donut-wrap svg { max-width: 170px; }
  .legend-list { width: 100%; }
  .bill { grid-template-columns: 46px 1fr auto; }
  .bill > .btn { grid-column: 1 / -1; }
  .commit-row { grid-template-columns: repeat(2, 1fr); }
  .cal-c { min-height: 54px; padding: 3px; }
  .cal-i span { display: none; }
  .cal-i { padding: 1px 2px; }
  .search-in input { width: 110px; }
  .tbl td, .tbl th { padding: 9px 8px; }
  .page-head { margin-bottom: 12px; }
  .invoices li { grid-template-columns: 1fr auto; }
  .invoices li .badge { grid-column: 1 / -1; justify-self: start; }
  .detail-head { flex-direction: column; }
  .detail-amount { text-align: left; }
  .sync-ind { padding: 6px 8px; }
}

/* ------------------------------------------------------------------ impressão (PDF) */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block; position: absolute; inset: 0; padding: 0 8mm; color: #17252B; background: #fff; }
  .print-head { display: flex; align-items: center; gap: 18px; border-bottom: 2px solid #123B4A; padding-bottom: 10px; margin-bottom: 14px; }
  .print-head .logo-img.on-light { display: block !important; width: 200px; height: auto; }
  .print-head .on-dark { display: none !important; }
  .print-head h1 { font-size: 18px; }
  .print-head p { color: #65757C; font-size: 11px; }
  #print-area .table-wrap { box-shadow: none; border: 0; overflow: visible; }
  #print-area .tbl { font-size: 10.5px; }
  #print-area .tbl th { background: #EDF3F5 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-area .card { box-shadow: none; break-inside: avoid; }
  #print-area .grid-2 { display: block; }
}
