:root {
  --navy: #1c3a7a; --navy-2: #2a4f9e; --yellow: #f7c400; --yellow-ink: #3a2e00;
  --bg: #f4f6f9; --card: #fff; --fg: #18212f; --muted: #6b778a; --faint: #9aa4b4; --line: #e8ecf1; --soft: #f3f5f8;
  --ok: #15803d; --ok-bg: #e8f5ec; --part: #b45309; --part-bg: #fef3e2; --err: #c62828; --err-bg: #fdecea;
  --urg: #c2410c; --urg-bg: #fff0e8; --info: #2a4f9e; --info-bg: #eaf0fb;
  --radius: 14px; --shadow: 0 1px 2px rgba(24, 33, 47, .04), 0 4px 14px rgba(24, 33, 47, .05);
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1218; --card: #161d27; --fg: #e6ebf2; --muted: #93a0b3; --faint: #66758a; --line: #232d3a; --soft: #1c2531;
    --ok: #4ade80; --ok-bg: #12301f; --part: #fbbf24; --part-bg: #33260c; --err: #ff6b6b; --err-bg: #3a1717;
    --urg: #fb923c; --urg-bg: #33190d; --info: #93b4f5; --info-bg: #18243c; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1218; --card: #161d27; --fg: #e6ebf2; --muted: #93a0b3; --faint: #66758a; --line: #232d3a; --soft: #1c2531;
  --ok: #4ade80; --ok-bg: #12301f; --part: #fbbf24; --part-bg: #33260c; --err: #ff6b6b; --err-bg: #3a1717;
  --urg: #fb923c; --urg-bg: #33190d; --info: #93b4f5; --info-bg: #18243c; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: contain; font-variant-numeric: tabular-nums;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: .45; }
svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- topo ---------- */
.top {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--card) 94%, transparent); color: var(--fg);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  padding: calc(var(--safe-top) + 6px) 6px 6px; display: flex; align-items: center; gap: 2px; min-height: 58px;
}
.top h1 { flex: 1; margin: 0 8px; font-size: 16.5px; font-weight: 600; letter-spacing: -.1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.top h1 small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.top .brand { flex: 1; display: flex; align-items: center; gap: 10px; padding-left: 10px; min-width: 0; }
.top .brand img { height: 26px; width: auto; display: block; border-radius: 2px; }
.top .brand span { font-size: 13px; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line); white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.top .brand img, .top .brand .hml { flex: none; }
.top .brand .hml { margin-left: 0; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.icon-btn:active { background: var(--soft); }
.top .icon-btn[data-a="voltar"] { color: var(--fg); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 600; display: grid; place-items: center; font-size: 12.5px; letter-spacing: .3px; }
.hml { background: var(--yellow); color: var(--yellow-ink); font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px; margin-left: 8px; vertical-align: 2px; letter-spacing: .4px; }

main { padding: 14px 14px calc(var(--safe-bottom) + 88px); max-width: 680px; margin: 0 auto; }
.hello { margin: 6px 2px 16px; }
.hello h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.3px; }
.hello p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }

