@font-face { font-family: 'Geist'; src: url('../vendor/fonts/geist.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('../vendor/fonts/geist-mono.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root {
  --bg: #EDEFE8;
  --bg-2: #E3E6DD;
  --card: #FFFFFF;
  --card-2: #F5F6F1;
  --line: rgba(13, 16, 14, .08);
  --line-2: rgba(13, 16, 14, .16);
  --ink: #0D100E;
  --ink-2: #49514B;
  --ink-3: #7D867F;
  --lime: #CBF53B;
  --lime-2: #B6E21F;
  --on-lime: #0D100E;
  --accent-text: #4B6800;
  --hero: #0F1311;
  --hero-ink: #F1F4EE;
  --hero-ink-2: #9AA39C;
  --hero-line: rgba(255, 255, 255, .09);
  --blue: #2E62F0; --blue-soft: #E4ECFF;
  --amber: #A86200; --amber-soft: #FFF1D9;
  --red: #CF3526; --red-soft: #FFE6E2;
  --green: #127A43; --green-soft: #DDF5E7;
  --shadow: 0 1px 0 rgba(13,16,14,.04), 0 10px 30px -18px rgba(13,16,14,.35);
  --r-lg: 24px;
  --r: 16px;
  --r-sm: 11px;
  --tabbar-h: 76px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #090B0A;
  --bg-2: #0F1210;
  --card: #141816;
  --card-2: #1B201D;
  --line: rgba(255, 255, 255, .065);
  --line-2: rgba(255, 255, 255, .14);
  --ink: #F0F3ED;
  --ink-2: #A3ACA5;
  --ink-3: #6B746D;
  --accent-text: #CBF53B;
  --hero: #151A17;
  --hero-line: rgba(255, 255, 255, .08);
  --blue: #86A9FF; --blue-soft: rgba(134, 169, 255, .13);
  --amber: #FFB547; --amber-soft: rgba(255, 181, 71, .13);
  --red: #FF7061; --red-soft: rgba(255, 112, 97, .13);
  --green: #52DE90; --green-soft: rgba(82, 222, 144, .12);
  --shadow: 0 0 0 1px rgba(255,255,255,.05);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--ink);
  font-feature-settings: 'ss01', 'cv11';
  overscroll-behavior-y: none;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { max-width: 100%; display: block; }
.i { width: 20px; height: 20px; flex: none; }
.mono { font-family: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace; font-feature-settings: normal; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ——— Estrutura ——— */
#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen {
  padding: calc(var(--sat) + 18px) 18px calc(var(--tabbar-h) + var(--sab) + 28px);
  animation: screen-in .42s var(--ease) both;
}
.screen.flow { padding-bottom: calc(var(--sab) + 120px); }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } }
.rise { animation: rise .55s var(--ease) both; animation-delay: calc(var(--d, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; min-height: 44px; }
.top .title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.eyebrow { font-size: 12.5px; color: var(--ink-3); font-weight: 500; letter-spacing: .01em; }
.h1 { font-size: 30px; line-height: 1.08; font-weight: 650; letter-spacing: -.035em; margin: 2px 0 0; }
.h2 { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 28px 2px 10px; display: flex; align-items: center; justify-content: space-between; }
.h2 a, .h2 button { color: var(--ink-3); font-weight: 500; font-size: 13px; text-decoration: none; }

.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--card); box-shadow: var(--shadow); color: var(--ink); flex: none;
  transition: transform .15s var(--ease);
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.plain { background: transparent; box-shadow: none; }

/* ——— Cartões ——— */
.card { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 12px; }
.card.tight { padding: 6px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.stat { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px 14px 13px; min-width: 0; }
.stat .k { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.stat .k .i { width: 15px; height: 15px; }
.stat .v { font-size: 23px; font-weight: 650; letter-spacing: -.035em; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .s { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.stat .v.good { color: var(--green); }
.stat .v.bad { color: var(--red); }

/* Cartão principal (viagem em andamento) */
.hero {
  background: var(--hero); color: var(--hero-ink); border-radius: 28px; padding: 20px; position: relative; overflow: hidden;
  box-shadow: 0 24px 50px -30px rgba(0,0,0,.6);
}
:root[data-theme="dark"] .hero { box-shadow: 0 0 0 1px var(--hero-line); }
.hero::before {
  content: ''; position: absolute; inset: auto -30% -65% auto; width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(203,245,59,.22), transparent); pointer-events: none;
}
.hero .muted { color: var(--hero-ink-2); }
.hero .big { font-size: 64px; line-height: .95; font-weight: 650; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.hero .big small { font-size: 22px; letter-spacing: -.02em; color: var(--hero-ink-2); font-weight: 500; margin-left: 4px; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.hero .route { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--hero-ink-2); white-space: nowrap; min-width: 0; overflow: hidden; }
.hero .route b { color: var(--hero-ink); font-weight: 550; }
.hero .route .i { width: 16px; height: 16px; }

.stepper { display: flex; align-items: center; gap: 0; margin: 18px 0 18px; }
.stepper .st { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; flex: 1; font-size: 12px; color: var(--hero-ink-2); position: relative; }
.stepper .st::before { content: ''; position: absolute; top: 5px; left: 14px; right: 2px; height: 2px; border-radius: 2px; background: var(--hero-line); }
.stepper .st:last-child { flex: none; }
.stepper .st:last-child::before { display: none; }
.stepper .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--hero-line); background: var(--hero); position: relative; z-index: 1; }
.stepper .st.done .dot { background: var(--lime); border-color: var(--lime); }
.stepper .st.done::before { background: var(--lime); }
.stepper .st.now .dot { border-color: var(--lime); box-shadow: 0 0 0 5px rgba(203,245,59,.18); animation: pulse 1.8s var(--ease) infinite; }
.stepper .st.now, .stepper .st.done { color: var(--hero-ink); }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(203,245,59,0); } }

.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.hero .progress { background: var(--hero-line); }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--lime); transition: width .6s var(--ease); }

