:root {
  --marca: #2563eb;
  --marca-txt: #ffffff;
  --fundo: #f5f5f4;
  --cartao: #ffffff;
  --txt: #18181b;
  --txt2: #71717a;
  --txt3: #a1a1aa;
  --linha: #e7e5e4;
  --linha2: #f0efee;
  --verde: #16a34a;
  --verde-bg: #ecfdf3;
  --amarelo: #b45309;
  --amarelo-bg: #fffbeb;
  --vermelho: #dc2626;
  --vermelho-bg: #fef2f2;
  --azul: #2563eb;
  --azul-bg: #eff6ff;
  --laranja: #f97316;
  --laranja-bg: #fff4ec;
  --noite: #0b1a44;
  --degrade: linear-gradient(135deg, color-mix(in srgb, var(--marca), #000 28%) 0%, var(--marca) 55%, color-mix(in srgb, var(--marca), #fff 22%) 100%);
  --degrade-fundo: radial-gradient(120% 90% at 85% 0%, rgba(96,165,250,.45) 0%, transparent 55%), linear-gradient(160deg, #0b1a44 0%, #12307f 50%, #1d4ed8 100%);
  --raio: 14px;
  --raio-p: 10px;
  --sombra: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
  --sombra-alta: 0 10px 40px rgba(0,0,0,.18);
  --fonte: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--fonte); font-size: 15px; line-height: 1.45; color: var(--txt);
  background: var(--fundo); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--txt2); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.bold { font-weight: 650; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.lg { gap: 20px; }
.stack > *, .grid2 > *, .grid3 > *, .stats > * { min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .grid2.resp { grid-template-columns: 1fr; } }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--marca); color: var(--marca-txt); font-weight: 600; cursor: pointer;
  transition: transform .08s ease, opacity .15s, background .15s; white-space: nowrap; user-select: none;
}
.btn { background: var(--degrade); }
.btn:active { transform: scale(.98); }

/* marca do sistema */
.mk { display: inline-flex; align-items: baseline; color: #fff; font-weight: 800; letter-spacing: -.05em; line-height: 1; white-space: nowrap; }
.mk-o { display: inline-block; width: .6em; height: .6em; margin-left: .04em; color: #f97316; align-self: baseline; }
.mk-o svg { display: block; width: 100%; height: 100%; }
.mk.escura { color: var(--txt); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.full { width: 100%; }
.btn.lg { height: 54px; font-size: 16px; border-radius: 14px; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.ghost { background: var(--cartao); color: var(--txt); border-color: var(--linha); }
.btn.ghost:hover { background: #fafaf9; }
.btn.soft { background: var(--linha2); color: var(--txt); }
.btn.danger { background: var(--vermelho-bg); color: var(--vermelho); }
.btn.green { background: var(--verde); color: #fff; }
.btn.link { background: none; color: var(--txt2); height: auto; padding: 4px; font-weight: 500; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--txt); flex: none; position: relative;
}
.icon-btn:hover { background: var(--linha2); }
.icon-btn svg, .btn svg { width: 20px; height: 20px; }
.btn.sm svg { width: 17px; height: 17px; }

/* campos */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 550; color: var(--txt2); }
.input, select.input, textarea.input {
  width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--linha); border-radius: 12px;
  background: var(--cartao); outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
textarea.input { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
.input:focus { border-color: var(--txt); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.input.erro { border-color: var(--vermelho); box-shadow: 0 0 0 3px rgba(220,38,38,.1); }
.field .ajuda { font-size: 12px; color: var(--txt3); }
.field .msg-erro { font-size: 12px; color: var(--vermelho); }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--txt3); pointer-events: none; }
.input-icon .input { padding-left: 42px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; cursor: pointer; }
.switch input { display: none; }
.switch i { width: 44px; height: 26px; border-radius: 99px; background: var(--linha); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--verde); }
.switch input:checked + i::after { transform: translateX(18px); }

.check { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--marca); }

/* cartões */
.card { background: var(--cartao); border-radius: var(--raio); border: 1px solid var(--linha); padding: 16px; }
.card.flat { border: 0; box-shadow: var(--sombra); }
.card.pad0 { padding: 0; overflow: hidden; }
.card > h2 + *, .card > h3 + * { margin-top: 12px; }
.card.stack > h2 + *, .card.stack > h3 + * { margin-top: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 10px; }
.section-title h2 { font-size: 16px; }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--linha2);
  cursor: pointer; transition: background .12s; background: var(--cartao);
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fafaf9; }
.list-item .sub { font-size: 13px; color: var(--txt2); }
.chev { color: var(--txt3); width: 18px; height: 18px; flex: none; }

.thumb { width: 52px; height: 52px; border-radius: 10px; background: var(--linha2); object-fit: cover; flex: none; overflow: hidden; display: grid; place-items: center; }
.thumb svg { width: 70%; height: 70%; }

/* selos */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--linha2); color: var(--txt2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.nodot::before { display: none; }
.pill.novo { background: var(--azul-bg); color: var(--azul); }
.pill.confirmado, .pill.separado { background: var(--amarelo-bg); color: var(--amarelo); }
.pill.saiu, .pill.pronto { background: #f5f3ff; color: #7c3aed; }
.pill.entregue, .pill.ok { background: var(--verde-bg); color: var(--verde); }
.pill.cancelado, .pill.erro { background: var(--vermelho-bg); color: var(--vermelho); }
.pill.aviso { background: var(--amarelo-bg); color: var(--amarelo); }

.badge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--vermelho); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; border: 2px solid var(--cartao); }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--linha); background: var(--cartao);
  font-size: 14px; font-weight: 550; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; scroll-snap-align: start; transition: all .15s;
}
.chip.on { background: var(--marca); background: var(--degrade); color: var(--marca-txt); border-color: var(--marca); }

