:root {
  --bg: #f3f4f8;
  --surface: rgba(255, 255, 255, .78);
  --surface-solid: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: rgba(17, 24, 39, .07);

  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: rgba(37, 99, 235, .09);
  --green: #15803d;
  --green-soft: rgba(22, 163, 74, .12);
  --warn: #b45309;
  --warn-soft: rgba(245, 158, 11, .15);

  /* Cores das dívidas na barra */
  --c1: #6d5dfc;
  --c2: #f472b6;
  --c3: #fb923c;

  --shadow: 0 1px 2px rgba(17, 24, 39, .03), 0 14px 40px rgba(17, 24, 39, .06);
  --shadow-hover: 0 1px 2px rgba(17, 24, 39, .03), 0 22px 54px rgba(17, 24, 39, .10);
  --r-card: 30px;
  --r-inner: 20px;
  --ease: cubic-bezier(.22, .8, .26, 1);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
p, h1, h2, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 999px;
}

/* ---------- Fundo ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .45;
  animation: drift 30s var(--ease) infinite alternate;
}
.blob--1 { width: 480px; height: 480px; background: #c7d2fe; top: -160px; left: 10%; }
.blob--2 { width: 420px; height: 420px; background: #fbcfe8; top: 35%; right: -120px; animation-duration: 36s; animation-delay: -10s; }
.blob--3 { width: 380px; height: 380px; background: #bae6fd; bottom: -160px; left: -80px; animation-duration: 40s; animation-delay: -18s; }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(50px, 30px) scale(1.06); }
  100% { transform: translate(-30px, 60px) scale(.96); }
}

/* ---------- Moldura ---------- */
.shell {
  max-width: 1240px;
  margin: 20px auto;
  padding: 22px 28px 36px;
  border-radius: 40px;
  background: rgba(255, 255, 255, .45);
  border: 1px solid rgba(255, 255, 255, .8);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 30px 80px rgba(17, 24, 39, .06);
}

/* ---------- Topo ---------- */
.topbar { display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.nav { display: flex; gap: 8px; flex: 1; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #93c5fd, #6d5dfc);
  color: #fff; font-weight: 700;
  box-shadow: 0 0 0 3px #fff, var(--shadow);
}

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 13px;
  background: var(--surface-solid);
  box-shadow: 0 1px 2px rgba(17, 24, 39, .05);
  transition: background-color .25s var(--ease), color .25s var(--ease), transform .2s var(--ease);
}
.pill--active { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .28); }
.pill--soft { color: var(--text); }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: transform .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:active { transform: scale(.96); }
.btn--sm { min-height: 34px; padding: 0 14px; }
.btn--xs { min-height: 30px; padding: 0 12px; font-size: 12px; }
.btn--block { width: 100%; }
.btn--center { margin: 18px auto 0; display: flex; }

.btn--primary { background: var(--blue); color: #fff; box-shadow: 0 6px 16px rgba(37, 99, 235, .28); }
.btn--primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.btn--primary:active { transform: scale(.96); }
.btn--soft { background: var(--blue-soft); color: var(--blue-dark); }
.btn--soft:hover { background: rgba(37, 99, 235, .15); }
.btn--outline { background: var(--surface-solid); border-color: var(--line); box-shadow: 0 1px 2px rgba(17, 24, 39, .04); }
.btn--outline:hover { border-color: var(--blue); color: var(--blue-dark); }
.btn--check { background: transparent; border-color: var(--line); }
.btn--check svg { color: var(--muted); transition: color .2s var(--ease), transform .3s var(--ease); }
.btn--check:hover { background: var(--green-soft); border-color: transparent; color: var(--green); }
.btn--check:hover svg { color: var(--green); transform: scale(1.2); }

.icon-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 0;
  display: grid; place-items: center;
  background: var(--surface-solid);
  box-shadow: 0 1px 3px rgba(17, 24, 39, .08);
  color: var(--text);
  cursor: pointer;
  transition: transform .2s var(--ease), color .2s var(--ease);
}
.icon-btn:hover { color: var(--blue); transform: rotate(-8deg) scale(1.06); }