/* ——— Botões ——— */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 56px; padding: 0 20px; border-radius: 18px; font-weight: 600; font-size: 16px; letter-spacing: -.01em;
  background: var(--lime); color: var(--on-lime);
  transition: transform .15s var(--ease), background .2s, opacity .2s;
  text-decoration: none;
}
.btn:active { transform: scale(.975); }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.soft { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.hero .btn.soft { background: rgba(255,255,255,.08); color: var(--hero-ink); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink-2); min-height: 48px; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.sm { min-height: 42px; border-radius: 13px; font-size: 14px; width: auto; padding: 0 14px; }
.btn[aria-disabled="true"] { opacity: .45; }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 14px 18px calc(var(--sab) + 14px);
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  max-width: 520px; margin: 0 auto;
}
.dock .hint { text-align: center; font-size: 12.5px; color: var(--ink-3); margin-top: 9px; }

/* ——— Pílulas e chips ——— */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.pill .i { width: 14px; height: 14px; }
.pill.coleta { background: var(--amber-soft); color: var(--amber); }
.pill.transito { background: var(--blue-soft); color: var(--blue); }
.pill.entregue { background: var(--green-soft); color: var(--green); }
.pill.cancelada { background: var(--card-2); color: var(--ink-3); }
.pill.faltando { background: var(--red-soft); color: var(--red); }
.pill.extra { background: var(--amber-soft); color: var(--amber); }
.pill.neutral { background: var(--card-2); color: var(--ink-2); }
.hero .pill { background: rgba(203,245,59,.14); color: var(--lime); }
.live { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -18px; padding: 2px 18px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 38px; padding: 0 15px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow);
  font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
  transition: background .2s, color .2s;
}
.chip b { font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip.on { background: var(--ink); color: var(--bg); box-shadow: none; }
.chip.on b { color: var(--bg); opacity: .6; }

/* ——— Listas ——— */
.list { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px; width: 100%; text-align: left;
  text-decoration: none; color: inherit; position: relative;
}
.row + .row::before { content: ''; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--line); }
.row:active { background: var(--card-2); }
.row .body { flex: 1; min-width: 0; }
.row .t { font-weight: 550; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .d { font-size: 13px; color: var(--ink-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex: none; }
.row .end .t { font-variant-numeric: tabular-nums; }
.row > .i:last-child { color: var(--ink-3); width: 18px; height: 18px; }
.badge {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: var(--card-2); color: var(--ink-2);
}
.badge.lime { background: var(--lime); color: var(--on-lime); }
.badge.coleta { background: var(--amber-soft); color: var(--amber); }
.badge.transito { background: var(--blue-soft); color: var(--blue); }
.badge.entregue { background: var(--green-soft); color: var(--green); }
.badge.faltando { background: var(--red-soft); color: var(--red); }

.code-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; position: relative; }
.code-row + .code-row::before { content: ''; position: absolute; top: 0; left: 16px; right: 16px; height: 1px; background: var(--line); }
.code-row .mono { flex: 1; font-size: 14px; letter-spacing: .01em; overflow: hidden; text-overflow: ellipsis; }
.code-row .time { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.code-row .x { color: var(--ink-3); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; }
.code-row .x .i { width: 16px; height: 16px; }

.empty { text-align: center; padding: 36px 20px; color: var(--ink-3); }
.empty .badge { margin: 0 auto 12px; width: 52px; height: 52px; border-radius: 16px; }
.empty .t { color: var(--ink); font-weight: 600; font-size: 16px; margin-bottom: 4px; }

/* ——— Formulários ——— */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); margin: 0 2px 7px; }
.field > small { display: block; font-size: 12.5px; color: var(--ink-3); margin: 6px 2px 0; }
.input, textarea.input, select.input {
  width: 100%; min-height: 54px; border-radius: 15px; border: 1.5px solid var(--line); background: var(--card);
  padding: 14px 15px; font-size: 16px; outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px var(--line); }
