/* MP Emprestimo — estilos
   Paleta fria de mesa de operação; o único elemento "expressivo" é o
   comprovante térmico do cálculo ao vivo (.recibo). */

:root {
  --papel: #f4f6f8;
  --superficie: #ffffff;
  --tinta: #1c2530;
  --tinta-2: #4a5867;
  --tinta-3: #7b8896;
  --linha: #d9dfe5;
  --linha-forte: #b9c3cc;
  --dinheiro: #0f6e5a;
  --dinheiro-claro: #e3f1ed;
  --aviso: #a86a0b;
  --aviso-claro: #fbf1df;
  --erro: #b42318;
  --erro-claro: #fbe9e7;
  --termica: #fbfaf6;
  --termica-tinta: #2b2b2b;
  --foco: #2f6fdf;
  --raio: 6px;
  --sombra: 0 1px 2px rgba(28, 37, 48, .06), 0 2px 8px rgba(28, 37, 48, .05);
  --fonte: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fonte-recibo: "Courier Prime", "Courier New", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --papel: #12171d; --superficie: #1a2129; --tinta: #e6ebf0; --tinta-2: #b3bec9; --tinta-3: #85929f;
    --linha: #2b3540; --linha-forte: #3d4a57; --dinheiro: #3fb593; --dinheiro-claro: #16302a;
    --aviso: #e0a446; --aviso-claro: #33280f; --erro: #f07468; --erro-claro: #3a1d1a;
    --termica: #23262a; --termica-tinta: #ecebe6; color-scheme: dark;
  }
}
:root[data-tema="escuro"] {
  --papel: #12171d; --superficie: #1a2129; --tinta: #e6ebf0; --tinta-2: #b3bec9; --tinta-3: #85929f;
  --linha: #2b3540; --linha-forte: #3d4a57; --dinheiro: #3fb593; --dinheiro-claro: #16302a;
  --aviso: #e0a446; --aviso-claro: #33280f; --erro: #f07468; --erro-claro: #3a1d1a;
  --termica: #23262a; --termica-tinta: #ecebe6; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--fonte); font-size: 15px; line-height: 1.5;
  background: var(--papel); color: var(--tinta);
  font-variant-numeric: tabular-nums;
}
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .25rem; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 .75rem; font-weight: 650; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; font-weight: 650; }
p { margin: .25rem 0 .75rem; max-width: 72ch; }
a { color: var(--dinheiro); }
small, .fraco { color: var(--tinta-3); }
.num { text-align: right; white-space: nowrap; }
.pos { color: var(--dinheiro); }
.neg { color: var(--erro); }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; }