/* rodapé "feito com" */
.feito-com { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12px; color: var(--txt3); padding: 18px 0 8px; }
.feito-com .mk { font-size: 14px; padding: 6px 10px 7px; border-radius: 9px; background: var(--degrade-fundo); }

/* abas */
.tabs { display: flex; gap: 4px; background: var(--linha2); padding: 4px; border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1; min-width: max-content; height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 550; color: var(--txt2); cursor: pointer; }
.tab.on { background: var(--cartao); color: var(--txt); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* stepper de quantidade */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--linha); border-radius: 12px; height: 42px; background: var(--cartao); }
.stepper button { width: 40px; height: 100%; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--txt); }
.stepper button:disabled { color: var(--txt3); }
.stepper span { min-width: 30px; text-align: center; font-weight: 650; font-variant-numeric: tabular-nums; }
.stepper.sm { height: 34px; }
.stepper.sm button { width: 32px; font-size: 17px; }

/* folha que sobe de baixo (modal) */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; opacity: 0; transition: opacity .2s; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg.on { opacity: 1; }
.sheet {
  background: var(--cartao); width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.sheet-bg.on .sheet { transform: none; }
.sheet .alca { width: 40px; height: 5px; border-radius: 9px; background: var(--linha); margin: 4px auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
@media (min-width: 700px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 22px; transform: translateY(20px) scale(.98); opacity: 0; transition: all .2s; }
  .sheet-bg.on .sheet { opacity: 1; }
  .sheet .alca { display: none; }
  .sheet { padding-top: 20px; }
}

/* aviso flutuante */
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast { background: #18181b; color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--sombra-alta); animation: subir .25s ease; display: flex; gap: 8px; align-items: center; }
.toast.erro { background: var(--vermelho); }
.toast.ok::before { content: "✓"; font-weight: 700; color: #4ade80; }
@keyframes subir { from { opacity: 0; transform: translateY(10px); } }

/* vazio e carregando */
.vazio { text-align: center; padding: 48px 20px; color: var(--txt2); }
.vazio svg { width: 48px; height: 48px; color: var(--txt3); margin: 0 auto 12px; }
.vazio h3 { color: var(--txt); margin-bottom: 4px; }
.skel { background: linear-gradient(90deg, var(--linha2) 25%, #fafaf9 37%, var(--linha2) 63%); background-size: 400% 100%; animation: brilho 1.4s ease infinite; border-radius: 10px; }
@keyframes brilho { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spin { width: 20px; height: 20px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: girar .7s linear infinite; display: inline-block; }
@keyframes girar { to { transform: rotate(360deg); } }

.fade-in { animation: aparecer .22s ease; }
@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } }

/* fotos em tela cheia */
.galeria-tela { position: fixed; inset: 0; z-index: 90; background: #0b0b0c; color: #fff; display: flex; flex-direction: column; animation: aparecer .18s ease; user-select: none; }
.gt-topo { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 12px 6px 18px; font-size: 14px; color: #a1a1aa; }
.gt-fechar { width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.gt-fechar svg { width: 22px; height: 22px; }
.gt-palco { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; touch-action: none; cursor: zoom-in; }
.gt-palco img { max-width: 100%; max-height: 100%; object-fit: contain; will-change: transform; pointer-events: none; }
.gt-seta { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.gt-seta svg { width: 24px; height: 24px; }
.gt-seta.esq { left: 12px; } .gt-seta.dir { right: 12px; }
@media (hover: none) { .gt-seta { display: none; } }
.gt-dica { text-align: center; font-size: 12px; color: #71717a; padding: 6px 16px; }
.gt-miniaturas { display: flex; gap: 8px; justify-content: center; padding: 6px 12px calc(14px + env(safe-area-inset-bottom)); overflow-x: auto; }
.gt-miniaturas button { width: 54px; height: 54px; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: #222; opacity: .55; flex: none; cursor: pointer; }
.gt-miniaturas button.on { border-color: #fff; opacity: 1; }
.gt-miniaturas img { width: 100%; height: 100%; object-fit: cover; }

.divider { height: 1px; background: var(--linha2); margin: 4px 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; }
.kv > :first-child { color: var(--txt2); }
.kv > :last-child { text-align: right; font-weight: 550; }
.total-line { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; padding-top: 10px; }
