/* ==========================================================================
   MPRINCESS - design system
   A Mafia Princess (Guara). Preto, dourado e rosa da marca.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
  /* --- tinta / neutros quentes --- */
  --tinta: #17120e;
  --tinta-2: #4a4038;
  --tinta-3: #7d7268;
  --tinta-4: #a89e93;

  --fundo: #f6f3ee;
  --superficie: #ffffff;
  --superficie-2: #faf8f4;
  --borda: #e7e1d7;
  --borda-forte: #d8d0c2;

  /* --- dourado da marca (usado com parcimonia) --- */
  --ouro: #b8893a;
  --ouro-claro: #e8c87d;
  --ouro-fraco: #f6ecd7;
  --ouro-gradiente: linear-gradient(135deg, #a3752c 0%, #e8c87d 48%, #c2953f 100%);

  /* --- apoio --- */
  --rosa: #c4737f;
  --rosa-fraco: #f8edec;
  --erro: #b23a2c;
  --erro-fraco: #fbecea;
  --ok: #2f7a4f;
  --ok-fraco: #eaf4ee;

  /* --- forma --- */
  --raio-s: 8px;
  --raio: 11px;
  --raio-g: 14px;

  --sombra-s: 0 1px 2px rgba(23, 18, 14, 0.05);
  --sombra: 0 2px 8px rgba(23, 18, 14, 0.06);
  --sombra-g: 0 16px 40px rgba(23, 18, 14, 0.16);

  --fonte: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --fonte-titulo: 'Playfair Display', Georgia, serif;

  --topo-altura: 60px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--fonte);
  font-size: 15px;
  line-height: 1.5;
  color: var(--tinta);
  background: var(--fundo);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Numeros de dinheiro precisam alinhar em coluna. */
.tabular { font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }

:focus-visible {
  outline: 2px solid var(--ouro);
  outline-offset: 2px;
}

/* ==========================================================================
   Marca
   ========================================================================== */

.texto-ouro {
  background: var(--ouro-gradiente);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Monograma: o "M" da marca numa placa dourada, no lugar do emoji de coroa. */
.monograma {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--ouro-gradiente);
  color: #231a10;
  font-family: var(--fonte-titulo);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  padding-bottom: 1px;
}

.monograma.g { width: 54px; height: 54px; border-radius: 14px; font-size: 1.7rem; }

/* ==========================================================================
   Barra do topo
   ========================================================================== */

.topo {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--topo-altura);
  padding: 0 1.5rem;
  background: var(--tinta);
  border-bottom: 1px solid rgba(232, 200, 125, 0.22);
}

.topo .identidade { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }

.topo .nome-marca {
  font-family: var(--fonte-titulo);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #f3ead9;
  white-space: nowrap;
}

.topo .selo {
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(232, 200, 125, 0.32);
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ouro-claro);
}

@media (max-width: 600px) {
  .topo { padding: 0 1rem; }
  .topo .selo { display: none; }
}

.topo-acoes { display: flex; align-items: center; gap: 0.5rem; }

/* Botao fantasma da barra escura (voltar, sair). */
.botao-topo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(232, 200, 125, 0.3);
  border-radius: var(--raio-s);
  background: transparent;
  color: #e4d9c6;
  font-family: var(--fonte);
  font-size: 0.78rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.botao-topo:hover {
  background: rgba(232, 200, 125, 0.12);
  border-color: rgba(232, 200, 125, 0.55);
  color: #fff;
}

.botao-topo svg { width: 14px; height: 14px; }

/* ==========================================================================
   Estrutura
   ========================================================================== */

.pagina { max-width: 1120px; margin: 0 auto; padding: 2.25rem 1.5rem 4rem; }
.pagina.estreita { max-width: 760px; }

@media (max-width: 600px) {
  .pagina { padding: 1.5rem 1rem 3rem; }
}

.cabecalho {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--borda);
}

.cabecalho h1 {
  font-family: var(--fonte-titulo);
  font-size: 1.95rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.cabecalho .subtitulo {
  margin-top: 0.3rem;
  color: var(--tinta-3);
  font-size: 0.88rem;
}

/* ==========================================================================
   Cartoes
   ========================================================================== */

.cartao {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio-g);
  box-shadow: var(--sombra-s);
}

.cartao-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--borda);
}

.cartao-topo h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.96rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.cartao-topo .legenda {
  margin-top: 0.2rem;
  color: var(--tinta-3);
  font-size: 0.8rem;
  font-weight: 400;
}

.cartao-corpo { padding: 1.4rem; }
.cartao-corpo.sem-respiro { padding: 0.75rem; }

.grade { display: grid; gap: 1.25rem; }
.grade.duas { grid-template-columns: 1fr 1fr; }
.grade.tres { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 880px) {
  .grade.duas, .grade.tres { grid-template-columns: 1fr; }
}