.input.big { font-size: 28px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.input-group { position: relative; }
.input-group .pre { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-group .input { padding-left: 42px; }
.search { position: relative; }
.search .i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--ink-3); width: 18px; height: 18px; }
.search .input { padding-left: 44px; min-height: 50px; border-color: transparent; box-shadow: var(--shadow); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--bg-2); padding: 4px; border-radius: 15px; gap: 4px; }
.seg button { height: 42px; border-radius: 11px; font-size: 14px; font-weight: 550; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 7px; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.seg .i { width: 17px; height: 17px; }

.toggle { position: relative; width: 50px; height: 30px; border-radius: 99px; background: var(--line-2); flex: none; transition: background .2s; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .25s var(--spring); }
.toggle.on { background: var(--lime-2); }
.toggle.on::after { transform: translateX(20px); }

.photo-slot {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px; border-radius: 18px;
  border: 1.5px dashed var(--line-2); background: var(--card); text-align: left; position: relative; overflow: hidden;
}
.photo-slot .thumb { width: 64px; height: 64px; border-radius: 12px; background: var(--card-2); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--ink-3); }
.photo-slot .thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot.has { border-style: solid; border-color: var(--line); }
.photo-slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.sig { position: relative; background: var(--card); border-radius: 18px; border: 1.5px solid var(--line); overflow: hidden; touch-action: none; }
.sig canvas { width: 100%; height: 190px; display: block; }
.sig .line { position: absolute; left: 22px; right: 22px; bottom: 44px; border-top: 1.5px dashed var(--line-2); pointer-events: none; }
.sig .ph { position: absolute; left: 22px; bottom: 18px; font-size: 12.5px; color: var(--ink-3); pointer-events: none; display: flex; align-items: center; gap: 6px; }
.sig .ph .i { width: 15px; height: 15px; }
.sig .clear { position: absolute; top: 10px; right: 10px; }
.sig.signed .ph { opacity: 0; }

