/* Compras Paraguai — visual baseado em /settings/references do PMS
   (paleta Hospio clara/escura, fonte Figtree, ícones Lucide) */
@font-face { font-family: Figtree; font-style: normal; font-weight: 300 900; font-display: swap; src: url(/fonts/figtree-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Figtree; font-style: normal; font-weight: 300 900; font-display: swap; src: url(/fonts/figtree-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4, U+2C60-2C7F, U+A720-A7FF; }

[hidden] { display: none !important; }

/* ---------- tema claro ---------- */
:root {
  color-scheme: light;
  --fundo: #ecede8; --superficie: #ffffff; --superficie-2: #f4f5f1;
  --borda: #e4e6dd; --borda-2: #cfd3c5;
  --texto: #263441; --texto-2: #3c4a56; --sub: #6b7670; --apagado: #8b938d;
  --primario: #52708c; --primario-forte: #3e5468; --primario-suave: #e6ecf2; --primario-texto: #3e5468;
  --marca: #597c61;
  --ok: #047857; --ok-suave: #e3f3ea; --ruim: #c10007; --ruim-suave: #fbe7e5;
  --topo: #ffffff; --topo-texto: #263441;
  --trilho: #e4e6dd;
  --sombra: 0 1px 2px rgba(38, 52, 65, .06), 0 2px 8px rgba(38, 52, 65, .05);
  --sombra-forte: 0 10px 28px rgba(38, 52, 65, .22);
  --raio: 14px;
}
/* ---------- tema escuro (Hospio) ---------- */
:root[data-tema="escuro"] {
  color-scheme: dark;
  --fundo: #181e1c; --superficie: #212824; --superficie-2: #29302c;
  --borda: #333a35; --borda-2: #414843;
  --texto: #f0f2ee; --texto-2: #e3e6e2; --sub: #a1a9a3; --apagado: #8b938d;
  --primario: #52708c; --primario-forte: #3e5468; --primario-suave: #263441; --primario-texto: #9fbad3;
  --marca: #597c61;
  --ok: #5ee9b5; --ok-suave: #254b3a; --ruim: #ffa2a2; --ruim-suave: #58332c;
  --topo: #10161a; --topo-texto: #f0f2ee;
  --trilho: #333a35;
  --sombra: 0 1px 2px rgba(0, 0, 0, .3);
  --sombra-forte: 0 12px 32px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--fundo); color: var(--texto); font-size: 15px;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto; min-height: 100vh;
  transition: background .2s, color .2s;
}
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.rotulo { font-size: 10.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--sub); }

/* ---------- topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  background: var(--topo); color: var(--topo-texto); border-bottom: 1px solid var(--borda);
  padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
}
.topbar h1 { flex: 1; margin: 0 0 0 4px; font-size: 18px; font-weight: 700; }
.icon-btn { background: none; border: 0; color: var(--sub); padding: 8px; border-radius: 10px; display: flex; cursor: pointer; }
.icon-btn:hover, .icon-btn:active { background: var(--superficie-2); color: var(--texto); }
.icon-btn.girando svg { animation: gira .7s linear; }
@keyframes gira { to { transform: rotate(360deg); } }

main { padding: 14px; }

/* ---------- navegação inferior ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--superficie); border-top: 1px solid var(--borda);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10;
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 500; color: var(--sub); text-decoration: none; padding: 4px 0; border-radius: 10px; }
.tabbar a.ativo { color: var(--primario-texto); font-weight: 700; }
.tabbar .tab-add { flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%; background: var(--primario); color: #fff; justify-content: center; margin-top: -24px; box-shadow: 0 4px 14px rgba(82, 112, 140, .45); }
.tabbar .tab-add svg { width: 26px; height: 26px; stroke-width: 2.2; }
.tabbar .tab-add.ativo, .tabbar .tab-add:active { color: #fff; background: var(--primario-forte); }

/* ---------- blocos ---------- */
.card { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: 14px; margin-bottom: 14px; }
.secao { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 2px 8px; }
.secao h2 { font-size: 16px; margin: 0; font-weight: 700; }
.secao a { font-size: 13px; color: var(--primario-texto); text-decoration: none; font-weight: 600; }
.sub { color: var(--sub); font-size: 12.5px; }
.vazio { text-align: center; color: var(--sub); padding: 28px 10px; }

.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; flex-shrink: 0; }
.avatar.sm { width: 22px; height: 22px; font-size: 11px; }

.pessoas { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.pessoa { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); padding: 12px 10px; text-align: center; text-decoration: none; color: inherit; transition: transform .15s, border-color .15s; }
.pessoa:hover { transform: translateY(-2px); border-color: var(--borda-2); }
.pessoa .nome { font-size: 13px; font-weight: 600; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--texto-2); }
.pessoa .valor { font-weight: 800; font-size: 16px; margin: 2px 0 8px; }
.pessoa .pct { font-size: 12px; color: var(--sub); margin-top: 4px; }

.barra { height: 7px; border-radius: 99px; background: var(--trilho); overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: 99px; transition: width .3s; }
.barra.grossa { height: 12px; }