/* ---------- login ---------- */
.login { padding: 0; margin: 0; max-width: none; min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.12fr 1fr; background: var(--card); }
.login-visual { position: relative; overflow: hidden; background: #162c47; color: #fff; display: flex; flex-direction: column; min-height: 720px; }
.login-art { position: absolute; width: 100%; height: 100%; object-fit: cover; object-position: 60% center; }
.login-visual::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, #0d213bd9 0%, #0d213b80 36%, #0d213b05 65%, #0d213be6 100%); }
.login-brand { display: flex; align-items: center; gap: 20px; padding: calc(var(--safe-top) + 42px) 7% 0; z-index: 1; }
.login-brand img { width: 134px; height: auto; display: block; }
.login-eyebrow { display: block; font-size: 10px; font-weight: 700; letter-spacing: 2px; }
.login-panel { display: flex; flex-direction: column; justify-content: center; position: relative; padding: 80px 48px; }
.login-form { width: 100%; max-width: 368px; margin: auto; }
.login-symbol { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--info-bg); color: var(--info); margin-bottom: 30px; }
.login-symbol svg { width: 24px; height: 24px; }
.login-form > .login-eyebrow { color: var(--muted); font-size: 9px; letter-spacing: 1.7px; margin-bottom: 12px; }
.login-form h1 { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -1.1px; line-height: 1.2; }
.login-form .lead { margin: 12px 0 32px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.login-form .field { margin-bottom: 20px; }
.login-form .field > span { font-size: 12px; font-weight: 600; color: var(--fg); margin-bottom: 8px; }
.login-input { position: relative; }
.login-input > svg { position: absolute; left: 15px; top: 17px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.login-form .field input { height: 52px; padding-left: 44px; background: var(--card); border-color: var(--line); border-radius: 10px; font-size: 16px; }
.login-form .field input::placeholder { color: var(--muted); opacity: .8; font-size: 14px; }
.login-form .pass button { top: 5px; right: 5px; color: var(--muted); }
.login-form .btn { margin-top: 8px; height: 52px; justify-content: space-between; padding: 0 20px; background: #1c3a7a; border-radius: 10px; font-size: 14px; box-shadow: 0 5px 12px #1c3a7a19; }
.login-form .btn:hover { background: #2a4f9e; }
.login-form button:focus-visible { outline: 3px solid var(--info); outline-offset: 4px; }
.login-help { margin: 23px 0 0; text-align: center; font-size: 11px; color: var(--muted); }
.versao { text-align: center; color: var(--muted); font-size: 10px; letter-spacing: .3px; margin: 50px 0 0; }
.versao span { padding: 0 7px; }
@media (min-width: 900px) { .login-panel .versao { position: absolute; left: 0; right: 0; bottom: 28px; } }
@media (max-width: 899px) {
  .login { display: flex; flex-direction: column; }
  .login-visual { min-height: 0; height: 330px; flex: none; }
  .login-brand { padding: calc(var(--safe-top) + 23px) 26px 0; gap: 14px; }
  .login-brand img { width: 108px; }
  .login-art { object-position: center 58%; }
  .login-panel { padding: 30px 26px calc(var(--safe-bottom) + 22px); background: var(--card); border-radius: 26px 26px 0 0; margin-top: -24px; z-index: 2; flex: 1; }
  .login-symbol, .login-form > .login-eyebrow { display: none; }
  .login-form h1 { font-size: 26px; letter-spacing: -.8px; }
  .login-form .lead { font-size: 13px; margin: 9px 0 24px; }
  .login-break { display: none; }
  .login-form .field { margin-bottom: 16px; }
  .login-help { margin-top: 20px; }
  .versao { margin-top: 30px; }
}
@media (max-width: 899px) and (max-height: 740px) {
  .login-visual { height: 245px; }
  .login-panel { padding-top: 24px; }
}

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }
.field input { width: 100%; height: 46px; border: 1px solid var(--line); border-radius: 10px; padding: 0 13px; font-size: 16px; background: var(--soft); outline: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus { border-color: var(--navy-2); background: var(--card); box-shadow: 0 0 0 3px rgba(42, 79, 158, .14); }
.pass { position: relative; }
.pass input { padding-right: 46px; }
.pass button { position: absolute; right: 2px; top: 2px; width: 42px; height: 42px; display: grid; place-items: center; color: var(--faint); }

.btn { height: 46px; border-radius: 10px; padding: 0 18px; font-weight: 600; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, transform .1s; }
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:active { background: var(--navy-2); }
.btn-yellow { background: var(--yellow); color: var(--yellow-ink); }
.btn-ghost { background: var(--card); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.btn-ok { background: var(--ok); color: #fff; }
:root[data-theme="dark"] .btn-ok { color: #06240f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-ok { color: #06240f; } }
.btn-danger { background: var(--err-bg); color: var(--err); }
.msg { border-radius: 10px; padding: 11px 13px; font-size: 13.5px; margin: 0 0 14px; line-height: 1.45; }
.msg-err { background: var(--err-bg); color: var(--err); }
.msg-info { background: var(--info-bg); color: var(--fg); }
.msg-warn { background: var(--part-bg); color: var(--fg); }

/* ---------- busca de plano ---------- */
.search { margin-bottom: 6px; }
.search .box { position: relative; display: flex; align-items: center; height: 48px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 0 5px 0 14px; gap: 4px; border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.search .box:focus-within { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(42, 79, 158, .14); }
.search .box > svg { color: var(--faint); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; padding: 0 8px; font-size: 16px; outline: none; }
.search input::placeholder { color: var(--faint); }
.search .scan { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.search .go { width: 38px; height: 38px; border-radius: 9px; background: var(--navy); color: #fff; display: grid; place-items: center; }
.search .go .spin { width: 16px; height: 16px; border-width: 2px; }

/* abas */
.seg { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 10px 2px 14px; }
.seg button { position: relative; height: 42px; font-weight: 500; font-size: 14px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.seg button[aria-pressed="true"] { color: var(--fg); font-weight: 600; }
.seg button[aria-pressed="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--navy-2); }
.seg .n { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--line); font-size: 11.5px; line-height: 18px; font-weight: 600; text-align: center; color: var(--muted); }
.seg button[aria-pressed="true"] .n { background: var(--info-bg); color: var(--info); }

/* ---------- cartão de plano ---------- */
.plan { display: block; width: 100%; text-align: left; background: var(--card); border-radius: var(--radius); padding: 14px 16px 13px; margin-bottom: 10px; box-shadow: var(--shadow); transition: transform .1s; }
.plan:active { transform: scale(.985); }
.plan-head { display: flex; align-items: center; gap: 8px; }
.plan-num { font-size: 16px; font-weight: 600; letter-spacing: .2px; flex: 1; }
.plan-meta { color: var(--muted); font-size: 13px; margin: 3px 0 11px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.plan-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.bar { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 4px; transition: width .3s; }
.bar.part i { background: var(--navy-2); }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; font-size: 12.5px; color: var(--muted); }
.plan-foot b { color: var(--fg); font-weight: 600; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 18px; }
.tag svg { width: 12px; height: 12px; stroke-width: 2; }
.tag-me { background: var(--info-bg); color: var(--info); }
.tag-other { background: var(--part-bg); color: var(--part); }
.tag-urg { background: var(--urg-bg); color: var(--urg); }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-wait { background: var(--soft); color: var(--muted); }
.tag-ordem { background: var(--soft); color: var(--muted); }

.empty { text-align: center; color: var(--muted); padding: 48px 20px; font-size: 14px; }
.empty svg { width: 40px; height: 40px; stroke-width: 1.3; color: var(--faint); margin-bottom: 6px; }
.empty .btn { margin-top: 8px; }
.skeleton { height: 104px; border-radius: var(--radius); margin-bottom: 10px; background: linear-gradient(90deg, var(--card) 25%, var(--soft) 50%, var(--card) 75%); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- tela do plano ---------- */
.prog { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px; }
.ring { position: relative; width: 58px; height: 58px; flex: none; }
.ring svg { width: 58px; height: 58px; transform: rotate(-90deg); stroke-width: 5; }
.ring .trk { stroke: var(--line); }
.ring .val { stroke: var(--navy-2); transition: stroke-dashoffset .4s; }
.ring.full .val { stroke: var(--ok); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 14px; font-weight: 600; }
.prog-txt { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.prog-txt strong { display: block; color: var(--fg); font-size: 15px; font-weight: 600; }
.sync { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap; align-self: flex-start; }
.sync svg { width: 12px; height: 12px; stroke-width: 2.2; }
.sync-ok { color: var(--ok); background: var(--ok-bg); }
.sync-wait { background: var(--info-bg); color: var(--info); }
.sync-off { background: var(--part-bg); color: var(--part); }

.tools { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.chips { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 12px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--navy); box-shadow: none; color: #fff; }
.chip .n { font-size: 11.5px; opacity: .7; }
.filter-search { margin-bottom: 14px; position: relative; }
.filter-search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--faint); }
.filter-search input { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); padding: 0 12px 0 38px; font-size: 15px; outline: none; }
.filter-search input:focus { border-color: var(--navy-2); }
.filter-search input::placeholder { color: var(--faint); }

.group { margin: 0 0 18px; }
.group-h { display: flex; align-items: center; gap: 8px; margin: 0; padding: 0 4px 7px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.group-h span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-h em { font-style: normal; letter-spacing: 0; color: var(--faint); }
.group-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

/* linha de item: [círculo = tudo carregado]  descrição  [quantidade = abre o teclado] */
.item { display: flex; align-items: center; gap: 4px; padding: 6px 12px 6px 4px; position: relative; }
.item + .item::before { content: ""; position: absolute; left: 52px; right: 0; top: 0; height: 1px; background: var(--line); }
.chk { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.chk i { width: 24px; height: 24px; border-radius: 50%; box-shadow: inset 0 0 0 1.8px var(--faint); display: grid; place-items: center; color: transparent; transition: background .15s, box-shadow .15s; }
.chk svg { width: 14px; height: 14px; stroke-width: 3; }
.chk:active i { transform: scale(.9); }
.item.part .chk i { box-shadow: inset 0 0 0 1.8px var(--part); background: linear-gradient(90deg, var(--part) 50%, transparent 50%); }
.item.done .chk i { background: var(--ok); box-shadow: none; color: #fff; }
:root[data-theme="dark"] .item.done .chk i { color: #06240f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .item.done .chk i { color: #06240f; } }
.item-main { flex: 1; min-width: 0; padding: 6px 0; }
.item-title { font-weight: 500; font-size: 14.5px; line-height: 1.3; }
.item.done .item-title { color: var(--muted); }
.item-sub { color: var(--faint); font-size: 12px; margin-top: 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 6px; }
.item-sub .tag { font-size: 10.5px; padding: 0 6px; line-height: 16px; letter-spacing: .2px; }
.item-cfg { font-size: 12px; margin-top: 4px; color: var(--muted); }
.qty { flex: none; min-width: 62px; height: 40px; padding: 0 10px; border-radius: 10px; background: var(--soft); display: inline-flex; align-items: baseline; justify-content: center; gap: 3px; line-height: 40px; }
.qty b { font-size: 16px; font-weight: 600; }
.qty small { color: var(--faint); font-size: 12px; }
.qty:active { background: var(--line); }
.item.done .qty { background: var(--ok-bg); }
.item.done .qty b { color: var(--ok); }
.item.part .qty { background: var(--part-bg); }
.item.part .qty b { color: var(--part); }
.item.locked .chk, .item.locked .qty { pointer-events: none; }
.item.locked .chk i { opacity: .5; }
.flash { animation: flash .7s; }
@keyframes flash { from { background: var(--ok-bg); } }

/* ---------- barra inferior ---------- */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 10px 14px calc(var(--safe-bottom) + 10px); }
.bottom .wrap { max-width: 680px; margin: 0 auto; display: flex; gap: 10px; }
.bottom .btn-ghost { flex: none; }
.bottom .btn-primary { flex: 1; }

/* ---------- folhas (bottom sheet) ---------- */
.backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(8, 14, 24, .45); animation: fade .15s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--card); border-radius: 18px 18px 0 0; padding: 8px 18px calc(var(--safe-bottom) + 18px); max-height: 90vh; overflow-y: auto; animation: up .22s cubic-bezier(.2, .8, .3, 1); max-width: 680px; margin: 0 auto; }
.sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin: 0 0 3px; font-size: 17px; font-weight: 600; }
.sheet .sub { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.sheet .actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
.sheet .btn-ghost { background: var(--soft); box-shadow: none; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

.display { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 6px 0 2px; }
.display b { font-size: 44px; font-weight: 600; letter-spacing: -1px; min-width: 1ch; line-height: 1.1; }
.display small { font-size: 17px; color: var(--faint); }
.display.err b { color: var(--err); }
.hint { min-height: 20px; text-align: center; font-size: 12.5px; color: var(--err); margin-bottom: 10px; }
.quick { display: flex; gap: 6px; margin-bottom: 10px; }
.quick button { flex: 1; height: 34px; border-radius: 17px; box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; font-size: 13px; color: var(--muted); }
.quick button:active { background: var(--soft); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.keys button { height: 52px; border-radius: 10px; background: var(--soft); font-size: 21px; font-weight: 500; display: grid; place-items: center; }
.keys button:active { background: var(--line); }

.resumo-row { padding: 11px 0; border-bottom: 1px solid var(--line); }
.resumo-row:last-of-type { border-bottom: 0; }
.resumo-top { display: flex; gap: 10px; align-items: baseline; margin-bottom: 7px; }
.resumo-top span { flex: 1; font-size: 13.5px; }
.resumo-top b { font-size: 13.5px; font-weight: 600; white-space: nowrap; }
.resumo-top b small { color: var(--faint); font-weight: 400; font-size: 12.5px; }

.menu-item { display: flex; align-items: center; gap: 14px; width: 100%; height: 50px; padding: 0 4px; font-size: 15px; border-bottom: 1px solid var(--line); text-align: left; }
.menu-item svg { color: var(--muted); }
.menu-item:last-of-type { border-bottom: 0; }
.menu-item.danger, .menu-item.danger svg { color: var(--err); }

.scan-view video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 3 / 4; object-fit: cover; }

/* ---------- aviso flutuante ---------- */
#toast { position: fixed; left: 14px; right: 14px; bottom: calc(var(--safe-bottom) + 78px); z-index: 60; display: flex; justify-content: center; pointer-events: none; }
.toast { background: #1f2835; color: #fff; border-radius: 10px; padding: 11px 14px; font-size: 13.5px; display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .28); pointer-events: auto; max-width: 480px; width: 100%; animation: up .2s ease-out; }
.toast span { flex: 1; }
.toast button { color: var(--yellow); font-weight: 600; padding: 4px 2px; }
.toast.err { background: #b3261e; }

.spin { width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .3); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; }
.spin.dark { border-color: var(--line); border-top-color: var(--navy-2); width: 26px; height: 26px; }
@keyframes rot { to { transform: rotate(360deg); } }
.center { display: grid; place-items: center; padding: 56px; }

/* ---------- conferência ---------- */
.sec { margin: 18px 4px 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.mat { position: relative; padding: 6px 12px 6px 4px; transition: background .2s; }
.mat + .mat::before { content: ""; position: absolute; left: 52px; right: 0; top: 0; height: 1px; background: var(--line); }
.mat-row { display: flex; align-items: center; gap: 4px; }
.mat.ok .chk i { background: var(--ok); box-shadow: none; color: #fff; }
.mat .qty.ro { pointer-events: none; }
.mat.full .qty { background: var(--ok-bg); } .mat.full .qty b { color: var(--ok); }
.mat.short .qty { background: var(--part-bg); } .mat.short .qty b { color: var(--part); }
.mat.ok .item-title { color: var(--muted); }
.motivos { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 0 8px 48px; }
.motivos .chip { height: 30px; font-size: 12.5px; }
.motivos .chip[aria-pressed="true"] { background: var(--part); color: #fff; }
.motivo-txt { display: block; width: calc(100% - 48px); margin: 0 0 8px 48px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); padding: 0 12px; font-size: 15px; outline: none; }
.motivo-txt:focus { border-color: var(--navy-2); background: var(--card); }
.mat.need { animation: tremer .35s; background: var(--err-bg); }
.mat.flash .chk i { animation: estalo .45s var(--spring); }
.mat.flash .chk svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: tracar .3s .12s var(--ease) forwards; }

.placa-box { display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px 0 16px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1.5px solid var(--line); transition: border-color .2s, box-shadow .2s; }
.placa-box > svg { color: var(--faint); }
.placa-box input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 22px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.placa-box input::placeholder { color: var(--line); }
.placa-box:focus-within { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(42, 79, 158, .14); }
.placa-box.ok { border-color: var(--ok); }
.placa-box.bad { border-color: var(--part); }
.placa-box.shake { animation: tremer .35s; border-color: var(--err); }
.sug { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; min-height: 4px; }
.sug .chip { font-family: ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: 1px; animation: fadeIn .2s; }

.bottom .wrap.col { flex-direction: column; gap: 6px; }
.hint-bar { margin: 0; text-align: center; font-size: 12.5px; color: var(--muted); min-height: 18px; }
.hint-bar.ready { color: var(--ok); font-weight: 600; }
.bottom .btn-ok { background: var(--ok); }

.resumo-envio { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.resumo-envio div { background: var(--soft); border-radius: 10px; padding: 9px 12px; }
.resumo-envio dt { font-size: 11.5px; color: var(--muted); }
.resumo-envio dd { margin: 1px 0 0; font-weight: 600; font-size: 14.5px; }
.sec-mini { margin: 16px 0 6px; font-size: 12px; font-weight: 600; color: var(--part); }
.falta-row { display: grid; grid-template-columns: 1fr auto; gap: 0 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.falta-row b { font-weight: 600; color: var(--part); }
.falta-row small { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }

.done-screen { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px; }
.done-badge { width: 104px; height: 104px; margin-bottom: 22px; }
.done-badge svg { width: 104px; height: 104px; stroke-width: 3.5; }
.done-badge circle { fill: var(--ok-bg); stroke: var(--ok); stroke-dasharray: 151; stroke-dashoffset: 151; animation: tracar .6s var(--ease) forwards; }
.done-badge path { stroke: var(--ok); stroke-dasharray: 40; stroke-dashoffset: 40; animation: tracar .35s .5s var(--ease) forwards; }
.done-badge { animation: estalo .6s .45s var(--spring) both; }
.done-screen h1 { margin: 0 0 8px; font-size: 22px; font-weight: 650; letter-spacing: -.3px; animation: subir .4s .3s var(--ease) both; }
.done-screen p { margin: 2px 0; font-size: 15px; animation: subir .4s .38s var(--ease) both; }
.done-screen .muted { color: var(--muted); font-size: 13.5px; }
.done-screen .btn { margin-top: 28px; min-width: 220px; animation: subir .4s .5s var(--ease) both; }

/* ---------- animações ---------- */
:root { --ease: cubic-bezier(.2, .8, .25, 1); --spring: cubic-bezier(.34, 1.56, .64, 1); }

/* troca de tela: avançando entra da direita, voltando entra da esquerda */
.in-fwd { animation: inFwd .3s var(--ease) both; }
.in-back { animation: inBack .3s var(--ease) both; }
.in-fade { animation: subir .4s var(--ease) both; }
@keyframes inFwd { from { opacity: 0; transform: translateX(32px); } }
@keyframes inBack { from { opacity: 0; transform: translateX(-32px); } }
@keyframes subir { from { opacity: 0; transform: translateY(12px); } }

/* listas entram em cascata (planos, grupos de itens) */
.pop { animation: subir .38s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + 60ms); }
.pop .bar i { animation: crescer .7s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + 250ms); }
@keyframes crescer { from { width: 0; } }
.skeleton { animation: sk 1.2s infinite, fadeIn .3s both; }
@keyframes fadeIn { from { opacity: 0; } }

/* aba ativa: sublinhado abre do centro */
.seg button[aria-pressed="true"]::after { animation: abrirX .25s var(--ease); }
@keyframes abrirX { from { transform: scaleX(0); } }
.seg button { transition: color .2s; }
.chip { transition: background .2s, color .2s, box-shadow .2s, transform .1s; }
.chip:active { transform: scale(.95); }

/* item marcado: o círculo "estala", o ✓ se desenha e o número pula */
.chk i { transition: background .2s, box-shadow .2s, transform .15s; }
.item.flash.done .chk i { animation: estalo .45s var(--spring); }
.item.flash.done .chk svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: tracar .3s .12s var(--ease) forwards; }
.item.flash.part .chk i { animation: estalo .4s var(--spring); }
.item.flash .qty b { display: inline-block; animation: pulo .4s var(--spring); }
.item.flash { animation: brilho .9s var(--ease); }
@keyframes estalo { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes tracar { to { stroke-dashoffset: 0; } }
@keyframes pulo { 0% { transform: translateY(0) scale(1); } 40% { transform: translateY(-5px) scale(1.15); } 100% { transform: none; } }
@keyframes brilho { from { background: var(--ok-bg); } }
.qty { transition: background .25s, transform .1s; }
.qty:active { transform: scale(.94); }
.item-title { transition: color .25s; }

/* item completo saindo da aba "Pendentes" */
.item.leaving { overflow: hidden; opacity: 0; transform: translateX(28px); padding-top: 0; padding-bottom: 0;
  transition: height .3s var(--ease), opacity .2s, transform .25s var(--ease), padding .3s var(--ease); }

/* anel de progresso e comemoração ao chegar em 100% */
.ring .val { transition: stroke-dashoffset .6s var(--ease), stroke .3s; }
.prog.celebra { animation: celebra .7s var(--spring); }
.prog.celebra .ring { animation: estalo .6s var(--spring); }
@keyframes celebra { 30% { box-shadow: 0 0 0 4px var(--ok-bg), var(--shadow); } }
.confete { position: fixed; z-index: 70; width: 7px; height: 7px; border-radius: 2px; pointer-events: none; animation: confete .85s cubic-bezier(.15, .7, .4, 1) forwards; }
@keyframes confete { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y) + 30px)) rotate(var(--r)) scale(1); opacity: 0; } }
.sync { animation: fadeIn .25s; }

/* folhas e avisos saem deslizando */
.sheet-out { pointer-events: none; }
.sheet-out .sheet { animation: descer .2s ease-in forwards; }
.sheet-out .backdrop { animation: fadeOut .2s forwards; }
@keyframes descer { to { transform: translateY(100%); } }
@keyframes fadeOut { to { opacity: 0; } }
.toast.out { animation: toastSai .2s ease-in forwards; }
@keyframes toastSai { to { opacity: 0; transform: translateY(12px) scale(.98); } }
.keys button { transition: background .1s, transform .08s; }
.keys button:active { transform: scale(.94); }
.display b { transition: color .2s; }
.display.err b { animation: tremer .3s; }
@keyframes tremer { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.bar i { transition: width .5s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* traços que só apareciam "desenhando": sem animação, já mostram o estado final */
  .done-badge circle, .done-badge path, .item.flash.done .chk svg path, .mat.flash .chk svg path { stroke-dashoffset: 0 !important; }
}