/* ---------- Menu Adicionar ---------- */
.add-menu { position: relative; }
.add-menu > summary { list-style: none; }
.add-menu > summary::-webkit-details-marker { display: none; }
.add-menu > summary svg { transition: transform .3s var(--ease); }
.add-menu[open] > summary svg { transform: rotate(45deg); }
.add-menu__list {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 210px;
  border-radius: 22px;
  padding: 8px;
  display: grid;
  gap: 2px;
  z-index: 30;
  background: rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow-hover);
  transform-origin: top right;
}
.add-menu[open] .add-menu__list { animation: pop .28s var(--ease); }
.add-menu__list button {
  text-align: left;
  background: none; border: 0;
  padding: 11px 14px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.add-menu__list button:hover { background: var(--blue-soft); color: var(--blue-dark); }
@keyframes pop {
  from { opacity: 0; transform: translateY(-6px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Cabeçalho da página ---------- */
.page { margin-top: 30px; }
.page__head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 24px;
}
h1 { font-size: 32px; font-weight: 700; letter-spacing: -.035em; margin-top: 12px; line-height: 1.1; }
.hello { color: var(--muted); font-weight: 500; margin-top: 4px; }
.page__actions { display: flex; align-items: center; gap: 10px; }

.demo-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fef3c7;
  color: #78350f;
  font-size: 12px; font-weight: 600;
}
.demo-chip__dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, .5); }
  50%      { box-shadow: 0 0 0 5px rgba(245, 158, 11, 0); }
}

/* ---------- Grade ---------- */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1fr);
  grid-template-areas:
    "saldo dividas cartao"
    "saldo dividas proximos";
  grid-template-rows: auto 1fr;
  gap: 20px;
  align-items: start;
}
.card--saldo { grid-area: saldo; align-self: stretch; }
.card--dividas { grid-area: dividas; }
.card--cartao { grid-area: cartao; }
.card--proximos { grid-area: proximos; }

/* ---------- Cartões ---------- */
.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 22px;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.card__head, .area__head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.card__head h2, .area__head h2 { font-size: 16px; font-weight: 600; letter-spacing: -.01em; flex: 1; }
.area__head h2 { font-size: 18px; }

.label { font-size: 12px; color: var(--muted); font-weight: 500; }
.meta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }

.money {
  font-weight: 700;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.money__cents { font-size: .55em; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.money--xl { font-size: 38px; margin: 4px 0 8px; }
.money--lg { font-size: 30px; margin-top: 4px; }

/* ---------- Saldo: esfera decorativa ---------- */
.card--saldo { display: flex; flex-direction: column; overflow: hidden; }
.orb {
  position: relative;
  height: 200px;
  margin: -6px 0 -60px;
  flex: 1;
  min-height: 170px;
}
.orb span {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
}
.orb__a {
  width: 190px; height: 190px;
  left: 50%; top: 50%;
  margin: -110px 0 0 -110px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, .95) 0 8%, transparent 26%),
    radial-gradient(circle at 70% 70%, #6d5dfc 0%, transparent 55%),
    radial-gradient(circle at 35% 65%, #f472b6 0%, transparent 60%),
    radial-gradient(circle at 60% 30%, #fb923c 0%, transparent 60%),
    #c7d2fe;
  box-shadow: inset -18px -24px 40px rgba(109, 93, 252, .35), inset 14px 16px 30px rgba(255, 255, 255, .6);
  animation: spin 18s linear infinite;
}
.orb__b {
  width: 90px; height: 90px;
  left: 18%; top: 14%;
  background: radial-gradient(circle at 35% 30%, #fff 0 10%, #bae6fd 40%, #93c5fd 100%);
  opacity: .85;
  animation: float 7s ease-in-out infinite;
}
.orb__c {
  width: 56px; height: 56px;
  right: 16%; top: 8%;
  background: radial-gradient(circle at 35% 30%, #fff 0 12%, #fbcfe8 45%, #f472b6 100%);
  opacity: .8;
  animation: float 9s ease-in-out infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-12px); }
}
.saldo-panel {
  position: relative;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .62);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 10px 30px rgba(17, 24, 39, .06);
}
.saldo-panel .btn { margin-top: 16px; }

/* ---------- Dívidas ---------- */
.split { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.split__right { text-align: right; }
.split__num { font-weight: 600; font-size: 15px; margin-top: 4px; }

.stack {
  display: flex; gap: 4px;
  height: 10px;
  margin: 16px 0 18px;
}
.stack span {
  width: var(--w);
  background: var(--c);
  border-radius: 999px;
  transform-origin: left;
  animation: grow .9s var(--ease) backwards .5s;
}
@keyframes grow { from { transform: scaleX(0); } }

.debt-list { display: grid; gap: 8px; }
.debt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "dot info value"
    ".   actions actions";
  gap: 10px 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--r-inner);
  background: rgba(255, 255, 255, .7);
  border: 1px solid var(--line);
  transition: background-color .25s var(--ease), border-color .25s var(--ease);
}
.debt:hover { background: #fff; border-color: rgba(37, 99, 235, .18); }
.debt__dot { grid-area: dot; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.debt__info { grid-area: info; min-width: 0; }
.debt__name { font-weight: 600; font-size: 14px; }
.debt__due { color: var(--muted); font-size: 12px; margin-top: 1px; }
.debt__value { grid-area: value; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right; }
.debt__actions { grid-area: actions; display: flex; gap: 6px; flex-wrap: wrap; }

.paid { margin-top: 12px; }
.paid > summary {
  list-style: none;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600; font-size: 13px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.paid > summary::-webkit-details-marker { display: none; }
.paid > summary:hover { background: rgba(255, 255, 255, .8); color: var(--blue-dark); }
.paid__chev { transition: transform .3s var(--ease); }
.paid[open] .paid__chev { transform: rotate(90deg); }
.paid[open] .debt-list { animation: fade-up .35s var(--ease); margin-top: 8px; }
.debt.is-paid { background: rgba(255, 255, 255, .4); }
.debt.is-paid .debt__name, .debt.is-paid .debt__value { color: var(--muted); text-decoration: line-through; }

/* ---------- Cartão de crédito ---------- */
.card-area { padding: 2px 4px 6px; }
.credit {
  position: relative;
  padding-top: 18px;
  transition: transform .4s var(--ease);
}
.credit:hover { transform: translateY(-4px) rotate(-1deg); }
.credit__layer {
  position: absolute;
  left: 50%;
  border-radius: 26px;
  transform: translateX(-50%);
}
.credit__layer--2 { top: 0; width: 80%; height: 40px; background: linear-gradient(90deg, #c4b5fd, #f9a8d4); opacity: .55; }
.credit__layer--1 { top: 8px; width: 90%; height: 40px; background: linear-gradient(90deg, #a5b4fc, #f0abfc); opacity: .8; }
.credit__face {
  position: relative;
  aspect-ratio: 1.62;
  border-radius: 26px;
  padding: 20px 22px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: #1e1b4b;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(255, 255, 255, .55), transparent 55%),
    linear-gradient(130deg, #c7d2fe 0%, #e9a8f5 45%, #fbb6a8 80%, #fde1c8 100%);
  box-shadow: 0 18px 40px rgba(109, 93, 252, .25), inset 0 1px 0 rgba(255, 255, 255, .6);
  overflow: hidden;
}
.credit__face::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .45) 45%, transparent 60%);
  transform: translateX(-100%);
  animation: shine 6s var(--ease) infinite 1.2s;
}
@keyframes shine {
  0%   { transform: translateX(-100%); }
  35%, 100% { transform: translateX(100%); }
}
.credit__top { display: flex; justify-content: space-between; align-items: center; }
.credit__chip {
  width: 38px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .8), rgba(255, 255, 255, .35));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7);
}
.credit__tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .5); }
.credit__value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.credit__value .money__cents { color: rgba(30, 27, 75, .65); }
.credit__bottom { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 600; }
.credit__days { padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, .55); font-size: 12px; }