/* ——— Barra de abas ——— */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; max-width: 520px; margin: 0 auto;
  height: calc(var(--tabbar-h) + var(--sab)); padding: 0 10px var(--sab);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 550; color: var(--ink-3); text-decoration: none; padding: 8px 0; transition: color .2s; }
.tab .i { width: 23px; height: 23px; transition: transform .25s var(--spring); }
.tab.on { color: var(--ink); }
.tab.on .i { transform: translateY(-1px); }
.tab-fab { display: grid; place-items: center; text-decoration: none; }
.tab-fab span {
  width: 62px; height: 62px; border-radius: 22px; display: grid; place-items: center; margin-top: -26px;
  background: var(--lime); color: var(--on-lime);
  box-shadow: 0 12px 26px -10px rgba(120, 160, 0, .75), 0 0 0 5px var(--bg);
  transition: transform .2s var(--spring);
}
.tab-fab span .i { width: 28px; height: 28px; }
.tab-fab:active span { transform: scale(.92) rotate(-4deg); }

/* ——— Gráfico de barras ——— */
.bars { display: grid; grid-template-columns: repeat(var(--n, 7), 1fr); gap: 8px; align-items: end; height: 132px; margin-top: 16px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bar i { display: block; width: 100%; max-width: 34px; border-radius: 9px; background: var(--card-2); min-height: 6px; transform-origin: bottom; animation: grow .7s var(--ease) both; animation-delay: calc(var(--d, 0) * 45ms); position: relative; }
.bar.today i { background: var(--lime); }
.bar.has i { background: var(--ink); }
:root[data-theme="dark"] .bar.has i { background: #3A423D; }
.bar.today.has i, :root[data-theme="dark"] .bar.today.has i { background: var(--lime); }
.bar em { font-style: normal; font-size: 11.5px; color: var(--ink-3); font-weight: 550; }
.bar b { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); min-height: 15px; }
@keyframes grow { from { transform: scaleY(0); } }

/* ——— Medidor do MEI ——— */
.meter { position: relative; height: 12px; border-radius: 12px; background: var(--card-2); overflow: visible; margin: 16px 0 8px; }
.meter .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 12px; background: var(--ink); transition: width .8s var(--ease); }
.meter .proj { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 12px; background: repeating-linear-gradient(-45deg, var(--line-2) 0 5px, transparent 5px 10px); }
.meter .cap { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--red); border-radius: 2px; }
.meter.alerta .fill { background: var(--amber); }
.meter.critico .fill { background: var(--red); }
:root[data-theme="dark"] .meter .fill { background: var(--lime); }
:root[data-theme="dark"] .meter.alerta .fill { background: var(--amber); }
:root[data-theme="dark"] .meter.critico .fill { background: var(--red); }
.legend { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.notice { display: flex; gap: 12px; padding: 14px 15px; border-radius: 18px; font-size: 14px; line-height: 1.45; }
.notice .i { margin-top: 1px; }
.notice.warn { background: var(--amber-soft); color: var(--amber); }
.notice.bad { background: var(--red-soft); color: var(--red); }
.notice.info { background: var(--blue-soft); color: var(--blue); }
.notice.good { background: var(--green-soft); color: var(--green); }
.notice b { font-weight: 650; }
.notice p { margin: 0; }

/* ——— Linha do tempo ——— */
.timeline { position: relative; padding: 4px 0 4px; }
.tl { display: flex; gap: 14px; position: relative; padding-bottom: 18px; }
.tl:last-child { padding-bottom: 0; }
.tl::before { content: ''; position: absolute; left: 15px; top: 34px; bottom: 2px; width: 2px; background: var(--line); border-radius: 2px; }
.tl:last-child::before { display: none; }
.tl .badge { width: 32px; height: 32px; border-radius: 10px; }
.tl .badge .i { width: 16px; height: 16px; }
.tl .t { font-weight: 600; font-size: 14.5px; }
.tl .d { font-size: 13px; color: var(--ink-3); }

.proofs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 12px; }
.proof { aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--card-2); position: relative; }
.proof img { width: 100%; height: 100%; object-fit: cover; }
.proof.sigimg { background: #fff; }
.proof.sigimg img { object-fit: contain; padding: 8px; }
.proof span { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 600; background: rgba(0,0,0,.6); color: #fff; padding: 2px 7px; border-radius: 99px; }

/* ——— Leitor de código ——— */
.scanner { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: flex; flex-direction: column; overflow: hidden; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .shade { position: absolute; inset: 0; pointer-events: none; }
.scanner .frame {
  position: absolute; left: 50%; top: 34%; width: min(82vw, 380px); height: 170px; transform: translate(-50%, -50%);
  border-radius: 22px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.52); transition: box-shadow .25s;
}
.frame .cn { position: absolute; width: 34px; height: 34px; border: 4px solid #fff; transition: border-color .15s; }
.frame .cn.a { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-radius: 22px 0 0 0; }
.frame .cn.b { right: -2px; top: -2px; border-left: 0; border-bottom: 0; border-radius: 0 22px 0 0; }
.frame .cn.c { left: -2px; bottom: -2px; border-right: 0; border-top: 0; border-radius: 0 0 0 22px; }
.frame .cn.d { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-radius: 0 0 22px 0; }
.frame .laser { position: absolute; left: 18px; right: 18px; top: 50%; height: 2px; border-radius: 2px; background: var(--lime); box-shadow: 0 0 18px 2px rgba(203,245,59,.7); animation: laser 1.9s ease-in-out infinite; }
@keyframes laser { 0%, 100% { transform: translateY(-58px); opacity: .4; } 50% { transform: translateY(58px); opacity: 1; } }
.frame.ok .cn { border-color: var(--lime); }
.frame.warn .cn { border-color: #FFB547; }
.frame.bad .cn { border-color: #FF7061; }
.frame.ok { animation: ping .35s var(--ease); }
@keyframes ping { 40% { transform: translate(-50%, -50%) scale(1.035); } }
.scan-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.scan-flash.ok { background: rgba(203,245,59,.22); animation: flash .45s ease-out; }
.scan-flash.warn { background: rgba(255,181,71,.25); animation: flash .5s ease-out; }
.scan-flash.bad { background: rgba(255,112,97,.28); animation: flash .5s ease-out; }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }

.scan-top { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: calc(var(--sat) + 14px) 16px 0; gap: 10px; }
.scan-top .icon-btn { background: rgba(0,0,0,.45); color: #fff; box-shadow: none; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.scan-top .icon-btn.on { background: var(--lime); color: #0D100E; }
.scan-top .ttl { text-align: center; font-size: 14px; font-weight: 600; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.scan-top .ttl small { display: block; font-weight: 450; opacity: .75; font-size: 12.5px; }
.scan-msg { position: absolute; z-index: 2; left: 0; right: 0; top: calc(34% + 110px); text-align: center; font-size: 14px; color: rgba(255,255,255,.8); text-shadow: 0 1px 8px rgba(0,0,0,.7); padding: 0 24px; }

.scan-panel {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto;
  background: var(--bg); color: var(--ink); border-radius: 30px 30px 0 0; padding: 10px 18px calc(var(--sab) + 16px);
  box-shadow: 0 -20px 50px -20px rgba(0,0,0,.6);
}
.scan-panel .grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 0 auto 12px; }
.counter { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.counter .n { font-size: 60px; line-height: .9; font-weight: 650; letter-spacing: -.06em; font-variant-numeric: tabular-nums; display: inline-block; }
.counter .n.bump { animation: bump .35s var(--spring); }
@keyframes bump { 40% { transform: scale(1.12); } }
.counter .of { font-size: 20px; color: var(--ink-3); font-weight: 500; letter-spacing: -.02em; margin-left: 2px; }
.last {
  display: flex; align-items: center; gap: 11px; margin: 14px 0 12px; padding: 11px 12px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow);
  min-height: 60px;
}
.last .badge { width: 38px; height: 38px; border-radius: 11px; }
.last .mono { font-size: 15px; font-weight: 550; }
.last.pop { animation: pop .35s var(--spring); }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: .4; } }
.scan-list { max-height: 26vh; overflow-y: auto; margin: 0 -18px 12px; padding: 0 2px; }

.cam-error { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 30px 30px 45vh; color: rgba(255,255,255,.85); }
.cam-error .i { width: 40px; height: 40px; margin: 0 auto 12px; opacity: .7; }

/* ——— Folhas, avisos ——— */
.sheet-bg { position: fixed; inset: 0; z-index: 80; background: rgba(5,7,6,.5); animation: fade .25s both; }
.sheet-bg.out { animation: fade .2s reverse both; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; max-width: 520px; margin: 0 auto;
  background: var(--bg); border-radius: 30px 30px 0 0; padding: 10px 18px calc(var(--sab) + 18px);
  max-height: 92dvh; overflow-y: auto; animation: sheet-up .42s var(--ease) both;
}
.sheet.out { animation: sheet-up .25s reverse both ease-in; }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet .grab { width: 40px; height: 5px; border-radius: 5px; background: var(--line-2); margin: 0 auto 16px; }
.sheet h3 { font-size: 22px; font-weight: 650; letter-spacing: -.03em; margin: 0 0 4px; }
.sheet .sub { color: var(--ink-3); font-size: 14px; margin: 0 0 18px; }

.toast-wrap { position: fixed; top: calc(var(--sat) + 12px); left: 0; right: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 12px; border-radius: 16px; max-width: 440px;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 550; box-shadow: 0 16px 40px -14px rgba(0,0,0,.5);
  animation: toast-in .4s var(--spring) both;
}
.toast .i { width: 18px; height: 18px; }
.toast.good .i { color: var(--lime); }
:root[data-theme="dark"] .toast.good .i { color: #4B6800; }
.toast.bad .i { color: var(--red); }
.toast.out { animation: toast-in .25s reverse both; }
@keyframes toast-in { from { transform: translateY(-20px) scale(.96); opacity: 0; } }

/* Tela de conclusão */
.finish {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--sat) + 30px) 22px calc(var(--sab) + 30px);
  background: var(--hero); color: var(--hero-ink); position: relative; overflow: hidden;
}
.finish::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; left: 50%; top: 32%; transform: translate(-50%, -50%); background: radial-gradient(closest-side, rgba(203,245,59,.25), transparent); }
.finish > * { position: relative; }
.finish .seal { width: 92px; height: 92px; border-radius: 30px; background: var(--lime); color: #0D100E; display: grid; place-items: center; margin-bottom: 26px; animation: seal .7s var(--spring) both; }
.finish .seal .i { width: 46px; height: 46px; stroke-width: 2.4; }
@keyframes seal { from { transform: scale(.3) rotate(-20deg); opacity: 0; } }
.finish .h1 { font-size: 38px; }
.finish .muted { color: var(--hero-ink-2); }
.finish .kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hero-line); border-radius: 20px; overflow: hidden; margin: 26px 0 28px; }
.finish .kpis > div { background: var(--hero); padding: 16px; }
.finish .kpis .v { font-size: 28px; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.finish .kpis .k { font-size: 12.5px; color: var(--hero-ink-2); }
.finish .btn.soft { background: rgba(255,255,255,.08); color: var(--hero-ink); box-shadow: none; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; background: var(--lime); animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* Onboarding */
.onb { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--sat) + 24px) 20px calc(var(--sab) + 24px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; letter-spacing: -.02em; }
.brand .mark { width: 36px; height: 36px; border-radius: 11px; background: #0F1311; color: var(--lime); display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line); }
.brand .mark .i { width: 20px; height: 20px; }
.onb-hero { margin: 42px 0 30px; }
.onb-hero .h1 { font-size: 40px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 22px; height: 5px; border-radius: 5px; background: var(--line-2); transition: background .3s, width .3s; }
.dots i.on { background: var(--ink); width: 34px; }

/* ——— Relatório (impressão) ——— */
.report { background: #fff; color: #111; border-radius: 18px; padding: 26px 22px; font-size: 12.5px; box-shadow: var(--shadow); }
.report h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; }
.report .rh { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 14px; margin-bottom: 16px; }
.report .rk { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 18px; }
.report .rk div { border: 1px solid #ddd; border-radius: 10px; padding: 10px 12px; }
.report .rk b { display: block; font-size: 20px; letter-spacing: -.02em; }
.report table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.report th { text-align: left; font-size: 11px; color: #666; font-weight: 600; border-bottom: 1px solid #ccc; padding: 6px 4px; }
.report td { border-bottom: 1px solid #eee; padding: 7px 4px; vertical-align: top; }
.report td.r, .report th.r { text-align: right; }
.report .codes { font-family: 'Geist Mono', monospace; font-size: 10px; color: #444; line-height: 1.6; word-break: break-all; }
.report .foot { margin-top: 20px; font-size: 11px; color: #666; }
.report-scroll { overflow-x: auto; }
@media (max-width: 520px) {
  .report { padding: 20px 16px; }
  .report .rh { flex-direction: column; gap: 8px; }
  .report .rh > div:last-child { text-align: left !important; }
  .report .rk b { font-size: 16px; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; }
  .tabbar, .dock, .top, .no-print, .toast-wrap { display: none !important; }
  .screen { padding: 0 !important; animation: none; }
  #app { max-width: none; }
  .report { box-shadow: none; padding: 0; border-radius: 0; font-size: 11px; }
  .report tr { break-inside: avoid; }
}

@media (min-width: 560px) {
  body { background: var(--bg-2); }
  #app { background: var(--bg); box-shadow: 0 0 0 1px var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ——— v2: sincronização, provas, portal ——— */
.sync-pill { flex: none; cursor: pointer; }
.sync-pill .i { width: 14px; height: 14px; }
.proof.missing { display: grid; place-items: center; }
.proof.missing::before { content: 'Enviando…'; font-size: 11px; color: var(--ink-3); }
.row[disabled] { cursor: default; }
.row[disabled]:active { background: none; }
.chips[style*="flex-wrap"] { margin: 0; padding: 2px 0; overflow: visible; }
a.proof { display: block; }
.btn[aria-disabled="true"] { pointer-events: none; }

/* ——— v3: contagem e recebimentos ——— */
.qty { display: grid; grid-template-columns: 60px 1fr 60px; gap: 8px; align-items: stretch; }
.qty-btn { height: 64px; border-radius: 18px; background: var(--card-2); color: var(--ink); display: grid; place-items: center; transition: transform .12s var(--ease), background .2s; touch-action: manipulation; user-select: none; }
.qty-btn:active { transform: scale(.94); background: var(--line-2); }
.qty-btn .i { width: 24px; height: 24px; stroke-width: 2.4; }
.qty-input { width: 100%; min-width: 0; height: 64px; border-radius: 18px; border: 1.5px solid var(--line); background: var(--card); text-align: center; font-size: 34px; font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; outline: none; -moz-appearance: textfield; }
.qty-input::-webkit-outer-spin-button, .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px var(--line); }
.card .qty-btn { background: var(--bg); }
.datebox { width: 46px; height: 50px; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; background: var(--card-2); color: var(--ink-2); line-height: 1; }
.datebox b { font-size: 19px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.datebox span { font-size: 11px; font-weight: 600; text-transform: lowercase; margin-top: 3px; }
.datebox.transito { background: var(--blue-soft); color: var(--blue); }
.datebox.entregue { background: var(--green-soft); color: var(--green); }
.datebox.faltando { background: var(--red-soft); color: var(--red); }
.datebox.coleta { background: var(--amber-soft); color: var(--amber); }
.row .d .pill { vertical-align: 1px; }
.row.rec { align-items: flex-start; }
.row.rec .t, .row.rec .d { white-space: normal; }
.row.rec .end { padding-top: 2px; }
