/* PrimeFin · direção: exato, sóbrio, confiável — livro-caixa e extrato.
   Neutros grafite, um destaque (azul da marca PrimeCloud), números em mono tabular.
   Redesenho seguindo o método unslop, de Damir Sokolovsky (@heydamir), CC BY 4.0. */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(/fonts/plex-sans-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(/fonts/plex-sans-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(/fonts/plex-sans-600.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url(/fonts/plex-mono-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(/fonts/plex-mono-500.woff2) format("woff2"); }

:root {
  /* rampa neutra grafite */
  --bg: #f5f5f4; --surface: #ffffff; --surface-2: #fafaf9; --hover: #f1f1f0; --sel: #ececea;
  --line: rgba(23, 25, 28, .09); --line-2: rgba(23, 25, 28, .06); --line-forte: rgba(23, 25, 28, .16);
  --text: #17191c; --text-2: #5c6067; --text-3: #8a8e95;
  /* destaque único: azul da marca */
  --acc: #1d6aa5; --acc-d: #17578a; --acc-bg: #eaf1f8;
  /* semânticas, contidas */
  --good: #2f7a4b; --bad: #b3372f; --warn: #8a5a12; --warn-bg: #f8f3e8;
  --navy: #0d173a;
  --r-ctl: 8px; --r: 12px; --shadow: 0 1px 2px rgba(23, 25, 28, .04);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --ease: cubic-bezier(.2, .6, .2, 1);
  /* compatibilidade com nomes antigos */
  --teal: var(--acc); --teal-d: var(--acc-d); --info-bg: var(--acc-bg); --good-bg: #edf5f0; --bad-bg: #f9eceb;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--sans); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--acc-d); text-decoration: none; } a:hover { text-decoration: underline; }
.num, td.num, th.num { text-align: right; font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num-l { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
svg.i { display: block; flex: none; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* layout */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--surface-2); border-right: 1px solid var(--line); color: var(--text-2); padding: 20px 12px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.side .logo { display: flex; align-items: center; gap: 12px; padding: 0 8px 20px; }
.side .logo img { height: 36px; border-radius: 6px; }
.side .logo small { display: block; color: var(--text-3); font-size: 13px; font-weight: 500; }
.side nav a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px; border-radius: var(--r-ctl); color: var(--text-2); font-size: 13.5px; margin-bottom: 2px; transition: background-color .15s var(--ease), color .15s var(--ease); }
.side nav a:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.side nav a.ativo { background: var(--sel); color: var(--text); font-weight: 500; box-shadow: inset 0 0 0 1px var(--line-2); }
.side nav a.ativo .ic { color: var(--acc); }
.side nav .sec { font-size: 12px; color: var(--text-3); padding: 20px 8px 8px; font-weight: 500; }
.side nav .sec:first-child { padding-top: 4px; }
.side .ic { width: 16px; display: flex; justify-content: center; color: var(--text-3); }
.side .user { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--text); }
.side .user span { color: var(--text-3) !important; }
.side .user button { background: none; border: 0; color: var(--acc-d); padding: 0; cursor: pointer; font: inherit; }
main { padding: 24px 32px 64px; min-width: 0; max-width: 1600px; }
.topo { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.topo h1 { font-size: 22px; margin: 0; font-weight: 500; letter-spacing: -.01em; }
.topo .eyebrow { font-size: 13px; color: var(--text-3); font-weight: 400; margin-bottom: 2px; }
.topo .acoes { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.menu-btn, .btn.menu-btn { display: none; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card h3 { margin: 0 0 16px; font-size: 14px; font-weight: 500; display: flex; align-items: baseline; gap: 8px; }
.card h3 .sub { font-weight: 400; color: var(--text-3); font-size: 12.5px; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card-h h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.principal { grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr); }
.mb { margin-bottom: 16px; }
.kpi { padding: 16px 20px; }
.kpi .rot { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.kpi .val { font-size: 24px; font-weight: 500; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi .det { font-size: 12.5px; color: var(--text-3); margin-top: 4px; }
.kpi.destaque { border-color: rgba(29, 106, 165, .28); box-shadow: inset 3px 0 0 var(--acc); }
.kpi.destaque .val { color: var(--acc-d); }
.up { color: var(--good); } .down { color: var(--bad); }
.pos { color: var(--good); } .neg { color: var(--bad); }

/* resumo do mês */
.mes-card h3 { font-size: 15px; margin-bottom: 8px; }
.st { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.st:first-of-type { border-top: 0; }
.st-r { font-size: 13px; color: var(--text-2); }
.st-v { font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.st-d { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* lista com barras finas */
.barras { display: flex; flex-direction: column; gap: 12px; }
.br { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 4px; font-size: 13px; }
.br-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.br i { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--acc); opacity: .75; }
.br:first-child i { opacity: 1; }

/* tabelas */
.tabela-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); position: sticky; top: 0; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:hover td { background: var(--surface-2); }
table.t tfoot td { font-weight: 500; border-top: 1px solid var(--line); background: var(--surface-2); }
table.t .acoes-l { white-space: nowrap; text-align: right; }
table.t .acoes-l .btn.ico { display: inline-flex; }
table.t .muted { color: var(--text-3); font-size: 12px; }
.vazio { text-align: center; color: var(--text-3); padding: 28px; font-size: 13px; }

/* status: ponto + texto (assinatura do extrato) */
.b { display: inline-flex; align-items: center; gap: 6px; padding: 0; border-radius: 0; background: none; font-size: 12.5px; font-weight: 400; color: var(--text-2); white-space: nowrap; vertical-align: middle; }
.b::before { content: ""; width: 6px; height: 6px; border-radius: 3px; background: var(--text-3); flex: none; }
.b.pago::before { background: var(--good); }
.b.aberto::before { background: var(--acc); }
.b.atrasado { color: var(--bad); } .b.atrasado::before { background: var(--bad); }
.b.cancelado { color: var(--text-3); } .b.cancelado::before { background: var(--line-forte); }
.b.cinza::before, .b.amber::before { display: none; }
.b.cinza { color: var(--text-3); }
.b.amber { color: var(--warn); }
.b svg.i { display: inline-block; }

/* botões e formulários */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; border: 1px solid var(--line-forte); background: var(--surface); color: var(--text); padding: 0 12px; border-radius: var(--r-ctl); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background-color .15s var(--ease), border-color .15s var(--ease); }
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn.p { background: var(--acc); border-color: var(--acc); color: #fff; } .btn.p:hover { background: var(--acc-d); border-color: var(--acc-d); }
.btn.ok { background: var(--good); border-color: var(--good); color: #fff; }
.btn.perigo { color: var(--bad); }
.btn.sm { height: 28px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn.ico { height: 28px; width: 28px; padding: 0; justify-content: center; border-color: transparent; background: transparent; color: var(--text-3); border-radius: 6px; }
.btn.ico:hover { background: var(--hover); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; font-size: 13.5px; padding: 0 10px; height: 34px; border: 1px solid var(--line-forte); border-radius: var(--r-ctl); background: var(--surface); color: var(--text); width: 100%; }
textarea { height: auto; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(29, 106, 165, .2); border-color: var(--acc); }
input[type=checkbox] { width: auto; height: auto; accent-color: var(--acc); }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filtros > * { width: auto; }
.filtros input[type=search] { min-width: 220px; }
.form { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.form label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; font-weight: 400; }
.form .f { grid-column: span 6; } .form .f.c3 { grid-column: span 3; } .form .f.c4 { grid-column: span 4; } .form .f.c2 { grid-column: span 2; }
.form .f.c8 { grid-column: span 8; } .form .f.c12 { grid-column: span 12; } .form .f.c9 { grid-column: span 9; }
.form .sep { grid-column: span 12; font-size: 13px; color: var(--text); font-weight: 500; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.form .ajuda { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.inline { display: flex; gap: 8px; align-items: center; }
.chk { display: flex !important; align-items: center; gap: 8px; font-size: 13px !important; color: var(--text) !important; margin-top: 24px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 8px 12px; font: inherit; font-size: 13.5px; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s var(--ease); }
.tabs button:hover { color: var(--text); }
.tabs button.ativo { color: var(--text); border-bottom-color: var(--acc); font-weight: 500; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(23, 25, 28, .32); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 760px; box-shadow: 0 12px 32px rgba(23, 25, 28, .14); animation: entra .18s var(--ease); }
.modal.sm { max-width: 460px; } .modal.lg { max-width: 1000px; }
.modal header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal header h2 { margin: 0; font-size: 16px; font-weight: 500; }
.modal header .x { margin-left: auto; }
.modal .corpo { padding: 20px; }
.modal footer { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--text); color: #fff; padding: 12px 16px; border-radius: 10px; z-index: 99; box-shadow: 0 8px 24px rgba(23, 25, 28, .18); max-width: 420px; font-size: 13.5px; animation: entra .18s var(--ease); }
.toast.erro { background: var(--bad); }
@keyframes entra { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* planilha mensal */
.bloco-tit { display: flex; align-items: baseline; justify-content: space-between; margin: 0 0 8px; }
.bloco-tit h4 { margin: 0; font-size: 14px; font-weight: 500; color: var(--text); }
.resultado { display: flex; justify-content: space-between; padding: 12px; border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--line-2); font-weight: 500; margin-top: 12px; font-variant-numeric: tabular-nums; }
.linha-fech { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.linha-fech:last-child { border-bottom: 0; }
.linha-fech.forte { font-weight: 500; font-size: 15px; }
.chart-box { position: relative; height: 260px; }
.chart-box.alto { height: 340px; }
.chart-box.baixo { height: 180px; }
.legenda { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; }
.card-h .legenda { margin: 0; }
.legenda i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.conta-card { display: flex; flex-direction: column; gap: 4px; }
.conta-card .tipo { font-size: 12.5px; color: var(--text-3); }
.alerta { padding: 12px 16px; border-radius: var(--r-ctl); background: var(--warn-bg); color: var(--warn); margin-bottom: 16px; font-size: 13px; border: 1px solid rgba(138, 90, 18, .14); }
.alerta.info { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.lista-fat button { display: flex; width: 100%; justify-content: space-between; background: none; border: 1px solid transparent; padding: 8px 12px; border-radius: var(--r-ctl); cursor: pointer; font: inherit; text-align: left; font-variant-numeric: tabular-nums; }
.lista-fat button:hover { background: var(--surface-2); }
.lista-fat button.ativo { background: var(--sel); border-color: var(--line-2); }

/* login */
.login-bg { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 24px; }
.login { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 4px 16px rgba(23, 25, 28, .06); }
.login .lg { margin-bottom: 24px; }
.login .lg img { height: 40px !important; border-radius: 6px; display: block; }
.login h2 { margin: 0 0 4px; font-size: 20px; font-weight: 500; } .login p { margin: 0 0 20px; color: var(--text-2); font-size: 13.5px; }
.login .campo { margin-bottom: 12px; } .login label { font-size: 12.5px; color: var(--text-2); display: block; margin-bottom: 4px; }
.login .btn.p { height: 38px; margin-top: 4px; }

@media (max-width: 1280px) { .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .principal { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; width: 260px; transform: translateX(-100%); transition: transform .2s var(--ease); box-shadow: 0 8px 24px rgba(23, 25, 28, .12); }
  .side.aberta { transform: none; }
  .btn.menu-btn { display: inline-flex; width: 34px; padding: 0; justify-content: center; }
  main { padding: 16px; }
  .g2, .g3 { grid-template-columns: 1fr; } .g6, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form .f, .form .f.c3, .form .f.c4, .form .f.c2, .form .f.c8, .form .f.c9 { grid-column: span 12; }
}
.topo .acoes input, .topo .acoes select { width: auto; }
@media (max-width: 520px) { .kpi .val { font-size: 19px; } .g6, .g4 { grid-template-columns: 1fr 1fr; gap: 12px; } }

/* aviso da demonstração */
.demo-aviso { display: flex; flex-direction: column; gap: 2px; padding: 12px; margin: 0 0 16px; border-radius: var(--r-ctl); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.demo-aviso span:first-child { color: var(--text); font-weight: 500; }