/* ---------- Próximos vencimentos ---------- */
.due-list { display: grid; gap: 12px; }
.due-item { display: flex; align-items: center; gap: 12px; }
.due-item__info { flex: 1; min-width: 0; }
.due-item__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.date-badge {
  width: 46px; height: 46px;
  border-radius: 50%;
  display: grid; place-items: center; align-content: center;
  background: #111827;
  color: #fff;
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em; line-height: 1;
  flex-shrink: 0;
}
.date-badge strong { font-size: 15px; letter-spacing: 0; margin-bottom: 2px; }
.date-badge--warn { background: #f59e0b; color: #fff; }
.note { margin-top: 14px; font-size: 12px; color: var(--muted); }

/* ---------- Entrada suave ---------- */
.reveal { animation: fade-up .7s var(--ease) backwards; animation-delay: calc(var(--d, 0) * 80ms); }
@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Barra flutuante (celular) ---------- */
.dock { display: none; }

/* Tablet */
@media (max-width: 1080px) {
  .grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "saldo   cartao"
      "saldo   proximos"
      "dividas dividas";
    grid-template-rows: auto auto auto;
  }
}

/* Celular */
@media (max-width: 640px) {
  body { padding-bottom: 104px; }
  .shell {
    margin: 0;
    padding: 16px 16px 24px;
    border-radius: 0;
    border: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }
  .nav { display: none; }
  .brand { flex: 1; }
  .page { margin-top: 18px; }
  .page__head { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  h1 { font-size: 28px; }
  .add-menu--top { display: none; }

  .grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "saldo" "cartao" "dividas" "proximos";
    gap: 16px;
  }
  .card { padding: 18px; border-radius: 26px; }
  .card:hover { transform: none; }
  .orb { height: 150px; min-height: 150px; flex: none; margin-bottom: -50px; }
  .orb__a { width: 150px; height: 150px; margin: -85px 0 0 -75px; }
  .money--xl { font-size: 36px; }

  .dock {
    display: flex; align-items: center; gap: 8px;
    position: fixed;
    left: 16px; right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 40;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .75);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, .9);
    box-shadow: 0 12px 34px rgba(17, 24, 39, .12);
    animation: fade-up .6s var(--ease) backwards .3s;
  }
  .dock__item {
    width: 50px; height: 50px; border-radius: 50%;
    display: grid; place-items: center;
    color: var(--muted); flex-shrink: 0;
  }
  .dock__item.is-active { background: var(--blue-soft); color: var(--blue-dark); }
  .add-menu--dock { flex: 1; }
  .btn--dock { width: 100%; min-height: 50px; font-size: 15px; }
  .add-menu--dock .add-menu__list { top: auto; bottom: calc(100% + 14px); left: 0; right: 0; transform-origin: bottom center; }
  .add-menu--dock .add-menu__list button { padding: 14px 16px; font-size: 16px; }
}

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

/* =====================================================
   Etapa 3: janelas, campos, estados e aviso rápido
   ===================================================== */
:root {
  --c4: #22c55e;
  --c5: #0ea5e9;
  --c6: #eab308;
  --red: #dc2626;
  --red-text: #b91c1c;
  --red-soft: rgba(220, 38, 38, .12);
}

[hidden] { display: none !important; }

/* Avatar vira botão de menu */
.avatar { cursor: pointer; list-style: none; user-select: none; transition: transform .2s var(--ease); }
.avatar:hover { transform: scale(1.06); }
.avatar:active { transform: scale(.94); }
.avatar-menu > summary::-webkit-details-marker { display: none; }
.add-menu__list hr { border: 0; border-top: 1px solid var(--line); margin: 4px 8px; }
.add-menu__list > div { display: grid; gap: 2px; }

