/* Doce Controle — rosa morango + chocolate */
:root {
  color-scheme: light;
  --bg: #fdf2f5;            /* rosa bem clarinho */
  --surface: #fffaf8;       /* creme */
  --surface-2: #fbe6ec;     /* rosa clarinho */
  --line: #f1d6de;
  --choc: #4b2a20;          /* chocolate */
  --choc-2: #6e4436;
  --text: #4b2a20;
  --text-2: #7a5244;
  --muted: #a8857a;
  --rosa: #d65f8a;
  --rosa-forte: #b8456f;
  --rosa-soft: #fce1ea;
  --accent: #b8456f;
  --accent-ink: #ffffff;
  --in: #d65f8a;            /* entradas */
  --out: #8f4a1f;           /* gastos */
  --good: #2f7d4a;
  --bad: #c0362c;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(75, 42, 32, .06), 0 6px 20px rgba(184, 69, 111, .08);
  --serif: "Fraunces", Georgia, serif;
  --sprinkles: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg opacity='.55'%3E%3Crect x='10' y='14' width='12' height='4' rx='2' fill='%23d65f8a' transform='rotate(35 16 16)'/%3E%3Crect x='70' y='20' width='12' height='4' rx='2' fill='%238f4a1f' transform='rotate(-20 76 22)'/%3E%3Crect x='40' y='60' width='12' height='4' rx='2' fill='%23f3a9c0' transform='rotate(70 46 62)'/%3E%3Crect x='95' y='75' width='12' height='4' rx='2' fill='%23d65f8a' transform='rotate(-55 101 77)'/%3E%3Crect x='15' y='95' width='12' height='4' rx='2' fill='%23c98b6b' transform='rotate(10 21 97)'/%3E%3Crect x='65' y='100' width='12' height='4' rx='2' fill='%23f3a9c0' transform='rotate(-30 71 102)'/%3E%3Ccircle cx='55' cy='30' r='2.5' fill='%23b8456f'/%3E%3Ccircle cx='100' cy='45' r='2.5' fill='%23f3a9c0'/%3E%3Ccircle cx='20' cy='60' r='2.5' fill='%238f4a1f'/%3E%3C/g%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
}
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--serif); }

/* ---------- Logo ---------- */
.logo {
  width: 44px; height: 44px; border-radius: 50%; background: var(--rosa-soft);
  display: grid; place-items: center; font-size: 24px; flex: none;
  box-shadow: inset 0 0 0 2px #fff, 0 2px 8px rgba(184, 69, 111, .25);
}
.brand-name { font-family: var(--serif); font-weight: 700; font-style: italic; letter-spacing: -.01em; }

/* ---------- Login ---------- */
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
  background: var(--sprinkles), linear-gradient(180deg, #fde4ec 0%, var(--bg) 60%);
}
.auth-card {
  position: relative; width: 100%; max-width: 400px; background: var(--surface);
  border-radius: 28px; padding: 64px 24px 26px; box-shadow: 0 12px 40px rgba(75, 42, 32, .14);
  overflow: hidden;
}
.auth-card .drip { position: absolute; top: 0; left: 0; right: 0; height: 46px; color: var(--choc); }
.auth-card .drip::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 18px; background: currentColor; }
.auth-card .drip svg { position: absolute; top: 17px; left: 0; width: 100%; height: 26px; }
.auth-head { text-align: center; margin-bottom: 18px; }
.auth-head .logo { width: 72px; height: 72px; font-size: 38px; margin: 0 auto 10px; }
.auth-head h1 { font-size: 30px; margin: 0; color: var(--choc); }
.auth-head p { color: var(--text-2); margin: 6px 0 0; }
.auth-tabs { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 10px; border-radius: 999px; font-weight: 800; color: var(--text-2); cursor: pointer;
}
.auth-tabs button.on { background: var(--surface); color: var(--rosa-forte); box-shadow: var(--shadow); }
.link { background: none; border: 0; color: var(--rosa-forte); font-weight: 800; cursor: pointer; padding: 6px 0; }

