:root {
  /* Identidade BR Trading: preto e branco, com verde/âmbar só para indicar vantagem ou desvantagem. */
  --bg: #f5f5f4;
  --surface: #ffffff;
  --text: #0a0a0a;
  --muted: #6b6b6b;
  --border: #e3e3e3;
  --primary: #0a0a0a;
  --primary-ink: #ffffff;
  --danger: #b91c1c;
  --good: #15803d;
  --good-bg: #dcfce7;
  --bad: #b45309;
  --bad-bg: #fef3c7;
  --neutral-bg: #f0f0ef;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 2px 8px rgb(0 0 0 / .04);
  --logo-filter: none;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #161616;
    --text: #f5f5f5;
    --muted: #a3a3a3;
    --border: #2c2c2c;
    --primary: #f5f5f5;
    --primary-ink: #0a0a0a;
    --danger: #f87171;
    --good: #4ade80;
    --good-bg: #12301e;
    --bad: #fbbf24;
    --bad-bg: #3a2c0b;
    --neutral-bg: #222222;
    --shadow: none;
    --logo-filter: invert(1);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
a, button, select, input, label { touch-action: manipulation; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}
body.has-tabs main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
body.has-tabs.has-fab main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
main { max-width: 760px; margin: 0 auto; padding: 16px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: 1.15rem; margin: 20px 0 10px; }
a { color: var(--text); }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

/* barra superior */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 1.1rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  border: 0; background: none; color: var(--text); font-size: 1.4rem;
  width: 44px; height: 44px; flex: none; border-radius: 50%; cursor: pointer;
}
.icon-btn:active { background: var(--neutral-bg); }
.rate-chip {
  font-size: .8rem; color: var(--muted); background: var(--neutral-bg);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}

/* barra de abas */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: .75rem; color: var(--muted); text-decoration: none;
}
.tabbar a span { font-size: 1.25rem; line-height: 1; }
.tab-icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; display: block; }
.tabbar a.active { color: var(--text); font-weight: 700; }

