/* =========================================================
  style.css (COMPLETO / AJUSTADO)
  ✔ nomes NÃO cortam com "..."
  ✔ valores NÃO vazam no mobile
========================================================= */

* { box-sizing: border-box; }

:root{
  --muted: #777;
}

body {
  margin: 0;
  background: #f6f3eb;
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 420px;
  padding: 20px;
}

/* =========================
  HEADER / MÊS
========================= */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

header h2 {
  margin: 0;
  font-weight: 600;
}

header button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
}

/* =========================
  CARD
========================= */
.card {
  background: #fffdf8;
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 16px;

  /* 🔧 evita vazamento no mobile */
  flex-wrap: wrap;
}

.card-header .left{
  flex: 1 1 auto;
  min-width: 0;
}

.card-header .right{
  flex: 0 0 auto;
  margin-left: auto;
  max-width: 100%;
}

.right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.descricao {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  line-height: 1.3;
}

.titulo{
  white-space: nowrap;
  display: block;
  font-size: 1rem;
  font-weight: 600;
}

/* =========================
  DINHEIRO
========================= */
.money{
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;

  /* 🔧 removido min-width fixo */
  min-width: 0;
  max-width: 100%;
}

.rs{
  color: var(--muted);
  font-weight: 400;
  flex: 0 0 auto;
}

.money-value{
  display: inline-block;
  text-align: right;
  font-weight: 700;
  min-width: 4ch;
  max-width: 100%;
}

.money-input{
  text-align: right;
  font-size: 16px;
  font-weight: 700;
  border: none;
  outline: none;
  background: transparent;
  padding: 2px 0;
  width: 4ch;     /* JS ajusta */
  max-width: 16ch;
}

.money-input:focus{
  border-bottom: 1px solid #ddd;
}

/* =========================
  OVERLAYS / POPUPS
========================= */
.hidden { display: none !important; }

#overlay, #overlay-copiar {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.popup {
  background: white;
  width: 90%;
  max-width: 320px;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  animation: fadeIn 0.2s ease;
}

.popup h3 { margin-top: 0; }

.popup input {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 15px;
}

.actions{
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
}

.actions button {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

#cancelar { background: #eee; }
#ok { background: #111; color: white; }

#copiar-nao { background: #eee; }
#copiar-sim { background: #111; color: #fff; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* =========================
  LISTA DE FIXOS
========================= */
.lista {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* item */
.item{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px;
  border-top: 1px solid #eee;
  font-size: 15px;
  border-radius: 10px;
}

/* zebra suave */
.item:nth-child(odd)  { background: rgba(0,0,0,0.02); }
.item:nth-child(even) { background: rgba(0,0,0,0.00); }

/* esquerda: (lixeira) + nome */
.item-left{
  display: flex;
  align-items: center;
  gap: 10px;

  /* 🔧 ESSENCIAL p/ não cortar texto errado */
  flex: 1 1 auto;
  min-width: 0;
}

/* 🔧 nome agora mostra COMPLETO */
.item .nome{
  white-space: normal;      /* quebra linha */
  overflow: visible;
  text-overflow: clip;
  max-width: none;
  word-break: break-word;
}

/* direita: só dinheiro */
.item-right{
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  flex: 0 0 auto;
}

/* botão remover */
.btn-remove{
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid #e6e2d8;
  background: transparent;
  color: #666;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-remove:hover{
  background: rgba(0,0,0,0.04);
}

/* desktop: aparece só no hover */
.item-left .btn-remove{
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.item:hover .item-left .btn-remove{
  opacity: 1;
  pointer-events: auto;
}

/* mobile: sempre visível */
@media (hover: none){
  .item-left .btn-remove{
    opacity: 1;
    pointer-events: auto;
  }
}

/* =========================
  ITEM NEUTRO (ADICIONAR)
========================= */
.item-add{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;

  padding: 10px 10px;
  border-top: 1px dashed #e6e2d8;
  border-radius: 10px;

  color: var(--muted);
  font-size: 14px;
  font-style: italic;

  cursor: pointer;
  user-select: none;
}

.item-add:hover{
  background: rgba(0,0,0,0.03);
}

.item-add .plus{
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid #e6e2d8;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-style: normal;
  color: #555;
}
