/* Método MP — app de controle. Coluna única tipo celular, abas embaixo, um número grande por tela.
   Mesma identidade da Calculadora de Preço Certo: vinho, rosé, dourado, Playfair + Montserrat. */
:root{
  --bg:#F3E4DE; --surface:#FFFFFF; --surface-2:#FAF3F0; --line:#E5D2CA; --wave:#EBD5CD;
  --fg:#2B2B2B; --muted:#6E5F5A; --wine:#6B1E3A; --wine-soft:#F0DCE2; --on-wine:#FFF7F3;
  --profit:#2F7D5B; --profit-soft:#DDEFE5; --warn:#A8670F; --warn-soft:#F7E7CC; --loss:#B5473A; --loss-soft:#F6DCD6;
  --gold:#C9A46A; --gold-text:#9A7638;
  --display:"Playfair Display", Georgia, "Times New Roman", serif;
  --body:"Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease:cubic-bezier(0.23, 1, 0.32, 1);          /* saída forte: entradas, toques */
  --ease-gaveta:cubic-bezier(0.32, 0.72, 0, 1);   /* janela que sobe de baixo (estilo iOS) */
  --shadow:0 1px 2px rgba(107,30,58,.05), 0 10px 26px -14px rgba(107,30,58,.18);
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#1C1315; --surface:#271B1E; --surface-2:#2F2124; --line:#43313A; --wave:#2A1C20;
  --fg:#F3E4DE; --muted:#BDA9A3; --wine:#E39AB4; --wine-soft:#3A2329; --on-wine:#1C1315;
  --profit:#62C08F; --profit-soft:#1F3A2C; --warn:#E3B160; --warn-soft:#3B2E17; --loss:#E58373; --loss-soft:#40211D;
  --gold:#D8B983; --gold-text:#D8B983; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#1C1315; --surface:#271B1E; --surface-2:#2F2124; --line:#43313A; --wave:#2A1C20;
  --fg:#F3E4DE; --muted:#BDA9A3; --wine:#E39AB4; --wine-soft:#3A2329; --on-wine:#1C1315;
  --profit:#62C08F; --profit-soft:#1F3A2C; --warn:#E3B160; --warn-soft:#3B2E17; --loss:#E58373; --loss-soft:#40211D;
  --gold:#D8B983; --gold-text:#D8B983; color-scheme:dark}

*{box-sizing:border-box}
[hidden]{display:none !important}
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--fg);font-family:var(--body);font-size:16px;line-height:1.5;
  -webkit-tap-highlight-color:transparent;overflow-x:hidden;position:relative;
  padding-left:max(16px, env(safe-area-inset-left, 0px));padding-right:max(16px, env(safe-area-inset-right, 0px));
  padding-top:calc(env(safe-area-inset-top, 0px) + 18px);padding-bottom:calc(env(safe-area-inset-bottom, 0px) + 104px)}
body.sem-abas{padding-bottom:calc(env(safe-area-inset-bottom, 0px) + 32px)}
::selection{background:var(--wine-soft);color:var(--wine)}
input,select,textarea{caret-color:var(--wine)}
button{font:inherit;color:inherit;touch-action:manipulation}
:focus-visible{outline:2px solid var(--wine);outline-offset:2px}
.waves{position:absolute;top:0;left:0;width:100%;height:260px;z-index:0;pointer-events:none}
.waves path{fill:var(--wave)} .waves path.line{fill:none;stroke:var(--gold);stroke-width:1.2;opacity:.55;vector-effect:non-scaling-stroke}

.wrap{position:relative;z-index:1;max-width:600px;margin:0 auto;display:flex;flex-direction:column;gap:16px}
.wrap.largo{max-width:1080px}
.topo{display:flex;align-items:center;justify-content:space-between;gap:12px}
.brand{display:flex;align-items:center;gap:10px;min-width:0}
.mono{flex:none;width:38px;height:38px;border-radius:50%;background:var(--wine);color:var(--on-wine);display:grid;place-items:center;font-family:var(--display);font-weight:700;font-size:15px}
.brand-name{font-weight:700;font-size:14px;color:var(--wine);line-height:1.2}
.brand-name small{display:block;font-weight:500;font-size:12px;color:var(--muted)}

