:root {
  --bg: #f3f6fa; --panel: #ffffff; --panel2: #f7f9fc; --line: #dfe5ee; --text: #1b2533; --muted: #66748a;
  --brand: #1683d2; --brand2: #2bb4ea; --brand-ink: #0b4f86; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --side: #0f2a44; --side-text: #cfe2f5; --radius: 10px; --shadow: 0 1px 3px rgba(16,40,70,.08), 0 6px 18px rgba(16,40,70,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0e1622; --panel: #152131; --panel2: #1a283b; --line: #26364c; --text: #e4ecf6; --muted: #91a2b8;
    --brand: #3aa0ea; --brand-ink: #9fd3fb; --side: #0a1320; --side-text: #b9cde3; --shadow: none; }
}
:root[data-theme="dark"] { --bg: #0e1622; --panel: #152131; --panel2: #1a283b; --line: #26364c; --text: #e4ecf6; --muted: #91a2b8;
  --brand: #3aa0ea; --brand-ink: #9fd3fb; --side: #0a1320; --side-text: #b9cde3; --shadow: none; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .center { text-align: center; } .spacer { flex: 1; }
.err { color: var(--bad); min-height: 18px; } .ok { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.pro { background: var(--brand2); color: #fff; font-weight: 800; font-size: 11px; padding: 2px 6px; border-radius: 6px; letter-spacing: .5px; vertical-align: 2px; }
a { color: var(--brand); }

/* login */
#login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, #0f2a44, #1683d2); }
.login-card { width: min(380px, 100%); background: var(--panel); border-radius: 16px; padding: 26px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.brand-big { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.brand-big img { width: 58px; height: 58px; } .brand-big b { font-size: 26px; } .brand-big small { display: block; color: var(--muted); }
.note { background: var(--panel2); border: 1px solid var(--line); padding: 8px 10px; border-radius: 8px; }

/* layout */
#app { display: flex; min-height: 100%; }
#side { width: 236px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; color: #fff; font-size: 19px; }
.brand img { width: 36px; height: 36px; }
#nav { flex: 1; overflow: auto; padding: 4px 8px; }
#nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--side-text); text-decoration: none; cursor: pointer; margin: 1px 0; }
#nav a:hover { background: rgba(255,255,255,.07); } #nav a.active { background: var(--brand); color: #fff; }
.navh { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; opacity: .55; padding: 12px 10px 4px; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.side-foot #who { width: 100%; color: #fff; font-weight: 600; }
.side-foot .btn.ghost { color: var(--side-text); border-color: rgba(255,255,255,.18); }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 10px; padding: 14px 22px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 19px; margin: 0; }
#btnMenu { display: none; }
#view { padding: 20px 22px 40px; }
@media (max-width: 860px) {
  #side { position: fixed; left: -250px; z-index: 30; transition: left .2s; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  body.menu #side { left: 0; }
  #btnMenu { display: inline-flex; }
  #view { padding: 14px 16px 40px; }
  .top { padding: 10px 16px; }
}

/* componentes */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 8px 14px;
  border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--brand); } .btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); } .btn.sm { padding: 4px 9px; font-size: 13px; } .btn.wide { width: 100%; justify-content: center; margin-top: 12px; }
.btn.ghost { background: transparent; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; font-weight: 500; }
.chk { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; } .chk input { width: auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card h3 { margin: 0 0 10px; font-size: 15px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.kpi { padding: 14px 16px; } .kpi .v { font-size: 22px; font-weight: 700; margin-top: 4px; } .kpi .l { color: var(--muted); font-size: 12.5px; }
.cols2 { grid-template-columns: 1fr 1fr; } @media (max-width: 1000px) { .cols2 { grid-template-columns: 1fr; } }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 14px; }
.form .full { grid-column: 1 / -1; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.bar input[type=search] { max-width: 280px; } .bar select { width: auto; }
.tblw { overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: var(--panel2); position: sticky; top: 0; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--panel2); } tr.click { cursor: pointer; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.tag.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 9%, transparent); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.tag.info { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, transparent); background: color-mix(in srgb, var(--brand) 9%, transparent); }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { border: 1px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 14px; cursor: pointer; font: inherit; color: var(--text); }
.tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.sum { display: flex; gap: 18px; flex-wrap: wrap; margin: 10px 2px; color: var(--muted); } .sum b { color: var(--text); }
.alert { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel2); margin-bottom: 12px; }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 8%, transparent); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, 96vw); background: var(--panel); color: var(--text); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(10,20,35,.5); }
.dlg-head { display: flex; align-items: center; padding: 16px 20px 6px; } .dlg-head h2 { margin: 0; font-size: 18px; flex: 1; }
.x { border: 0; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }
#dlgBody { padding: 4px 20px 10px; max-height: 70vh; overflow: auto; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
#toast { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
#toast div { background: #12324f; color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 420px; }
#toast div.e { background: var(--bad); }