.total .grande { font-size: 34px; font-weight: 800; margin: 4px 0 12px; letter-spacing: -.01em; }
.total .rodape { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; color: var(--texto-2); }
.pill { padding: 6px 10px; border-radius: 10px; font-weight: 800; font-size: 14px; text-align: center; }
.pill small { display: block; font-weight: 600; font-size: 11px; }
.pill.ok { background: var(--ok-suave); color: var(--ok); }
.pill.ruim { background: var(--ruim-suave); color: var(--ruim); }

/* ---------- listas ---------- */
.lista { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--borda); background: var(--superficie); }
.item:last-child { border-bottom: 0; }
.item .info { flex: 1; min-width: 0; }
.item .prod { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .val { font-weight: 800; color: var(--primario-texto); white-space: nowrap; text-align: right; }
.item .acoes { display: flex; gap: 2px; }
.item .acoes button { background: none; border: 0; color: var(--apagado); padding: 6px; border-radius: 8px; cursor: pointer; display: flex; }
.item .acoes button:hover, .item .acoes button:active { background: var(--superficie-2); color: var(--texto); }
.item .acoes svg { width: 18px; height: 18px; }

/* ---------- abas e chips ---------- */
.abas { display: flex; background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.abas button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font: inherit; font-size: 14px; font-weight: 500; color: var(--sub); cursor: pointer; }
.abas button.ativo { background: var(--primario); color: #fff; font-weight: 700; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.chip { border: 1px solid var(--borda); background: var(--superficie); color: var(--texto-2); border-radius: 99px; padding: 7px 12px; font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.chip.ativo { border-color: var(--primario); background: var(--primario-suave); color: var(--primario-texto); font-weight: 700; }
.subtotal { display: flex; justify-content: space-between; padding: 0 4px 10px; font-size: 14px; color: var(--sub); }
.subtotal b { color: var(--texto); }

/* ---------- formulário ---------- */
.campo { margin-bottom: 16px; }
.campo label { display: block; margin-bottom: 7px; }
input { width: 100%; font: inherit; font-size: 16px; padding: 12px; border: 1px solid var(--borda-2); border-radius: 10px; background: var(--superficie); color: var(--texto); }
input::placeholder { color: var(--apagado); }
input:focus { outline: 2px solid var(--primario); outline-offset: -1px; border-color: transparent; }
.escolha { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.escolha button { border: 2px solid var(--borda); background: var(--superficie); color: var(--texto-2); border-radius: 12px; padding: 10px 6px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.escolha button.ativo { border-color: var(--primario); background: var(--primario-suave); color: var(--texto); }
.aviso { background: var(--primario-suave); border-radius: 12px; padding: 12px; font-size: 13px; color: var(--texto-2); margin-bottom: 16px; }
.aviso.alerta { background: var(--ruim-suave); color: var(--ruim); }
.btn { display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; margin-bottom: 10px; text-align: center; text-decoration: none; }
.btn.primario { background: var(--primario-forte); color: #fff; }
.btn.primario:hover { background: var(--primario); }
.btn.primario:disabled { opacity: .6; }
.btn.secundario { background: var(--superficie); color: var(--texto); border: 1px solid var(--borda-2); }

/* ---------- resumo ---------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpis .card { margin: 0; text-align: center; }
.kpis .num { font-size: 22px; font-weight: 800; margin-bottom: 2px; }
.rosca { width: 130px; height: 130px; border-radius: 50%; position: relative; flex-shrink: 0; }
.rosca::after { content: ""; position: absolute; inset: 18px; background: var(--superficie); border-radius: 50%; }
.rosca .meio { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 22px; }
.rosca .meio b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rosca .meio span { font-size: 10px; color: var(--sub); line-height: 1.2; }
.rosca.menor { width: 128px; height: 128px; margin: 0 auto; }
.rosca.menor::after { inset: 15px; }
.rosca.menor .meio b { font-size: 15px; }
/* gráficos: pizza em cima, legenda-tabela embaixo (não espreme em telas estreitas) */
.graf .graf-corpo { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 12px; }
.duas-roscas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; text-align: center; }
.rosca-tit { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.tab-leg { width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; margin-top: 14px; }
.graf-corpo .tab-leg { margin-top: 0; }
.tab-leg > div { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; column-gap: 12px; align-items: center; padding: 7px 0; border-top: 1px solid var(--borda); }
.tab-leg.tres > div { grid-template-columns: minmax(0, 1fr) 96px 96px; }
.tab-leg > div > :not(:first-child) { text-align: right; }
.tab-leg .tl-cab { border-top: 0; padding-top: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sub); }
.tab-leg .tl-nome { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-leg .tl-nome i { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tab-leg b { font-weight: 800; white-space: nowrap; }
.tab-leg small { display: block; font-size: 11.5px; color: var(--sub); font-weight: 500; }
.tab-leg .tl-total { font-weight: 700; border-top: 1px solid var(--borda-2); }
@media (orientation: landscape) and (min-width: 600px) {
  .graf .graf-corpo { flex-direction: row; gap: 28px; }
  .graf .graf-corpo .tab-leg { flex: 1; }
  .rosca.menor { width: 150px; height: 150px; }
}
.porpessoa .linha { padding: 10px 0; border-bottom: 1px solid var(--borda); }
.porpessoa .linha:last-child { border-bottom: 0; }
.porpessoa .topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* ---------- sobre ---------- */
.sobre-hero { text-align: center; padding: 20px 12px; }
.sobre-hero .logo { width: 52px; height: 52px; margin: 0 auto 6px; border-radius: 16px; background: var(--primario-suave); color: var(--primario-texto); display: flex; align-items: center; justify-content: center; }
.sobre-hero .logo svg { width: 28px; height: 28px; }
.sobre-hero h2 { margin: 6px 0; font-weight: 800; }
.check { display: flex; gap: 10px; align-items: center; margin: 9px 0; color: var(--texto-2); }
.check svg { width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: var(--ok-suave); color: var(--ok); stroke-width: 3; box-sizing: content-box; }
.editar-pessoa { display: grid; grid-template-columns: 1fr 110px; gap: 8px; align-items: end; padding: 10px 0; background: var(--superficie); position: relative; transition: transform .2s ease; }
/* linha que arrasta para a esquerda revelando "Excluir" */
.deslizar { position: relative; overflow: hidden; border-bottom: 1px solid var(--borda); touch-action: pan-y; }
#fp .deslizar { margin: 0 -14px; }
.deslizar .editar-pessoa { padding-left: 14px; padding-right: 14px; }
.deslizar > .item { border-bottom: 0; position: relative; transition: transform .2s ease; }
.lista .deslizar:last-child { border-bottom: 0; }
.dica-arrastar { color: var(--sub); font-size: 12px; margin: 10px 4px 0; text-align: center; }
.dica-arrastar svg { width: 14px; height: 14px; }
.deslizar:last-of-type { border-bottom: 0; }
.editar-pessoa input { padding: 10px; }
.editar-pessoa label { display: block; margin-bottom: 5px; }
.tema-opcoes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tema-opcoes button { border: 2px solid var(--borda); background: var(--superficie); color: var(--texto-2); border-radius: 12px; padding: 10px 4px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tema-opcoes button.ativo { border-color: var(--primario); background: var(--primario-suave); color: var(--texto); }

/* ---------- desejos + arrastar ---------- */
.desejo .alca { color: var(--apagado); cursor: grab; touch-action: none; padding: 6px 2px; margin: -6px 0 -6px -6px; display: flex; border-radius: 6px; }
.desejo .alca:hover { color: var(--texto); }
.desejo .alca svg { width: 18px; height: 18px; }
.desejo.feito .alca { visibility: hidden; }
.desejo .marca { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--borda-2); background: var(--superficie); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; padding: 0; }
.desejo .marca svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 3; }
.desejo.feito .marca { background: var(--marca); border-color: var(--marca); }
.desejo.feito .prod { text-decoration: line-through; color: var(--sub); }
.desejo .aprox { font-size: 11.5px; color: var(--sub); text-align: right; font-weight: 500; }
.desejo.feito .val { color: var(--ok); }
.linha-d.arrastando { overflow: visible; z-index: 5; border-bottom-color: transparent; }
.linha-d.arrastando > .item { box-shadow: var(--sombra-forte); transform: scale(1.02); border-radius: 10px; cursor: grabbing; }
body.arrastando, body.arrastando * { user-select: none; -webkit-user-select: none; cursor: grabbing !important; }

/* ---------- modal e aviso ---------- */
.modal-fundo { position: fixed; inset: 0; background: rgba(16, 22, 26, .55); z-index: 30; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--superficie); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); border: 1px solid var(--borda); }
.modal h3 { margin: 0 0 4px; }
.modal p { margin: 0 0 14px; }
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: #10161a; color: #f0f2ee; padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; max-width: 90%; border: 1px solid #333a35; }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.erro { background: #c10007; border-color: #c10007; }

.colunas { display: block; }

/* ---------- paisagem (celular deitado / tablet) ---------- */
@media (orientation: landscape) and (min-width: 600px) {
  body { max-width: none; padding-bottom: 0; padding-left: calc(84px + env(safe-area-inset-left)); }
  .topbar { padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: 8px; }
  main { padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); }
  .tabbar {
    top: 0; bottom: 0; left: 0; transform: none; width: calc(84px + env(safe-area-inset-left)); max-width: none;
    flex-direction: column; justify-content: center; gap: 6px;
    border-top: 0; border-right: 1px solid var(--borda); padding: 8px 4px 8px env(safe-area-inset-left);
  }
  .tabbar a { flex: 0 0 auto; width: 72px; padding: 7px 0; }
  .tabbar a.ativo:not(.tab-add) { background: var(--primario-suave); }
  .tabbar .tab-add { margin: 4px 0; width: 50px; height: 50px; }
  /* coluna única usando toda a largura (mais espaço para os textos) */
  .so-retrato { display: none; }
  .modal-fundo { align-items: center; }
  .modal { border-radius: 18px; max-width: 440px; }
  #toast { bottom: 20px; }
}
@media (orientation: landscape) and (min-width: 600px) and (max-height: 480px) {
  .tabbar { gap: 0; }
  .tabbar a { padding: 4px 0; font-size: 10px; }
  .tabbar .tab-add { width: 44px; height: 44px; }
  .total .grande { font-size: 28px; }
}
.btn.perigo { background: var(--ruim-suave); color: var(--ruim); border: 1px solid transparent; }
:root[data-tema="claro"] .btn.perigo { background: #c10007; color: #fff; }
.modal { animation: sobe .18s ease-out; }
@keyframes sobe { from { transform: translateY(24px); opacity: .4; } }
.btn:focus { outline: none; } .btn:focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; }

/* aviso com "Desfazer" (opção 2) */
#toast.com-acao { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 6px 6px 6px 16px; overflow: hidden; min-width: 260px; justify-content: space-between; }
#toast.com-acao span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toast.com-acao button { background: none; border: 0; color: #9fbad3; font: inherit; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; padding: 10px 12px; border-radius: 8px; cursor: pointer; flex-shrink: 0; }
#toast.com-acao button:active { background: rgba(255, 255, 255, .1); }
#toast .tempo { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: #52708c; transform-origin: left; animation: tempo linear forwards; }
@keyframes tempo { to { transform: scaleX(0); } }
.item.saindo { opacity: 0; transform: translateX(-30px); transition: opacity .2s, transform .2s; }

/* balão do nome completo */
.item .prod { cursor: default; }
#balao { position: fixed; z-index: 50; max-width: calc(100vw - 20px); background: #10161a; color: #f0f2ee; border: 1px solid #333a35; font-size: 14px; font-weight: 600; line-height: 1.35; padding: 8px 12px; border-radius: 10px; box-shadow: var(--sombra-forte); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; visibility: hidden; overflow-wrap: anywhere; }
#balao.on { opacity: 1; transform: none; visibility: visible; }
#balao::after { content: ""; position: absolute; left: var(--seta, 16px); bottom: -6px; width: 10px; height: 10px; background: inherit; border: inherit; border-width: 0 1px 1px 0; transform: translateX(-50%) rotate(45deg); }
#balao.embaixo::after { bottom: auto; top: -6px; border-width: 1px 0 0 1px; }

/* cor da pessoa (5 cores de brilho do hover da referência) */
.nome-cor { display: flex; align-items: center; gap: 10px; }
.cor-pessoa { width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; flex-shrink: 0; cursor: pointer; box-shadow: 0 0 0 2px var(--superficie), 0 0 0 3px var(--borda-2); }
#seletor-cor { position: fixed; z-index: 45; display: flex; gap: 10px; padding: 10px 12px; background: var(--superficie); border: 1px solid var(--borda-2); border-radius: 14px; box-shadow: var(--sombra-forte); animation: sobe .15s ease-out; }
#seletor-cor button { width: 30px; height: 30px; border-radius: 50%; border: 0; padding: 0; background: var(--c); cursor: pointer; }
#seletor-cor button.ativo { box-shadow: 0 0 0 2px var(--superficie), 0 0 0 4px var(--c, var(--texto)); }
.rosca[data-tip] { cursor: pointer; }
.cor-pessoa.vazia { display: inline-block; background: transparent; border: 2px dashed var(--borda-2); box-shadow: none; cursor: default; }
.editar-pessoa.inativa input[data-nome]::placeholder { font-style: italic; }
#seletor-cor button.ocupada { opacity: .25; cursor: not-allowed; position: relative; }
#seletor-cor button.ocupada::after { content: ""; position: absolute; left: 50%; top: 4px; bottom: 4px; width: 2px; background: var(--superficie); transform: translateX(-50%) rotate(45deg); }

/* deslizar: etiqueta Editar (esquerda) + linha que "levanta" enquanto arrasta */
.deslizar > :last-child { position: relative; z-index: 1; transition: transform .22s cubic-bezier(.2, .8, .2, 1), box-shadow .15s, border-radius .15s; }
.deslizar.arrastando-lado > :last-child { box-shadow: 0 8px 22px rgba(16, 22, 26, .22), 0 0 0 1px var(--borda-2); border-radius: 10px; }
:root[data-tema="escuro"] .deslizar.arrastando-lado > :last-child { box-shadow: 0 8px 22px rgba(0, 0, 0, .6), 0 0 0 1px var(--borda-2); }
.deslizar.aberto > :last-child { box-shadow: 0 2px 10px rgba(16, 22, 26, .14), 0 0 0 1px var(--borda); border-radius: 10px; }
:root[data-tema="escuro"] .deslizar.aberto > :last-child { box-shadow: 0 2px 10px rgba(0, 0, 0, .45), 0 0 0 1px var(--borda); }
.deslizar.arrastando-lado, .deslizar.arrastando-lado * { user-select: none; -webkit-user-select: none; }

/* ações do deslizar: etiquetas coloridas, só o ícone, encostado na borda (lixeira à direita, lápis à esquerda) */
:root { --etiqueta-excluir: #e04f4f; }
:root[data-tema="escuro"] { --etiqueta-excluir: #b23b37; }
.deslizar { background: var(--superficie-2); }
.acao-excluir, .acao-editar { position: absolute; top: 18.5%; bottom: 18.5%; width: 52px; border: 0; padding: 0; color: #fff; display: flex; align-items: center; cursor: pointer; }
.acao-excluir { right: 0; background: var(--etiqueta-excluir); border-radius: 8px 0 0 8px; justify-content: flex-end; padding-right: 12px; }
.acao-editar { left: 0; background: var(--primario); border-radius: 0 8px 8px 0; justify-content: flex-start; padding-left: 12px; }
.acao-excluir svg, .acao-editar svg { width: 18px; height: 18px; stroke-width: 2; }

/* aviso fixo com × no canto superior direito */
#toast.fixo { pointer-events: auto; width: min(92vw, 420px); max-width: none; padding: 14px 40px 14px 16px; line-height: 1.4; text-align: left; transform: translateX(-50%); }
#toast.fixo .toast-fechar { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .18); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
#toast.fixo .toast-fechar:hover, #toast.fixo .toast-fechar:active { background: rgba(255, 255, 255, .32); }
#toast.fixo .toast-fechar svg { width: 15px; height: 15px; stroke-width: 2.5; }

/* nome com link: sublinhado na mesma cor do texto (sem o azul padrão) */
.item a.prod.link { display: inline-block; max-width: 100%; vertical-align: top; color: inherit; text-decoration: underline; text-decoration-color: currentColor; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.item a.prod.link:active { opacity: .7; }
.desejo.feito a.prod.link { text-decoration: line-through underline; }
.campo .opcional { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--apagado); }
.dica-url { font-size: 12px; color: var(--apagado); margin-top: 6px; min-height: 16px; }
.dica-url.carregando { color: var(--sub); }
.dica-url.ok { color: var(--ok); font-weight: 600; }
.dica-url.aviso-url { color: var(--ruim); }

/* valor + quantidade lado a lado */
.linha-valor { display: grid; grid-template-columns: minmax(0, 1fr) 132px; gap: 10px; align-items: end; margin-bottom: 6px; }
.linha-valor label { display: block; margin-bottom: 7px; }
.qtd { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: stretch; border: 1px solid var(--borda-2); border-radius: 10px; overflow: hidden; background: var(--superficie); height: 48px; }
.qtd button { border: 0; background: var(--superficie-2); color: var(--texto); font: inherit; font-size: 22px; font-weight: 600; line-height: 1; cursor: pointer; padding: 0; }
.qtd button:active { background: var(--borda); }
.qtd button:disabled { color: var(--apagado); cursor: default; }
.qtd input { border: 0; border-radius: 0; text-align: center; padding: 0; font-weight: 700; min-width: 0; font-variant-numeric: tabular-nums; }
.qtd input:focus { outline: none; background: var(--primario-suave); }
.total-qtd { font-size: 12.5px; color: var(--sub); min-height: 16px; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
/* "2×" antes do nome nas listas */
.prod-linha { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.prod-linha .prod { min-width: 0; }
.qtd-badge { flex-shrink: 0; font-size: 12px; font-weight: 800; color: var(--primario-texto); background: var(--primario-suave); border-radius: 6px; padding: 1px 5px; }
.linha-valor > div > input { height: 48px; }
.modal .link-nome { font-weight: 700; font-size: 16px; line-height: 1.35; margin: 6px 0 4px; overflow-wrap: anywhere; }
.modal .link-dominio { display: flex; align-items: center; gap: 4px; margin: 0 0 16px; }
.modal .link-dominio svg { width: 14px; height: 14px; }
/* "2× US$ 30" pequeno em cima do total */
.valores { text-align: right; flex-shrink: 0; }
.val-unit { font-size: 11.5px; font-weight: 600; color: var(--sub); white-space: nowrap; font-variant-numeric: tabular-nums; margin-bottom: 1px; }

/* ---------- etiqueta da loja: "tag" de papel kraft pendurada (ponta recortada + furinho) ---------- */
:root { --etq-bg: #ebe2cc; --etq-txt: #6e5a35; --etq-furo: var(--superficie); }
:root[data-tema="escuro"] { --etq-bg: #3b3527; --etq-txt: #d9c79c; }
.etq-loja {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
  height: 15px; padding: 0 7px 0 9px; margin: 0 0 3px;
  font-size: 8.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; line-height: 1; white-space: nowrap;
  color: var(--etq-txt); background: var(--etq-bg);
  clip-path: polygon(5px 0, 100% 0, 100% 100%, 5px 100%, 0 50%);
  border-radius: 0 3px 3px 0; transform-origin: 0 50%;
}
.etq-loja i { width: 3px; height: 3px; border-radius: 50%; background: var(--etq-furo); flex-shrink: 0; }
.info .etq-loja { display: flex; width: max-content; }

/* sugestões de loja no formulário */
.sug-lojas { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; min-height: 4px; }
.etq-opcao { border: 0; cursor: pointer; height: 22px; font-size: 10px; padding: 0 10px 0 12px; font-family: inherit; clip-path: polygon(7px 0, 100% 0, 100% 100%, 7px 100%, 0 50%); margin: 0; }
.etq-opcao i { width: 4px; height: 4px; }
.etq-opcao.ativo { background: var(--primario); color: #fff; }
.sug-nova { font-size: 12px; color: var(--sub); font-style: italic; }

/* lojas em Configurações */
.item-loja { gap: 10px; }
.item-loja .etq-loja { margin: 0; flex-shrink: 0; }
.item-loja .loja-nome-completo { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }

/* etiqueta da loja pendurada na borda superior da linha: não ocupa altura (usa a folga de cima) */
.item .info { position: relative; }
.item .info > .etq-loja {
  position: absolute; top: -12px; left: 0; margin: 0;
  height: 14px; font-size: 9px; letter-spacing: .1em; padding: 0 7px 0 9px;
  border-radius: 0 0 3px 0; clip-path: polygon(4px 0, 100% 0, 100% 100%, 4px 100%, 0 50%);
}
.item .info > .etq-loja i { width: 3px; height: 3px; }
.item.desejo { min-height: 60px; } /* mesma altura das linhas de Compras: etiqueta da loja fica igual */
.etq-previa { height: 18px; font-size: 9.5px; margin: 0; opacity: .95; }

/* fita fina à esquerda na cor da pessoa */
.item.com-fita { position: relative; }
.item.com-fita::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--cp); opacity: .4; } /* 40% da cor: identifica sem destacar */
/* no tema claro, cores fortes (ex.: vermelho) cansam a vista: um pouco menos saturadas */
:root[data-tema="claro"] .item.com-fita::before { filter: saturate(.6); }
.deslizar.arrastando-lado > .item.com-fita::before, .deslizar.aberto > .item.com-fita::before { border-radius: 10px 0 0 10px; }

/* etiqueta "copiar" (arraste para a direita, ao lado do editar) */
.acao-copiar { position: absolute; top: 18.5%; bottom: 18.5%; left: 56px; width: 52px; border: 0; padding: 0; background: var(--marca); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.acao-copiar.sozinho { left: 0; border-radius: 0 8px 8px 0; justify-content: flex-start; padding-left: 12px; }
.acao-copiar svg { width: 18px; height: 18px; stroke-width: 2; }


/* barra de quem passou da cota: vermelho suave (avisa sem cansar a vista) */
:root { --excedeu: #e7a1a1; }
:root[data-tema="escuro"] { --excedeu: #9a4a46; }
/* abas Shoppings / Pessoas com ícone */
.abas button { display: flex; align-items: center; justify-content: center; gap: 7px; }
.abas button svg { width: 17px; height: 17px; }


/* filtro por loja: etiquetas kraft em fileira (desliza para o lado) + etiqueta Limpar */
.filtro-lojas { display: flex; align-items: center; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding: 2px 0 4px; scrollbar-width: none; }
.filtro-lojas::-webkit-scrollbar { display: none; }
.filtro-lojas a { text-decoration: none; flex-shrink: 0; }
:root { --etq-limpar: #c0674a; }
:root[data-tema="escuro"] { --etq-limpar: #a5573f; }
.etq-limpar { background: var(--etq-limpar); color: #fff; }
.etq-limpar svg { width: 11px; height: 11px; stroke-width: 3; margin-right: 1px; }

/* etiqueta "SEM LOJA" (versão 1): cinza-grafite, borda tracejada, "?" no lugar do furinho */
.etq-semloja { background: var(--superficie-2); color: var(--texto-2); clip-path: none; border: 1.5px dashed var(--apagado); border-radius: 4px; padding: 0 9px; }
.etq-semloja b { font-size: 10px; font-weight: 900; margin-right: 1px; }
.etq-semloja.ativo { background: var(--primario); color: #fff; border-color: transparent; border-style: solid; }

/* loja selecionada encolhida: só a pontinha com o furinho (<•|) */
.etq-opcao.recolhida { padding: 0 6px 0 12px; min-width: 0; gap: 0; }
.etq-opcao.recolhida.etq-semloja { padding: 0 7px; }
.etq-opcao.recolhida.animar { animation: recolher .35s ease-out; }
@keyframes recolher { from { padding-right: 70px; } to { padding-right: 6px; } }
.filtro-lojas .recolhida + .recolhida { margin-left: -2px; }

/* formulário: sugestões de loja em fileira com rolagem lateral (como o filtro de Shoppings) */
.sug-lojas { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; }
.sug-lojas::-webkit-scrollbar { display: none; }
.sug-lojas > * { flex-shrink: 0; }
.sug-nova { white-space: nowrap; }

/* listas: etiqueta da loja pendurada perto do topo (3px de folga, sem colar); produto e pessoa um pouco mais abaixo */
.item.com-fita .info { padding-top: 12px; }
.item.com-fita .info > .etq-loja { top: -9px; }
.item.com-fita .info .sub { margin-top: 4px; }

/* ---------- Início: "Listar mais" + itens que "saem impressos" ---------- */
/* mais compras abaixo: "cartas empilhadas" sob a lista */
.lista.cupom.tem-mais { margin-bottom: 16px; box-shadow: var(--sombra),
  0 11px 0 -6px var(--superficie), 0 11px 0 -5px var(--borda-2),
  0 21px 0 -11px var(--superficie), 0 21px 0 -10px var(--borda-2); }
.btn-mais {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 4px auto 0;
  border: 1px dashed var(--borda-2); background: var(--superficie); color: var(--texto-2);
  font: inherit; font-size: 14px; font-weight: 700; padding: 9px 16px; border-radius: 99px; cursor: pointer;
}
.btn-mais small { font-size: 11.5px; font-weight: 700; color: var(--primario-texto); background: var(--primario-suave); border-radius: 99px; padding: 2px 7px; }
.btn-mais svg { width: 18px; height: 18px; transition: transform .2s; }
.btn-mais:active svg, .btn-mais.carregando svg { transform: translateY(3px); }
.btn-mais.carregando { opacity: .6; pointer-events: none; }
/* novas compras saem da "impressora": revelam de cima para baixo, uma por vez */
.imprimindo { animation: imprimir .45s cubic-bezier(.2, .8, .2, 1) both; transform-origin: top; }
.imprimindo > .item { border-bottom: 1px solid var(--borda); }
@keyframes imprimir { from { clip-path: inset(0 0 100% 0); transform: translateY(-6px); opacity: .3; } to { clip-path: inset(0 0 0 0); transform: none; opacity: 1; } }
/* Início: avatar leva às compras da pessoa */
.avatar-link { display: inline-flex; border-radius: 50%; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.avatar-link:active { transform: scale(.92); }
@media (hover: hover) { .avatar-link:hover { box-shadow: 0 0 0 3px var(--primario-suave); } }

/* ---------- modo fantasma (compra conta US$ 0, reversível) ---------- */
.acao-fantasma { position: absolute; top: 18.5%; bottom: 18.5%; right: 56px; width: 52px; border: 0; padding: 0; background: var(--primario); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.acao-fantasma svg { width: 19px; height: 19px; stroke-width: 2; }
.acao-fantasma.desligar { background: var(--superficie); color: var(--primario-texto); border: 1.5px dashed var(--primario); }
.acao-fantasma.desligar svg { opacity: .8; }
.item.fantasma > * { opacity: .45; }
.item.fantasma > .valores { opacity: 1; }
.item.fantasma .val-riscado { text-decoration: line-through; color: var(--apagado); font-weight: 700; opacity: .7; }
.val-fantasma { display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 12.5px; font-weight: 800; color: var(--primario-texto); white-space: nowrap; margin-top: 1px; }
.val-fantasma svg { width: 14px; height: 14px; stroke-width: 2.2; }

/* ---------- selo da cotação do dólar (verde) ---------- */
.topbar h1 { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cotacao {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; margin-right: 2px;
  padding: 4px 10px 4px 8px; border-radius: 99px; cursor: pointer;
  background: var(--ok-suave); color: var(--ok); font-size: 12.5px; line-height: 1;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cotacao .cot-moeda { font-size: 13px; font-weight: 800; }
.cotacao svg { width: 15px; height: 15px; stroke-width: 2.2; }
.cotacao b { font-weight: 800; font-size: 13px; }
.cotacao.antiga { opacity: .7; }
@media (max-width: 360px) { .cotacao .cot-moeda { display: none; } }

/* ---------- aba ativa da barra inferior: bloco com fundo azul-claro (estilo D, sem ponto) ---------- */
.tabbar a { position: relative; transition: color .15s, background .15s; }
/* o destaque é um bloco por trás, 5% mais estreito de cada lado (claro e escuro) */
.tabbar a { isolation: isolate; }
.tabbar a.ativo::before { content: ""; position: absolute; inset: 0 5%; border-radius: 10px; background: var(--primario-suave); z-index: -1; }
/* tema claro: aba ativa mais marcada (o fundo suave sumia sobre a barra branca) */
:root[data-tema="claro"] .tabbar a.ativo { color: var(--primario-forte); }
:root[data-tema="claro"] .tabbar a.ativo::before { background: #d3dfeb; box-shadow: inset 0 0 0 1px #b9cbdd; }
/* card "já comprados" (Desejos) leva à Lista de compras */
.card-link { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .12s; }
.card-link:active { transform: scale(.98); }
@media (hover: hover) { .card-link:hover { border-color: var(--borda-2); } }
.card-link .ver-link { color: var(--primario-texto); font-weight: 600; }

/* ---------- etiqueta da pessoa (cor da pessoa, mesmo formato da etiqueta de loja) ---------- */
.sub-pessoa { display: flex; align-items: center; gap: 7px; min-width: 0; white-space: nowrap; }
.sub-pessoa > span:not(.etq-pessoa) { overflow: hidden; text-overflow: ellipsis; }
.etq-pessoa {
  display: inline-flex; align-items: center; flex-shrink: 0;
  height: 16px; padding: 0 7px; border-radius: 4px; font-size: 8.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; line-height: 1;
  color: color-mix(in srgb, var(--cp) 72%, var(--texto)); background: color-mix(in srgb, var(--cp) 20%, var(--superficie));
}
:root[data-tema="escuro"] .etq-pessoa { color: color-mix(in srgb, var(--cp) 55%, #fff); background: color-mix(in srgb, var(--cp) 28%, var(--superficie)); }
.etq-pessoa[data-ir-pessoa] { cursor: pointer; }
.sub-pessoa .aloc { display: inline-flex; color: var(--apagado); margin: 0 -3px; }
.sub-pessoa .aloc svg { width: 12px; height: 12px; stroke-width: 2.4; }

/* etiqueta "mover" (arraste para a direita, depois de editar/copiar) */
.acao-mover { position: absolute; top: 18.5%; bottom: 18.5%; width: 52px; border: 0; padding: 0; background: var(--etq-mover); color: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.acao-mover svg { width: 18px; height: 18px; stroke-width: 2; }
.mv-livre { font-size: 11px; color: var(--sub); font-weight: 600; line-height: 1.3; }
.mv-livre.estoura { color: var(--ruim); }
.etq-pessoa { width: max-content; max-width: 100%; }

/* ---------- separação entre itens: sombra suave embaixo de cada item (todas as listas) ---------- */
.sep-sombra .item { border-bottom: 0; box-shadow: inset 0 -7px 7px -7px rgba(38, 52, 65, .16); }
:root[data-tema="escuro"] .sep-sombra .item { box-shadow: inset 0 -7px 7px -7px rgba(0, 0, 0, .55); }
.sep-sombra > :last-child .item, .sep-sombra > .item:last-child { box-shadow: none; }

/* data/hora: fonte de log, pequena e esmaecida (informação secundária) */
.data-log { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace; font-size: 10.5px; letter-spacing: -.01em; color: var(--apagado); opacity: .85; }
.sep-sombra > .deslizar { border-bottom: 0; }

/* mover: laranja (distinto do lápis azul e do copiar verde) */
:root { --etq-mover: #e28a35; }
:root[data-tema="escuro"] { --etq-mover: #b86a26; }
/* Análise: etiquetas de nome no lugar das bolinhas */
.tab-leg .tl-nome .etq-pessoa { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.porpessoa .topo .etq-pessoa { height: 18px; font-size: 9.5px; }
/* filtro por pessoa: selecionada = contorno 2px na cor do app (neutro, não a cor da pessoa) */
.chip-pessoa { transition: box-shadow .15s, border-color .15s; }
.chip-pessoa.ativo { border-color: var(--primario); box-shadow: 0 0 0 1px var(--primario); background: var(--primario-suave); color: var(--texto); }
:root[data-tema="claro"] .chip-pessoa.ativo { background: #dde7f1; }
.chips { padding: 3px 3px 5px; }
/* compra alocada: fantasma sozinho à direita e mover sozinho à esquerda, colados na borda */
.acao-fantasma.sozinho { right: 0; border-radius: 8px 0 0 8px; }
.acao-mover[style*="left:0px"] { border-radius: 0 8px 8px 0; }

/* ---------- Configurações: atalho Lojas + Atividades ---------- */
.card.atalho { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; margin-top: 18px; }
.card.atalho > svg:first-child { color: var(--primario-texto); }
.card.atalho span { flex: 1; display: flex; flex-direction: column; }
.card.atalho small { color: var(--sub); font-size: 12.5px; }
.card.atalho > svg:last-child { color: var(--apagado); }
.atividades { padding: 6px 14px 12px; }
.atv-dia { font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--sub); margin: 12px 0 4px; }
.atv { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; box-shadow: inset 0 -7px 7px -7px rgba(38, 52, 65, .12); }
:root[data-tema="escuro"] .atv { box-shadow: inset 0 -7px 7px -7px rgba(0, 0, 0, .5); }
.atv-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--superficie-2); color: var(--sub); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.atv-ic svg { width: 15px; height: 15px; }
.atv-apagou .atv-ic, .atv-excluiu .atv-ic { color: var(--ruim); background: var(--ruim-suave); }
.atv-criou .atv-ic, .atv-comprou .atv-ic { color: var(--ok); background: var(--ok-suave); }
.atv-moveu .atv-ic, .atv-devolveu .atv-ic { color: var(--etq-mover); }
.atv-txt { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.atv-meta { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.atividades .btn-mais { margin-top: 10px; }
.card.atalho.atalho-2 { margin-top: 10px; }
.atv-meta { flex-wrap: wrap; row-gap: 3px; }
.atv-aparelho { opacity: .7; }
.atv-aparelho::before { content: "· "; }