h1,h2,h3{margin:0;text-wrap:balance}
h1{font-family:var(--display);font-weight:700;font-size:clamp(26px,6vw,34px);line-height:1.15;color:var(--wine)}
h2{font-family:var(--display);font-weight:700;font-size:21px;line-height:1.25}
h3{font-size:15px;font-weight:700}
p{margin:0}
.muted{color:var(--muted)}
.small{font-size:13px}
.eyebrow{font-size:12px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;color:var(--gold-text)}
.num{font-variant-numeric:tabular-nums}
.pos{color:var(--profit)} .neg{color:var(--loss)} .warn-t{color:var(--warn)}

.card{background:var(--surface);border-radius:22px;padding:20px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:14px;min-width:0}
.card.flat{box-shadow:none;border:1.5px solid var(--line)}
.stack{display:flex;flex-direction:column;gap:12px}
.row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.between{display:flex;align-items:center;justify-content:space-between;gap:12px}

/* Botões grandes: pensados para dedo, não para mouse */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:50px;padding:12px 20px;border-radius:999px;border:0;
  background:var(--wine);color:var(--on-wine);font-weight:700;font-size:16px;cursor:pointer;text-decoration:none;
  touch-action:manipulation;user-select:none;-webkit-user-select:none;transition:transform 160ms var(--ease), opacity 160ms var(--ease), background-color 200ms ease, color 200ms ease}