/* formulários */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.stack > * + * { margin-top: 14px; }
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
label .req { color: var(--danger); }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.hint.ok { color: var(--good); }
.hint.err { color: var(--danger); }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 12px; min-height: 46px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
@media (max-width: 400px) { .row.stack-sm { grid-template-columns: minmax(0, 1fr); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; border-radius: 10px; min-height: 46px;
  padding: 10px 16px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { color: var(--danger); }
.btn.block { width: 100%; }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: .88rem; white-space: nowrap; flex: none; }
.btn:disabled { opacity: .55; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1; }

/* foto */
.photo-input {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 140px; border: 2px dashed var(--border); border-radius: var(--radius);
  background: var(--neutral-bg); color: var(--muted); overflow: hidden; text-align: center;
}
.photo-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.photo-buttons .btn { position: relative; overflow: hidden; cursor: pointer; }
.photo-input img { width: 100%; max-height: min(320px, 40vh); object-fit: contain; background: #000; }
.photo-remove { display: block; margin: 10px auto 0; }
.photo-buttons input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

/* listas */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input { flex: 1; }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.item {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px; color: inherit; text-decoration: none; box-shadow: var(--shadow);
}
.thumb {
  width: 64px; height: 64px; flex: none; border-radius: 8px; object-fit: cover;
  background: var(--neutral-bg); display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 1.4rem;
}
.item-body { flex: 1; min-width: 0; }
.item-title {
  font-weight: 600; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
.item-sub { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.item-side { flex: none; text-align: right; font-size: .9rem; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty .btn { margin-top: 14px; }

.badge {
  display: inline-block; font-size: .78rem; font-weight: 700; padding: 3px 8px; border-radius: 999px;
  background: var(--neutral-bg); color: var(--muted); white-space: nowrap;
}
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }

.fab {
  position: fixed; right: 18px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 9;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--primary); color: var(--primary-ink); font-size: 1.8rem; line-height: 1;
  box-shadow: 0 4px 14px rgb(0 0 0 / .25); cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
}

/* ofertas */
.offer { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--bg); }
.offer + .offer { margin-top: 10px; }
.offer-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.offer-calc { margin-top: 10px; font-size: .9rem; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

/* tabela simples */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.best td { font-weight: 600; }

/* ranking */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: 1.5rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.rank-item { display: block; }
.rank-top { display: flex; gap: 12px; align-items: center; }
.rank-pos { font-weight: 800; color: var(--muted); width: 26px; text-align: center; flex: none; }
.compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; font-size: .82rem; }
.compare.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 420px) { .compare.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.compare div { background: var(--neutral-bg); border-radius: 8px; padding: 6px 8px; }
.compare b { display: block; font-size: .95rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.segmented { display: flex; background: var(--neutral-bg); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.segmented button {
  flex: 1; border: 0; background: none; font: inherit; font-size: .9rem; padding: 8px; border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* autenticação */
.auth { max-width: 420px; margin: 0 auto; padding-top: 6vh; }
.brand { text-align: center; margin-bottom: 22px; }
.brand-logo { filter: var(--logo-filter); }
.brand .brand-logo { width: min(300px, 80%); height: auto; margin: 0 auto 22px; }
.brand h1 { font-size: 1.5rem; letter-spacing: .02em; }
.brand .brand-by { margin: 2px 0 8px; font-size: .9rem; letter-spacing: .25em; text-transform: uppercase; color: var(--text); }
.brand p { color: var(--muted); margin: 4px 0 0; }
.switch { text-align: center; margin-top: 16px; font-size: .95rem; }

.error-box { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }

.detail-photo { border-radius: var(--radius); overflow: hidden; background: #000; cursor: zoom-in; }
.detail-photo img { width: 100%; max-height: 380px; object-fit: contain; }
.meta { font-size: .8rem; color: var(--muted); margin-top: 12px; }

.toast {
  position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50;
  font-size: .92rem; max-width: calc(100% - 32px); box-shadow: 0 4px 14px rgb(0 0 0 / .25);
}
.lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgb(0 0 0 / .92);
  display: flex; align-items: center; justify-content: center; padding: 12px; cursor: zoom-out;
}
.lightbox img { max-height: 100%; object-fit: contain; }
.spinner { text-align: center; color: var(--muted); padding: 40px; }

/* marca */
.topbar-mark { width: 32px; height: 32px; border-radius: 6px; flex: none; }
@media (prefers-color-scheme: dark) { .topbar-mark { outline: 1px solid var(--border); } }
.signature { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 32px 0 8px; color: var(--muted); font-size: .8rem; }
.signature img { width: 160px; height: auto; opacity: .85; }

/* campo de fornecedor com busca */
.combo { position: relative; flex: 1; min-width: 0; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: 4px; list-style: none; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .14);
}
.combo-list li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
}
.combo-list li small { color: var(--muted); white-space: nowrap; }
.combo-list li.active, .combo-list li:hover { background: var(--neutral-bg); }
.combo-list li.selected span { font-weight: 700; }
.combo-list li.disabled { opacity: .45; cursor: not-allowed; }
.combo-list .empty-opt { color: var(--muted); cursor: default; }

/* administrador */
.badge.admin { background: var(--text); color: var(--bg); letter-spacing: .06em; }
.badge.company { background: var(--neutral-bg); color: var(--text); font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.scope-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.scope-bar select { flex: 1; min-width: 0; }

/* leitor de cartões */
.ocr-status { border-radius: 10px; padding: 10px 12px; font-size: .9rem; background: var(--neutral-bg); }
.ocr-status.busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px;
  border: 2px solid var(--muted); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite;
}
.ocr-status.ok { background: var(--good-bg); color: var(--good); }
.ocr-status.err { background: var(--bad-bg); color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } }
input.autofilled, textarea.autofilled, select.autofilled { background: var(--good-bg); }
.phone-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* WhatsApp / WeChat */
.msg-badge { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 600; border-radius: 999px; padding: 2px 8px 2px 5px; color: #fff; }
.msg-badge svg, .msg-toggle svg { width: 16px; height: 16px; flex: none; }
.msg-badge.whatsapp { background: #25d366; color: #063b1c; }
.msg-badge.wechat { background: #07c160; color: #fff; }
.btn.wa-btn { background: #25d366; border-color: #25d366; color: #063b1c; gap: 6px; }
.btn.wa-btn svg { width: 16px; height: 16px; }
.msg-icons { display: inline-flex; gap: 4px; vertical-align: middle; }
.msg-icons .msg-badge { padding: 3px; }
.btn.wc-btn { background: #07c160; border-color: #07c160; color: #fff; gap: 6px; }
.btn.wc-btn svg { width: 16px; height: 16px; }
.msg-icons .msg-badge svg { width: 13px; height: 13px; }
.msg-toggles { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.msg-toggle { position: relative; display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: .85rem; border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--muted); }
.msg-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.msg-toggle:has(input:focus-visible) { outline: 2px solid var(--accent, #1a56db); outline-offset: 2px; }
.msg-toggle.whatsapp:has(input:checked) { background: #25d366; border-color: #25d366; color: #063b1c; }
.msg-toggle.wechat:has(input:checked) { background: #07c160; border-color: #07c160; color: #fff; }

/* ---------- celular ---------- */
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.offer-head .item-body { min-width: 0; }
.offer-head .badge { flex: none; }
.members { list-style: none; margin: 0; padding: 0; }
.members li { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.members li:last-child { border-bottom: 0; }
.detail-photo img { max-height: min(380px, 45vh); }

/* Barra fixa com Salvar/Excluir nos formulários (sempre ao alcance do polegar). */
.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  margin: 0 -16px -16px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
}
form:not(.card) > .form-actions { margin: 0 -16px; border-radius: 0; background: var(--bg); }
.form-actions .btn { flex: 1; }
.form-actions .btn.danger { flex: 0 0 auto; }

@media (max-width: 400px) {
  main { padding: 12px; }
  .card { padding: 14px; }
  .topbar { padding-left: 10px; padding-right: 12px; gap: 6px; }
  .topbar h1 { font-size: 1rem; }
  .rate-long { display: none; }
  .stats { gap: 8px; }
  .stat { padding: 10px; }
  .stat b { font-size: 1.3rem; }
  .compare { gap: 6px; }
  .compare div { padding: 6px; }
  .compare b { font-size: .88rem; }
  .thumb { width: 56px; height: 56px; }
  .item { gap: 10px; }
  .rank-pos { width: 18px; }
  .offer { padding: 10px; }
  .offer label { font-size: .82rem; }
  .form-actions { margin: 0 -14px -14px; }
  form:not(.card) > .form-actions { margin: 0 -12px; }
}

/* mapa da feira */
body.map-mode main { display: none; }
.map-view {
  position: fixed; left: 0; right: 0; z-index: 1;
  top: calc(64px + env(safe-area-inset-top));
  bottom: calc(62px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; background: var(--bg);
}
.map-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.map-toolbar .item-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-frame { position: relative; flex: 1; background: #fff; }
.map-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.map-frame .spinner { position: absolute; inset: 0; }
@media (max-width: 400px) { .tabbar a { font-size: .66rem; } }

/* câmbio */
.rate-chip { cursor: pointer; }
.topbar-interp {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--neutral-bg); color: var(--text); text-decoration: none;
}
.topbar-interp .tab-icon { width: 1.05rem; height: 1.05rem; }
.topbar-interp:active, .topbar-interp.active { background: var(--primary); color: var(--primary-ink); }
.rate-chip.warn { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.rate-chip small { font-size: .7rem; opacity: .8; }
.rate-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.rate-now b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.rate-now .item-sub:last-child { flex-basis: 100%; }

/* bandeiras China (estimado) e Brasil (preço no Brasil) */
.flag { display: inline-block; width: 1.25em; height: .84em; border-radius: 2px; vertical-align: -.08em;
  box-shadow: 0 0 0 1px rgb(0 0 0 / .08); flex: none; }
.price-line { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.price-line + .price-line { margin-top: 2px; }
.compare .flag { margin-right: 2px; }

/* viagem: subnavegação Roteiro | Mapa */
.subnav { display: flex; background: var(--neutral-bg); border-radius: 10px; padding: 3px; gap: 2px; }
.subnav a { flex: 1; text-align: center; padding: 7px 10px; border-radius: 8px; font-size: .9rem; color: var(--muted); text-decoration: none; white-space: nowrap; }
.subnav a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.subnav-page { margin-bottom: 14px; }
.map-toolbar .subnav { flex: 1; min-width: 0; }

/* roteiro */
.trip-head { margin-bottom: 14px; }
.trip-days { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.trip-day.today { outline: 2px solid var(--good); }
.trip-day.past { opacity: .7; }
.trip-day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.trip-day-num { font-weight: 800; font-size: 1.05rem; }
.trip-day-title { flex: 1; color: var(--muted); min-width: 0; }
.trip-day-title span { color: var(--text); }
.badge.city { background: var(--neutral-bg); color: var(--text); }
.trip-items { list-style: none; margin: 0; padding: 0; }
.trip-item { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.trip-item:first-child { border-top: 0; }
.trip-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.trip-activity { font-weight: 600; margin: 2px 0 4px; overflow-wrap: anywhere; }
.trip-line { display: flex; gap: 6px; align-items: baseline; font-size: .9rem; margin-top: 3px; overflow-wrap: anywhere; }
.trip-line > span:nth-child(2) { flex: 1; min-width: 0; white-space: pre-wrap; }
.copy-btn { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; font-size: .75rem; padding: 2px 8px; cursor: pointer; }
.trip-edit-day + .trip-edit-day { margin-top: 12px; }

/* tipos de atividade: a cor da planilha aparece como faixa lateral */
.trip-item.tinted { border-left: 4px solid var(--cat); padding-left: 8px; margin-left: -12px; }

/* meu cartão de visitas (aba Conta) */
.my-card-img { display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; overflow: hidden; cursor: zoom-in; }
.my-card-img img { width: 100%; max-height: 260px; object-fit: contain; }
.photo-input.compact { min-height: 90px; font-size: .9rem; }
.my-card-more { margin-top: 10px; font-size: .9rem; }
.my-card-more summary { cursor: pointer; color: var(--muted); }

.lightbox.rotated { background: #000; }
.lightbox.rotated img { max-width: none; max-height: none; width: calc(100vh - 24px); height: calc(100vw - 24px);
  transform: rotate(90deg); }
#lightbox:not(.rotated) { background: rgb(0 0 0 / .96); }
.lightbox-close {
  position: fixed; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 61;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgb(255 255 255 / .18); color: #fff; font-size: 1.3rem; line-height: 1;
}

/* administração */
.admin-row { align-items: flex-start; }
.admin-company { display: block; margin: 8px 0 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.admin-company select { margin-top: 4px; min-height: 40px; font-size: .9rem; color: var(--text); font-weight: 400; }
.danger-icon { color: var(--danger); font-size: 1.15rem; }
.danger-icon:disabled { opacity: .3; cursor: not-allowed; }

/* Cadastro pela foto */
.add-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.add-choice .btn { flex-direction: column; gap: 2px; line-height: 1.2; }
.add-choice small { font-weight: 400; font-size: .76rem; opacity: .75; }
.scan-item { display: grid; gap: 10px; }
.scan-item.off { opacity: .5; }
.scan-head { display: flex; align-items: center; gap: 10px; }
.scan-head .scan-check { flex: 1; }
.scan-check { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; }
.scan-check input { width: 20px; height: 20px; margin: 0; flex: none; }
.scan-src { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* Aviso de produto parecido */
.dup-box { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--warn-bg, #fff6e0); border: 1px solid var(--warn-border, #f2d48a); display: grid; gap: 8px; font-size: .88rem; }
.dup-title { font-weight: 600; }
.dup-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dup-item small { color: var(--muted); }

/* Cadastros aguardando internet */
.outbox-bar { display: block; padding: 9px 16px; font-size: .85rem; text-align: center; text-decoration: none;
  background: #fff3cd; color: #5c4400; border-bottom: 1px solid #f2d48a; }
.outbox-bar.warn { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.outbox-bar b { margin-left: 6px; text-decoration: underline; }
.badge.pending { background: #fff3cd; color: #5c4400; }
@media (prefers-color-scheme: dark) {
  .dup-box { background: #3a2f12; border-color: #5c4a1c; }
  .outbox-bar, .badge.pending { background: #3a2f12; color: #f5d98b; border-color: #5c4a1c; }
}
.outbox-bar[hidden] { display: none; }

/* Teste de modelos */
.bench-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.bench-table th, .bench-table td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.bench-sample { display: grid; gap: 8px; }
.bench-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 10px; padding-top: 6px; border-top: 1px solid var(--border); }
.bench-row > div { flex-basis: 100%; }

/* Controle de viagem */
.exp-summary { display: grid; gap: 4px; }
.exp-total { font-size: 1.9rem; font-weight: 700; letter-spacing: -.01em; }
.exp-cats { display: grid; gap: 6px; margin-top: 10px; }
.exp-cat { position: relative; display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .9rem; overflow: hidden; background: var(--neutral-bg); }
.exp-cat > * { position: relative; z-index: 1; }
.exp-cat i { position: absolute; inset: 0 auto 0 0; background: var(--good-bg); z-index: 0; }
.exp-cat.active { outline: 2px solid var(--text); }
.exp-day { display: flex; justify-content: space-between; margin: 16px 2px 6px; font-size: .85rem; color: var(--muted); text-transform: capitalize; }
.exp-day b { color: var(--text); }
.exp-list .item { margin-bottom: 8px; }
.exp-amount { font-size: 1.5rem; font-weight: 600; }
.exp-preview { font-size: 1.05rem; font-weight: 600; color: var(--good); min-height: 0; }
.exp-preview:empty { display: none; }
.exp-cat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.exp-cat-opt { margin: 0; cursor: pointer; }
.exp-cat-opt input { position: absolute; opacity: 0; pointer-events: none; }
.exp-cat-opt span { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border: 1px solid var(--border); border-radius: 10px; font-size: 1.4rem; text-align: center; }
.exp-cat-opt small { font-size: .72rem; font-weight: 500; color: var(--muted); line-height: 1.15; }
.exp-cat-opt input:checked + span { border-color: var(--text); background: var(--neutral-bg); box-shadow: inset 0 0 0 1px var(--text); }
.exp-cat-opt input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

/* Intérprete e créditos */
.interp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.interp-head > div { flex: 1; min-width: 110px; }
.interp-head select { width: auto; flex: 1; min-width: 150px; }
.interp-bal { font-size: 1.3rem; } .interp-bal.low { color: var(--danger); }
.interp-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.interp-btn { display: grid; justify-items: center; gap: 6px; padding: 22px 10px; border-radius: 16px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; min-height: 150px; text-align: center; }
.interp-btn .interp-flag { font-size: 2rem; } .interp-btn .interp-flag .flag { width: 48px; height: 32px; }
.interp-btn small { color: var(--muted); }
.interp-btn.rec { border-color: var(--danger); background: var(--bad-bg); animation: interp-pulse 1.2s ease-in-out infinite; }
.interp-btn:disabled { opacity: .5; cursor: default; }
@keyframes interp-pulse { 50% { box-shadow: 0 0 0 6px rgb(185 28 28 / .15); } }
.interp-log { display: grid; gap: 10px; }
.interp-msg { display: grid; gap: 6px; }
.interp-msg .flag { width: 18px; height: 12px; vertical-align: -1px; }
.interp-tr { font-size: 1.35rem; font-weight: 600; line-height: 1.35; }
.credit-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.credit-pack { display: grid; gap: 4px; }
.checkout { margin-top: 12px; justify-items: stretch; }
.pix-qr { width: 220px; height: 220px; justify-self: center; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 8px; }
.pix-code { display: flex; gap: 8px; align-items: center; }
.pix-code code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .72rem; background: var(--neutral-bg); padding: 8px; border-radius: 8px; max-height: 80px; overflow-y: auto; }
.pos { color: var(--good); } .neg { color: var(--danger); }
.src-table-wrap { overflow-x: auto; }

/* ícones de linha fina (substituem emojis) */
.ic { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.thumb .ic { width: 1.5rem; height: 1.5rem; vertical-align: 0; }
.trip-line > span:first-child .ic { vertical-align: -.22em; color: var(--muted); }

/* turismo */
.tour-head { display: grid; gap: 10px; margin-bottom: 12px; }
.tour-where { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; color: var(--muted); }
.tour-where b { color: var(--text); }
.tour-where .ic { margin-top: 2px; }
.tour-head .row { display: flex; gap: 8px; }
.tour-head .row select { flex: 1; min-width: 0; }
.tour-head .row .btn { flex: none; gap: 6px; }
.tour-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tour-cat { flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px;
  padding: 5px 12px; font: inherit; font-size: .82rem; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.tour-cat.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.tour-item { display: grid; gap: 8px; }
.tour-top { display: flex; gap: 12px; align-items: center; }
.tour-top .thumb { width: 52px; height: 52px; }
.tour-zh { font-size: .95rem; }
.tour-desc { margin: 0; font-size: .9rem; color: var(--text); }
.tour-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tour-actions .btn { gap: 5px; }
.taxi-card { position: fixed; inset: 0; z-index: 50; background: rgb(0 0 0 / .6); display: grid; place-items: center; padding: 16px; }
.taxi-inner { background: var(--surface); border-radius: 16px; padding: 28px 20px 20px; width: 100%; max-width: 480px; display: grid; gap: 10px; text-align: center; }
.taxi-ask { font-size: 1.3rem; }
.taxi-place { font-size: 2.6rem; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.taxi-city { font-size: 1.5rem; color: var(--muted); }
.map-toolbar .subnav a { padding: 7px 4px; }
@media (max-width: 420px) { .map-open-label { display: none; } .map-toolbar { gap: 6px; padding: 8px; } }
.tour-item.has-photo { padding: 0 14px 14px; overflow: hidden; }
.tour-photo { position: relative; margin: 0 -14px; aspect-ratio: 16 / 9; background: var(--neutral-bg); }
.tour-photo img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.tour-photo figcaption { position: absolute; right: 0; bottom: 0; max-width: 100%; padding: 2px 6px; font-size: .62rem;
  background: rgb(0 0 0 / .45); color: #fff; border-top-left-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tour-photo figcaption a { color: inherit; text-decoration: none; }
.tour-item .item-sub .ic { width: 1em; height: 1em; vertical-align: -.12em; }
.exp-fees { display: grid; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: .9rem; }
.exp-fees > div:not(.item-sub) { display: flex; justify-content: space-between; gap: 10px; }
.exp-fees b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.exp-fees-total { font-weight: 600; padding-top: 4px; }
.exp-fees .item-sub { font-size: .78rem; }

/* fotos do produto por fornecedor */
.offer-card { display: block; }
.offer-link { display: flex; color: inherit; text-decoration: none; }
.offer-photos { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; }
.offer-photo { position: relative; flex: none; width: 76px; height: 76px; border-radius: 8px; overflow: hidden; background: var(--neutral-bg); }
.offer-photo img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.offer-photo-del { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / .55); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.offer-photo-del .ic { width: 14px; height: 14px; }
.offer-photo-add { display: grid; place-items: center; align-content: center; gap: 2px; border: 1.5px dashed var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; font-size: .72rem; text-align: center; }
.offer-photo-add .ic { width: 22px; height: 22px; }
.offer-photo-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.offer-photo-add.busy { pointer-events: none; opacity: .7; }
.offer .offer-photos-label { margin-top: 12px; font-size: .85rem; font-weight: 600; }
.offer .offer-photos { margin-top: 6px; }

/* toque longo e menu de ações */
#list .item[data-product] { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; transition: transform .15s, background-color .15s; }
#list .item.pressing { transform: scale(.98); background: var(--neutral-bg); }
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgb(0 0 0 / .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 520px; border-radius: 16px 16px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: grid; gap: 8px; }
.sheet-title { font-weight: 600; text-align: center; padding: 4px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-photo { display: flex; align-items: center; gap: 10px; }
.scan-photo img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; cursor: zoom-in; flex: none; }
.scan-photo-actions { display: grid; gap: 6px; justify-items: start; }
.scan-photo .btn { gap: 6px; }

/* título do topo com "voltar para …" */
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { flex: none; }
.backline { font-size: .72rem; color: var(--muted); line-height: 1.1; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* cartão de oferta espelhado (produto ↔ fornecedor) */
.mirror { display: grid; gap: 10px; }
.m-head { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.m-head .thumb { width: 52px; height: 52px; }
.m-head .item-body { flex: 1; min-width: 0; }
.m-head .badge { flex: none; }
.m-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; font-size: .74rem; }
.m-grid div { background: var(--neutral-bg); border-radius: 8px; padding: 6px 7px; color: var(--muted); min-width: 0; }
.m-grid b { display: block; color: var(--text); font-size: .9rem; overflow-wrap: anywhere; }
.m-est { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.m-est small { font-size: .72rem; }
.m-est b { font-size: 1.15rem; white-space: nowrap; }
.mirror .offer-photos { margin-top: 0; }
.block-title { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .92rem; align-items: baseline; }
.kv > span:nth-child(odd) { color: var(--muted); font-size: .85rem; }
.kv-addr { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.add-menu { display: grid; gap: 8px; position: relative; }
.add-menu-btn { justify-content: space-between; gap: 10px; }
.add-menu-btn span { flex: 1; text-align: center; }
.add-menu.open .add-menu-btn .ic:last-child { transform: rotate(180deg); }
.menu { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / .12); overflow: hidden; }
.menu a { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; }
.menu a:last-child { border-bottom: 0; }
.menu a:active { background: var(--neutral-bg); }
.menu .ic { width: 22px; height: 22px; flex: none; }
.menu small { display: block; color: var(--muted); font-size: .78rem; }
.block-sep { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.badge .ic { width: 1em; height: 1em; vertical-align: -.15em; }
.contact-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.contact-actions .btn { padding-left: 6px; padding-right: 6px; gap: 6px; font-size: .92rem; white-space: nowrap; }
.contact-actions .btn svg { width: 16px; height: 16px; flex: none; }
/* miniatura do cartão de visita no formato do cartão (≈ 1,7 : 1) */
.thumb.card-thumb { width: 86px; height: 52px; border-radius: 6px; }
@media (max-width: 420px) { .thumb.card-thumb { width: 76px; height: 46px; } }
.adj-row { display: flex; gap: 12px; align-items: center; }
.adj-img { width: 120px; height: 76px; object-fit: contain; background: var(--neutral-bg); border-radius: 8px; flex: none; cursor: zoom-in; }
.adj-row .item-body { min-width: 0; }

/* Pedidos para entrar na empresa */
.join-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.join-row .actions { margin: 0; }
.pending-card { text-align: center; margin-top: 24px; }
.pending-icon .ic { width: 44px; height: 44px; color: var(--primary, #c8102e); }
.import-cols { margin-top: 6px; font-size: 13px; line-height: 1.5; }