/* Icone de secao: traco fino, nunca emoji. */
.icone {
  width: 17px;
  height: 17px;
  flex: none;
  stroke: var(--ouro);
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   Indicadores (KPI)
   ========================================================================== */

.indicador {
  padding: 1.3rem 1.4rem;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio-g);
  box-shadow: var(--sombra-s);
}

.indicador.escuro {
  background:
    radial-gradient(ellipse at 100% 0%, rgba(232, 200, 125, 0.14), transparent 62%),
    var(--tinta);
  border-color: #342a20;
}

.indicador .rotulo {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--tinta-4);
  margin-bottom: 0.65rem;
}

.indicador.escuro .rotulo { color: #a1917a; }

.indicador .numero {
  font-size: 1.95rem;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.indicador.escuro .numero { color: var(--ouro-claro); }

.indicador .nota {
  display: block;
  margin-top: 0.55rem;
  font-size: 0.79rem;
  color: var(--tinta-3);
}

.indicador.escuro .nota { color: #9c8c77; }

/* Variacao: subir despesa e ruim, cair e bom. */
.variacao { display: inline-flex; align-items: center; gap: 0.3rem; }
.variacao.subiu { color: var(--erro); }
.variacao.caiu { color: var(--ok); }
.variacao svg { width: 17px; height: 17px; stroke-width: 2.4; fill: none; stroke: currentColor; }

/* ==========================================================================
   Formularios
   ========================================================================== */

.campo { margin-bottom: 1.1rem; }

.rotulo {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tinta-2);
}

input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.68rem 0.85rem;
  border: 1px solid var(--borda-forte);
  border-radius: var(--raio-s);
  background: var(--superficie);
  font-family: var(--fonte);
  font-size: 0.94rem;
  color: var(--tinta);
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

input::placeholder { color: var(--tinta-4); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ouro);
  box-shadow: 0 0 0 3px rgba(184, 137, 58, 0.14);
}

select {
  appearance: none;
  padding-right: 2.1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d7268' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 15px;
  cursor: pointer;
}

/* Campo de dinheiro: o "R$" fica dentro da caixa, colado na borda. */
.campo-moeda { position: relative; }

.campo-moeda .prefixo {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--tinta-3);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: none;
}

.campo-moeda input { padding-left: 2.5rem; font-variant-numeric: tabular-nums; }

.linha-campos { display: grid; gap: 1rem; }

/* ==========================================================================
   Botoes
   ========================================================================== */

.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.68rem 1.2rem;
  border: 1px solid transparent;
  border-radius: var(--raio-s);
  font-family: var(--fonte);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease,
    box-shadow 0.14s ease, opacity 0.14s ease;
}

.botao svg { width: 15px; height: 15px; }
.botao.bloco { width: 100%; }

.botao-principal {
  background: var(--tinta);
  color: var(--ouro-claro);
  box-shadow: var(--sombra-s);
}

.botao-principal:hover:not(:disabled) { background: #251d16; box-shadow: var(--sombra); }

.botao-ouro {
  background: var(--ouro-gradiente);
  color: #241a0e;
  box-shadow: var(--sombra-s);
}

.botao-ouro:hover:not(:disabled) { filter: brightness(1.05); box-shadow: var(--sombra); }

.botao-neutro {
  background: var(--superficie);
  border-color: var(--borda-forte);
  color: var(--tinta-2);
}

.botao-neutro:hover:not(:disabled) { border-color: var(--tinta-3); color: var(--tinta); }

.botao:disabled { opacity: 0.45; cursor: not-allowed; }

/* Acao pequena dentro de lista (editar, excluir). */
.botao-mini {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.38rem 0.65rem;
  border: 1px solid var(--borda-forte);
  border-radius: var(--raio-s);
  background: var(--superficie);
  color: var(--tinta-2);
  font-family: var(--fonte);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.botao-mini:hover { border-color: var(--tinta-3); color: var(--tinta); }
.botao-mini.perigo:hover {
  border-color: var(--erro);
  background: var(--erro-fraco);
  color: var(--erro);
}

.botao-mini svg { width: 13px; height: 13px; stroke-width: 1.8; fill: none; stroke: currentColor; }

/* Botao quadrado de navegacao (setas de mes). */
.botao-passo {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--borda-forte);
  border-radius: var(--raio-s);
  background: var(--superficie);
  color: var(--tinta-2);
  cursor: pointer;
  transition: border-color 0.14s ease, color 0.14s ease, opacity 0.14s ease;
}

.botao-passo:hover:not(:disabled) { border-color: var(--ouro); color: var(--tinta); }
.botao-passo:disabled { opacity: 0.35; cursor: not-allowed; }
.botao-passo svg { width: 15px; height: 15px; stroke-width: 2; fill: none; stroke: currentColor; }

/* ==========================================================================
   Listas de dados
   ========================================================================== */

/* Linhas separadas por hairline, sem caixinha em volta de cada item. */
.lista > .item {
  display: grid;
  align-items: center;
  gap: 0.9rem;
  padding: 0.78rem 0.65rem;
  border-radius: var(--raio-s);
  transition: background 0.12s ease;
}

.lista > .item + .item { border-top: 1px solid var(--borda); }
.lista > .item:hover { background: var(--superficie-2); }

.item-titulo { font-size: 0.93rem; font-weight: 600; word-break: break-word; }
.item-sub { margin-top: 0.1rem; font-size: 0.79rem; color: var(--tinta-3); }

.item-valor {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* O icone do setor e dado da usuaria (emoji). Fica num quadro neutro e discreto. */
.avatar-setor {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  font-size: 1.02rem;
  line-height: 1;
  border: 1px solid var(--borda);
  border-radius: var(--raio-s);
  background: var(--superficie-2);
}

.etiqueta {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--borda);
  border-radius: 999px;
  background: var(--superficie-2);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--tinta-2);
  white-space: nowrap;
}