/* preenchimento automático do navegador sem fundo claro no tema escuro */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus { -webkit-text-fill-color: var(--text); -webkit-box-shadow: 0 0 0 1000px var(--panel) inset; transition: background-color 9999s; }
.horT input[type=time] { min-width: 96px; padding: 5px 6px; } .horT td { padding: 5px 6px; }

.gperm { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.ac { position: relative; } .acL { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-height: 280px; overflow: auto; }
.acL div { padding: 7px 10px; cursor: pointer; font-size: 13.5px; } .acL div:hover, .acL div.on { background: color-mix(in srgb, var(--brand) 18%, transparent); }
#rubT td { vertical-align: top; } #rubT input[type=month] { width: 138px; min-width: 0; } #rubT td:first-child { min-width: 260px; } #rubT input, #rubT select { padding: 6px 8px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; } .thumbs figure { margin: 0; } .thumbs img { width: 100%; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.thumbs figcaption { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.tl { margin-top: 10px; } .tli { display: grid; grid-template-columns: 82px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); } .tld { font-size: 12px; color: var(--text); }

/* ---- dashboards (2.3) */
.dbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dsel-w { position: relative; }
.dsel { appearance: none; -webkit-appearance: none; font-size: 17px; font-weight: 700; padding: 9px 40px 9px 14px; border-radius: 10px; min-width: 280px; cursor: pointer;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2366748a' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center; }
.dsel:disabled { opacity: 1; cursor: default; background-image: none; padding-right: 14px; }
.dper { margin: 0; } .dper button { padding: 5px 12px; font-size: 13px; }
.dload { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 30px 4px; }
.spin { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: sp .8s linear infinite; } @keyframes sp { to { transform: rotate(360deg); } }
.dks { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); margin-bottom: 14px; }
.dk { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 13px; position: relative; overflow: hidden; min-width: 0; }
.dk::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.dk.ok::before { background: #0ca30c; } .dk.warn::before { background: #fab219; } .dk.bad::before { background: #d03b3b; }
.dk-l { color: var(--muted); font-size: 12.5px; font-weight: 500; } .dk-v { font-size: 24px; font-weight: 750; margin-top: 4px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-s { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgrid { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-flow: row dense; }
.dc { min-width: 0; display: flex; flex-direction: column; } .dc.w2 { grid-column: span 2; } .dc.w3 { grid-column: 1 / -1; }
@media (max-width: 1250px) { .dgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .dc.w2 { grid-column: 1 / -1; } }
@media (max-width: 760px) { .dgrid { grid-template-columns: minmax(0, 1fr); } .dsel { min-width: 0; width: 100%; font-size: 15px; } .dsel-w { flex: 1 1 100%; } }
.dc-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; } .dc-h h3 { margin: 0; font-size: 14px; font-weight: 650; flex: 1; min-width: 0; }
.dc-t { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dc-c { position: relative; width: 100%; } .dc-n { color: var(--muted); font-size: 12px; margin-top: 8px; }
.dc-vazio { flex: 1; min-height: 160px; display: grid; place-items: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }
.dnut { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; } .dnut-c { position: relative; width: 170px; height: 170px; flex: 0 0 170px; margin: auto; }
.dleg { flex: 1 1 160px; min-width: 0; display: grid; gap: 6px; font-size: 12.5px; }
.dl-r { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 38px; gap: 8px; align-items: center; } .dl-r i { width: 10px; height: 10px; border-radius: 3px; }
.dl-r .dl-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .dl-r b { font-variant-numeric: tabular-nums; } .dl-r .muted { text-align: right; }
.funil { display: grid; gap: 12px; padding-top: 6px; } .fu-r { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 13px; }
.fu-b { background: var(--panel2); border-radius: 6px; height: 26px; overflow: hidden; } .fu-b div { height: 100%; border-radius: 6px; }
.dk-v.lg { font-size: 19.5px; letter-spacing: -.4px; padding-top: 3px; }
/* orçamento: recorrente × avulso (2.3.1) */
.form .full2 { grid-column: span 2; } @media (max-width: 560px) { .form .full2 { grid-column: 1 / -1; } }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; } @media (max-width: 600px) { .seg { grid-template-columns: 1fr; } }
.seg label { margin: 0; display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--panel); color: var(--text); font-size: 13.5px; }
.seg label span { color: var(--muted); font-size: 12px; font-weight: 400; } .seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--panel)); box-shadow: inset 0 0 0 1px var(--brand); }
.seg label:focus-within { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); }
.req { color: var(--bad); font-weight: 700; }
.obg { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 14px; margin-top: 10px; }
