:root {
  --a: #2563A8;
  --ad: #1A4A80;
  --ink: #172033;
  --mut: #4D5B70;
  --bg: #F3F6FA;
  --bd: #DCE3EC;
  --bd2: #C6D0DC;
  --tint: #EAF0F7;
  --chip: #DBE7F5;
  --warn: #9A4A0C;
  --warnbg: #FCEBDC;
  --warnbd: #F2C9A6;
  --danger: #B42318;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 16px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
.display { font-weight: 800; letter-spacing: -0.02em; margin: 0; line-height: 1.08; }
.muted { color: var(--mut); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* loading */
.loading { min-height: 100dvh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--bd); border-top-color: var(--a); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* forms & buttons */
.stack { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input, .input { height: 52px; border: 1.5px solid var(--bd2); border-radius: 12px; padding: 0 16px; font-size: 16px; background: #fff; width: 100%; outline: none; }
.field input:focus, .input:focus { border-color: var(--a); box-shadow: 0 0 0 3px rgba(37,99,168,.15); }
.hint { font-size: 13px; font-weight: 400; color: var(--mut); }
.btn { height: 54px; border: none; border-radius: 14px; background: var(--a); color: #fff; font-size: 17px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.btn:active { background: var(--ad); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-o { height: 54px; border: 2px solid var(--a); border-radius: 16px; background: #fff; color: var(--a); font-size: 16px; font-weight: 600; width: 100%; }
.btn-ghost { height: 48px; border: 1.5px solid var(--bd2); border-radius: 12px; background: #fff; font-weight: 600; font-size: 15px; width: 100%; }
.btn-danger { height: 48px; border: 1.5px solid #F1B5AF; border-radius: 12px; background: #FFF5F4; color: var(--danger); font-weight: 600; font-size: 15px; width: 100%; }
.error { color: var(--danger); font-size: 14px; margin: 0; min-height: 0; }
.error:empty { display: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 22px; border: 1.5px solid var(--bd2); background: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; color: var(--ink); text-decoration: none; flex-shrink: 0; }
.back { width: 44px; height: 44px; margin-left: -10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); background: none; border: none; text-decoration: none; flex-shrink: 0; }

/* auth screens */
.auth { min-height: 100dvh; padding: 88px 28px 40px; display: flex; flex-direction: column; gap: 36px; }
.brand { display: flex; flex-direction: column; gap: 20px; }
.logo { width: 64px; height: 64px; border-radius: 18px; background: var(--a); display: flex; align-items: center; justify-content: center; }
.lock { width: 56px; height: 56px; border-radius: 16px; background: var(--chip); display: flex; align-items: center; justify-content: center; }
.auth .foot { margin-top: auto; font-size: 13px; text-align: center; line-height: 1.5; }

/* page header */
.top { padding: 52px 24px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top .actions { display: flex; gap: 8px; }
.sub-top { padding: 48px 20px 16px; background: #fff; border-bottom: 1px solid var(--bd); display: flex; flex-direction: column; gap: 14px; }
.sub-top .title-row { display: flex; align-items: center; gap: 8px; }
.sub-top h1 { font-size: 24px; }

.content { padding: 8px 24px 180px; display: flex; flex-direction: column; gap: 14px; }
.content.tight { padding: 18px 20px 150px; gap: 10px; }

/* cards */
.card { display: flex; flex-direction: column; gap: 14px; padding: 20px; background: #fff; border-radius: 18px; text-decoration: none; color: var(--ink); box-shadow: 0 1px 2px rgba(23,32,51,.06), 0 4px 16px rgba(23,32,51,.05); }
.card-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-title { font-weight: 700; font-size: 19px; letter-spacing: -0.01em; }
.card-meta { font-size: 13px; color: var(--mut); }
.hcard { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; background: #fff; border-radius: 16px; border: 1.5px solid var(--bd); text-decoration: none; color: var(--ink); }
.bar { height: 8px; border-radius: 4px; background: var(--bd); overflow: hidden; }
.bar > div { height: 8px; border-radius: 4px; background: var(--a); transition: width .25s; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--chip); color: var(--ad); }
.tag.warn { background: var(--warnbg); color: var(--warn); }
.tag.gray { background: var(--tint); color: var(--mut); }
.empty { text-align: center; color: var(--mut); padding: 48px 12px; line-height: 1.5; }

/* items */
.sec { margin: 6px 0 2px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); }
.it { display: flex; align-items: center; gap: 14px; min-height: 60px; padding: 10px 16px; background: #fff; border: 1.5px solid var(--bd); border-radius: 14px; text-align: left; width: 100%; }
button.it:active { transform: scale(.99); }
.ck { width: 26px; height: 26px; border-radius: 13px; border: 2px solid #8592A6; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.it-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.it-name { font-weight: 600; overflow-wrap: anywhere; }
.it-by { font-size: 13px; color: var(--mut); }
.qty { font-size: 14px; font-weight: 600; background: var(--tint); padding: 4px 10px; border-radius: 8px; white-space: nowrap; }
.it.done { background: var(--tint); border-color: transparent; color: var(--mut); min-height: 54px; }
.it.done .ck { border: none; background: var(--a); }
.it.done .it-name { font-weight: 400; text-decoration: line-through; }
.it.done .qty { background: none; font-weight: 400; padding: 0; }
.it.nb { background: #FFF8F2; border-color: var(--warnbd); }
.it.nb .ck { border: none; background: var(--warn); }
.it.nb .qty { background: var(--warnbg); }
.it.closed-done .it-name { text-decoration: none; }
.it.row { padding: 0; gap: 0; }
.it-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 10px 4px 10px 16px; background: none; border: none; text-align: left; }
.it-main:active { opacity: .7; }
.more { width: 44px; align-self: stretch; flex-shrink: 0; background: none; border: none; color: var(--mut); display: flex; align-items: center; justify-content: center; border-radius: 0 12px 12px 0; }
.more:active { background: rgba(23,32,51,.06); }

.add-row { display: flex; gap: 8px; }
.add-row .input { height: 48px; background: #F8FAFC; padding: 0 14px; }
.add-row .qty-in { width: 72px; flex-shrink: 0; padding: 0 10px; }
.add-btn { width: 48px; height: 48px; flex-shrink: 0; border: none; border-radius: 12px; background: var(--a); display: flex; align-items: center; justify-content: center; }

/* fixed bottom */
.bottom { position: fixed; bottom: 0; left: 0; right: 0; max-width: 480px; margin: 0 auto; z-index: 5; }
.bottom-bar { padding: 14px 20px calc(24px + var(--safe-b)); background: var(--bg); border-top: 1px solid var(--bd); display: flex; flex-direction: column; gap: 8px; }
.bottom-bar .note { font-size: 13px; color: var(--mut); text-align: center; }
.fab-wrap { padding: 0 24px 16px; }
.nav { height: calc(68px + var(--safe-b)); padding-bottom: var(--safe-b); background: #fff; border-top: 1px solid var(--bd); display: grid; grid-template-columns: 1fr 1fr; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 500; color: var(--mut); text-decoration: none; }
.nav a.on { color: var(--a); font-weight: 600; }

/* users */
.urow { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: #fff; border: 1.5px solid var(--bd); border-radius: 14px; text-decoration: none; color: var(--ink); }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--chip); color: var(--ad); font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.panel { background: #fff; border: 1.5px solid var(--bd); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { margin: 0; font-size: 17px; }

/* configurações */
.gtitle { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); margin: 0 4px 8px; }
.group { background: #fff; border: 1.5px solid var(--bd); border-radius: 16px; overflow: hidden; }
.group .row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; width: 100%; background: none; border: none; text-align: left; text-decoration: none; color: var(--ink); }
.group .row + .row { border-top: 1px solid var(--bd); }
.ic { width: 38px; height: 38px; border-radius: 12px; background: var(--chip); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ic.warn { background: var(--warnbg); }
.ic.red { background: #FDECEA; }
.rt { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rt b { font-weight: 600; font-size: 16px; }
.rt span { font-size: 13px; color: var(--mut); line-height: 1.35; }
.sw { width: 52px; height: 32px; border-radius: 16px; background: #8592A6; position: relative; flex-shrink: 0; border: none; padding: 0; transition: background .2s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s; }
.sw.on { background: var(--a); }
.sw.on::after { left: 23px; }
.sw[disabled] { opacity: .45; cursor: default; }
.status { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.45; padding: 12px 14px; border-radius: 12px; }
.status svg { flex-shrink: 0; margin-top: 2px; }
.status.ok { background: #E3F4EA; color: #17663D; font-weight: 600; align-items: center; }
.status.warn { background: var(--warnbg); color: var(--warn); }
.status.info { background: var(--tint); color: var(--ink); }
.note-box { display: flex; gap: 10px; align-items: center; background: var(--tint); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.note-box svg { flex-shrink: 0; }

/* quem pode ver */
.vis { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--tint); color: var(--mut); max-width: 100%; }
.vis > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vis svg { flex-shrink: 0; }
.vis.priv { background: #EFE7FB; color: #5B2E91; }
.vis.grp { background: #E2F1EA; color: #17663D; }
.link-btn { border: none; background: none; padding: 6px 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--a); }
.opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--bd); border-radius: 12px; background: #fff; width: 100%; text-align: left; }
.opt.sel { border-color: var(--a); background: #F4F8FD; }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid #8592A6; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.opt.sel .radio { border-color: var(--a); }
.opt.sel .radio::after { content: ""; width: 11px; height: 11px; border-radius: 6px; background: var(--a); }
.opt b { font-size: 15px; }
.opt .d { font-size: 13px; color: var(--mut); }
.people { display: flex; flex-direction: column; border: 1.5px solid var(--bd); border-radius: 12px; background: #fff; margin-left: 34px; }
.person { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 48px; font-size: 15px; }
.person + .person { border-top: 1px solid var(--bd); }
.person input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--a); margin: 0; flex-shrink: 0; }
.av { width: 30px; height: 30px; border-radius: 15px; background: var(--chip); color: var(--ad); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.pbar { height: 10px; border-radius: 5px; background: var(--bd); overflow: hidden; }
.pbar > div { height: 10px; border-radius: 5px; background: var(--a); transition: width .2s; }
.upd-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; background: #fff; border: 2px solid var(--a); border-radius: 16px; }
.updx { width: 36px; height: 36px; margin: -6px -8px 0 0; border: none; background: none; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* modal */
.overlay { position: fixed; inset: 0; background: rgba(23,32,51,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; animation: fade .15s; }
.sheet { background: #fff; width: 100%; max-width: 480px; border-radius: 22px 22px 0 0; padding: 24px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; animation: up .2s ease-out; }
.sheet h2 { margin: 0; font-size: 21px; letter-spacing: -0.01em; }
.sheet p { margin: 0; color: var(--mut); line-height: 1.5; white-space: pre-line; }
.sheet .row { display: flex; gap: 10px; }
.sheet .row > * { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }

#toast { position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 30; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* recorrência */
.tags2 { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tags2 .vis { align-self: auto; }
.rec, .late { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--ad); max-width: 100%; }
.rec svg, .late svg { flex-shrink: 0; }
.late { background: var(--warnbg); color: var(--warn); font-weight: 700; }
.tgrow { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--bd); border-radius: 12px; background: #fff; width: 100%; text-align: left; }
.tgrow svg { flex-shrink: 0; }
.tgrow .d { font-size: 13px; color: var(--mut); }
.tgrow.on { border-color: var(--a); background: #F4F8FD; }
.tgrow.on + .recbox { margin-top: -14px; }
.sw { width: 46px; height: 28px; border-radius: 14px; background: #B9C6D6; position: relative; flex-shrink: 0; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: left .15s; }
.sw.on { background: var(--a); }
.sw.on::after { left: 21px; }
.recbox { display: flex; flex-direction: column; gap: 12px; border: 1.5px solid var(--a); border-top: none; border-radius: 0 0 12px 12px; background: #F4F8FD; padding: 4px 14px 14px; }
.tgrow.on:has(+ .recbox) { border-radius: 12px 12px 0 0; border-bottom: none; }
.recline { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.step { display: flex; align-items: center; gap: 8px; }
.stb { width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--bd2); background: #fff; font-size: 22px; font-weight: 600; color: var(--a); display: flex; align-items: center; justify-content: center; padding: 0; }
.stb:active { background: var(--tint); }
.stv { width: 58px; height: 40px; border-radius: 12px; border: 1.5px solid var(--bd2); background: #fff; font-size: 18px; font-weight: 700; text-align: center; padding: 0; -moz-appearance: textfield; }
.stv::-webkit-outer-spin-button, .stv::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stv:focus { outline: none; border-color: var(--a); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1.5px solid var(--bd2); color: var(--mut); }
.chip.on { background: var(--a); border-color: var(--a); color: #fff; }
.rechint { font-size: 13px; color: var(--mut); line-height: 1.45; }
.rechint b { color: var(--ink); }
.cbx { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--mut); margin-top: -4px; }
.cbx[hidden] { display: none; }
.cbx input { width: 20px; height: 20px; accent-color: var(--a); margin: 0; flex-shrink: 0; }
.sheet .cbx { margin-top: 0; }
.once { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--mut); background: var(--tint); padding: 2px 7px; border-radius: 999px; align-self: flex-start; margin-top: 2px; }
.it.done .once { background: #fff; }
.nextcard { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; border: 2px dashed var(--bd2); border-radius: 18px; }
.warnbox { display: flex; gap: 10px; align-items: flex-start; background: var(--warnbg); border: 1.5px solid var(--warnbd); color: var(--warn); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.warnbox svg { flex-shrink: 0; margin-top: 1px; }
.btn-s { height: 40px; border: 1.5px solid var(--a); border-radius: 12px; background: #fff; color: var(--a); font-weight: 600; font-size: 14px; padding: 0 14px; }
.btn-s[disabled] { opacity: .6; }

/* excluir lista */
.sub-top .title-row h1 { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.del-btn { width: 44px; height: 44px; margin-right: -10px; flex-shrink: 0; border: none; background: none; border-radius: 22px; color: var(--mut); display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.del-btn:active { background: #FFF5F4; color: var(--danger); }

/* botão com ícone (nova lista só com os não comprados) */
.btn-ico { display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; font-size: 15px; }
.btn-ico[hidden] { display: none; }
.content.tight.two-btn { padding-bottom: 210px; }
.link-btn.rec-on { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 2px 0; }
.ren-btn { margin-right: -4px; }
.ren-btn:active { background: var(--tint); color: var(--a); }
