/* ============================================================
   Plius Tasks — Design System
   Base: workspace claro e calmo. Dinheiro é codificado por cor:
   verde = a receber, coral = custo, âmbar = em produção.
   Assinatura: a "barra de margem" (custo vs receber) em cada card.
   ============================================================ */

:root {
  --ink:        #17203A;
  --ink-soft:   #3B4560;
  --muted:      #6B7590;
  --paper:      #EAEDF4;
  --card:       #FFFFFF;
  --line:       #DCE2EE;

  --brand:      #2F5FE0;
  --brand-ink:  #1B2E7A;
  --brand-wash: #E7EDFC;

  --receber:    #0FA968;
  --receber-w:  #E1F5EC;
  --custo:      #E5484D;
  --custo-w:    #FCE7E8;
  --producao:   #E9920B;
  --producao-w: #FBEFD6;

  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --sombra: 0 8px 30px -12px rgba(23, 32, 58, .28);
  --sombra-sm: 0 2px 10px -4px rgba(23, 32, 58, .22);

  --fonte: 'Inter', system-ui, sans-serif;
  --display: 'Space Grotesk', 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--fonte);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
}

.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Topo enxuto ---------- */
.topo {
  background:
    radial-gradient(120% 140% at 100% 0%, #21316b 0%, transparent 55%),
    linear-gradient(160deg, #1c2748 0%, #131a30 100%);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 16px) 18px 16px;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  box-shadow: var(--sombra);
}
.topo__marca { display: flex; align-items: center; gap: 10px; }
.topo__logo {
  font-family: var(--display); font-weight: 700; font-size: 18px;
  width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--brand); border-radius: 10px; position: relative;
}
.topo__logo em { position: absolute; top: 3px; right: 5px; font-size: 11px; font-style: normal; opacity: .85; }
.topo__nome { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: .2px; }
.topo__cfg {
  margin-left: auto; background: rgba(255,255,255,.1); color: #fff;
  border: none; width: 34px; height: 34px; border-radius: 10px;
  font-size: 16px; cursor: pointer; transition: background .15s;
}
.topo__cfg:hover { background: rgba(255,255,255,.2); }

/* Dinheiro: uma linha que expande */
.dinheiro {
  width: 100%; margin-top: 14px; display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--r-sm); padding: 11px 13px;
  color: #cdd8f2; font: inherit; font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.dinheiro:hover { background: rgba(255,255,255,.12); }
.dinheiro__resumo { text-align: left; }
.dinheiro__resumo b { font-family: var(--display); color: #fff; font-variant-numeric: tabular-nums; }
.dinheiro__resumo b.alerta { color: #ff9a9d; }
.dinheiro__resumo i { opacity: .4; font-style: normal; margin: 0 6px; }
.dinheiro__seta { margin-left: auto; opacity: .6; font-size: 15px; }
.dinheiro[aria-expanded="true"] .dinheiro__seta { transform: rotate(180deg); }

.dinheiro__painel { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pill {
  flex: 1 1 44%; min-width: 96px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--r-sm); padding: 9px 11px;
  display: flex; flex-direction: column; gap: 2px;
}
.pill span { font-size: 11px; color: #9fb0d8; letter-spacing: .3px; }
.pill b { font-family: var(--display); font-size: 15px; font-variant-numeric: tabular-nums; }
.pill--receber b { color: #57e0a0; }
.pill--custo b    { color: #ff9a9d; }
.pill--lucro b    { color: #ffd27a; }
.pill--saldo b    { color: #fff; }

.devedores { flex: 1 1 100%; margin-top: 4px; }
.devedores__t { font-size: 11px; color: #9fb0d8; letter-spacing: .3px; margin-bottom: 6px; }
.dev {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 13px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.07);
}
.dev b { font-family: var(--display); color: #57e0a0; font-variant-numeric: tabular-nums; }

.topo__sync {
  margin-top: 12px; font-size: 11px; color: #7f90ba;
  display: flex; align-items: center; gap: 6px;
}
.topo__sync::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #55617f; }
.topo__sync.ok::before { background: #57e0a0; }
.topo__sync.erro::before { background: #ff9a9d; }

/* ---------- Seções ---------- */
.conteudo { padding: 4px 16px 0; }
.secao { margin-top: 26px; }
.secao__cab { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.secao__titulo { font-family: var(--display); font-size: 16px; font-weight: 600; }
.secao__dica { font-size: 11.5px; color: var(--muted); }

/* ---------- Lista ---------- */
.filtros { display: flex; gap: 6px; }
.filtro {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  font-family: var(--fonte); transition: all .14s;
}
.filtro--ativo { background: var(--ink); color: #fff; border-color: var(--ink); }

.lista { display: flex; flex-direction: column; gap: 10px; }
.item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px; box-shadow: var(--sombra-sm);
  transition: border-color .14s;
}
.item__topo { display: flex; align-items: center; gap: 10px; }
.selo {
  font-size: 10.5px; font-weight: 500; padding: 3px 8px; border-radius: 999px;
  letter-spacing: .3px; white-space: nowrap;
}
.selo--fila { background: var(--brand-wash); color: var(--brand-ink); }
.selo--producao { background: var(--producao-w); color: #9a5c02; }
.selo--concluida { background: var(--receber-w); color: #0a7a4b; }
.item__tipo { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.item__linha { display: flex; align-items: baseline; gap: 10px; margin: 10px 0 8px; }
.item__titulo { font-weight: 600; font-size: 15px; cursor: pointer; }
.item.feito .item__titulo { color: var(--muted); text-decoration: line-through; }
.item__prog {
  margin-left: auto; font-size: 11.5px; color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* Checklist inline */
.checklist { display: flex; flex-direction: column; gap: 2px; margin: 0 0 12px; }
.checklist__vazio { font-size: 12px; color: var(--muted); padding: 2px 0 4px; }
.check {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 5px 6px; margin-left: -6px; border-radius: 7px;
  font-size: 13.5px; line-height: 1.35; cursor: pointer;
  transition: background .12s;
}
.check:hover { background: var(--brand-wash); }
.check input {
  appearance: none; -webkit-appearance: none;
  width: 17px; height: 17px; flex: none; margin-top: 1px;
  border: 1.5px solid var(--line); border-radius: 5px;
  background: var(--card); cursor: pointer;
  transition: background .12s, border-color .12s;
}
.check input:checked {
  background: var(--receber); border-color: var(--receber);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E");
  background-size: 13px; background-position: center; background-repeat: no-repeat;
}
.check.ok span { color: var(--muted); text-decoration: line-through; }
.checklist__novo { margin: 4px 0 0; }
.checklist__novo input {
  width: 100%; border: none; border-bottom: 1px dashed var(--line);
  background: transparent; padding: 5px 0 5px 26px;
  font: inherit; font-size: 13px; color: var(--ink);
}
.checklist__novo input::placeholder { color: var(--muted); }
.checklist__novo input:focus { outline: none; border-bottom-color: var(--brand); }

/* Ações da tarefa */
.item__acoes { display: flex; gap: 8px; margin-top: 12px; }
.acao {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 12.5px;
  font-weight: 500; cursor: pointer; transition: background .12s, border-color .12s;
}
.acao:hover { background: var(--brand-wash); border-color: var(--brand); }
.acao--fraca { color: var(--muted); }

/* Barra de margem — a assinatura */
.margem { margin-top: 4px; }
.margem__barra {
  height: 8px; border-radius: 999px; overflow: hidden;
  display: flex; background: var(--line);
}
.margem__custo { background: var(--custo); }
.margem__lucro { background: var(--receber); }
.margem__leg {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 7px; font-size: 12px;
}
.margem__leg span { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.margem__leg .ponto { width: 8px; height: 8px; border-radius: 50%; }
.ponto--custo { background: var(--custo); }
.ponto--receber { background: var(--receber); }
.margem__leg b { font-family: var(--display); }

/* ---------- FAB ---------- */
.fabs {
  position: fixed; right: max(18px, calc(50% - 320px + 18px));
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  z-index: 30; display: flex; align-items: center; gap: 10px;
}
.fab {
  width: 60px; height: 60px; border-radius: 20px;
  background: var(--brand); color: #fff; border: none; cursor: pointer;
  display: grid; place-items: center;
  box-shadow: 0 12px 26px -8px rgba(47,95,224,.6);
  transition: transform .15s, background .15s;
  flex: none;
}
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(.94); }

.fab--mic {
  width: 50px; height: 50px; border-radius: 17px;
  background: var(--card); color: var(--ink-soft);
  border: 1px solid var(--line);
  box-shadow: var(--sombra-sm);
}
.fab--mic:hover { color: var(--brand); border-color: var(--brand); }
.fab__parar { display: none; }
.fab--mic.gravando {
  background: var(--custo); color: #fff; border-color: var(--custo);
  animation: pulso 1.2s infinite;
}
.fab--mic.gravando svg:not(.fab__parar) { display: none; }
.fab--mic.gravando .fab__parar { display: block; }

/* Transcrição ao vivo, discreta, ao lado dos botões */
.transcricao {
  max-width: min(52vw, 260px);
  background: var(--ink); color: #fff;
  font-size: 12.5px; line-height: 1.35;
  padding: 9px 13px; border-radius: 14px;
  box-shadow: var(--sombra);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; pointer-events: none;
}
.transcricao.ouvindo { color: #9fb0d8; font-style: italic; }

/* ---------- Folhas (bottom sheets) ---------- */
.folha { position: fixed; inset: 0; z-index: 50; visibility: hidden; }
.folha.aberta { visibility: visible; }
.folha__fundo {
  position: absolute; inset: 0; background: rgba(15,20,38,.5);
  opacity: 0; transition: opacity .25s;
}
.folha.aberta .folha__fundo { opacity: 1; }
.folha__corpo {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 100%);
  width: 100%; max-width: 640px;
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 22px);
  max-height: 92vh; overflow-y: auto;
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.folha.aberta .folha__corpo { transform: translate(-50%, 0); }
.folha__alca { width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 16px; }
.folha__cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.folha__corpo h3 { font-family: var(--display); font-size: 19px; font-weight: 600; }
.folha__acoes { display: flex; gap: 10px; margin-top: 22px; }

.mic {
  width: 44px; height: 44px; border-radius: 13px; border: none; cursor: pointer;
  background: var(--brand-wash); color: var(--brand);
  display: grid; place-items: center; transition: all .15s;
}
.mic.ativo { background: var(--custo); color: #fff; animation: pulso 1.2s infinite; }
@keyframes pulso { 0%,100% { box-shadow: 0 0 0 0 rgba(229,72,77,.5); } 50% { box-shadow: 0 0 0 10px rgba(229,72,77,0); } }

.ditado {
  display: flex; align-items: center; gap: 10px;
  background: var(--custo-w); color: #9a2b2f;
  padding: 11px 14px; border-radius: var(--r-sm); font-size: 13px; margin-bottom: 16px;
}
.ditado__ponto { width: 9px; height: 9px; border-radius: 50%; background: var(--custo); animation: pisca 1s infinite; }
@keyframes pisca { 50% { opacity: .3; } }

/* ---------- Campos ---------- */
.campo { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.campo > span { font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }
.campo input, .campo select {
  font-family: var(--fonte); font-size: 15px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 12px 13px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.campo input:focus, .campo select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash);
}
.campo-dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.campo--money .money { position: relative; display: flex; align-items: center; }
.campo--money .money i {
  position: absolute; left: 13px; font-style: normal; font-size: 14px;
  font-family: var(--display); color: var(--muted);
}
.campo--money input { padding-left: 38px; font-variant-numeric: tabular-nums; }
.campo--receber input:focus { border-color: var(--receber); box-shadow: 0 0 0 3px var(--receber-w); }
.campo--custo input:focus { border-color: var(--custo); box-shadow: 0 0 0 3px var(--custo-w); }

.subs { display: flex; flex-direction: column; gap: 7px; }
.sub {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 14px;
}
.sub input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--receber); }
.sub.ok span { text-decoration: line-through; color: var(--muted); }
.sub span { flex: 1; }
.sub__x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.sub-add { display: flex; gap: 8px; margin-top: 8px; }
.sub-add input { flex: 1; font-family: var(--fonte); font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 11px 12px; }
.sub-add button { background: var(--ink); color: #fff; border: none; border-radius: var(--r-sm); padding: 0 16px; font-size: 14px; cursor: pointer; }

/* ---------- Botões ---------- */
.btn {
  flex: 1; font-family: var(--fonte); font-size: 15px; font-weight: 600;
  padding: 14px; border-radius: var(--r-md); border: none; cursor: pointer;
  transition: transform .1s, filter .15s;
}
.btn:active { transform: scale(.98); }
.btn--cheio { background: var(--brand); color: #fff; }
.btn--cheio:hover { filter: brightness(1.06); }
.btn--fantasma { background: transparent; color: var(--custo); border: 1px solid var(--custo-w); flex: 0 0 auto; padding: 14px 20px; }

.ajuda { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-top: -4px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 13.5px; box-shadow: var(--sombra); z-index: 80; opacity: 0;
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.mostra { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Agora ---------- */
.agora { margin-top: 20px; }
.agora__rot {
  font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; font-weight: 500;
}
.agora__cartao {
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--r-md); padding: 16px; box-shadow: var(--sombra-sm);
}
.agora__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agora__cli { font-size: 12px; color: var(--ink-soft); font-weight: 500; }
.agora__prazo { font-size: 12px; color: var(--muted); margin-left: auto; }
.agora__prazo.atrasada { color: var(--custo); font-weight: 600; }
.agora__titulo {
  font-family: var(--display); font-size: 20px; font-weight: 600;
  line-height: 1.25; margin: 10px 0 12px; cursor: pointer;
}
.agora__passo {
  display: flex; align-items: flex-start; gap: 11px;
  background: var(--brand-wash); border-radius: var(--r-sm);
  padding: 12px 13px; font-size: 14.5px; line-height: 1.35; cursor: pointer;
}
.agora__passo input {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; flex: none; margin-top: 1px;
  border: 1.5px solid var(--brand); border-radius: 6px;
  background: #fff; cursor: pointer;
}
.agora__passo input:checked { background: var(--receber); border-color: var(--receber); }
.agora__semitem { font-size: 13px; color: var(--muted); padding: 4px 0 8px; }
.agora__prog {
  height: 5px; background: var(--line); border-radius: 999px;
  overflow: hidden; margin-top: 12px;
}
.agora__prog i { display: block; height: 100%; background: var(--receber); transition: width .25s; }
.agora__progt { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.agora__acoes { display: flex; gap: 8px; margin-top: 14px; }
.agora__acoes .btn { flex: 1; padding: 12px 14px; font-size: 14px; }
.agora__acoes .btn--fantasma { flex: 0 0 auto; color: var(--ink-soft); border-color: var(--line); }
.agora__vazio {
  background: var(--card); border: 1.5px dashed var(--line);
  border-radius: var(--r-md); padding: 26px 18px; text-align: center;
  display: flex; flex-direction: column; gap: 5px;
}
.agora__vazio b { font-family: var(--display); font-size: 15px; }
.agora__vazio span { font-size: 13px; color: var(--muted); }

/* ---------- Grupos da lista ---------- */
.grupo { margin-bottom: 22px; }
.grupo__cab {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.grupo__cab h3 { font-family: var(--display); font-size: 13.5px; font-weight: 600; }
.grupo__cab span, .grupo__cab b {
  margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.grupo__cab b { font-family: var(--display); color: var(--receber); }
.grupo--alerta .grupo__cab h3 { color: var(--custo); }
.grupo .item { margin-bottom: 9px; }
.vazio {
  color: var(--muted); font-size: 13px; padding: 26px 4px; text-align: center;
  border: 1.5px dashed var(--line); border-radius: var(--r-md);
}

.selo--aguardando { background: var(--producao-w); color: #8a5a00; }
.item__cli { font-size: 11.5px; color: var(--ink-soft); font-weight: 500; }
.item__prazo { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.item__prazo.atrasada { color: var(--custo); font-weight: 600; }

/* ---------- Valores no cartão ---------- */
.valores {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 10px; border-top: 1px solid var(--line);
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.valores__rec { color: var(--receber); font-weight: 600; }
.valores__cus { color: var(--custo); }
.marca {
  margin-left: auto; border: 1px solid var(--line); background: var(--card);
  color: var(--muted); border-radius: 999px; padding: 5px 11px;
  font: inherit; font-size: 11.5px; cursor: pointer; transition: all .14s;
}
.marca:hover { border-color: var(--receber); color: var(--receber); }
.marca.paga { background: var(--receber-w); color: #0a7a4b; border-color: var(--receber-w); font-weight: 600; }

/* ---------- Confirmação do ditado ---------- */
.confirma {
  background: var(--paper); border-radius: var(--r-md); padding: 15px;
}
.confirma__tit { font-family: var(--display); font-size: 17px; font-weight: 600; }
.confirma__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.confirma__tags span {
  font-size: 11.5px; background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px; color: var(--ink-soft);
}
.confirma__tags .rec { color: var(--receber); border-color: var(--receber-w); background: var(--receber-w); font-weight: 600; }
.confirma__tags .cus { color: var(--custo); border-color: var(--custo-w); background: var(--custo-w); }
.confirma__subs { margin: 12px 0 0 18px; font-size: 13px; color: var(--ink-soft); }
.confirma__subs li { margin-bottom: 3px; }
.confirma__fala {
  margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted); font-style: italic; line-height: 1.45;
}

/* ---------- Atalhos de prazo e troca ---------- */
.atalhos { display: flex; gap: 6px; margin: -4px 0 16px; flex-wrap: wrap; }
.atalhos button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
  border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 12px; cursor: pointer;
  transition: all .14s;
}
.atalhos button:hover { border-color: var(--brand); color: var(--brand); }
.troca {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
  font-size: 13.5px; color: var(--ink-soft); cursor: pointer;
}
.troca input { width: 19px; height: 19px; accent-color: var(--receber); cursor: pointer; }