/* ---------- estrutura ---------- */
.app { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.menu {
  background: var(--superficie); border-right: 1px solid var(--linha);
  padding: 1.25rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.marca { display: flex; align-items: center; gap: .6rem; padding: 0 .5rem 1.25rem; font-weight: 750; font-size: 1.05rem; }
.marca svg { flex: none; }
.menu a {
  display: flex; align-items: center; justify-content: space-between;
  padding: .5rem .65rem; border-radius: var(--raio); text-decoration: none; color: var(--tinta-2);
}
.menu a:hover { background: var(--papel); color: var(--tinta); }
.menu a[aria-current="page"] { background: var(--dinheiro-claro); color: var(--dinheiro); font-weight: 650; }
.menu .grupo-menu { margin: 1rem .65rem .25rem; font-size: .8rem; color: var(--tinta-3); }
.menu .rodape-menu { margin-top: auto; padding: 1rem .65rem 0; font-size: .85rem; color: var(--tinta-3); }
.menu .rodape-menu button { margin-top: .5rem; }
.contador { background: var(--aviso); color: #fff; font-size: .75rem; border-radius: 99px; padding: 0 .45rem; font-weight: 700; }
.conteudo { padding: 1.75rem 2rem 4rem; min-width: 0; }
.cabecalho { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.cabecalho p { margin: 0; color: var(--tinta-2); }

/* ---------- controles ---------- */
label { display: block; font-size: .85rem; color: var(--tinta-2); margin-bottom: .25rem; font-weight: 550; }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; padding: .55rem .65rem; background: var(--superficie);
  border: 1px solid var(--linha-forte); border-radius: var(--raio);
}
input:focus, select:focus, textarea:focus { border-color: var(--foco); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--foco) 20%, transparent); }
textarea { min-height: 9rem; font-size: .85rem; }
input.valor { text-align: right; font-weight: 600; }
.campo { margin-bottom: .85rem; }
.linha-campos { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: var(--raio); border: 1px solid var(--linha-forte);
  background: var(--superficie); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--tinta-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario { background: var(--dinheiro); border-color: var(--dinheiro); color: #fff; }
.btn.primario:hover { filter: brightness(1.08); }
.btn.perigo { color: var(--erro); }
.btn.pequeno { padding: .3rem .6rem; font-size: .85rem; }
.btn.fantasma { border-color: transparent; background: transparent; }
.acoes { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* bandeiras como botões de escolha */
.escolha { display: flex; gap: 4px; flex-wrap: wrap; }
.escolha button {
  padding: .45rem .6rem; border: 1px solid var(--linha-forte); border-radius: var(--raio);
  background: var(--superficie); cursor: pointer; font-size: .85rem; font-weight: 600; min-width: 3.4rem;
}
.escolha button[aria-pressed="true"] { background: var(--tinta); color: var(--superficie); border-color: var(--tinta); }

/* ---------- painéis e tabelas ---------- */
.painel { background: var(--superficie); border: 1px solid var(--linha); border-radius: 8px; padding: 1.1rem 1.25rem; }
.painel + .painel { margin-top: 1rem; }
.filtros { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; margin-bottom: 1rem; }

.tabela-rolagem { overflow-x: auto; border: 1px solid var(--linha); border-radius: 8px; background: var(--superficie); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: .5rem .7rem; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: top; }
th { font-weight: 600; color: var(--tinta-2); background: var(--papel); position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover { background: color-mix(in srgb, var(--papel) 70%, transparent); }
tfoot td { font-weight: 700; background: var(--papel); border-bottom: 0; }
tr.estornado td { color: var(--tinta-3); text-decoration: line-through; }
td .acoes { flex-wrap: nowrap; }
.vazio { padding: 2.5rem 1rem; text-align: center; color: var(--tinta-2); }

.selo { display: inline-block; font-size: .75rem; font-weight: 650; padding: .05rem .45rem; border-radius: 4px; }
.selo.lancado { background: var(--dinheiro-claro); color: var(--dinheiro); }
.selo.rascunho { background: var(--aviso-claro); color: var(--aviso); }
.selo.estornado, .selo.rejeitado { background: var(--erro-claro); color: var(--erro); }
.selo.fechado { background: var(--tinta); color: var(--superficie); }

.barra { height: 6px; background: var(--dinheiro); border-radius: 3px; min-width: 2px; }

.mensagens { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .35rem; }
.mensagens li { padding: .45rem .65rem; border-radius: var(--raio); font-size: .88rem; }
.mensagens .erro { background: var(--erro-claro); color: var(--erro); }
.mensagens .aviso { background: var(--aviso-claro); color: var(--aviso); }

/* ---------- tela de lançamento ---------- */
.lancar { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; align-items: start; }
.lancar > * { min-width: 0; }
.comprovante-form { border: 1px dashed var(--linha-forte); border-radius: 8px; padding: .9rem 1rem .4rem; margin-bottom: .75rem; position: relative; }
.comprovante-form .titulo-comp { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; font-weight: 650; }
.grade-comp { display: grid; gap: .75rem; grid-template-columns: 1.8fr 1.1fr 1fr 1.1fr; }
.grade-comp .full { grid-column: 1 / -1; }
.sugestoes { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .35rem; }

/* O comprovante térmico */
.recibo {
  position: sticky; top: 1rem;
  background: var(--termica); color: var(--termica-tinta);
  font-family: var(--fonte-recibo); font-size: .9rem; line-height: 1.45;
  padding: 1.4rem 1.25rem 1.6rem; box-shadow: var(--sombra);
  margin-bottom: 10px;
}
/* borda serrilhada de papel destacado */
.recibo::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 9px;
  background:
    linear-gradient(-45deg, transparent 6px, var(--termica) 0) 0 0 / 12px 9px repeat-x,
    linear-gradient(45deg, transparent 6px, var(--termica) 0) 0 0 / 12px 9px repeat-x;
}
.recibo .topo { text-align: center; padding-bottom: .6rem; border-bottom: 1px dashed currentColor; margin-bottom: .6rem; }
.recibo .topo strong { display: block; font-size: 1rem; }
.recibo .l { display: flex; justify-content: space-between; gap: .75rem; }
.recibo .l span:last-child { text-align: right; }
.recibo .sep { border-top: 1px dashed currentColor; margin: .6rem 0; opacity: .6; }
.recibo .total { font-size: 1.15rem; font-weight: 700; }
.recibo .total.pos { color: var(--dinheiro); }
.recibo .total.neg { color: var(--erro); }
.recibo .apagado { opacity: .55; }
.recibo .mensagens { font-family: var(--fonte); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login .painel { width: min(380px, 100%); padding: 2rem; }
.login .marca { padding: 0 0 1.25rem; justify-content: flex-start; }

/* ---------- abas ---------- */
.abas { display: flex; gap: 2px; border-bottom: 1px solid var(--linha); margin-bottom: 1rem; overflow-x: auto; }
.abas button {
  border: 0; background: none; padding: .6rem .9rem; cursor: pointer; color: var(--tinta-2);
  border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap;
}
.abas button[aria-selected="true"] { color: var(--dinheiro); border-bottom-color: var(--dinheiro); }

/* ---------- grade de taxas ---------- */
.grade-taxas td input { padding: .3rem .4rem; text-align: right; min-width: 5rem; }
.grade-taxas td:first-child { font-weight: 600; }

/* ---------- toast e modal ---------- */
.toasts { position: fixed; bottom: 1rem; right: 1rem; display: grid; gap: .5rem; z-index: 50; max-width: min(420px, calc(100vw - 2rem)); }
.toast { background: var(--tinta); color: var(--superficie); padding: .7rem 1rem; border-radius: var(--raio); box-shadow: var(--sombra); animation: entra .18s ease-out; }
.toast.erro { background: var(--erro); color: #fff; }
@keyframes entra { from { transform: translateY(8px); opacity: 0; } }
dialog { border: 0; border-radius: 10px; padding: 0; width: min(560px, calc(100vw - 2rem)); background: var(--superficie); color: var(--tinta); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(18, 23, 29, .45); }
dialog .corpo { padding: 1.25rem 1.4rem; max-height: 70vh; overflow-y: auto; }
dialog .rodape { display: flex; justify-content: flex-end; gap: .5rem; padding: .9rem 1.4rem; border-top: 1px solid var(--linha); }

.carregando { color: var(--tinta-3); padding: 1.5rem 0; }

/* ---------- responsivo ---------- */
@media (max-width: 1100px) {
  .lancar { grid-template-columns: 1fr; }
  .recibo { position: relative; top: 0; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .menu {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; z-index: 20;
    flex-direction: row; overflow-x: auto; padding: .35rem; border-right: 0; border-top: 1px solid var(--linha);
  }
  .menu .marca, .menu .grupo-menu, .menu .rodape-menu { display: none; }
  .menu a { flex: none; font-size: .85rem; padding: .5rem .7rem; }
  .conteudo { padding: 1.1rem 1rem 6rem; }
  .grade-comp { grid-template-columns: 1fr 1fr; }
  h1 { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@media print { .menu, .acoes, .filtros { display: none !important; } .app { display: block; } }

/* Usuários: escolha de lojas liberadas */
.escolha-lojas { width: min(32rem, 78vw); max-width: 100%; }
.escolha-lojas .linha-busca { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }
.escolha-lojas .linha-busca input { flex: 1 1 12rem; min-width: 0; }
.lista-lojas { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .25rem .75rem;
  max-height: 46vh; overflow: auto; padding: .5rem; border: 1px solid var(--linha); border-radius: var(--raio); }
.caixa-loja { display: flex; align-items: center; gap: .35rem; padding: .2rem 0; cursor: pointer; }
.caixa-loja[hidden] { display: none; }
.caixa-loja.forte { font-weight: 650; }
.resumo-lojas { font-size: .9rem; margin-bottom: .3rem; max-width: 18rem; }
.escolha-lojas .caixa-loja { display: flex; justify-content: flex-start; text-align: left; font-weight: 500; margin: 0; }
.escolha-lojas .caixa-loja.forte { font-weight: 650; }
.escolha-lojas input[type="checkbox"] { width: 1.05rem; height: 1.05rem; flex: 0 0 auto; margin: 0; padding: 0; accent-color: var(--dinheiro); }
.escolha-lojas .linha-busca .btn { white-space: nowrap; }
.escolha-lojas .caixa-loja[hidden] { display: none; }
.acoes-loja { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.escolha-lojas .caixa-loja small { margin-left: .25rem; font-weight: 400; }
/* Conferência por loja */
.titulo-impressao { margin: 0 0 .25rem; }
.tabela-conferencia td, .tabela-conferencia th { white-space: nowrap; }
.atalhos-dia .acoes { gap: 4px; }
@media print { .cabecalho p, .tabela-rolagem { overflow: visible !important; } .tabela-conferencia { font-size: 11px; } }

/* =====================================================================
   Identidade MP Soluções de Crédito — azul-marinho + dourado da logo.
   Fica no fim do arquivo para sobrescrever a paleta base.
   ===================================================================== */
:root {
  --marinho: #0a2a8f;        /* azul da logo */
  --marinho-forte: #061a5c;
  --marinho-claro: #e8edfb;
  --ouro: #f2b705;           /* dourado da logo */
  --ouro-forte: #c99400;
  --ouro-claro: #fff5d1;
  --foco: #f2b705;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) { --marinho: #6f8ff0; --marinho-claro: #17224a; --ouro-claro: #3a2f0c; }
}
:root[data-tema="escuro"] { --marinho: #6f8ff0; --marinho-claro: #17224a; --ouro-claro: #3a2f0c; }

a { color: var(--marinho); }
h1 { color: var(--marinho-forte); }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) h1 { color: var(--tinta); } }
:root[data-tema="escuro"] h1 { color: var(--tinta); }

.btn.primario {
  background: linear-gradient(180deg, #ffcb2e, var(--ouro)); border-color: var(--ouro-forte);
  color: #0b1a4d; font-weight: 750; box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 1px 2px rgba(6,26,92,.25);
}
.btn.primario:hover { filter: brightness(1.04); }

/* menu lateral em azul-marinho */
.menu {
  background: linear-gradient(180deg, #0b2e9e 0%, #081f73 55%, #061a5c 100%);
  border-right: 0; color: #dfe6ff;
}
.menu a { color: #c9d3f5; }
.menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.menu a[aria-current="page"] {
  background: rgba(242,183,5,.16); color: #ffd34d; font-weight: 700;
  box-shadow: inset 3px 0 0 var(--ouro);
}
.menu .grupo-menu { color: rgba(223,230,255,.55); text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.menu .rodape-menu { color: rgba(223,230,255,.7); border-top: 1px solid rgba(255,255,255,.12); }
.menu .rodape-menu .btn { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.contador { background: var(--ouro); color: #0b1a4d; }
.marca { color: #fff; padding: .25rem .5rem 1.25rem; margin-bottom: .5rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.marca img { border-radius: 9px; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.marca-texto { display: flex; flex-direction: column; line-height: 1.1; }
.marca-texto strong { font-size: 1.15rem; letter-spacing: .04em; }
.marca-texto small { color: #ffd34d; font-size: .74rem; font-weight: 600; }

/* tela de login: fundo azul com brilho dourado, cartão branco com a logo */
.login {
  background:
    radial-gradient(1200px 600px at 85% 110%, rgba(242,183,5,.28), transparent 60%),
    radial-gradient(900px 500px at 0% -10%, rgba(255,214,77,.18), transparent 55%),
    linear-gradient(160deg, #0b2e9e 0%, #071f78 45%, #040f3d 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem;
}
.login .painel {
  width: min(420px, 100%); padding: 0 1.75rem 1.75rem; overflow: hidden;
  border: 0; border-radius: 16px; box-shadow: 0 20px 60px rgba(2,8,40,.55), 0 0 0 1px rgba(242,183,5,.35);
}
.logo-login { margin: 0 -1.75rem 1.25rem; background: #031055; border-bottom: 3px solid var(--ouro); }
.logo-login img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.titulo-login { font-size: 1.15rem; margin: 0 0 .75rem; }
.login .campo input { background: var(--papel); }
.rodape-login { color: rgba(223,230,255,.75); font-size: .82rem; text-align: center; margin: 0; }
.login .carregando { color: #dfe6ff; }

.escolha button[aria-pressed="true"] { background: var(--marinho); border-color: var(--marinho); color: #fff; box-shadow: inset 0 -3px 0 var(--ouro); }
.abas button[aria-selected="true"] { color: var(--marinho); border-bottom-color: var(--ouro); }

/* Campo de busca com lista (loja) */
.combo { position: relative; }
.combo-entrada { width: 100%; padding-right: 4.2rem !important; }
.combo-seta { position: absolute; right: .8rem; top: 50%; width: .5rem; height: .5rem; border-right: 2px solid var(--tinta-2); border-bottom: 2px solid var(--tinta-2); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.combo-limpar { position: absolute; right: 2.1rem; top: 50%; transform: translateY(-50%); width: 1.7rem; height: 1.7rem; border: 0; border-radius: 50%; background: transparent; color: var(--tinta-2); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.combo-limpar:hover { background: var(--linha); color: var(--tinta); }
.combo-limpar[hidden] { display: none; }
.combo-lista { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); max-height: min(22rem, 55vh); overflow-y: auto; margin: 0; padding: .3rem; list-style: none; background: var(--superficie); border: 1px solid var(--linha-forte); border-radius: 10px; box-shadow: 0 12px 32px rgba(6,26,92,.18); }
.combo-lista[hidden] { display: none; }
.combo-lista [role=option] { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .55rem .7rem; border-radius: 7px; cursor: pointer; }
.combo-lista [role=option].ativo { background: var(--marinho-claro, #e8edfb); }
.combo-lista [role=option].escolhido .combo-rotulo { font-weight: 700; color: var(--marinho, inherit); }
.combo-lista [role=option].escolhido .combo-rotulo::after { content: ' ✓'; color: var(--ouro-forte, #c99400); }
.combo-lista mark { background: var(--ouro-claro, #fff5d1); color: inherit; border-radius: 3px; padding: 0 1px; font-weight: 700; }
.combo-detalhe { color: var(--tinta-2); font-size: .82rem; white-space: nowrap; }
.combo-grupo { padding: .55rem .7rem .25rem; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tinta-2); }
.combo-vazio { padding: .8rem .7rem; color: var(--tinta-2); }

/* Confirmação de venda lançada */
.venda-ok { text-align: center; min-width: min(380px, 80vw); }
.venda-ok h2 { margin: .5rem 0 .15rem; color: var(--marinho-forte, inherit); }
.venda-ok-icone { width: 64px; height: 64px; margin: .25rem auto 0; border-radius: 50%; display: grid; place-items: center;
  font-size: 34px; font-weight: 800; color: #fff; background: linear-gradient(180deg, #22a06b, #148552);
  box-shadow: 0 0 0 6px rgba(34,160,107,.15); animation: venda-ok-entra .35s ease-out; }
@keyframes venda-ok-entra { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .venda-ok-icone { animation: none; } }
.venda-ok-resumo { margin-top: 1rem; text-align: left; border-top: 1px dashed var(--linha-forte); padding-top: .6rem; }
.venda-ok-resumo .l { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; font-size: .92rem; }
.venda-ok-resumo .l.total { border-top: 1px solid var(--linha); margin-top: .25rem; padding-top: .45rem; }
dialog:has(.venda-ok) .rodape { justify-content: center; }
dialog:has(.venda-ok) .rodape .btn { min-width: 12rem; }

/* Fechamento: quadro "Quanto cada um recebe" — lojas próprias separadas em cima */
tr.linha-proprias td { border-bottom: 2px solid var(--linha-forte); background: rgba(10, 42, 143, .04); }