.btn:active{transform:scale(.97)}
.btn[disabled]{opacity:.45;cursor:not-allowed}
.btn.full{width:100%}
.btn.ghost{background:transparent;color:var(--wine);border:1.5px solid var(--wine)}
.btn.soft{background:var(--wine-soft);color:var(--wine)}
.btn.danger{background:var(--loss);color:#fff}
.btn.sm{min-height:40px;padding:8px 14px;font-size:14px}
.link{background:none;border:0;padding:6px 2px;color:var(--wine);font-weight:600;cursor:pointer;text-decoration:underline;text-underline-offset:3px;font-size:14px}
.google{background:var(--surface);color:var(--fg);border:1.5px solid var(--line)}
.google svg{width:20px;height:20px}

.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{font-size:15px;font-weight:600;border:1.5px solid var(--line);background:var(--surface);color:var(--fg);padding:10px 16px;min-height:46px;border-radius:999px;cursor:pointer;
  touch-action:manipulation;user-select:none;-webkit-user-select:none;transition:transform 160ms var(--ease), background-color 200ms var(--ease), border-color 200ms var(--ease)}
.chip:active{transform:scale(.96)}
.chip[aria-pressed="true"]{border-color:var(--wine);background:var(--wine-soft);color:var(--wine)}
.chip small{display:block;font-weight:500;font-size:12px;color:var(--muted)}
.chips.opcoes .chip{flex:1 1 140px;border-radius:16px;text-align:left;padding:12px 14px}

.field{display:flex;flex-direction:column;gap:6px;min-width:0}
.field>label,.field>.lbl{font-size:15px;font-weight:600;line-height:1.35}
.hint{font-size:13px;color:var(--muted)}
.input{display:flex;align-items:center;background:var(--surface-2);border:1.5px solid var(--line);border-radius:14px;overflow:hidden;transition:border-color 160ms var(--ease), box-shadow 160ms var(--ease)}
.input:focus-within{border-color:var(--wine);box-shadow:0 0 0 3px var(--wine-soft)}
.input b{font-weight:600;font-size:15px;color:var(--muted);padding-left:14px}
.input b.after{padding:0 14px 0 0}
.input input,.input select{font:inherit;font-size:18px;font-variant-numeric:tabular-nums;border:0;background:transparent;color:var(--fg);padding:12px 14px;width:100%;min-width:0;min-height:50px}
.input input:focus,.input select:focus{outline:none}
.input input[type=date]{-webkit-appearance:none;appearance:none;text-align:left;display:block}
.input input[type=date]::-webkit-date-and-time-value{text-align:left}
.grid2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
@media (max-width:420px){.grid2{grid-template-columns:minmax(0,1fr)}}
.erro{color:var(--loss);font-size:14px;font-weight:600}
.check{display:flex;gap:10px;align-items:flex-start;font-size:14px}
.check input{width:22px;height:22px;accent-color:var(--wine);flex:none;margin-top:1px}

/* Mês: seletor */
.mesnav{display:flex;align-items:center;justify-content:space-between;gap:8px;background:var(--surface);border-radius:999px;padding:4px;box-shadow:var(--shadow)}
.mesnav button{width:44px;height:44px;border-radius:50%;border:0;background:transparent;color:var(--wine);font-size:22px;cursor:pointer;display:grid;place-items:center;transition:transform 160ms var(--ease), background-color 160ms ease}
.mesnav button:active{background:var(--wine-soft);transform:scale(.92)}
.mesnav button[disabled]{opacity:.3}
.mesnav strong{font-size:16px}

/* Número principal */
.hero{gap:10px}
.big{font-family:var(--display);font-weight:700;font-size:clamp(42px,12vw,56px);line-height:1;font-variant-numeric:tabular-nums}
.pill{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;font-size:13px;font-weight:700;padding:5px 12px;border-radius:999px}
.pill i{width:9px;height:9px;border-radius:50%;background:currentColor}
.pill.verde{background:var(--profit-soft);color:var(--profit)}
.pill.amarelo{background:var(--warn-soft);color:var(--warn)}
.pill.vermelho{background:var(--loss-soft);color:var(--loss)}
.pill.vazio{background:var(--surface-2);color:var(--muted)}
.frase{font-size:16px}

.tiles{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.tile.wide{grid-column:1/-1;flex-direction:row;align-items:baseline;flex-wrap:wrap;gap:4px 10px}
.tile{background:var(--surface);border-radius:18px;padding:14px 12px;box-shadow:var(--shadow);display:flex;flex-direction:column;gap:4px;min-width:0}
.tile span{font-size:12.5px;color:var(--muted);font-weight:600}
.tile strong{font-size:clamp(17px,5vw,22px);font-variant-numeric:tabular-nums;white-space:nowrap}
.tile small{font-size:12px;color:var(--muted)}

.meter{height:14px;border-radius:7px;background:var(--surface-2);overflow:hidden;border:1px solid var(--line)}
.meter div{height:100%;background:var(--wine);border-radius:7px;transition:width 300ms var(--ease)}
.meter.ok div{background:var(--profit)}

.lines{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:10px}
.lines li{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 12px;align-items:center;font-size:15px}
.lines li .v{font-variant-numeric:tabular-nums;font-weight:600}
.lines li .b{grid-column:1/-1;height:6px;border-radius:3px;background:var(--surface-2);overflow:hidden}
.lines li .b i{display:block;height:100%;background:var(--gold);border-radius:3px}
.lines li.total{border-top:1.5px dashed var(--line);padding-top:10px;font-weight:700}

details.mais{gap:0}
details.mais>:not(summary){margin-top:12px}
details.mais summary{touch-action:manipulation;-webkit-user-select:none;user-select:none;cursor:pointer;color:var(--wine);font-weight:700;list-style:none;display:flex;align-items:center;gap:6px;font-size:15px;min-height:40px}
details.mais summary::-webkit-details-marker{display:none}
details.mais summary::before{content:"+";display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;border:1.5px solid currentColor;font-size:13px;line-height:1}
details.mais[open] summary::before{content:"−"}
@supports selector(::details-content){
  details.mais{interpolate-size:allow-keywords}
  details.mais::details-content{block-size:0;opacity:0;overflow:clip;transition:block-size 260ms var(--ease), opacity 200ms ease, content-visibility 260ms allow-discrete}
  details.mais[open]::details-content{block-size:auto;opacity:1}
}

/* Gráfico do ano */
.ano{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:4px;align-items:end;height:150px;padding-top:6px;position:relative}
.ano .col{display:flex;flex-direction:column;align-items:center;height:100%;gap:4px;background:none;border:0;padding:0;cursor:pointer;border-radius:8px}
.ano .col[disabled]{cursor:default}
.ano .plot{flex:1;position:relative;width:100%}
.ano .bar{position:absolute;left:50%;transform:translateX(-50%);width:70%;max-width:26px;border-radius:4px;background:var(--profit)}
.ano .bar.neg{background:var(--loss)}
.ano .bar.none{background:var(--line)}
.ano .zl{position:absolute;left:0;right:0;border-top:1px dashed var(--muted);opacity:.5}
.ano .col.sel .bar{outline:2px solid var(--wine);outline-offset:2px}
.ano .col.sel>span:last-child{color:var(--wine);font-weight:700}
.ano .col>span:last-child{font-size:10.5px;color:var(--muted)}
@media (max-width:359px){.ano{gap:2px}.ano .col>span:last-child{font-size:9px;letter-spacing:-.02em}}

/* Lista de lançamentos */
.dia{font-size:13px;font-weight:700;color:var(--muted);text-transform:capitalize;padding:6px 4px 0}
.item{display:grid;grid-template-columns:40px minmax(0,1fr) auto;gap:12px;align-items:center;background:var(--surface);border-radius:16px;padding:12px 14px;border:0;width:100%;text-align:left;cursor:pointer;box-shadow:var(--shadow)}
.item{transition:transform 160ms var(--ease)}
.item:active{transform:scale(.98)}
.item .ic{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font-weight:700;font-size:18px}
.item .ic.a{background:var(--profit-soft);color:var(--profit)}
.item .ic.g{background:var(--loss-soft);color:var(--loss)}
.item .ic.r{background:var(--wine-soft);color:var(--wine)}
.item .t{font-weight:600;font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.item .s{font-size:13px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.item .v{font-weight:700;font-variant-numeric:tabular-nums}
.vazio-box{text-align:center;padding:28px 16px;color:var(--muted);display:flex;flex-direction:column;gap:12px;align-items:center}

/* Serviços */
.serv .nome{font-weight:700;font-size:17px}
.serv .det{font-size:14px;color:var(--muted)}
.serv .sobra{font-size:15px}
.serv .sobra strong{font-size:20px;font-variant-numeric:tabular-nums}

/* Aviso de exemplo / demonstração */
.aviso{background:var(--warn-soft);color:var(--fg);border-radius:18px;padding:14px 16px;display:flex;flex-direction:column;gap:10px;font-size:14px}
.aviso strong{color:var(--warn)}

/* Barra de abas */
.tabbar{position:fixed;left:0;right:0;bottom:0;z-index:20;background:var(--surface);border-top:1.5px solid var(--line);
  padding:6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));align-items:end;box-shadow:0 -10px 26px -18px rgba(107,30,58,.3)}
.tabbar button{border:0;background:none;display:flex;flex-direction:column;align-items:center;gap:2px;padding:6px 2px;min-height:56px;font-size:11.5px;font-weight:600;color:var(--muted);cursor:pointer;touch-action:manipulation}
.tabbar button svg{width:24px;height:24px;stroke:currentColor;fill:none;stroke-width:1.8}
.tabbar button[aria-current="page"]{color:var(--wine)}
.tabbar .fab{position:relative}
.tabbar .fab span.plus{width:58px;height:58px;margin-top:-26px;border-radius:50%;background:var(--wine);color:var(--on-wine);display:grid;place-items:center;font-size:32px;font-weight:400;line-height:1;box-shadow:0 8px 20px -8px rgba(107,30,58,.6);border:4px solid var(--bg)}
.tabbar .fab{color:var(--wine)}
.tabbar button{white-space:nowrap;min-width:0;transition:color 160ms ease}
.tabbar button svg{transition:transform 160ms var(--ease)}
.tabbar button:active svg{transform:scale(.88)}
.tabbar .fab span.plus{transition:transform 160ms var(--ease)}
.tabbar .fab:active span.plus{transform:scale(.92)}
@media (max-width:359px){.tabbar{padding-left:max(2px, env(safe-area-inset-left, 0px));padding-right:max(2px, env(safe-area-inset-right, 0px))}
  .tabbar button{font-size:10px;letter-spacing:-.01em;padding:6px 0}
  .tabbar .fab span.plus{width:52px;height:52px;font-size:28px}}

/* Janela que sobe de baixo */
.veu{position:fixed;inset:0;z-index:40;background:rgba(28,19,21,.45);display:flex;align-items:flex-end;justify-content:center;opacity:0;transition:opacity 200ms ease}
.veu.on{opacity:1;transition-duration:300ms}
.sheet{background:var(--bg);width:100%;max-width:600px;max-height:92vh;max-height:92dvh;overflow-y:auto;border-radius:26px 26px 0 0;
  padding:10px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  transform:translateY(100%);transition:transform 220ms var(--ease-gaveta);display:flex;will-change:transform;flex-direction:column;gap:16px;overscroll-behavior:contain}
.veu.on .sheet{transform:none;transition-duration:380ms}
.sheet.arrastando{transition:none}
.sheet .alca{width:44px;height:5px;border-radius:3px;background:var(--line);align-self:center;flex:none;position:relative}
.sheet .alca::after{content:"";position:absolute;inset:-14px -40px}
.sheet .alca,.sheet .cab{touch-action:none}
.sheet .cab{display:flex;align-items:center;justify-content:space-between;gap:12px}
.x{width:44px;height:44px;border-radius:50%;border:0;background:var(--surface);color:var(--fg);font-size:22px;cursor:pointer;flex:none}
@media (min-width:640px){.veu{align-items:center}
  .sheet{border-radius:26px;max-height:88vh;max-height:88dvh;transform:scale(.96);opacity:0;transition:transform 200ms var(--ease), opacity 200ms ease}
  .veu.on .sheet{transform:none;opacity:1;transition-duration:240ms}
  .sheet .alca{display:none}}

.toast{position:fixed;left:50%;bottom:calc(96px + env(safe-area-inset-bottom, 0px));transform:translate(-50%,20px);z-index:60;background:var(--fg);color:var(--bg);
  padding:12px 18px;border-radius:999px;font-weight:600;font-size:15px;opacity:0;transition:opacity 200ms var(--ease), transform 200ms var(--ease);pointer-events:none;max-width:calc(100% - 32px);text-align:center}
.toast.on{opacity:1;transform:translate(-50%,0)}

/* Passo a passo do cadastro */
.passos{display:flex;gap:6px}
.passos i{flex:1;height:5px;border-radius:3px;background:var(--line)}
.passos i.on{background:var(--wine)}
.linha-edit{display:grid;grid-template-columns:minmax(0,1fr) 120px 44px;gap:8px;align-items:center}
.linha-edit .input input{font-size:16px;min-height:46px;padding:10px 12px}
.rm{width:44px;height:44px;border-radius:50%;border:1.5px solid var(--line);background:var(--surface);color:var(--muted);font-size:20px;cursor:pointer}
.serv-edit{border:1.5px solid var(--line);border-radius:18px;padding:14px;display:flex;flex-direction:column;gap:10px;background:var(--surface)}

.carregando{min-height:60vh;min-height:60dvh;display:grid;place-items:center;color:var(--muted)}
.tabela{width:100%;border-collapse:collapse;font-size:14px}
.tabela th{font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted);text-align:left;padding:8px 10px;border-bottom:1.5px solid var(--line);white-space:nowrap}
.tabela td{padding:12px 10px;border-bottom:1px solid var(--line);font-variant-numeric:tabular-nums;vertical-align:middle}
.tabela tr.click{cursor:pointer}
@media (hover:hover) and (pointer:fine){.tabela tr.click:hover td{background:var(--surface-2)}}
.scroll-x{overflow-x:auto;-webkit-overflow-scrolling:touch}
/* Entrada de tela e barras que crescem (o único momento "de enfeite" do app) */
@keyframes crescerX{from{scale:0 1}}
@keyframes crescerY{from{scale:1 0}}
.entra .meter div,.entra .lines li .b i{transform-origin:left center;animation:crescerX 520ms var(--ease) backwards}
.entra .ano .bar{transform-origin:center bottom;animation:crescerY 520ms var(--ease) backwards}
.entra .ano .bar.neg{transform-origin:center top}
.entra .lines li:nth-child(2) .b i{animation-delay:40ms}
.entra .lines li:nth-child(3) .b i{animation-delay:80ms}
.entra .lines li:nth-child(4) .b i{animation-delay:120ms}
.entra .lines li:nth-child(5) .b i{animation-delay:160ms}
.carregando{animation:aparecer 400ms ease 300ms backwards}
@keyframes aparecer{from{opacity:0}}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation:none !important;scroll-behavior:auto !important}
  .btn:active,.chip:active,.item:active,.mesnav button:active,.tabbar button:active svg,.tabbar .fab:active span.plus{transform:none}
  .sheet,.veu.on .sheet{transform:none !important;transition:opacity 200ms ease}
  .toast{transform:translate(-50%,0)}
}
.x.engrenagem{display:grid;place-items:center;box-shadow:var(--shadow)}
.x.engrenagem svg{width:22px;height:22px;stroke:var(--wine);fill:none;stroke-width:1.8}
.x.engrenagem[aria-current="page"]{background:var(--wine-soft)}