/* Dívida vencida */
.chip--late { background: var(--red-soft); color: var(--red-text); margin-left: 4px; }
.debt__due.is-late { color: var(--red-text); font-weight: 600; }
.date-badge--late { background: var(--red); color: #fff; }
.credit__days.is-late { background: #fee2e2; color: var(--red-text); }
.debt { transition: background-color .25s var(--ease), border-color .25s var(--ease), opacity .2s var(--ease), transform .2s var(--ease); }
.debt.is-leaving { opacity: 0; transform: translateX(14px) scale(.98); }

/* Mensagens de lista vazia e aviso da fatura */
.empty {
  margin: 4px 0;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-radius: var(--r-inner);
  background: rgba(255, 255, 255, .5);
  border: 1px dashed rgba(17, 24, 39, .12);
}
.alert-pill {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--warn-soft);
  color: var(--warn);
  font-weight: 600;
  font-size: 12px;
  text-align: center;
}

/* Botão de perigo e texto-botão */
.btn--danger { background: var(--red-soft); color: var(--red-text); }
.btn--danger:hover { background: rgba(220, 38, 38, .2); }
.link-btn {
  border: 0; background: none; cursor: pointer;
  color: var(--blue-dark); font-weight: 600; font-size: 13px;
  padding: 6px 8px; border-radius: 999px;
  transition: background-color .2s var(--ease);
}
.link-btn:hover { background: var(--blue-soft); }

/* ---------- Janelas (dialog) ---------- */
dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  width: 100%;
  max-width: min(440px, calc(100vw - 32px));
  overflow: visible;
}
dialog::backdrop {
  background: rgba(17, 24, 39, .28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
dialog[open] { animation: sheet-in .32s var(--ease); }
dialog[open]::backdrop { animation: fade-in .3s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  display: grid;
  gap: 16px;
  padding: 26px;
  border-radius: 32px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid #fff;
  box-shadow: 0 30px 80px rgba(17, 24, 39, .22);
}
.sheet h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.sheet__hint { color: var(--muted); font-size: 13px; margin-top: -8px; }
.sheet__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.sheet__actions .push-left { margin-right: auto; }

.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 13px; }
.field label em { font-style: normal; font-weight: 500; color: var(--muted); }
.field__box {
  display: flex; align-items: center; gap: 8px;
  height: 50px;
  padding: 0 16px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(17, 24, 39, .12);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.field__box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }
.field__box i { font-style: normal; font-weight: 600; color: var(--muted); }
.field__box input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: none;
  font: inherit; font-size: 16px; color: var(--text);
}
.field__box input::placeholder { color: #9ca3af; }
.field.has-error .field__box { border-color: var(--red); box-shadow: 0 0 0 4px rgba(220, 38, 38, .10); }
.field__err { color: var(--red-text); font-size: 12px; font-weight: 500; }
.field__err:empty { display: none; }

/* ---------- Aviso rápido ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .92);
  color: #fff;
  font-size: 13px; font-weight: 600;
  text-align: center;
  box-shadow: 0 16px 40px rgba(17, 24, 39, .25);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .25s var(--ease), transform .3s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  dialog { margin: auto auto calc(12px + env(safe-area-inset-bottom)); max-width: calc(100vw - 24px); }
  .sheet { padding: 22px 20px; border-radius: 30px; }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* Janelas: a coluna pode encolher em telas bem estreitas */
.sheet { grid-template-columns: minmax(0, 1fr); }
.field, .field__box { min-width: 0; }
.field__box input[type="date"] { min-width: 0; width: 100%; }
.sheet__actions { flex-wrap: wrap; }

/* =====================================================
   Etapa 4: cartão de assinaturas
   ===================================================== */
.card--assin { grid-area: assin; }
.card--assin .debt-list { margin-top: 16px; }
.card--assin .note { margin-top: 14px; }
.debt__value small { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 2px; }

.field__box select {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: none;
  font: inherit; font-size: 16px; color: var(--text);
  cursor: pointer;
}

/* Grade: as regras abaixo substituem as anteriores, em todos os tamanhos */
.grid {
  grid-template-areas:
    "saldo dividas cartao"
    "assin dividas proximos";
  grid-template-rows: auto auto;
}
.card--saldo { align-self: start; }

@media (max-width: 1080px) {
  .grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "saldo   cartao"
      "saldo   proximos"
      "assin   assin"
      "dividas dividas";
    grid-template-rows: auto auto auto auto;
  }
  .card--saldo { align-self: stretch; }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "saldo" "cartao" "assin" "dividas" "proximos";
    grid-template-rows: none;
  }
  .card--saldo { align-self: start; }
}