.etiqueta.ouro { border-color: #e8d9b4; background: var(--ouro-fraco); color: #7a5a1e; }
.etiqueta.data { font-variant-numeric: tabular-nums; color: var(--tinta-3); }

/* ==========================================================================
   Barras de proporcao
   ========================================================================== */

.barra + .barra { margin-top: 1.05rem; }

.barra-topo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
}

.barra-nome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-size: 0.89rem;
  font-weight: 500;
}

.barra-nome .emoji { font-size: 0.95rem; line-height: 1; flex: none; }
.barra-nome span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.barra-valor {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  white-space: nowrap;
  font-size: 0.89rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.barra-valor .pct { font-weight: 500; font-size: 0.78rem; color: var(--tinta-4); }

.trilha {
  height: 6px;
  border-radius: 999px;
  background: #ece6dc;
  overflow: hidden;
}

.preenchimento {
  height: 100%;
  border-radius: 999px;
  background: var(--ouro-gradiente);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.barra-rodape { margin-top: 0.3rem; font-size: 0.76rem; color: var(--tinta-4); }

/* ==========================================================================
   Estados
   ========================================================================== */

.vazio {
  padding: 2.75rem 1.25rem;
  text-align: center;
  color: var(--tinta-3);
}

.vazio .icone-vazio {
  width: 34px;
  height: 34px;
  margin: 0 auto 0.85rem;
  stroke: var(--tinta-4);
  stroke-width: 1.3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.vazio p { font-size: 0.88rem; }
.vazio .acao-vazio { margin-top: 1rem; }

.alerta {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border: 1px solid #e8d9b4;
  border-radius: var(--raio-s);
  background: var(--ouro-fraco);
  color: #70521a;
  font-size: 0.86rem;
  line-height: 1.45;
}

.alerta a { color: #6b4d13; font-weight: 600; }
.alerta svg { width: 17px; height: 17px; flex: none; margin-top: 1px; stroke: #a07a26; stroke-width: 1.7; fill: none; }

.aviso-erro {
  display: none;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1.1rem;
  border: 1px solid #efcfc9;
  border-left: 3px solid var(--erro);
  border-radius: var(--raio-s);
  background: var(--erro-fraco);
  color: var(--erro);
  font-size: 0.85rem;
}

.aviso-erro.visivel { display: block; }

/* Torrada de confirmacao no rodape da tela. */
#aviso {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  max-width: calc(100vw - 2rem);
  padding: 0.72rem 1.1rem;
  border-radius: var(--raio);
  background: var(--tinta);
  color: #f3ead9;
  font-size: 0.87rem;
  font-weight: 500;
  box-shadow: var(--sombra-g);
  opacity: 0;
  transform: translateX(-50%) translateY(14px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#aviso.aparece { opacity: 1; transform: translateX(-50%) translateY(0); }
#aviso.ruim { background: var(--erro); color: #fff; }

/* ==========================================================================
   Dialogo
   ========================================================================== */

dialog {
  border: 1px solid var(--borda);
  border-radius: var(--raio-g);
  padding: 0;
  width: min(440px, calc(100vw - 2rem));
  background: var(--superficie);
  color: var(--tinta);
  box-shadow: var(--sombra-g);
}

dialog::backdrop { background: rgba(23, 18, 14, 0.5); backdrop-filter: blur(2px); }

dialog .dialogo-topo {
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--borda);
}

dialog .dialogo-topo h2 { font-size: 0.98rem; font-weight: 600; }
dialog .dialogo-corpo { padding: 1.4rem; }

.dialogo-acoes {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--borda);
  background: var(--superficie-2);
  border-radius: 0 0 var(--raio-g) var(--raio-g);
}
