:root{--navy:#071b36;--navy2:#0d2b52;--navy3:#174577;--gold:#d6a62e;--gold2:#f0cf70;--cream:#fffaf0;--bg:#f3f6fa;--card:#fff;--ink:#0b1f3b;--muted:#68778a;--green:#157347;--red:#c43d3d;--orange:#9b6500;--line:#e2e8f0;--shadow:0 10px 28px rgba(7,27,54,.08)}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}html{background:var(--navy)}body{margin:0;background:var(--bg);font-family:"Segoe UI Variable","Aptos","Segoe UI",Roboto,Helvetica,Arial,sans-serif;color:var(--ink);padding-bottom:calc(84px + env(safe-area-inset-bottom));min-height:100vh}button,input,select,textarea{font:inherit}button{cursor:pointer}.hidden{display:none!important}.wrap{max-width:820px;margin:auto;min-height:100vh;background:var(--bg)}
.top{padding:calc(17px + env(safe-area-inset-top)) 18px 19px;background:linear-gradient(145deg,var(--navy),var(--navy2));color:#fff;border-radius:0 0 28px 28px;box-shadow:0 10px 28px rgba(7,27,54,.17);position:relative;overflow:hidden}.top:after{content:"";position:absolute;width:190px;height:190px;border:1px solid rgba(214,166,46,.35);border-radius:50%;right:-90px;top:-105px}.toprow,.headrow,.month,.summary-line,.card-top,.report-head{display:flex;justify-content:space-between;align-items:center;gap:10px}.top h1{margin:0;font-size:24px;letter-spacing:-.5px}.top p{margin:4px 0 0;color:#d5dfeb;font-size:12px}.logout{border:1px solid rgba(255,255,255,.32);background:rgba(255,255,255,.08);color:white;border-radius:12px;padding:8px 11px;position:relative;z-index:1}
.card{background:#fff;border:1px solid var(--line);border-radius:20px;padding:15px;margin:13px;box-shadow:var(--shadow)}.month{margin-top:-2px}.month button{border:0;background:#edf2f7;color:var(--navy);border-radius:12px;width:40px;height:40px;font-size:22px;font-weight:900}.month strong{font-size:15px;text-transform:capitalize}.month small{display:block;color:var(--muted);font-size:9px;font-weight:500;text-align:center;margin-top:2px}
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:9px;margin:13px}.metric{background:#fff;border:1px solid var(--line);border-radius:18px;padding:13px;box-shadow:0 7px 20px rgba(7,27,54,.05);position:relative;overflow:hidden}.metric:before{content:"";position:absolute;left:0;top:0;bottom:0;width:4px;background:var(--gold)}.metric span{font-size:10px;color:var(--muted);display:block}.metric strong{font-size:18px;display:block;margin-top:5px}.metric small{font-size:9px;color:var(--muted);display:block;margin-top:3px}.green{color:var(--green)}.red{color:var(--red)}h2{font-size:17px;margin:0 0 12px}h3{font-size:14px;margin:0}.section-title{display:flex;align-items:center;gap:8px}.section-title .dot{width:9px;height:9px;background:var(--gold);border-radius:50%}.subtle{font-size:11px;color:var(--muted);margin:-6px 0 12px;line-height:1.45}
.alerts{margin:13px}.alert{display:flex;gap:11px;align-items:flex-start;border-radius:17px;padding:12px 13px;margin-bottom:8px;border:1px solid}.alert strong{display:block;font-size:13px}.alert span{display:block;font-size:11px;margin-top:3px}.alert.over{background:#fff0f0;border-color:#f0c7c7;color:#8e2424}.alert.soon{background:#fff8e5;border-color:#ecd79a;color:#745000}.alert.today{background:#fff3dc;border-color:#e5c36b;color:#694800}.alert.good{background:#eef8f2;border-color:#c9e7d5;color:#17603c}.alert .badge{font-size:20px;line-height:1}
.quick{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.quick button{border:1px solid var(--line);background:linear-gradient(180deg,#fff,#fafbfd);border-radius:16px;padding:14px 6px;font-size:21px;color:var(--navy);box-shadow:0 6px 16px rgba(7,27,54,.04)}.quick span{display:block;font-size:10px;font-weight:800;margin-top:6px}.quick button:active{transform:scale(.98)}
.item{border:1px solid var(--line);border-radius:16px;padding:12px;margin:8px 0;background:#fff;display:flex;gap:10px;align-items:center}.item.overdue{border-color:#efc6c6;background:#fffafa}.item.soon{border-color:#ead493;background:#fffdf7}.grow{flex:1;min-width:0}.title{font-weight:850;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.meta{font-size:10px;color:var(--muted);margin-top:4px;line-height:1.4}.value{font-weight:900;text-align:right;font-size:14px}.kind-pill,.status-pill{display:inline-block;border-radius:999px;padding:3px 7px;font-size:8px;font-weight:850;margin-top:5px;background:#eef2f6;color:var(--muted)}.kind-pill{margin-right:4px;background:#eef4fb;color:var(--navy2)}.kind-pill.in{background:#e8f6ee;color:var(--green)}.kind-pill.cardk{background:#fff4d8;color:#7a5500}.status-pill.paid{background:#e7f5ed;color:var(--green)}.status-pill.late{background:#fdeaea;color:var(--red)}.status-pill.near{background:#fff2cf;color:#855d00}.actions{display:flex;gap:5px;justify-content:flex-end;margin-top:7px;flex-wrap:wrap}.small{border:0;border-radius:9px;padding:7px 8px;font-size:9px;font-weight:850}.ok{background:#e4f5ec;color:var(--green)}.edit{background:#e8eef7;color:var(--navy2)}.del{background:#fdeaea;color:var(--red)}.undo{background:#f0f2f6;color:#526174}.primary{border:0;background:var(--navy);color:white;border-radius:12px;padding:11px 14px;font-weight:850}.gold{background:var(--gold);color:var(--navy)}.secondary{border:0;background:#eef1f6;color:var(--navy);border-radius:12px;padding:11px;font-weight:750}.danger{background:#fdeaea;color:var(--red)}
.filters{display:grid;grid-template-columns:1.5fr 1fr 1fr;gap:7px;margin-bottom:10px}.filters input,.filters select{margin:0;padding:10px;font-size:11px}.empty{text-align:center;color:var(--muted);padding:22px 10px;font-size:12px;line-height:1.5}.empty b{color:var(--ink)}
.cardline{background:linear-gradient(135deg,var(--navy),var(--navy2));color:white;border-radius:19px;padding:16px;margin:10px 0;box-shadow:0 10px 22px rgba(7,27,54,.15);position:relative;overflow:hidden}.cardline:after{content:"";position:absolute;width:120px;height:120px;border:1px solid rgba(214,166,46,.3);border-radius:50%;right:-50px;top:-55px}.cardline .meta{color:#d5dfeb}.cardname{font-size:17px;font-weight:900}.cardstats{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:14px}.cardstat{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.1);border-radius:12px;padding:9px}.cardstat span{display:block;color:#d5dfeb;font-size:8px}.cardstat strong{display:block;font-size:11px;margin-top:3px}.card-actions{display:flex;gap:6px;margin-top:11px;position:relative;z-index:2}.card-actions button{border:1px solid rgba(255,255,255,.22);background:rgba(255,255,255,.08);color:#fff;border-radius:9px;padding:7px 9px;font-size:9px;font-weight:800}.card-actions .danger-card{color:#ffd1d1}.limitbar{height:5px;background:rgba(255,255,255,.18);border-radius:10px;overflow:hidden;margin-top:10px}.limitbar i{display:block;height:100%;background:var(--gold);border-radius:10px}
.report-intro{background:linear-gradient(135deg,var(--navy),var(--navy2));color:#fff}.report-intro h2{margin-bottom:5px}.report-intro p{margin:0;color:#d7e0ec;font-size:11px;line-height:1.5}.report-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}.reportbox{border:1px solid var(--line);border-radius:14px;padding:11px}.reportbox span{font-size:9px;color:var(--muted);display:block}.reportbox strong{display:block;margin-top:5px;font-size:15px}.reportbox small{display:block;color:var(--muted);font-size:8px;margin-top:3px}.progress{height:9px;background:#edf1f5;border-radius:20px;overflow:hidden;margin:8px 0 4px}.progress i{height:100%;display:block;background:linear-gradient(90deg,var(--gold),var(--gold2));border-radius:20px}.progress-label{font-size:10px;color:var(--muted)}.donut-wrap{display:grid;grid-template-columns:150px 1fr;gap:16px;align-items:center}.donut{width:145px;height:145px;border-radius:50%;position:relative;margin:auto;background:#edf1f5}.donut:after{content:"";position:absolute;inset:28px;border-radius:50%;background:#fff}.donut-center{position:absolute;inset:0;display:grid;place-items:center;text-align:center;z-index:2;font-size:9px;color:var(--muted);pointer-events:none}.donut-center strong{display:block;color:var(--ink);font-size:14px}.legend{display:flex;flex-direction:column;gap:7px}.legend-row{display:grid;grid-template-columns:9px 1fr auto;gap:7px;align-items:center;font-size:10px}.legend-row i{width:9px;height:9px;border-radius:3px}.legend-row span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.legend-row strong{font-size:10px}.insight{background:var(--cream);border:1px solid #ecdba8;border-radius:14px;padding:11px;font-size:10px;line-height:1.5;color:#604700;margin-top:12px}
.bottom{position:fixed;bottom:0;left:0;right:0;background:rgba(255,255,255,.97);border-top:1px solid var(--line);display:flex;justify-content:center;padding:7px 5px calc(7px + env(safe-area-inset-bottom));z-index:20;box-shadow:0 -8px 24px rgba(7,27,54,.08);backdrop-filter:blur(12px)}.bottom button{width:min(25%,205px);border:0;background:transparent;color:#7b8797;font-size:18px;padding:4px}.bottom span{display:block;font-size:9px;margin-top:2px}.bottom .active{color:var(--navy);font-weight:900}.bottom .active:after{content:"";display:block;width:18px;height:3px;background:var(--gold);border-radius:3px;margin:3px auto 0}.fab{position:fixed;right:max(20px,calc((100vw - 820px)/2 + 20px));bottom:calc(91px + env(safe-area-inset-bottom));width:58px;height:58px;border-radius:50%;border:0;background:var(--gold);color:var(--navy);font-size:30px;font-weight:700;box-shadow:0 12px 28px rgba(7,27,54,.30);z-index:18}
dialog{border:0;border-radius:22px;width:min(94vw,560px);padding:0;box-shadow:0 30px 70px rgba(0,0,0,.25);max-height:88vh}dialog::backdrop{background:rgba(7,27,54,.68);backdrop-filter:blur(2px)}form{padding:18px}label{display:block;font-size:11px;font-weight:800;margin-top:10px}input,select,textarea{width:100%;border:1px solid #d5dde7;border-radius:12px;padding:12px;margin-top:5px;background:white;color:var(--ink);outline:none}input:focus,select:focus,textarea:focus{border-color:var(--gold);box-shadow:0 0 0 3px rgba(214,166,46,.14)}.two{display:grid;grid-template-columns:1fr 1fr;gap:9px}.dhead{display:flex;justify-content:space-between;align-items:center;position:sticky;top:0;background:#fff;z-index:3;padding-bottom:3px}.dhead h2{margin:0}.x{border:0;background:#eef1f6;border-radius:10px;width:36px;height:36px}.dactions{display:flex;justify-content:flex-end;gap:8px;margin-top:16px}.fieldhint{font-size:9px;color:var(--muted);margin-top:4px;line-height:1.35}
.auth{min-height:100vh;display:grid;place-items:center;padding:20px;background:radial-gradient(circle at 85% 10%,rgba(214,166,46,.28),transparent 28%),linear-gradient(150deg,var(--navy),var(--navy2))}.authbox{width:min(100%,420px);background:white;border-radius:26px;padding:26px;box-shadow:0 28px 70px rgba(0,0,0,.28)}.brandmark{width:64px;height:64px;border-radius:19px;background:var(--navy);color:var(--gold);display:grid;place-items:center;font-size:25px;font-weight:900;margin-bottom:16px;border:2px solid var(--gold)}.authbox h1{margin:0}.authbox p{color:var(--muted)}.authbox button{width:100%;margin-top:12px}.switch{background:transparent!important;color:var(--ink)!important}.notice{font-size:11px;color:var(--muted);margin-top:12px}.install-card{border:1px dashed #d6b14e;background:#fffaf0}.install-row{display:flex;align-items:center;gap:12px}.install-icon{width:46px;height:46px;border-radius:14px;background:var(--navy);color:var(--gold);display:grid;place-items:center;font-weight:900}.install-row .grow p{margin:3px 0 0;font-size:10px;color:var(--muted)}.install-btn{white-space:nowrap;border:0;background:var(--gold);color:var(--navy);font-weight:900;border-radius:11px;padding:9px 11px;font-size:10px}
@media(max-width:560px){body{padding-bottom:calc(80px + env(safe-area-inset-bottom))}.wrap{width:100%}.top{border-radius:0 0 23px 23px;padding-left:15px;padding-right:15px}.top h1{font-size:22px}.card{margin:10px 9px;padding:13px;border-radius:18px}.grid{margin:10px 9px;gap:7px}.metric{padding:11px}.metric strong{font-size:16px}.alerts{margin:10px 9px}.quick button{padding:12px 4px}.filters{grid-template-columns:1fr 1fr}.filters input{grid-column:1/-1}.item{align-items:flex-start;flex-direction:column}.item>div:last-child{width:100%}.value{text-align:left}.actions{justify-content:flex-start}.donut-wrap{grid-template-columns:1fr}.donut{width:135px;height:135px}.cardstats{grid-template-columns:1fr 1fr 1fr}.two{grid-template-columns:1fr 1fr}.fab{right:16px}.report-grid{gap:6px}.reportbox{padding:10px}.install-row{align-items:flex-start}.install-btn{align-self:center}}
@media(max-width:370px){.two{grid-template-columns:1fr}.cardstats{grid-template-columns:1fr}.quick span{font-size:9px}}

/* ===== Tema profissional azul-marinho + dourado ===== */
.theme-actions{display:flex;align-items:center;gap:8px;position:relative;z-index:2}
.theme-btn{border:1px solid rgba(214,166,46,.65);background:rgba(214,166,46,.12);color:var(--gold2);border-radius:12px;padding:8px 10px;font-weight:900}
.signature{font-family:"Segoe Script","Brush Script MT",cursive;color:var(--gold2)!important;font-size:16px!important;letter-spacing:.2px;margin-top:6px!important}
.app-signature{text-align:center;color:var(--gold2);font-family:"Segoe Script","Brush Script MT",cursive;font-size:16px;padding:10px 10px 2px}
.theme-panel{padding:18px}
.theme-options{display:grid;gap:9px;margin-top:14px}
.theme-option{width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid var(--line);background:var(--card);color:var(--ink);border-radius:14px;padding:13px 14px;font-weight:850}
.theme-option.active{border-color:var(--gold);box-shadow:0 0 0 2px rgba(214,166,46,.16);color:var(--gold)}
.theme-note{font-size:10px;color:var(--muted);line-height:1.5;margin-top:10px}

/* Tema escuro: a base inteira acompanha o azul do topo */
html[data-theme="dark"]{
 --navy:#061a35;--navy2:#0b2b55;--navy3:#154a82;
 --gold:#e0ad2f;--gold2:#f6d779;--cream:#172f50;
 --bg:#061a35;--card:#0b2b55;--ink:#ffffff;--muted:#b8c7d9;
 --green:#58d59a;--red:#ff7777;--orange:#f1bf58;--line:#24486f;
 --shadow:0 12px 30px rgba(0,0,0,.22)
}
html[data-theme="dark"],html[data-theme="dark"] body{background:#061a35}
html[data-theme="dark"] .wrap{background:#061a35}
html[data-theme="dark"] .card,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .item,
html[data-theme="dark"] .reportbox{background:var(--card);border-color:var(--line);color:var(--ink)}
html[data-theme="dark"] .metric{box-shadow:0 8px 22px rgba(0,0,0,.18)}
html[data-theme="dark"] .metric:before{width:5px;background:linear-gradient(var(--gold2),var(--gold))}
html[data-theme="dark"] .month button,
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .x{background:#14375f;color:#fff}
html[data-theme="dark"] .quick button{background:linear-gradient(180deg,#103762,#0b2b55);border-color:#2a527c;color:#fff}
html[data-theme="dark"] .bottom{background:rgba(6,26,53,.97);border-color:#24486f}
html[data-theme="dark"] .bottom button{color:#9fb2c9}
html[data-theme="dark"] .bottom .active{color:var(--gold2)}
html[data-theme="dark"] .item.overdue{background:#3a1f2b;border-color:#824251}
html[data-theme="dark"] .item.soon{background:#3a321c;border-color:#826d34}
html[data-theme="dark"] .alert.over{background:#3a1f2b;border-color:#824251;color:#ffd3d3}
html[data-theme="dark"] .alert.soon,
html[data-theme="dark"] .alert.today{background:#3a321c;border-color:#826d34;color:#ffe3a0}
html[data-theme="dark"] .alert.good{background:#163b31;border-color:#2d6b58;color:#c7f4df}
html[data-theme="dark"] .install-card{background:#102f52;border-color:#b78a23}
html[data-theme="dark"] .insight{background:#263819;border-color:#806d2b;color:#ffe9aa}
html[data-theme="dark"] .donut:after{background:var(--card)}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{background:#071f3e;border-color:#31567c;color:#fff}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{color:#8fa4bc}
html[data-theme="dark"] dialog{background:var(--card);color:var(--ink)}
html[data-theme="dark"] .dhead{background:var(--card)}
html[data-theme="dark"] .authbox{background:#0b2b55;color:#fff;border:1px solid #2c527b}
html[data-theme="dark"] .switch{color:#fff!important}
html[data-theme="dark"] .kind-pill{background:#163d67;color:#dceaff}
html[data-theme="dark"] .status-pill{background:#163d67;color:#dceaff}
html[data-theme="dark"] .status-pill.paid{background:#174a39;color:#bff3d9}
html[data-theme="dark"] .status-pill.late{background:#4b2631;color:#ffd0d0}
html[data-theme="dark"] .status-pill.near{background:#4b3c19;color:#ffe3a0}
html[data-theme="dark"] .ok{background:#174a39;color:#c6f5df}
html[data-theme="dark"] .edit{background:#173d68;color:#dceaff}
html[data-theme="dark"] .del{background:#4b2631;color:#ffd0d0}
html[data-theme="dark"] .undo{background:#233d5c;color:#d7e2ef}
html[data-theme="dark"] .progress{background:#17375a}
html[data-theme="dark"] .empty b{color:#fff}

/* Tema claro: branco como base, mantendo azul e dourado em evidência */
html[data-theme="light"]{
 --navy:#071b36;--navy2:#0d2b52;--navy3:#174577;
 --gold:#d6a62e;--gold2:#efc95c;--cream:#fffaf0;
 --bg:#f5f7fb;--card:#ffffff;--ink:#0b1f3b;--muted:#68778a;
 --green:#157347;--red:#c43d3d;--orange:#9b6500;--line:#dfe6ef;
 --shadow:0 10px 28px rgba(7,27,54,.08)
}
html[data-theme="light"] .wrap{background:var(--bg)}
html[data-theme="light"] .top{border-bottom:3px solid var(--gold)}
html[data-theme="light"] .bottom .active{color:var(--navy)}
@media(max-width:560px){
 .theme-btn{padding:8px 9px}
 .signature{font-size:14px!important}
 .app-signature{font-size:14px}
}


.invoice-badge{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:6px 9px;font-size:11px;font-weight:900;margin-top:6px}
.invoice-badge.open{background:#fff4d6;color:#7a5600;border:1px solid #ecd58d}
.invoice-badge.paid{background:#e9f7ef;color:#17653f;border:1px solid #b9e2ca}
.invoice-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.invoice-actions button{flex:1;min-width:120px;border:0;border-radius:12px;padding:10px 12px;font-weight:900}
.pay-invoice{background:var(--gold);color:var(--navy)}
.reopen-invoice{background:#e9eef5;color:var(--navy)}
.view-invoice{background:#163d68;color:#fff}
.invoice-summary{display:grid;grid-template-columns:1.4fr 1fr 1fr;gap:8px;margin-top:12px}
.invoice-box{border:1px solid var(--line);border-radius:13px;padding:10px;background:rgba(255,255,255,.03)}
.invoice-box span{display:block;font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.4px}
.invoice-box strong{display:block;margin-top:4px;font-size:15px}
@media(max-width:560px){.invoice-summary{grid-template-columns:1fr 1fr}.invoice-summary .invoice-box:first-child{grid-column:1/-1}.invoice-actions button{min-width:0}}

.syncstate{font-size:9px;margin-top:7px;color:#bcd3e8}.syncstate.ok{color:#9de1b7}.syncstate.err{color:#ffb3b3}.home-focus{border-left:4px solid var(--gold)}.home-focus-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.eyebrow{font-size:9px;font-weight:900;letter-spacing:1px;color:var(--gold)}.health-dot{width:13px;height:13px;border-radius:50%;background:var(--gold);box-shadow:0 0 0 5px rgba(214,166,46,.12)}.health-dot.good{background:var(--green);box-shadow:0 0 0 5px rgba(21,115,71,.12)}.health-dot.warn{background:var(--red);box-shadow:0 0 0 5px rgba(196,61,61,.12)}.checkline{display:flex;gap:9px;align-items:flex-start;background:#f7f9fc;border:1px solid var(--line);border-radius:12px;padding:10px;font-size:11px;line-height:1.4}.checkline input{width:auto;margin:2px 0 0}.invoice-history-row{display:flex;justify-content:space-between;gap:10px;border:1px solid var(--line);border-radius:14px;padding:11px;margin:7px 0}.invoice-history-row strong{font-size:12px}.invoice-history-row span{font-size:10px;color:var(--muted)}.loading-mask{position:fixed;inset:0;background:rgba(7,27,54,.32);display:none;place-items:center;z-index:100;backdrop-filter:blur(2px)}.loading-mask.show{display:grid}.spinner{width:38px;height:38px;border:4px solid rgba(255,255,255,.35);border-top-color:#fff;border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.toast{position:fixed;left:50%;bottom:96px;transform:translateX(-50%) translateY(20px);background:var(--navy);color:#fff;border:1px solid rgba(255,255,255,.15);border-radius:14px;padding:11px 14px;box-shadow:0 12px 30px rgba(0,0,0,.2);font-size:11px;opacity:0;pointer-events:none;transition:.2s;z-index:120;max-width:min(90vw,520px)}.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}.toast.error{background:#7f2323}.toast.success{background:#125d3b}body[data-busy="1"] button{cursor:wait}.secondary{white-space:nowrap}
/* ===== Refinamento visual profissional ===== */
:root{
  --radius-xl:22px;
  --radius-lg:18px;
  --radius-md:14px;
}
body{
  font-family:"Segoe UI Variable","Aptos","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  font-size:14px;
  letter-spacing:-.01em;
}
h1,h2,h3,strong,.primary,.secondary,button{
  font-family:"Segoe UI Variable","Aptos Display","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
h1,h2,h3{letter-spacing:-.025em}
.card{
  border-radius:var(--radius-xl);
  box-shadow:0 10px 30px rgba(7,27,54,.07);
}
html[data-theme="dark"] .card{
  box-shadow:0 12px 30px rgba(0,0,0,.17);
}
.top-brand{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.top-app-icon{
  width:48px;
  height:48px;
  border-radius:14px;
  object-fit:cover;
  box-shadow:0 8px 20px rgba(0,0,0,.22);
  flex:0 0 auto;
}
.brandmark{
  overflow:hidden;
  border:0;
  background:transparent;
  box-shadow:0 10px 24px rgba(7,27,54,.18);
}
.brandmark img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}
.install-icon{
  overflow:hidden;
  padding:0;
  background:transparent;
}
.install-icon img{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
}
#home>.card:first-child{
  margin-top:10px;
}
#home>.card:first-child h2{
  margin-bottom:10px;
}
.quick{
  gap:10px;
}
.quick button{
  min-height:88px;
  border-radius:18px;
  border:1px solid var(--line);
  transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease;
}
.quick button:hover{
  transform:translateY(-1px);
  border-color:rgba(214,166,46,.62);
  box-shadow:0 10px 20px rgba(7,27,54,.08);
}
.quick button span{
  font-size:10.5px;
  letter-spacing:-.01em;
}
.metric{
  border-radius:18px;
}
.metric span,.metric small,.subtle,.meta,.fieldhint,.notice{
  letter-spacing:0;
}
input,select,textarea{
  border-radius:13px;
}
.primary,.secondary,.logout,.theme-btn{
  border-radius:13px;
}
.bottom span{
  font-size:9.5px;
  font-weight:650;
}
.app-signature{display:none!important}

@media(max-width:560px){
  .top-app-icon{width:42px;height:42px;border-radius:12px}
  .top-brand{gap:10px}
  .quick button{min-height:80px}
}

/* ===== Estrutura refinada v7 ===== */
:root{
 --bg:#f4f7fb; --surface:#ffffff; --surface-2:#f8fafc; --text:#10233f;
 --muted:#607089; --line:#dce4ee; --navy:#082b52; --gold:#c99728;
 --danger:#c53c45; --success:#14835f; --shadow:0 8px 24px rgba(15,35,64,.07);
}
html[data-theme="dark"]{
 --bg:#07182c; --surface:#0d2541; --surface-2:#112d4d; --text:#f5f8fc;
 --muted:#c0ccda; --line:#284664; --navy:#f5f8fc; --gold:#f0c45d;
 --danger:#ff8a92; --success:#62d6aa; --shadow:0 10px 28px rgba(0,0,0,.22);
}
html,body,button,input,select,textarea{
 font-family:"Trebuchet MS","Segoe UI",Arial,sans-serif!important;
}
body{background:var(--bg)!important;color:var(--text)!important;line-height:1.45}
h1,h2,h3,h4,label,strong,.amount,.value{color:var(--text)}
p,small,.subtle,.meta,.fieldhint{color:var(--muted)!important}
.card,.panel,.metric,.invoice-box,.install-card,.modal-content{
 background:var(--surface)!important;color:var(--text)!important;
 border:1px solid var(--line)!important;border-radius:18px!important;
 box-shadow:var(--shadow)!important;
}
.metric,.quick button,.invoice-summary>div{min-width:0}
.quick{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(120px,1fr))!important;gap:12px!important}
.quick button{
 background:var(--surface-2)!important;color:var(--text)!important;
 border:1px solid var(--line)!important;border-radius:16px!important;
 padding:14px 10px!important;min-height:86px!important;
}
input,select,textarea{
 background:var(--surface)!important;color:var(--text)!important;
 border:1px solid var(--line)!important;
}
input::placeholder,textarea::placeholder{color:var(--muted)!important;opacity:.9}
table,th,td,.row,.transaction-row,.purchase-row{color:var(--text)}
th{color:var(--muted)!important}
.secondary,.theme-btn{
 background:var(--surface-2)!important;color:var(--text)!important;border-color:var(--line)!important
}
.notice,.empty,.install-card{color:var(--text)!important}
.app-signature::after,.user-signature::after,.signature::after{display:none!important;content:none!important}
.app-signature,.user-signature,.signature{border-bottom:0!important;box-shadow:none!important;background:transparent!important}
.month-label,.month-title{text-transform:none!important}
.section-grid,.metrics,.invoice-summary{gap:12px!important}
.card{padding:18px!important;margin-bottom:14px!important}
@media(max-width:700px){
 .card{padding:14px!important;border-radius:16px!important}
 .metrics,.section-grid{grid-template-columns:1fr!important}
 .quick{grid-template-columns:repeat(2,minmax(0,1fr))!important}
 .topbar{gap:10px!important}
}

/* ===== Ajustes de legibilidade e proporção ===== */

/* Tema claro: textos mais definidos */
html[data-theme="light"],
:root{
  --text:#0a1d34;
  --muted:#46566b;
  --line:#d5dee9;
}
html[data-theme="light"] body,
html[data-theme="light"] .card,
html[data-theme="light"] .panel,
html[data-theme="light"] .metric,
html[data-theme="light"] .invoice-box,
html[data-theme="light"] .install-card,
html[data-theme="light"] .modal-content{
  color:#0a1d34!important;
}
html[data-theme="light"] h1,
html[data-theme="light"] h2,
html[data-theme="light"] h3,
html[data-theme="light"] h4,
html[data-theme="light"] label,
html[data-theme="light"] strong,
html[data-theme="light"] .value,
html[data-theme="light"] .amount,
html[data-theme="light"] button,
html[data-theme="light"] td{
  color:#0a1d34!important;
}
html[data-theme="light"] p,
html[data-theme="light"] small,
html[data-theme="light"] .subtle,
html[data-theme="light"] .meta,
html[data-theme="light"] .fieldhint,
html[data-theme="light"] th{
  color:#46566b!important;
}

/* Tema escuro: textos mais claros e luminosos */
html[data-theme="dark"]{
  --text:#ffffff;
  --muted:#d8e2ee;
  --line:#365270;
}
html[data-theme="dark"] body,
html[data-theme="dark"] .card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .invoice-box,
html[data-theme="dark"] .install-card,
html[data-theme="dark"] .modal-content{
  color:#ffffff!important;
}
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] label,
html[data-theme="dark"] strong,
html[data-theme="dark"] .value,
html[data-theme="dark"] .amount,
html[data-theme="dark"] button,
html[data-theme="dark"] td{
  color:#ffffff!important;
}
html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] .subtle,
html[data-theme="dark"] .meta,
html[data-theme="dark"] .fieldhint,
html[data-theme="dark"] th{
  color:#d8e2ee!important;
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  color:#ffffff!important;
  background:#102b49!important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{
  color:#c8d5e4!important;
}

/* Retângulo superior "Minhas Finanças" na mesma proporção visual dos demais cartões */
.topbar,
.header-card,
.top-brand-card{
  min-height:unset!important;
}
.topbar{
  border-radius:18px!important;
  padding:16px 18px!important;
  margin-bottom:14px!important;
  box-sizing:border-box!important;
}
.top-brand{
  min-height:64px!important;
  align-items:center!important;
}
.top-app-icon{
  width:42px!important;
  height:42px!important;
  border-radius:12px!important;
}
.top-brand h1{
  margin:0!important;
  font-size:22px!important;
  line-height:1.15!important;
}
.top-brand p{
  margin:3px 0 0!important;
  font-size:13px!important;
}

/* Remove qualquer espaço residual do indicador de sincronização */
.syncstate,
#syncState{
  display:none!important;
  margin:0!important;
  padding:0!important;
  height:0!important;
  min-height:0!important;
}

/* ===== Correção de contraste e largura v9 ===== */

/* Cabeçalho superior com exatamente a largura útil dos demais cartões */
.topbar{
  width:100%!important;
  max-width:none!important;
  box-sizing:border-box!important;
  margin-left:0!important;
  margin-right:0!important;
  align-self:stretch!important;
}
main,.main,.content,.app-content{
  box-sizing:border-box!important;
}

/* Nome Minhas Finanças sempre legível */
.top-brand h1,
.topbar h1,
.brand h1,
.brand-title{
  opacity:1!important;
  visibility:visible!important;
  -webkit-text-fill-color:currentColor!important;
  text-shadow:none!important;
}
html[data-theme="light"] .top-brand h1,
html[data-theme="light"] .topbar h1,
html[data-theme="light"] .brand h1,
html[data-theme="light"] .brand-title{
  color:#082b52!important;
  -webkit-text-fill-color:#082b52!important;
}
html[data-theme="dark"] .top-brand h1,
html[data-theme="dark"] .topbar h1,
html[data-theme="dark"] .brand h1,
html[data-theme="dark"] .brand-title{
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
}

/* Login: título e botão Entrar com contraste independente do tema */
.login-card h1,
.login-card h2,
.auth-card h1,
.auth-card h2{
  opacity:1!important;
  visibility:visible!important;
}
button.primary,
.primary,
#loginBtn,
button[type="submit"]{
  opacity:1!important;
  visibility:visible!important;
  background:#c99728!important;
  color:#07182c!important;
  -webkit-text-fill-color:#07182c!important;
  border:1px solid #d9ad45!important;
  font-weight:800!important;
  text-shadow:none!important;
}
button.primary:hover,
#loginBtn:hover,
button[type="submit"]:hover{
  background:#ddb54f!important;
  color:#06172b!important;
}
button.primary:disabled,
#loginBtn:disabled,
button[type="submit"]:disabled{
  opacity:.65!important;
}

/* Garante contraste também em botões dentro do modo escuro */
html[data-theme="dark"] button.primary,
html[data-theme="dark"] #loginBtn,
html[data-theme="dark"] button[type="submit"]{
  background:#f0c45d!important;
  color:#07182c!important;
  -webkit-text-fill-color:#07182c!important;
}

/* Mobile: mesma largura visual dos cartões */
@media(max-width:700px){
  .topbar{
    width:100%!important;
    margin-left:0!important;
    margin-right:0!important;
    padding:14px!important;
  }
}

/* ===== CONTRASTE TOTAL v10 ===== */

/* CLARO: todo texto-base escuro */
html[data-theme="light"] body,
html[data-theme="light"] body *{
  color:#07182c!important;
  -webkit-text-fill-color:#07182c!important;
}
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder{
  color:#526176!important;
  -webkit-text-fill-color:#526176!important;
  opacity:1!important;
}

/* ESCURO: todo texto-base claro */
html[data-theme="dark"] body,
html[data-theme="dark"] body *{
  color:#f8fbff!important;
  -webkit-text-fill-color:#f8fbff!important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder{
  color:#d4dfeb!important;
  -webkit-text-fill-color:#d4dfeb!important;
  opacity:1!important;
}

/* Campos coerentes com cada tema */
html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea{
  background:#ffffff!important;
  color:#07182c!important;
  -webkit-text-fill-color:#07182c!important;
  border-color:#cfd9e5!important;
}
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea{
  background:#102b49!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
  border-color:#365675!important;
}
html[data-theme="dark"] select option{
  background:#102b49!important;
  color:#ffffff!important;
}

/* Botões dourados: texto escuro para contraste real nos dois temas */
html[data-theme="light"] .primary,
html[data-theme="light"] button.primary,
html[data-theme="light"] #loginBtn,
html[data-theme="light"] button[type="submit"],
html[data-theme="dark"] .primary,
html[data-theme="dark"] button.primary,
html[data-theme="dark"] #loginBtn,
html[data-theme="dark"] button[type="submit"]{
  background:#efc45c!important;
  color:#07182c!important;
  -webkit-text-fill-color:#07182c!important;
  font-weight:800!important;
}

/* Botões secundários acompanham o tema */
html[data-theme="light"] .secondary,
html[data-theme="light"] .theme-btn{
  background:#f5f8fc!important;
  color:#07182c!important;
  -webkit-text-fill-color:#07182c!important;
}
html[data-theme="dark"] .secondary,
html[data-theme="dark"] .theme-btn{
  background:#173654!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
}

/* Estados semânticos continuam legíveis */
html[data-theme="light"] .danger,
html[data-theme="light"] .overdue{color:#9e2632!important;-webkit-text-fill-color:#9e2632!important}
html[data-theme="light"] .success,
html[data-theme="light"] .paid{color:#0b694d!important;-webkit-text-fill-color:#0b694d!important}
html[data-theme="dark"] .danger,
html[data-theme="dark"] .overdue{color:#ffabb1!important;-webkit-text-fill-color:#ffabb1!important}
html[data-theme="dark"] .success,
html[data-theme="dark"] .paid{color:#83e4bf!important;-webkit-text-fill-color:#83e4bf!important}

/* SVG/ícones que usam currentColor também acompanham o tema */
html[data-theme="light"] svg{color:#07182c}
html[data-theme="dark"] svg{color:#f8fbff}

/* Links */
html[data-theme="light"] a{color:#082b52!important;-webkit-text-fill-color:#082b52!important}
html[data-theme="dark"] a{color:#ffffff!important;-webkit-text-fill-color:#ffffff!important}

/* ===== Topo claro reforçado v11 ===== */

/* No tema claro, o topo ganha fundo azul-marinho para fazer o texto sobressair */
html[data-theme="light"] .topbar{
  background:#082b52!important;
  border:1px solid #123f70!important;
  box-shadow:0 10px 28px rgba(8,43,82,.16)!important;
}

/* Todo conteúdo textual do topo fica claro e nítido */
html[data-theme="light"] .topbar,
html[data-theme="light"] .topbar *,
html[data-theme="light"] .top-brand,
html[data-theme="light"] .top-brand *{
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
  opacity:1!important;
}

/* Subtexto do cabeçalho um pouco mais suave, sem perder contraste */
html[data-theme="light"] .topbar p,
html[data-theme="light"] .topbar small,
html[data-theme="light"] .topbar .subtle,
html[data-theme="light"] .topbar .meta{
  color:#dce7f3!important;
  -webkit-text-fill-color:#dce7f3!important;
}

/* Ícone do topo destacado */
html[data-theme="light"] .top-app-icon{
  background:#ffffff!important;
  border:1px solid rgba(255,255,255,.35)!important;
  box-shadow:0 4px 14px rgba(0,0,0,.14)!important;
}

/* Se houver botões/controles no topo, manter legibilidade */
html[data-theme="light"] .topbar button,
html[data-theme="light"] .topbar .secondary,
html[data-theme="light"] .topbar .theme-btn{
  background:#ffffff!important;
  color:#082b52!important;
  -webkit-text-fill-color:#082b52!important;
  border-color:#d9e3ee!important;
  font-weight:700!important;
}

/* ===== Título Minhas Finanças dourado v12 ===== */
html[data-theme="light"] .top-brand h1,
html[data-theme="light"] .topbar h1,
html[data-theme="dark"] .top-brand h1,
html[data-theme="dark"] .topbar h1{
  color:#f0c45d!important;
  -webkit-text-fill-color:#f0c45d!important;
  opacity:1!important;
  font-weight:800!important;
}

/* ===== Tema discreto + cabeçalho unificado v13 ===== */
#themeBtn,.theme-btn:not(#mfThemeToggle),.theme-modal,.theme-dialog,[data-theme-dialog]{
  display:none!important;
}

/* Cabeçalho: mesma cor nos dois temas */
html[data-theme="light"] .topbar,
html[data-theme="dark"] .topbar{
  background:#082b52!important;
  border:1px solid #173f69!important;
  box-shadow:0 10px 28px rgba(0,0,0,.14)!important;
}
html[data-theme="light"] .topbar p,
html[data-theme="dark"] .topbar p,
html[data-theme="light"] .topbar small,
html[data-theme="dark"] .topbar small{
  color:#e4edf7!important;
  -webkit-text-fill-color:#e4edf7!important;
}
html[data-theme="light"] .top-brand h1,
html[data-theme="dark"] .top-brand h1{
  color:#f0c45d!important;
  -webkit-text-fill-color:#f0c45d!important;
}

/* Alternância discreta: apenas sol/lua */
#mfThemeToggle{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:34px!important;
  height:34px!important;
  min-width:34px!important;
  padding:0!important;
  margin-left:auto!important;
  border:1px solid rgba(255,255,255,.18)!important;
  border-radius:50%!important;
  background:rgba(255,255,255,.08)!important;
  color:#f0c45d!important;
  -webkit-text-fill-color:#f0c45d!important;
  font-size:17px!important;
  line-height:1!important;
  box-shadow:none!important;
  cursor:pointer!important;
}
#mfThemeToggle:hover{background:rgba(255,255,255,.14)!important}
.topbar{position:relative!important}
#mfThemeToggle{position:absolute!important;right:16px!important;top:16px!important}

/* Sair reacendido nos dois temas */
#logoutBtn,.logout-btn,[data-action="logout"],button.logout{
  opacity:1!important;
  font-weight:800!important;
  border:1px solid #f0c45d!important;
  background:#f0c45d!important;
  color:#07182c!important;
  -webkit-text-fill-color:#07182c!important;
  box-shadow:0 4px 12px rgba(240,196,93,.18)!important;
}
#logoutBtn:hover,.logout-btn:hover,[data-action="logout"]:hover,button.logout:hover{
  background:#ffd878!important;
}

/* Três acessos rápidos sempre na mesma linha no smartphone */
@media(max-width:700px){
  .quick{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:7px!important;
  }
  .quick button{
    min-width:0!important;
    min-height:78px!important;
    padding:9px 5px!important;
    border-radius:13px!important;
    font-size:11px!important;
    line-height:1.15!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  .quick button svg,.quick button .icon{
    width:19px!important;
    height:19px!important;
  }
}