/* ---------- Campos ---------- */
label.f { display: block; margin-bottom: 16px; }
label.f > span { display: block; font-size: 15px; font-weight: 800; color: var(--choc-2); margin-bottom: 7px; }
input.in, select.in, textarea.in {
  width: 100%; border: 2px solid var(--line); background: #fff; border-radius: 14px;
  padding: 12px 14px; font-size: 17px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input.in:focus, select.in:focus { border-color: var(--rosa); box-shadow: 0 0 0 4px var(--rosa-soft); }
input.in::placeholder { color: #c9aaa0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.money { position: relative; }
.money::before { content: "R$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 800; }
.money input { padding-left: 44px; font-weight: 800; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 800; cursor: pointer; font-size: 16px;
  transition: transform .1s, filter .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, var(--rosa) 0%, var(--rosa-forte) 100%); color: #fff; width: 100%; box-shadow: 0 6px 16px rgba(184, 69, 111, .3); }
.btn.choc { background: var(--choc); color: #fff; box-shadow: 0 6px 16px rgba(75, 42, 32, .25); }
.btn.ghost { background: var(--surface-2); color: var(--choc); }
.btn.danger { background: transparent; color: var(--bad); }
.btn:disabled { opacity: .6; cursor: default; }
.msg { font-size: 15px; padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; }
.msg.err { background: #fde8e6; color: var(--bad); }
.msg.ok { background: #e7f4ea; color: var(--good); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 2px solid var(--line); background: #fff; border-radius: 999px;
  padding: 9px 15px; font-weight: 800; font-size: 15px; cursor: pointer; color: var(--text-2);
}
.chip.on { border-color: var(--rosa); background: var(--rosa-soft); color: var(--choc); }

/* ---------- Topo (bolo com cobertura de chocolate) ---------- */
header.top { position: sticky; top: 0; z-index: 10; background: var(--choc); color: #fff3ee; }
header.top::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 22px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 24' preserveAspectRatio='none'%3E%3Cpath fill='%234b2a20' d='M0 0H400V6Q392 6 390 11Q388 20 382 20Q376 20 375 11Q373 6 360 6H330Q322 6 321 9Q320 14 315 14Q310 14 309 9Q308 6 300 6H250Q242 6 240 13Q238 24 231 24Q224 24 223 13Q221 6 212 6H170Q163 6 162 9Q161 15 156 15Q151 15 150 9Q149 6 142 6H95Q88 6 86 12Q84 21 78 21Q72 21 71 12Q69 6 60 6H30Q24 6 23 8Q22 12 18 12Q14 12 13 8Q12 6 6 6H0Z'/%3E%3C/svg%3E") center top / 100% 100% no-repeat;
}
.top-inner { max-width: 760px; margin: 0 auto; padding: 12px 16px 6px; display: flex; align-items: center; gap: 12px; }
.top-inner .logo { background: #fce1ea; }
.top-inner .who { flex: 1; min-width: 0; }
.who b { display: block; font-family: var(--serif); font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small { color: #e8bfb0; font-size: 13px; }
.top-btn { background: rgba(255, 255, 255, .12); color: #fff3ee; border: 0; border-radius: 12px; padding: 8px 14px; font-weight: 800; font-size: 14px; cursor: pointer; }
.month { max-width: 760px; margin: 0 auto; padding: 4px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.month h2 { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 600; }
.month-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 22px; cursor: pointer; display: grid; place-items: center; }
.client-pick { max-width: 760px; margin: 0 auto; padding: 0 16px 8px; }
.client-pick select { padding: 9px 12px; font-size: 15px; background: #fff3ee; color: var(--choc); border: 0; }

main { max-width: 760px; margin: 0 auto; padding: 34px 16px 16px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h3 { margin: 0 0 2px; font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--choc); }
.card .sub { color: var(--muted); font-size: 14px; margin: 0 0 14px; }

/* Saudação */
.hello { margin: 0 2px 16px; }
.hello h2 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--choc); }
.hello p { margin: 4px 0 0; color: var(--text-2); font-size: 16px; }
.hello p b { color: var(--choc); }

/* Lucro (cartão de chocolate) */
.hero {
  position: relative; overflow: hidden; border-radius: 24px; padding: 20px 20px 18px; margin-bottom: 12px; color: #fff3ee;
  background: var(--sprinkles) right -48px top -56px / 150px no-repeat, linear-gradient(150deg, #6b3b2c 0%, var(--choc) 70%);
  box-shadow: 0 10px 28px rgba(75, 42, 32, .28);
}
.hero .lbl { font-weight: 800; font-size: 15px; color: #f5c6d4; }
.hero .val { font-family: var(--serif); font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin-top: 2px; }
.hero .val.neg { color: #ffb4a8; }
.hero .hint { color: #e8cfc6; font-size: 15px; margin-top: 4px; }
.hero .bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .15); margin-top: 14px; overflow: hidden; display: flex; }
.hero .bar i { display: block; height: 100%; }
.hero .bar-legend { display: flex; justify-content: space-between; font-size: 13px; color: #e8cfc6; margin-top: 6px; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .lbl { font-size: 14px; font-weight: 800; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.kpi .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.kpi .val { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; color: var(--choc); }
.kpi .hint { font-size: 13px; color: var(--muted); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.quick .btn { width: 100%; padding: 16px 10px; font-size: 16px; border-radius: 18px; }
.quick .btn .e { font-size: 22px; }

.pos { color: var(--good); }
.neg { color: var(--bad); }
.alert { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--choc-2); background: #fff4e5; border: 1.5px solid #f7d9a8; border-radius: 16px; padding: 12px 14px; margin-bottom: 14px; }

.chart-box { position: relative; height: 230px; }
.legend { display: flex; gap: 16px; font-size: 14px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.tip { display: flex; gap: 10px; background: var(--rosa-soft); border-radius: 16px; padding: 12px 14px; font-size: 15px; color: var(--choc-2); margin-bottom: 14px; }

/* Listas */
.day { margin: 20px 4px 8px; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; display: flex; justify-content: space-between; }
.item {
  display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 16px; padding: 12px 14px;
  margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer; width: 100%; border: 0; text-align: left;
}
.item:active { transform: scale(.99); }
.item .ic { width: 42px; height: 42px; border-radius: 50%; background: var(--rosa-soft); display: grid; place-items: center; font-size: 20px; flex: none; }
.item.out .ic { background: #f5e6dc; }
.item .tx { flex: 1; min-width: 0; }
.item .tx b { display: block; font-weight: 800; color: var(--choc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .tx small { color: var(--muted); font-size: 13.5px; }
.item .v { font-weight: 800; white-space: nowrap; text-align: right; color: var(--choc); }
.item.in .v { color: var(--rosa-forte); }
.tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-top: 2px; }
.tag.pend { background: #fff0d9; color: #8a5a12; }
.empty { text-align: center; color: var(--text-2); padding: 36px 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.empty .big { font-size: 52px; line-height: 1; margin-bottom: 8px; }
.empty b { font-family: var(--serif); font-size: 20px; color: var(--choc); font-weight: 600; }
.totbar {
  display: flex; justify-content: space-between; align-items: center; border-radius: 20px; padding: 16px 18px; color: #fff;
  background: linear-gradient(150deg, var(--rosa) 0%, var(--rosa-forte) 100%); box-shadow: 0 8px 22px rgba(184, 69, 111, .28);
}
.totbar.out { background: linear-gradient(150deg, #6b3b2c 0%, var(--choc) 100%); box-shadow: 0 8px 22px rgba(75, 42, 32, .25); }
.totbar span { font-weight: 800; opacity: .9; }
.totbar b { font-family: var(--serif); font-size: 26px; }

.fab {
  position: fixed; right: max(16px, calc(50% - 364px)); bottom: 96px; z-index: 20;
  height: 58px; padding: 0 24px; border-radius: 999px; border: 0; color: #fff;
  background: linear-gradient(180deg, var(--rosa) 0%, var(--rosa-forte) 100%);
  font-weight: 800; font-size: 17px; box-shadow: 0 8px 22px rgba(184, 69, 111, .45); cursor: pointer;
}
.fab.out { background: var(--choc); box-shadow: 0 8px 22px rgba(75, 42, 32, .4); }

nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 15; background: var(--surface);
  box-shadow: 0 -4px 20px rgba(75, 42, 32, .08); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom);
  border-radius: 22px 22px 0 0;
}
nav.tabs .wrap { display: flex; max-width: 760px; width: 100%; padding: 8px 8px 10px; gap: 4px; }
nav.tabs button {
  flex: 1; border: 0; background: none; padding: 7px 2px 6px; font-size: 13px; font-weight: 800; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; border-radius: 16px;
}
nav.tabs button .e { font-size: 23px; line-height: 1; opacity: .55; }
nav.tabs button.on { background: var(--rosa-soft); color: var(--rosa-forte); }
nav.tabs button.on .e { opacity: 1; }

/* Formulário (folha que sobe) */
.sheet-bg { position: fixed; inset: 0; background: rgba(75, 42, 32, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  border-radius: 28px 28px 0 0; padding: 10px 18px 26px;
}
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 12px; }
@media (min-width: 640px) { .sheet-bg { align-items: center; } .sheet { border-radius: 28px; } .sheet::before { display: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h3 { margin: 0; font-family: var(--serif); font-size: 23px; color: var(--choc); }
.close-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--choc); font-size: 18px; cursor: pointer; }
.sheet .actions { display: flex; gap: 10px; margin-top: 10px; }
.sheet .actions .btn.primary { flex: 1; }
.sheet.out .btn.primary { background: var(--choc); box-shadow: 0 6px 16px rgba(75, 42, 32, .25); }

/* Relatório */
.rep h2 { margin: 0; font-family: var(--serif); font-size: 26px; color: var(--choc); }
.rep .meta { color: var(--muted); font-size: 14px; margin-bottom: 14px; }
table.t { width: 100%; border-collapse: collapse; font-size: 15px; }
table.t th, table.t td { padding: 9px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.t th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.tot td { font-weight: 800; border-bottom: 0; color: var(--choc); }
.rep-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.rep-actions .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: 168px; transform: translateX(-50%); background: var(--choc); color: #fff3ee;
  padding: 12px 18px; border-radius: 999px; font-weight: 800; z-index: 60; font-size: 15px; box-shadow: 0 8px 20px rgba(75, 42, 32, .3);
}

@media print {
  body { background: #fff; padding: 0; }
  header.top, nav.tabs, .fab, .rep-actions, .no-print, .toast { display: none !important; }
  main { max-width: none; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ecd3da; break-inside: avoid; }
}
