/* MC9 Financeiro */
:root {
  --card: #ffffff;
  --surface-2: #f7fafb;
  --hover: #f6f9fa;
  --input-bg: #ffffff;
  --brand-ink: #0b6079;
  --brand-soft-hover: #cfe6eb;
  --topbar: #0b6079;
  --btn-dark: #26343a;
  --red-soft: #fdecec;
  --red-line: #f6c9ca;
  --red-text: #a32025;
  --green-soft: #e6f6ed;
  --green-text: #0f6b3c;
  --warn-soft: #fff7e6;
  --line-strong: #cfd8dc;
  --muted-2: #b8c4c8;
  --shadow-pop: 0 10px 30px rgba(0,0,0,.14);
  --auth-bg: linear-gradient(160deg, #e3f1f4, #eef3f4 60%);
  --on-brand: #ffffff;
  --brand-glow: rgba(11,96,121,.35);
  color-scheme: light;
  --brand: #0b6079;
  --brand-dark: #084a5e;
  --brand-2: #3a9bad;
  --brand-soft: #e3f1f4;
  --bg: #eef3f4;
  --text: #1d2b31;
  --muted: #6b7a80;
  --line: #e4ebed;
  --in: #16a35a;
  --out: #e0393e;
  --blue: #2f6fdb;
  --warn: #f2a305;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 42, 52, .05), 0 4px 16px rgba(16, 42, 52, .04);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 1.3rem; font-weight: 600; }
h3 { font-size: 1.08rem; font-weight: 600; }
small { font-size: .82em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
code { background: var(--brand-soft); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
kbd { font: 11px Inter, sans-serif; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; padding: 1px 8px; margin-left: auto; opacity: .75; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.text-right { text-align: right; }
.v-in { color: var(--in); }
.v-out { color: var(--out); }
.v-blue { color: var(--blue); }
.v-transfer { color: var(--blue); }
svg.lucide { width: 18px; height: 18px; stroke-width: 2; flex-shrink: 0; }
svg.mini { width: 13px; height: 13px; vertical-align: -2px; }

/* ---------- topo ---------- */
.topbar { background: var(--topbar); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.topbar-inner { max-width: 1220px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none !important; }
.brand img { height: 34px; }
.brand-name { font-weight: 700; font-size: 1.3rem; }
.brand span { font-weight: 300; font-size: 1.35rem; letter-spacing: .2px; opacity: .95; }
.mainnav { display: flex; gap: 6px; flex: 1; justify-content: center; }
.mainnav a { color: rgba(255,255,255,.85); padding: 18px 10px; border-bottom: 3px solid transparent; font-size: .98rem; text-decoration: none; }
.mainnav a:hover { color: #fff; }
.mainnav a.active { color: #fff; font-weight: 600; border-bottom-color: #fff; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { background: transparent; border: 0; color: inherit; width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; cursor: pointer; }
.topbar .icon-btn:hover { background: rgba(255,255,255,.14); }
.icon-btn.outline { border: 1px solid var(--line); color: var(--text); background: var(--card); border-radius: 12px; }
.icon-btn.outline:hover { background: var(--brand-soft); }
.icon-btn.ghost { color: var(--muted); }
.icon-btn.ghost:hover { background: var(--bg); }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); background: var(--brand-2); color: #fff; font-weight: 600; cursor: pointer; font-family: inherit; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; margin-left: auto; cursor: pointer; }

/* ---------- dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; top: calc(100% + 8px); left: 0; min-width: 220px; background: var(--card); color: var(--text); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 8px; z-index: 60; }
.dropdown-menu.right { left: auto; right: 0; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); }
.dropdown-menu form { margin: 0; }
.dropdown-head { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: grid; }
.dropdown-head small { color: var(--muted); }
.dropdown-menu.dark { background: #26343a; min-width: 300px; padding: 10px; }
.dropdown-menu.dark button { color: #fff; padding: 11px 12px; font-weight: 600; }
.dropdown-menu.dark button:hover { background: rgba(255,255,255,.1); }

/* ---------- layout ---------- */
.container { max-width: 1220px; margin: 0 auto; padding: 28px 20px 60px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 30px; margin-bottom: 22px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.grid-2 .card { margin-bottom: 22px; }
.section-head, .list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section-head h2, .list-head h2 { margin: 0; }

/* ---------- botões ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; justify-content: center; border: 1px solid transparent; border-radius: 12px; padding: 10px 18px; font: 500 .95rem Inter, sans-serif; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.sm { padding: 6px 12px; font-size: .85rem; border-radius: 9px; }
.btn.block { width: 100%; margin-top: 14px; }
.btn-primary { background: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-dark { background: var(--btn-dark); color: #fff; }
.btn-dark:hover { background: #111c20; }
.btn-outline { background: var(--card); border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.btn-soft { background: var(--brand-soft); color: var(--brand-ink); }
.btn-soft:hover { background: var(--brand-soft-hover); }
.btn-light { background: var(--card); border-color: var(--line); color: var(--muted); }
.btn-light:hover { color: var(--text); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--out); color: #fff; }
.btn-danger-soft { background: var(--red-soft); color: var(--out); }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--out); }
.round-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; }
.round-btn.primary { width: 72px; height: 72px; background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 16px var(--brand-glow); }
.round-btn.primary svg { width: 30px; height: 30px; }
.round-btn.primary:hover { background: var(--brand-dark); }
.round-btn.ghost { background: var(--bg); color: var(--muted); }
.round-btn.ghost:hover { color: var(--text); }

/* ---------- formulários ---------- */
input, select, textarea { font: inherit; color: var(--text); }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; background: var(--input-bg); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2) !important; box-shadow: 0 0 0 3px rgba(58,155,173,.18); }
label { display: grid; gap: 6px; font-size: .9rem; color: var(--text); font-weight: 500; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.narrow { max-width: 620px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.inline-form { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin-bottom: 22px; }
.inline-add { display: flex; gap: 10px; margin: 14px 0 18px; max-width: 520px; }
.inline-input { padding: 7px 10px !important; border-radius: 8px !important; }
.input-action { display: flex; gap: 8px; align-items: center; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; cursor: pointer; display: block; position: relative; }
.swatch input { position: absolute; opacity: 0; }
.swatch:has(input:checked) { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--text); }
input[type=color] { width: 38px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--input-bg); cursor: pointer; }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; max-height: 190px; overflow: auto; padding: 4px; }
.icon-picker label { display: grid; place-items: center; height: 40px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer; color: var(--muted); background: var(--card); }
.icon-picker input { position: absolute; opacity: 0; pointer-events: none; }
.icon-picker label:has(input:checked) { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.segmented { display: inline-flex; background: var(--bg); border-radius: 12px; padding: 4px; gap: 2px; margin-bottom: 16px; flex-wrap: wrap; }
.segmented label { display: flex; align-items: center; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; color: var(--muted); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--card); color: var(--brand-ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.segmented.sm { margin-bottom: 0; }
.segmented.sm label { padding: 5px 11px; font-size: .86rem; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; width: max-content; }
.switch input { position: absolute; opacity: 0; }
.slider { width: 40px; height: 22px; background: var(--line-strong); border-radius: 22px; position: relative; transition: background .2s; flex-shrink: 0; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + .slider { background: var(--in); }
.switch input:checked + .slider::after { transform: translateX(18px); }

/* ---------- alertas e toasts ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: .93rem; }
.alert-ok { background: var(--green-soft); color: var(--green-text); }
.alert-error { background: var(--red-soft); color: var(--red-text); }
.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 200; }
.toast { background: #26343a; color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: opacity .4s, transform .4s; }
.toast-error { background: var(--out); }
.toast.out { opacity: 0; transform: translateY(10px); }

/* ---------- bolhas (ícones de categoria/conta) ---------- */
.bubble { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; flex-shrink: 0; }
.bubble.sm { width: 34px; height: 34px; }
.bubble.sm svg { width: 16px; height: 16px; }
.bubble.xs { width: 22px; height: 22px; vertical-align: middle; margin-right: 6px; }
.bubble.xs svg { width: 12px; height: 12px; }
.bubble.lg { width: 58px; height: 58px; font-size: 1.3rem; }
.bubble.letter { font-weight: 700; font-size: .95rem; }
.bubble.xs.letter { font-size: .7rem; }

/* ---------- visão geral ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.hero p { margin: 0; }
.hero-name { font-size: 1.35rem; margin: 2px 0 18px; }
.hero-stats { display: flex; gap: 28px; align-items: center; }
.hero-stats small { display: block; color: var(--muted); font-size: .88rem; }
.hero-stats strong { font-size: 1.35rem; font-weight: 600; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-actions .btn { padding: 11px 16px; font-size: 1rem; }
.qa-icon { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; }
.qa-icon svg { width: 15px; height: 15px; stroke-width: 3; }
.qa-icon.out { background: var(--out); }
.qa-icon.in { background: var(--in); }
.qa-icon.tr { background: var(--blue); }
.qa-icon.im { background: var(--brand-2); }
.saldo-geral { border-left: 3px solid var(--brand-2); padding-left: 16px; margin-bottom: 22px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.saldo-geral small { width: 100%; color: var(--muted); }
.saldo-geral strong { font-size: 1.5rem; font-weight: 600; }
.account-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.account-row > div { flex: 1; display: grid; }
.account-row small { color: var(--muted); }
.account-row > span:last-child { font-weight: 600; font-size: 1.1rem; }
.card-block { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card-block-head { display: flex; align-items: center; gap: 12px; }
.card-block-head > div { flex: 1; display: grid; }
.card-block-head small { color: var(--muted); }
.card-block-body { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); border-radius: 12px; padding: 12px 16px; margin-top: 12px; text-align: center; }
.card-block-body small { display: block; color: var(--muted); }
.card-block-body em { font-style: normal; font-size: .85em; }
.pill { background: var(--bg); color: var(--muted); text-align: center; border-radius: 10px; padding: 9px; margin: 6px 0 4px; font-weight: 500; }
.pill-red { background: var(--red-soft); color: var(--out); }
.due-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); cursor: pointer; color: var(--text); text-decoration: none !important; }
.due-row:hover { background: var(--hover); }
.due-main { flex: 1; min-width: 0; }
.due-main > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-main small { color: var(--muted); }
.see-more { display: block; text-align: center; color: var(--muted); margin-top: 12px; }
.top-gastos { display: grid; grid-template-columns: 1fr 180px; gap: 18px; align-items: center; }
.top-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.top-item span { flex: 1; }
.top-chart { position: relative; }
.empty { text-align: center; color: var(--muted); padding: 24px 10px; }
.empty svg { width: 34px; height: 34px; opacity: .45; }
.empty p { margin: 8px 0 12px; }
body.privacy .sensitive { filter: blur(7px); user-select: none; }

/* ---------- lançamentos ---------- */
.notice { padding: 0; }
.notice summary { list-style: none; cursor: pointer; padding: 20px 28px; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.notice summary::-webkit-details-marker { display: none; }
.notice summary > svg:first-child { color: var(--warn); }
.notice .chev { margin-left: auto; transition: transform .2s; }
.notice[open] .chev { transform: rotate(180deg); }
.notice .tx-list { padding: 0 28px 16px; }
.month-nav { display: flex; align-items: center; gap: 18px; }
.month-nav > a, .month-nav > .disabled { color: var(--text); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; }
.month-nav > a:hover { background: var(--bg); text-decoration: none; }
.month-nav > .disabled { opacity: .3; }
.month-nav strong { font-size: 1.15rem; font-weight: 600; min-width: 150px; text-align: center; }
.period-label { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; border-radius: 10px; padding: 6px 12px; font: 600 1.15rem Inter, sans-serif; color: var(--text); cursor: pointer; min-width: 170px; justify-content: center; }
.period-label:hover { background: var(--bg); }
.period-menu { left: 50%; transform: translateX(-50%); min-width: 190px; background: var(--surface-2); padding: 10px; }
.period-shortcuts { display: grid; text-align: center; }
.period-shortcuts a, .period-shortcuts button { justify-content: center; color: var(--muted); padding: 7px 10px; }
.period-shortcuts a.on { color: var(--brand-ink); font-weight: 600; }
.period-form { display: grid; gap: 8px; justify-items: center; }
.period-form input[type=date] { padding: 8px 10px !important; }
.period-form .btn { width: 100%; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--bg); border-radius: 18px; padding: 10px 14px; margin-bottom: 18px; }
.chip-select { width: auto !important; border: 0 !important; background: transparent !important; padding: 7px 28px 7px 10px !important; border-radius: 10px !important; cursor: pointer; font-weight: 500; max-width: 220px; }
.chip-select:hover { background: var(--input-bg) !important; }
.search-box { display: flex; align-items: center; margin-left: auto; background: var(--input-bg); border-radius: 12px; padding-left: 4px; }
.search-box input { border: 0 !important; box-shadow: none !important; width: 210px !important; padding: 8px 6px !important; }
.clear-filters { font-size: .85rem; }
.filter-summary { display: flex; gap: 22px; flex-wrap: wrap; font-size: .92rem; color: var(--muted); padding: 2px 4px 14px; }
.filter-summary strong { margin-left: 4px; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--brand-soft); padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; position: sticky; top: 68px; z-index: 5; }
.bulk-bar > span { margin-right: 8px; }
.check-all { display: flex; align-items: center; gap: 6px; font-weight: 400; margin-right: 8px; }
.day-group { margin-bottom: 14px; }
.day-head { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: .85rem; margin: 10px 0 4px; }
.day-head::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.day-balance { text-align: right; color: var(--muted); padding: 10px 50px 6px 0; }
.day-balance strong { margin-left: 12px; font-size: 1.05rem; }
.tx-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 200px 120px 36px; align-items: center; gap: 14px; padding: 10px 6px; border-radius: 12px; cursor: pointer; }
.tx-row:hover { background: var(--hover); }
.tx-row:has(.tx-check) { grid-template-columns: auto auto minmax(0, 1fr) auto 200px 120px 36px; }
.tx-row:has(.tx-date) { grid-template-columns: 64px auto minmax(0, 1fr) auto 200px 120px 36px; }
.tx-check { display: none; width: 18px; height: 18px; }
body.selecting .tx-check { display: block; }
body:not(.selecting) .tx-row:has(.tx-check) { grid-template-columns: auto minmax(0, 1fr) auto 200px 120px 36px; }
.tx-date { color: var(--muted); font-size: .88rem; }
.tx-main { min-width: 0; }
.tx-desc { font-weight: 500; overflow-wrap: anywhere; }
.tx-meta { font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tx-meta .dot { opacity: .6; }
.client-link { color: var(--brand-ink); }
.tx-badges { display: flex; gap: 4px; color: var(--muted); }
.badge-icon svg { width: 15px; height: 15px; }
.tx-origin { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-value { text-align: right; font-weight: 600; white-space: nowrap; }
.tx-row.unpaid .tx-value { opacity: .65; }
.paid-btn { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; display: grid; place-items: center; cursor: pointer; color: var(--muted-2); }
.paid-btn.is-paid { color: var(--in); }
.paid-btn.is-paid svg { fill: rgba(22,163,90,.18); }
.paid-btn.is-late { color: var(--out); }
.paid-btn.card { cursor: default; color: var(--brand-2); }
.paid-btn:hover:not(.card) { background: var(--bg); }
.list-foot { display: grid; justify-content: end; grid-template-columns: auto auto; gap: 4px 28px; background: var(--surface-2); margin: 18px -30px -26px; padding: 18px 70px 20px 30px; border-radius: 0 0 var(--radius) var(--radius); }
.list-foot > div { display: contents; }
.list-foot small { color: var(--muted); font-size: 1rem; text-align: right; }
.list-foot strong { font-size: 1.25rem; font-weight: 600; text-align: right; }

/* fatura */
.invoice-title { display: flex; align-items: center; gap: 14px; }
.invoice-title h2 { margin: 0; }
.invoice-summary { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; background: var(--bg); border-radius: 14px; padding: 16px 20px; margin-bottom: 16px; }
.invoice-summary small { display: block; color: var(--muted); }
.invoice-summary strong { font-size: 1.08rem; }
.status-paga { color: var(--in); }
.status-vencida { color: var(--out); }
.status-fechada { color: var(--warn); }
.status-aberta { color: var(--blue); }
.invoice-pay { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--brand-soft); padding: 12px 18px; border-radius: 12px; margin-bottom: 22px; }

/* ---------- modal ---------- */
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(16, 30, 36, .55); display: grid; place-items: start center; padding: 40px 16px; overflow-y: auto; z-index: 100; animation: fade .15s; }
.modal { background: var(--card); border-radius: 22px; width: 100%; max-width: 540px; padding: 26px 32px; display: grid; gap: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .18s; }
.modal.small { max-width: 420px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; }
.tx-modal.despesa .modal-head h2 { color: var(--out); }
.tx-modal.receita .modal-head h2 { color: var(--in); }
.tx-modal.transferencia .modal-head h2 { color: var(--blue); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.money-input { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; padding-left: 14px; background: var(--input-bg); }
.money-input span { color: var(--muted); }
.money-input input { border: 0 !important; box-shadow: none !important; padding-left: 8px !important; font-size: 1.05rem; }
.money-input:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(58,155,173,.18); }
.extra-toggles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0 16px; }
.extra-toggles button { display: grid; justify-items: center; gap: 4px; background: none; border: 0; color: var(--muted); cursor: pointer; font: .78rem Inter, sans-serif; }
.extra-toggles button svg { width: 50px; height: 50px; padding: 14px; border: 1px solid var(--line); border-radius: 50%; }
.extra-toggles button.on svg, .extra-toggles button:hover svg { border-color: var(--brand-2); color: var(--brand-ink); background: var(--brand-soft); }
.extra { background: var(--surface-2); border-radius: 12px; padding: 14px; display: grid; gap: 12px; }
.modal-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; justify-items: center; gap: 20px; }
.series-info { background: var(--brand-soft); color: var(--brand-ink); border-radius: 10px; padding: 8px 12px; font-size: .88rem; display: flex; gap: 8px; align-items: center; }
.att { display: flex; justify-content: space-between; gap: 8px; font-size: .9rem; }
.att a { display: flex; align-items: center; gap: 6px; }
.scope-opts { display: grid; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

/* combo */
.combo { position: relative; }
.combo-input { padding-right: 36px !important; }
.combo-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); cursor: pointer; display: grid; }
.combo-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-height: 260px; overflow: auto; background: var(--card); border-radius: 12px; box-shadow: var(--shadow-pop); z-index: 10; padding: 6px; font-weight: 400; }
.combo-opt { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.combo-opt.child { padding-left: 30px; color: var(--muted); }
.combo-opt.muted { color: var(--muted); font-style: italic; }
.combo-opt:hover, .combo-opt.active { background: var(--bg); color: var(--text); }
.combo-group { font-size: .75rem; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.combo-empty { padding: 10px; color: var(--muted); }
.dot-color { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ---------- configurações ---------- */
.settings-layout { display: grid; grid-template-columns: 210px 1fr; gap: 28px; align-items: start; }
.settings-nav { display: grid; gap: 2px; position: sticky; top: 90px; }
.settings-nav a { color: var(--muted); padding: 9px 14px; border-radius: 10px; font-size: 1rem; }
.settings-nav a:hover { background: var(--card); text-decoration: none; }
.settings-nav a.active { color: var(--brand-ink); font-weight: 600; background: var(--card); }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { flex: 1; text-align: center; padding: 12px 16px; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 500; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.active { color: var(--brand-ink); border-bottom-color: var(--brand-ink); }
.cat-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cat-row.sub { padding-left: 58px; color: var(--muted); }
.cat-name { flex: 1; font-weight: 500; min-width: 160px; }
.cat-row.sub .cat-name { font-weight: 400; }
.row-actions { display: flex; gap: 14px; flex-wrap: wrap; margin: 0; }
.muted-row { opacity: .6; }
.archived { margin: 0 0 12px; }
.archived summary { color: var(--muted); text-decoration: underline; cursor: pointer; padding: 6px 0; }
.tag-row .inline-input { max-width: 300px; flex: 1; }
.steps-help { color: var(--muted); padding-left: 20px; }
.danger-zone { border: 1px solid var(--red-line); }
.danger-zone h2 { color: var(--out); }
.import-progress { margin-top: 20px; }
.import-progress pre { background: #1d2b31; color: #d7e3e6; border-radius: 12px; padding: 14px; max-height: 320px; overflow: auto; font-size: .85rem; white-space: pre-wrap; }
.progress { height: 8px; background: var(--bg); border-radius: 8px; overflow: hidden; margin: 6px 0; }
.progress > div { height: 100%; background: var(--in); border-radius: 8px; transition: width .3s; }
.progress > div.warn { background: var(--warn); }
.progress > div.over { background: var(--out); }
.table-wrap { overflow-x: auto; }
.stmt-table select { min-width: 150px; padding: 6px 8px !important; border-radius: 8px !important; }
.stmt-table tr.dup { background: var(--card)7e6; }

/* ---------- clientes ---------- */
.client-row { display: grid; grid-template-columns: auto 1fr 130px 130px 130px; gap: 16px; align-items: center; padding: 13px 6px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none !important; border-radius: 10px; }
.client-row:hover { background: var(--hover); }
.client-main { display: grid; min-width: 0; }
.client-main small { color: var(--muted); }
.client-num { display: grid; text-align: right; }
.client-num small { color: var(--muted); }
.client-num span { font-weight: 600; }
.client-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.client-id { display: flex; gap: 18px; align-items: flex-start; }
.client-id h2 { margin-bottom: 4px; }
.client-id p { margin: 4px 0; }
.contact-line { display: flex; flex-wrap: wrap; gap: 16px; }
.contact-line a, .contact-line span { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.contact-line svg { width: 15px; height: 15px; color: var(--muted); }
.client-actions { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.tag-pill { font-size: .75rem; background: var(--bg); color: var(--muted); padding: 2px 8px; border-radius: 10px; vertical-align: middle; font-weight: 500; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat { padding: 18px 22px; }
.stat small { display: block; color: var(--muted); }
.stat strong { font-size: 1.3rem; font-weight: 600; }
.notes-box { background: var(--surface-2); border-radius: 12px; padding: 14px 18px; margin-top: 16px; }
.notes-box p { margin: 6px 0 0; }
.client-form [data-pf], .client-form [data-pj] { }
.client-form label > span[hidden] { display: none; }

/* ---------- relatórios ---------- */
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.report-head h2 { margin: 0; }
.report-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 22px; }
.report-filters input[type=date] { width: auto !important; padding: 7px 10px !important; }
.report-split { display: grid; grid-template-columns: 320px 1fr; gap: 32px; align-items: start; }
.chart-box { position: relative; margin-bottom: 20px; }
.chart-box.square { aspect-ratio: 1; }
.chart-box.wide { height: 320px; }
.chart-box.short { height: 240px; }
.legend-row { display: flex; justify-content: flex-end; gap: 18px; font-size: .88rem; color: var(--muted); margin-bottom: 8px; }
.lg::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg.in::before { background: var(--in); }
.lg.out::before { background: var(--out); }
.lg.acc::before { background: rgba(58,155,173,.35); }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 11px 8px; border-bottom: 1px solid var(--line); }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot th { color: var(--text); font-weight: 600; border-bottom: 0; border-top: 2px solid var(--line); }
.table .sub-row td { color: var(--muted); padding-left: 38px; font-size: .88rem; }
.table .sub-row td.num { padding-left: 8px; }
.group-row td { font-weight: 500; }

/* ---------- limites ---------- */
.budget-total { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg); border-radius: 14px; padding: 16px 20px; margin-bottom: 18px; }
.budget-total small { display: block; color: var(--muted); }
.budget-total strong { font-size: 1.2rem; }
.budget-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.budget-input { max-width: 160px; text-align: right; }
.budget-main { flex: 1; }
.budget-line { display: flex; justify-content: space-between; gap: 10px; font-weight: 500; }

/* ---------- login / instalação ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--auth-bg); }
.auth-card { background: var(--card); border-radius: 22px; box-shadow: 0 20px 60px rgba(11,96,121,.12); padding: 40px; width: 100%; max-width: 440px; }
.auth-logo { display: block; height: 70px; margin: 0 auto 18px; }
.auth-card h1 { text-align: center; font-size: 1.25rem; font-weight: 600; color: var(--brand-ink); margin-bottom: 22px; }
.auth-card .form-grid { grid-template-columns: 1fr 1fr; }
.auth-card .btn { padding: 13px; margin-top: 4px; }

/* ---------- responsivo ---------- */
@media (max-width: 1000px) {
  .grid-2, .report-split { grid-template-columns: 1fr; }
  .invoice-summary { grid-template-columns: repeat(3, 1fr); }
  .tx-row, .tx-row:has(.tx-date), .tx-row:has(.tx-check), body:not(.selecting) .tx-row:has(.tx-check) { grid-template-columns: auto auto minmax(0, 1fr) auto 36px; }
  .tx-row .tx-origin, .tx-row .tx-badges { display: none; }
  body:not(.selecting) .tx-row:has(.tx-check):not(:has(.tx-date)) { grid-template-columns: auto minmax(0, 1fr) auto 36px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; display: flex; overflow-x: auto; }
  .settings-nav a { white-space: nowrap; }
}
@media (max-width: 860px) {
  .topbar-inner { gap: 12px; }
  .nav-toggle { display: grid; }
  .mainnav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--brand-dark); flex-direction: column; padding: 8px 16px 16px; }
  .mainnav.open { display: flex; }
  .mainnav a { padding: 12px 6px; border-bottom: 0; }
  .topbar-actions { margin-left: 4px; }
}
@media (max-width: 640px) {
  .container { padding: 16px 12px 40px; }
  .card { padding: 18px 16px; border-radius: 14px; }
  .brand span { display: none; }
  .hero-stats { gap: 18px; flex-wrap: wrap; }
  .quick-actions .btn { flex: 1 1 45%; }
  .form-grid, .form-grid.cols-4, .row-2 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .list-head { justify-content: center; }
  .search-box { margin-left: 0; width: 100%; }
  .search-box input { width: 100% !important; }
  .tx-row, .tx-row:has(.tx-date), body:not(.selecting) .tx-row:has(.tx-check):not(:has(.tx-date)) { grid-template-columns: auto minmax(0, 1fr) auto 32px; gap: 10px; }
  .tx-row .tx-date { display: none; }
  .tx-row:has(.tx-date) { grid-template-columns: auto minmax(0, 1fr) auto 32px; }
  .client-row { grid-template-columns: auto 1fr auto; }
  .client-row .client-num:nth-of-type(1), .client-row .client-num:nth-of-type(2) { display: none; }
  .invoice-summary, .budget-total { grid-template-columns: 1fr 1fr; }
  .top-gastos { grid-template-columns: 1fr; }
  .top-chart { max-width: 220px; margin: 0 auto; }
  .list-foot { margin: 14px -16px -18px; padding: 16px; }
  .modal { padding: 20px; border-radius: 18px; }
  .modal-backdrop { padding: 12px; }
  .stat-row { gap: 12px; }
  .day-balance { padding-right: 0; }
}

/* ---------- tema escuro ---------- */
:root[data-theme="dark"] {
  --bg: #0e1619;
  --card: #172125;
  --surface-2: #1c282d;
  --hover: #1e2b30;
  --input-bg: #111a1d;
  --text: #e2eaec;
  --muted: #92a4aa;
  --muted-2: #55666c;
  --line: #29373c;
  --line-strong: #3a494f;
  --brand-soft: #16353e;
  --brand-soft-hover: #1c4450;
  --brand-ink: #6fc6d8;
  --topbar: #0a3a48;
  --btn-dark: #2f4148;
  --in: #3dcc7e;
  --out: #ff6b70;
  --blue: #74a3ff;
  --warn: #f5b83d;
  --red-soft: #3a1e21;
  --red-line: #6a2c30;
  --red-text: #ff9da0;
  --green-soft: #15301f;
  --green-text: #80dea9;
  --warn-soft: #362c12;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.2);
  --shadow-pop: 0 10px 30px rgba(0,0,0,.5);
  --auth-bg: linear-gradient(160deg, #0a2a33, #0e1619 60%);
  color-scheme: dark;
}
:root[data-theme="dark"] .auth-logo.light, :root:not([data-theme="dark"]) .auth-logo.dark { display: none; }
:root[data-theme="dark"] .segmented label:has(input:checked) { background: var(--hover); }
:root[data-theme="dark"] .import-progress pre { background: #0a1113; }

/* ---------- impressão ---------- */
@media print {
  .topbar, .no-print, .toast-wrap, .settings-nav { display: none !important; }
  body { background: #fff; color: #000; }
  .container { padding: 0; max-width: none; }
  .card { box-shadow: none; padding: 0; }
  .chart-box.wide { height: 260px; }
}

.filters.searching .search-box { opacity: .7; }
.filters.searching .search-box svg { animation: pulse .8s ease-in-out infinite alternate; }
@keyframes pulse { to { opacity: .3; } }

/* cadastro rápido dentro do lançamento */
.combo-opt.create { color: var(--brand-ink); font-weight: 600; }
.combo-opt.create:hover, .combo-opt.create.active { background: var(--brand-soft); color: var(--brand-ink); }
.modal-backdrop.stacked { z-index: 120; background: rgba(10, 18, 22, .45); }
.quick-form h3 { margin: 0; }
.quick-form .segmented { margin-bottom: 0; }

/* relatório de categorias: receitas e despesas juntas */
.report-totals { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; background: var(--bg); border-radius: 14px; padding: 16px 20px; margin-bottom: 22px; }
.report-totals small { display: block; color: var(--muted); }
.report-totals strong { font-size: 1.25rem; }
.report-section-title { margin: 26px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.report-totals + .report-section-title { margin-top: 0; }

/* DRE */
.dre-kpis em { font-style: normal; font-size: .8rem; color: var(--muted); }
.dre-table .dre-group td { font-weight: 600; }
.dre-table .dre-total td { font-weight: 700; background: var(--surface-2); }
.dre-table .dre-result td { font-weight: 700; font-size: 1.08rem; background: var(--brand-soft); border-bottom: 0; }
.dre-table thead th:first-child { color: var(--text); font-weight: 600; }
.dre-map { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.dre-map summary { cursor: pointer; font-weight: 600; color: var(--brand-ink); }
.dre-map h4 { margin: 18px 0 6px; color: var(--muted); font-weight: 600; font-size: .9rem; text-transform: uppercase; letter-spacing: .3px; }
.dre-map-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); font-weight: 400; }
.dre-map-row select { max-width: 300px; padding: 7px 10px !important; }
@media (max-width: 640px) { .dre-map-row { flex-direction: column; align-items: stretch; } .dre-map-row select { max-width: none; } }

/* Livro caixa */
.cash-kpis { grid-template-columns: repeat(4, 1fr); }
.cash-table thead tr:first-child th { color: var(--text); font-weight: 600; }
.cash-table .cash-opening td { background: var(--surface-2); font-weight: 600; }
.cash-table .cash-row { cursor: pointer; }
.cash-table .cash-row:hover td { background: var(--hover); }
.cash-table td small { font-size: .8rem; }
@media (max-width: 640px) { .cash-kpis { grid-template-columns: 1fr 1fr; } .cash-table .col-acc { display: none; } }
.cash-table .cash-opening-row td { background: var(--brand-soft); }
.cash-kpis small.muted { display: block; margin-top: 2px; font-size: .78rem; }
