
:root{
  --bg:#f3f4f6; --card:#fff; --ink:#111827; --muted:#6b7280;
  --line:#e5e7eb; --accent:#111827; --soft:#eef2ff;
  --danger:#b91c1c; --radius:20px;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif}
body{min-height:100vh}
button,input,select{font:inherit}
button{cursor:pointer}
#app{max-width:760px;margin:0 auto;min-height:100vh;padding-bottom:92px}
.topbar{display:flex;align-items:center;justify-content:space-between;padding:20px 18px 12px;position:sticky;top:0;background:rgba(243,244,246,.94);backdrop-filter:blur(14px);z-index:8}
h1,h2,h3{margin:0}
h1{font-size:30px;letter-spacing:-1px}.eyebrow{font-size:11px;font-weight:800;letter-spacing:1.2px;color:var(--muted);text-transform:uppercase}
main{padding:0 14px 18px}.view{display:none}.view.active{display:block}
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:0 1px 2px rgba(0,0,0,.03)}
.summary-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:8px 0 12px}
.summary-grid .card{padding:16px;min-height:116px;display:flex;flex-direction:column;gap:5px}
.summary-grid .accent{background:var(--accent);color:white;border-color:var(--accent)}
.summary-grid span,.summary-grid small{font-size:12px;opacity:.72}.summary-grid strong{font-size:22px;letter-spacing:-.6px;margin-top:auto}
.text-btn{border:0;background:transparent;color:inherit;padding:0;font-weight:700;font-size:13px}.accent .text-btn{color:white;text-align:left;opacity:.85}
.icon-btn{border:0;background:var(--card);width:42px;height:42px;border-radius:14px;border:1px solid var(--line)}
.section-card{padding:16px;margin:12px 0}.section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}
.section-head h2{font-size:25px;letter-spacing:-.6px}.section-head h3{font-size:19px}.sticky-title{padding:8px 2px 10px}
.progress{height:12px;background:#e5e7eb;border-radius:999px;overflow:hidden}.progress>div{height:100%;width:0;background:#111827;border-radius:999px;transition:.25s}
.progress-labels{display:flex;justify-content:space-between;color:var(--muted);font-size:12px;margin-top:8px}
.quick-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:16px}
.primary,.secondary{border:0;border-radius:14px;padding:13px 14px;font-weight:800}
.primary{background:#111827;color:#fff}.secondary{background:#fff;border:1px solid var(--line);color:#111827}
.small{padding:9px 12px;font-size:13px}.full{width:100%}.danger{color:var(--danger)}
.info-card{padding:13px 15px;margin-bottom:12px;font-size:13px;color:#374151}
.stack{display:flex;flex-direction:column;gap:9px}.compact{gap:7px}
.item-card{padding:13px 14px;display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center}
.item-card .meta{color:var(--muted);font-size:12px;margin-top:4px}.item-card .name{font-weight:800}
.item-actions{display:flex;align-items:center;gap:7px}.pill{font-size:11px;font-weight:800;border-radius:999px;padding:5px 8px;background:#f3f4f6}
.qty-controls{display:flex;gap:6px;align-items:center}.qty-controls button{width:31px;height:31px;border-radius:10px;border:1px solid var(--line);background:white;font-weight:800}
.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px}
label{display:flex;flex-direction:column;gap:6px;color:#374151;font-weight:700;font-size:12px}
input,select{width:100%;border:1px solid var(--line);border-radius:12px;background:white;padding:12px;color:var(--ink);outline:none}
input:focus,select:focus{border-color:#9ca3af;box-shadow:0 0 0 3px rgba(17,24,39,.06)}
.input-suffix{position:relative}.input-suffix span{position:absolute;right:12px;top:12px;color:var(--muted)}
.switch-row{flex-direction:row;align-items:center}.switch-row input{width:auto}
.hidden{display:none!important}.promo-status{margin-top:12px;padding:12px;border-radius:13px;background:#f9fafb;font-size:13px;color:#374151}
.checkout-bar{position:sticky;bottom:76px;background:rgba(243,244,246,.94);backdrop-filter:blur(12px);padding:10px 0 4px;z-index:5}
.checkout-stats{display:grid;grid-template-columns:1fr 1fr 1fr;background:white;border:1px solid var(--line);border-radius:16px;padding:12px;margin-bottom:8px}
.checkout-stats div{display:flex;flex-direction:column;gap:3px}.checkout-stats span{font-size:10px;color:var(--muted);font-weight:700}.checkout-stats strong{font-size:15px}
.bottom-nav{position:fixed;left:50%;transform:translateX(-50%);bottom:0;width:min(760px,100%);display:grid;grid-template-columns:repeat(6,1fr);padding:7px 8px calc(7px + env(safe-area-inset-bottom));background:rgba(255,255,255,.96);backdrop-filter:blur(16px);border-top:1px solid var(--line);z-index:10}
.nav-btn{border:0;background:transparent;color:#6b7280;padding:5px 2px;font-size:10px;font-weight:700}.nav-btn span{display:block;font-size:19px;margin-bottom:2px}.nav-btn.active{color:#111827}
.mini-list{display:flex;flex-direction:column;gap:9px}.mini-row{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-top:1px solid var(--line)}.mini-row:first-child{border-top:0}
.empty{padding:24px;text-align:center;color:var(--muted);background:white;border:1px dashed #d1d5db;border-radius:16px}
dialog{border:0;border-radius:22px;padding:0;width:min(92vw,520px);box-shadow:0 25px 80px rgba(0,0,0,.28)}dialog::backdrop{background:rgba(17,24,39,.45)}
#modalForm{padding:18px}.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.modal-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:18px}
.modal-fields{display:grid;gap:11px}.hint{font-size:11px;color:var(--muted);font-weight:500}
.row-check{display:flex;flex-direction:row;align-items:center;gap:8px}.row-check input{width:auto}
.history-card{padding:15px}.history-top{display:flex;justify-content:space-between;gap:12px}.history-amount{text-align:right}.history-amount strong{display:block}.history-items{margin-top:10px;padding-top:10px;border-top:1px solid var(--line);font-size:12px;color:#4b5563}
@media(max-width:480px){.field-grid{grid-template-columns:1fr}.quick-actions{grid-template-columns:1fr}.summary-grid .card{min-height:108px}.checkout-stats{gap:6px}.checkout-stats strong{font-size:14px}}


.filter-card{padding:14px 15px;margin-bottom:12px}
.filter-card small{display:block;margin-top:8px;color:var(--muted);font-size:11px;line-height:1.45}
.store-line{font-size:11px;color:#4b5563;margin-top:6px;font-weight:700}
.list-group-title{display:flex;align-items:end;justify-content:space-between;gap:10px;padding:13px 4px 4px}
.list-group-title strong{display:block;font-size:17px;margin-top:2px}
.secondary-group{margin-top:10px;padding-top:18px;border-top:1px solid var(--line)}
.compact-empty{padding:15px}

.head-actions{display:flex;gap:8px;align-items:center}
textarea{width:100%;border:1px solid var(--line);border-radius:12px;background:white;padding:12px;color:var(--ink);outline:none;resize:vertical;font:inherit}
textarea:focus{border-color:#9ca3af;box-shadow:0 0 0 3px rgba(17,24,39,.06)}
.price-ref-line{font-size:11px;color:#4b5563;margin-top:4px;font-weight:700}
.price-compare{font-size:11px;font-weight:800;margin-top:5px}
.price-compare.good{color:#047857}
.price-compare.bad{color:#b91c1c}
.price-compare.ok{color:#374151}
.price-compare.neutral{color:#6b7280}

.item-subtotal{margin-top:5px;font-size:13px;color:var(--ink)}
.item-total-preview{display:flex;flex-direction:column;gap:4px;padding:12px}
.item-total-preview span{font-size:12px;color:#6b7280}
.item-total-preview strong{font-size:22px}
.item-total-preview small{font-size:11px;color:#6b7280}

.product-search-card{padding:10px;margin-bottom:10px}.product-card{padding:13px 14px;display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center}.product-main{min-width:0}.product-main .name{font-weight:800}.product-main .meta{color:var(--muted);font-size:12px;margin-top:4px}.product-actions{display:flex;gap:7px;align-items:center}.bottom-nav .nav-btn{font-size:9px}@media(max-width:420px){.product-card{grid-template-columns:1fr}.product-actions{justify-content:flex-start}.bottom-nav .nav-btn span{font-size:17px}}

.status-legend{display:flex;gap:12px;flex-wrap:wrap;align-items:center;padding:12px;margin-bottom:12px;font-size:12px;font-weight:700}
.status-legend span{display:flex;align-items:center;gap:6px}
.status-dot{width:11px;height:11px;border-radius:50%;display:inline-block;border:1px solid rgba(0,0,0,.12)}
.status-dot.bought{background:#86efac}.status-dot.pending{background:#fff}.status-dot.no{background:#fecaca}.status-dot.not-needed{background:#fde68a}
.monthly-item{transition:.15s ease;background:#fff}
.monthly-item.bought{background:#dcfce7;border-color:#86efac}
.monthly-item.no{background:#fee2e2;border-color:#fecaca}
.monthly-item.not-needed{background:#fef3c7;border-color:#fde68a}
.monthly-item.pending{background:#fff}
.item-status-row{margin-bottom:5px}
.status-badge{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;font-size:10px;font-weight:800;letter-spacing:.01em;border:1px solid transparent}
.status-badge.bought{background:#bbf7d0;color:#166534;border-color:#86efac}
.status-badge.pending{background:#f9fafb;color:#374151;border-color:#d1d5db}
.status-badge.no{background:#fee2e2;color:#991b1b;border-color:#fecaca}
.status-badge.not-needed{background:#fde68a;color:#854d0e;border-color:#facc15}

.span-2{grid-column:1/-1}.promo-preset-info{padding:12px 14px;margin-bottom:12px;line-height:1.5;background:#f8fafc}.source-link{font-weight:700;text-decoration:none}.sale-pill{background:#fff3cd;color:#7c5700}.muted-pill{background:#f1f5f9;color:#64748b}.promo-preset-info .hint{display:inline-block;margin-top:4px}

.title-line{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.version-tag{font-size:11px;font-weight:700;letter-spacing:.04em;padding:3px 7px;border-radius:999px;background:#e5e7eb;color:#374151}

.promo-picker-wrap{display:flex;flex-direction:column;gap:8px}.field-title{font-size:13px;font-weight:700;color:#374151}
.promo-options{display:grid;gap:9px}.promo-group-title{display:flex;justify-content:space-between;align-items:center;font-size:12px;font-weight:800;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;margin-top:3px}.promo-group-title span{background:#e5e7eb;border-radius:999px;padding:2px 7px;font-size:11px}
.promo-option{display:flex;gap:10px;padding:12px;border:1px solid #e5e7eb;border-radius:14px;background:#fff;cursor:pointer;align-items:flex-start}.promo-option.selected{border-color:#111827;box-shadow:0 0 0 1px #111827}.promo-option.reference-only{opacity:.78;cursor:default}.promo-option>input{margin-top:3px;flex:0 0 auto}.promo-option-body{min-width:0;flex:1}.promo-option-top{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}.promo-option-top strong{font-size:14px;line-height:1.3}.promo-type-pill{font-size:10px;font-weight:800;text-transform:uppercase;padding:3px 6px;border-radius:999px;white-space:nowrap}.promo-type-pill.cashback{background:#dcfce7;color:#166534}.promo-type-pill.discount{background:#dbeafe;color:#1e40af}.promo-option-meta{font-size:12px;color:#4b5563;margin-top:4px}.promo-option-tags{display:flex;gap:5px;flex-wrap:wrap;margin-top:7px}.promo-option-tags span{font-size:10px;border-radius:999px;background:#f3f4f6;padding:3px 6px;color:#4b5563}.promo-option-tags .promo-verified{background:#dcfce7;color:#166534}.promo-option-tags .promo-warning{background:#fef3c7;color:#92400e}.promo-option-note{font-size:11px;color:#6b7280;margin-top:6px;line-height:1.35}.promo-option .source-link{display:inline-block;margin-top:6px;font-size:11px}.promo-unverified{border-top:1px dashed #d1d5db;margin-top:5px;padding-top:8px}.promo-unverified summary{cursor:pointer;font-size:12px;font-weight:700;color:#92400e;margin-bottom:8px}.promo-empty{padding:12px}.selected-promos-summary{display:grid;gap:6px;margin-bottom:10px}.selected-promo-line{display:flex;justify-content:space-between;gap:8px;padding:8px 10px;background:#f8fafc;border-radius:10px;font-size:12px}.selected-promo-line span{white-space:nowrap;color:#4b5563}.promo-calc-line{display:flex;flex-direction:column;gap:2px;padding:6px 0;border-bottom:1px solid #e5e7eb}.promo-calc-line:last-child{border-bottom:0}.promo-calc-line strong{font-size:12px}.promo-calc-line span{font-size:11px;color:#6b7280}.checkout-stats-4{grid-template-columns:repeat(4,1fr)}
@media(max-width:540px){.promo-option-top{flex-direction:column}.checkout-stats-4{grid-template-columns:repeat(2,1fr)}.selected-promo-line{flex-direction:column}.selected-promo-line span{white-space:normal}}

.source-button,.official-promos-btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  text-decoration:none;font-weight:700;border-radius:10px;padding:9px 11px;
}
.source-button{margin-top:8px;background:#f3f4f6;color:#111827;border:1px solid #d1d5db}
.official-promos-btn{width:100%;margin:0 0 12px;background:#111827;color:#fff}
.stock-card{display:grid;grid-template-columns:86px minmax(0,1fr);gap:14px;align-items:center;padding:14px}
.stock-number-wrap{text-align:center}
.stock-number{font-size:36px;line-height:1;font-weight:800;letter-spacing:-.04em}
.stock-unit{font-size:11px;color:#6b7280;margin-top:6px;line-height:1.2}
.stock-main{min-width:0}
.stock-name-bar{
  position:relative;overflow:hidden;min-height:44px;border-radius:12px;
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:10px 12px;background:color-mix(in srgb,var(--stock-color) 28%,white);
  border:1px solid color-mix(in srgb,var(--stock-color) 55%,white);
}
.stock-name-progress{
  position:absolute;left:0;top:0;bottom:0;background:var(--stock-color);opacity:.22;pointer-events:none;
}
.stock-name-bar strong,.stock-name-bar span{position:relative;z-index:1}
.stock-name-bar strong{font-size:15px;min-width:0;overflow:hidden;text-overflow:ellipsis}
.stock-name-bar span{font-size:12px;font-weight:800}
.stock-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px}
.stock-reference{font-size:11px;color:#6b7280}
@media(max-width:420px){
  .stock-card{grid-template-columns:72px minmax(0,1fr);gap:10px}
  .stock-number{font-size:32px}
  .stock-actions{align-items:flex-end}
  .stock-reference{max-width:120px}
}

.promo-feed-status{font-size:12px;color:#6b7280}.language-note{font-size:12px;color:#6b7280}

.promo-type-pill.installments{background:#ede9fe;color:#5b21b6;border-color:#c4b5fd}.editable-pct-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:9px;padding:8px 10px;border-radius:10px;background:#fff7ed;border:1px solid #fed7aa;font-size:12px;font-weight:700}.editable-pct-row .input-suffix{width:105px}.editable-pct-row input{padding:7px 28px 7px 8px}.promo-option.reference-only{opacity:.88}.promo-option.reference-only .promo-type-pill{background:#f3f4f6;color:#4b5563}

/* v1.11.2 — mercado independente da data */
@media(max-width:540px){
  #shopView .section-card .field-grid > label:has(#storeName),
  #shopView .section-card .field-grid > label:has(#purchaseDate){
    grid-column:1/-1;
  }
  #storeName,#purchaseDate{
    min-height:48px;
    position:relative;
    z-index:3;
  }
  .promo-picker-wrap{
    position:relative;
    z-index:1;
  }
}

.stock-count-badge{
  font-size:.48em;
  font-weight:800;
  color:#6b7280;
  vertical-align:middle;
  white-space:nowrap;
}

.pending-home-row{gap:10px}.pending-home-row .tiny{white-space:nowrap}
.reference-card{display:flex;align-items:center;justify-content:space-between;gap:12px}
.reference-price{display:flex;flex-direction:column;align-items:flex-end;font-weight:800}.reference-price small{font-size:10px;color:#6b7280;font-weight:600}
.reference-line{font-size:12px;margin-top:4px;color:#374151}
.tiny{font-size:11px;padding:7px 9px}
@media(max-width:480px){.pending-home-row{align-items:flex-start}.pending-home-row .tiny{white-space:normal;max-width:112px}}

.cart-live-total{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin:0 0 12px;padding:12px 14px;border-radius:12px;background:#f3f4f6;
}
.cart-live-total span{font-size:13px;color:#6b7280}
.cart-live-total strong{font-size:24px;letter-spacing:-.03em}
.pending-shop-row{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:11px 0;border-bottom:1px solid #eef0f2;
}
.pending-shop-row:last-child{border-bottom:0}
.pending-shop-main{display:flex;flex-direction:column;gap:3px;min-width:0}
.pending-shop-main strong{font-size:14px}
.pending-shop-main span{font-size:12px;color:#6b7280}
.pending-shop-row.already-in-cart{opacity:.65}
.save-product-options{display:grid;gap:7px}
.promo-calc-card{padding:10px 0;border-top:1px solid #e5e7eb}
.promo-calc-card:first-child{border-top:0}
.promo-progress-block{margin-top:9px}
.promo-progress-head,.promo-progress-foot{
  display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px
}
.promo-progress-head span,.promo-progress-foot{color:#6b7280}
.promo-progress-track{height:9px;background:#e5e7eb;border-radius:999px;overflow:hidden;margin:5px 0}
.promo-progress-fill{height:100%;background:#111827;border-radius:999px}
.promo-used-before,.promo-equivalent{font-size:11px;color:#6b7280;margin-top:6px}

.sim-grid{display:grid;grid-template-columns:2fr 1fr;gap:10px}.sim-actions{display:flex;gap:8px;margin-top:10px}.sim-row{padding:12px}.sr{margin-top:8px}.best-sim{padding:12px;background:#ecfdf5;border-radius:12px;display:flex;justify-content:space-between}.price-compare-box{display:flex;justify-content:space-between;gap:12px;margin-top:16px}.price-compare-row{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px solid #eee}@media(max-width:540px){.sim-grid{grid-template-columns:1fr}}
.sim-target{padding:12px;margin-bottom:12px;background:#f9fafb}.sim-row-result,.sr{display:grid;gap:5px}.sr>div{display:flex;justify-content:space-between;gap:10px}.sr small{color:#6b7280;line-height:1.35}.best-sim>div{display:flex;flex-direction:column;gap:4px}.best-sim small{color:#047857}

.pending-money-card{border-color:#fde68a}
.pending-money-card strong{color:#b45309}
.projected-money-card{border-color:#bfdbfe}
.projected-money-card strong{color:#1d4ed8}
.cashback-history-box{
  margin-top:12px;padding:10px 12px;border-radius:12px;background:#fffbeb;border:1px solid #fde68a;
}
.cashback-history-head{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;flex-wrap:wrap}
.cashback-history-head>div{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.cashback-history-head>span{font-size:12px;color:#6b7280}
.cashback-history-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.cb-badge{font-size:11px;font-weight:700;padding:3px 7px;border-radius:999px}
.cb-badge.pending{background:#fef3c7;color:#92400e}
.cb-badge.received{background:#dcfce7;color:#166534}
.cb-badge.cancelled{background:#fee2e2;color:#991b1b}

.topbar-actions{display:flex;align-items:center;gap:8px}
.sync-status-btn{
  border:1px solid #e5e7eb;background:#fff;border-radius:999px;padding:7px 10px;
  font-size:12px;font-weight:700;color:#6b7280
}
.sync-status-btn.connected{border-color:#bbf7d0;background:#f0fdf4;color:#166534}
.compact-info{padding:9px 11px;font-size:12px;margin-bottom:10px}
.cart-inline-price-label{display:grid;grid-template-columns:auto minmax(110px,160px);align-items:center;gap:10px;margin-top:8px;font-size:12px;color:#6b7280}
.cart-inline-price{font-size:18px;font-weight:700;padding:9px 10px}
.reference-actions{display:flex;align-items:flex-end;gap:8px;flex-direction:column}
.cloud-settings{display:grid;gap:10px;padding:12px}
.cloud-settings-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.cloud-settings-head span{font-size:12px;color:#6b7280}
.cloud-buttons{display:flex;gap:7px;flex-wrap:wrap}
.cloud-last-sync{font-size:11px;color:#6b7280}
@media(max-width:560px){
  .cart-inline-price-label{grid-template-columns:1fr}
  .reference-actions{align-items:flex-start}
  .sync-status-btn span{display:none}
}

/* v1.19 mobile-first purchase experience */
html,body{max-width:100%;overflow-x:hidden}
body{-webkit-text-size-adjust:100%}
#app{width:100%;max-width:760px}
main,.view,.section-card,.card{min-width:0}
input,select,textarea{max-width:100%;min-width:0}
.inline-search{margin:0 0 10px}
.utility-panel.collapsed{display:none!important}
#shopView.active{padding-bottom:190px}
.checkout-bar{
  position:fixed;left:50%;transform:translateX(-50%);bottom:67px;
  width:min(760px,100%);padding:8px 12px;background:rgba(243,244,246,.97);
  backdrop-filter:blur(14px);z-index:9;border-top:1px solid var(--line)
}
.checkout-bar .checkout-stats{margin-bottom:6px;padding:8px 10px}
.checkout-bar .primary.full{padding:10px 12px}
.shop-fabs{
  position:fixed;right:max(14px,calc((100vw - 760px)/2 + 14px));bottom:182px;
  display:flex;flex-direction:column;gap:10px;z-index:11
}
.fab{
  width:52px;height:52px;border:0;border-radius:50%;background:#111827;color:white;
  font-size:25px;font-weight:800;box-shadow:0 8px 24px rgba(0,0,0,.20)
}
.fab-secondary{background:#fff;color:#111827;border:1px solid #d1d5db}
.cart-session-bar{display:flex;gap:8px;align-items:center;margin:0 0 10px;overflow:hidden}
.cart-session-tabs{display:flex;gap:7px;overflow-x:auto;flex:1;padding:2px 0;scrollbar-width:none}
.cart-session-tabs::-webkit-scrollbar{display:none}
.cart-session-tab{flex:0 0 auto;border:1px solid var(--line);background:white;border-radius:13px;padding:8px 10px;text-align:left;min-width:104px}
.cart-session-tab span{display:block;font-weight:800;font-size:12px}
.cart-session-tab small{display:block;color:#6b7280;font-size:10px;margin-top:2px}
.cart-session-tab.active{background:#111827;color:#fff;border-color:#111827}
.cart-session-tab.active small{color:#d1d5db}
.promo-refresh-card{padding:10px 12px;margin-bottom:10px;display:flex;align-items:center;justify-content:space-between;gap:10px}
.promo-refresh-card>div{min-width:0;display:flex;flex-direction:column;gap:2px}
.promo-refresh-card small{color:#6b7280;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:500px}
.history-open-btn{width:100%;border:0;background:transparent;padding:0;text-align:left;color:inherit}
.history-clickable{overflow:hidden}
.history-clickable .history-items{color:#6b7280}
.history-detail-modal{display:grid;gap:12px}
.history-summary-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.history-summary-grid>div{padding:10px;border:1px solid var(--line);border-radius:12px;display:flex;flex-direction:column;gap:4px}
.history-summary-grid span{font-size:10px;color:#6b7280}
.history-summary-grid strong{font-size:14px}
.history-detail-items{display:grid;gap:0;border:1px solid var(--line);border-radius:14px;overflow:hidden}
.history-detail-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;padding:10px 12px;border-bottom:1px solid var(--line)}
.history-detail-row:last-child{border-bottom:0}
.history-detail-row>div{display:flex;flex-direction:column;gap:3px}
.history-detail-row>div:last-child{text-align:right}
.history-detail-row span{font-size:11px;color:#6b7280}
.history-edit-list{display:grid;gap:8px;margin:10px 0}
.history-edit-row{display:grid;grid-template-columns:minmax(120px,1fr) 80px 120px auto;gap:8px;align-items:end;padding:10px;border:1px solid var(--line);border-radius:12px}
.history-edit-name{min-width:0;display:flex;flex-direction:column;gap:2px}
.history-edit-name strong{overflow:hidden;text-overflow:ellipsis}
.history-edit-name small{color:#6b7280}
.history-edit-total{font-weight:800;padding-bottom:12px;white-space:nowrap}
.history-edit-preview{padding:12px;display:flex;flex-direction:column;gap:4px}
.history-edit-preview span,.history-edit-preview small{color:#6b7280;font-size:11px}
.history-edit-preview strong{font-size:22px}
@media(max-width:560px){
  input,select,textarea{font-size:16px}
  main{padding-left:10px;padding-right:10px}
  .topbar{padding-left:12px;padding-right:12px}
  .section-card{padding:12px;margin:9px 0}
  .item-card{padding:11px}
  .history-edit-row{grid-template-columns:1fr 76px 1fr}
  .history-edit-name{grid-column:1/-1}
  .history-edit-total{grid-column:1/-1;padding:0;text-align:right}
  .history-summary-grid{grid-template-columns:1fr 1fr}
  .checkout-bar{bottom:64px;padding-left:8px;padding-right:8px}
  .checkout-stats-4{grid-template-columns:repeat(4,minmax(0,1fr));gap:3px}
  .checkout-stats-4 span{font-size:8px}
  .checkout-stats-4 strong{font-size:12px;white-space:nowrap}
  .shop-fabs{right:12px;bottom:170px}
  .fab{width:48px;height:48px}
}
@media(max-width:360px){
  .checkout-stats-4{grid-template-columns:repeat(2,1fr)}
  .history-summary-grid{grid-template-columns:1fr}
}

/* v1.20 — Voz contextual */
.voice-context-btn{display:inline-flex;align-items:center;gap:7px;min-height:40px;padding:8px 12px;border-radius:999px;border:1px solid var(--border);background:var(--card);color:var(--text);font-weight:800;cursor:pointer;white-space:nowrap}
.voice-context-btn.recording{background:#fee2e2;border-color:#fecaca;color:#991b1b;animation:voicePulse 1.2s ease-in-out infinite}
.voice-context-btn .mic{font-size:18px;line-height:1}
@keyframes voicePulse{50%{transform:scale(1.03)}}
.voice-fab{position:fixed;right:18px;bottom:150px;z-index:95;width:54px;height:54px;border-radius:50%;border:none;background:var(--primary,#2563eb);color:#fff;font-size:24px;box-shadow:0 8px 24px rgba(0,0,0,.22);display:flex;align-items:center;justify-content:center}
.voice-fab.recording{background:#b91c1c;animation:voicePulse 1.2s ease-in-out infinite}
.voice-panel{position:fixed;inset:0;z-index:250;background:rgba(0,0,0,.44);display:flex;align-items:flex-end;justify-content:center;padding:12px}
.voice-panel.hidden{display:none}
.voice-sheet{width:min(680px,100%);max-height:86vh;overflow:auto;background:var(--card,#fff);color:var(--text,#111827);border-radius:22px 22px 14px 14px;padding:18px;border:1px solid var(--border,#e5e7eb);box-shadow:0 -10px 40px rgba(0,0,0,.25)}
.voice-sheet-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}.voice-sheet-head h3{margin:0}.voice-sheet-head small{display:block;margin-top:4px;color:var(--muted,#6b7280)}
.voice-live{min-height:82px;width:100%;font-size:17px;line-height:1.4;border:1px solid var(--border,#d1d5db);border-radius:14px;padding:12px;background:var(--bg,#f9fafb);color:inherit;resize:vertical}
.voice-status{margin:9px 0;padding:10px 12px;border-radius:12px;background:var(--surface,#f3f4f6);font-size:14px}.voice-status.error{background:#fee2e2;color:#991b1b}.voice-status.ok{background:#dcfce7;color:#166534}
.voice-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.voice-actions button{flex:1;min-width:130px;min-height:44px}
.voice-examples{margin-top:13px;font-size:13px;color:var(--muted,#6b7280);line-height:1.5}.voice-examples strong{color:var(--text,#111827)}
.voice-preview{margin-top:10px;padding:10px 12px;border-radius:12px;border:1px dashed var(--border,#d1d5db);font-size:14px;white-space:pre-wrap}
@media(max-width:560px){.voice-context-btn .voice-label{display:inline}.voice-context-btn{width:auto;min-width:72px;height:42px;padding:0 10px;justify-content:center}.voice-fab{right:14px;bottom:142px}.voice-sheet{padding:15px}.voice-actions button{min-width:0}}


/* v1.21 — edição completa, simulador flutuante e voz sempre visível */
.simulator-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.46);z-index:180}
.simulator-backdrop.hidden{display:none!important}
#simulatorSection.simulator-floating{position:fixed;z-index:190;left:50%;top:50%;transform:translate(-50%,-50%);width:min(680px,calc(100vw - 24px));max-height:min(82vh,760px);overflow:auto;margin:0!important;border-radius:20px;box-shadow:0 24px 60px rgba(0,0,0,.28);padding-bottom:20px}
#simulatorSection.simulator-floating.collapsed{display:none!important}
.history-full-actions{display:grid;gap:10px;margin-top:14px}
.danger-button{min-height:44px;border:1px solid #ef4444;background:#fff;color:#b91c1c;border-radius:12px;font-weight:800;padding:10px 14px}
#finalizeBtn.editing-purchase{position:relative;background:#0f766e}
#finalizeBtn.editing-purchase::before{content:"✎ ";}
@media(max-width:560px){
  #simulatorSection.simulator-floating{top:auto;bottom:12px;transform:translateX(-50%);max-height:84vh;width:calc(100vw - 16px);border-radius:18px}
  .section-head.sticky-title .head-actions{gap:6px;flex-wrap:wrap;justify-content:flex-end}
  .section-head.sticky-title>.voice-context-btn{margin-left:auto}
}

.history-card-actions{display:flex;gap:.55rem;justify-content:flex-end;align-items:center;margin-top:.65rem;flex-wrap:wrap}
.history-card-actions .small{min-height:42px}

/* v1.25 — dispositivos pequenos: conteúdo e ações nunca devem ser cortados */
html{width:100%;overflow-x:clip}body,#app,main,.view{width:100%;min-width:0;max-width:100%}
.section-head,.head-actions,.history-top,.history-card-actions,.cart-session-bar,.promo-option-top,.promo-refresh-card{min-width:0;max-width:100%}
.section-head{flex-wrap:wrap}.section-head>div{min-width:0;max-width:100%}.head-actions{flex-wrap:wrap;justify-content:flex-start}
button,.primary,.secondary,.text-btn{max-width:100%;overflow-wrap:anywhere}
.card,.section-card,.item-card,.product-card,.history-card,.stock-card,.modal-fields,.field-grid,.sim-grid{min-width:0;max-width:100%}
.item-card,.product-card{grid-template-columns:minmax(0,1fr) auto}
.item-actions,.product-actions,.qty-controls{min-width:0;flex-wrap:wrap;justify-content:flex-end}
.checkout-stats-4 strong{white-space:normal!important;overflow-wrap:anywhere;font-size:clamp(10px,3vw,15px)}
.checkout-stats-4 div{min-width:0;overflow-wrap:anywhere}
#shopView.active{padding-bottom:calc(215px + env(safe-area-inset-bottom))}
.checkout-bar{bottom:calc(64px + env(safe-area-inset-bottom));max-width:100%;box-sizing:border-box}
.bottom-nav{max-width:100%;min-width:0;gap:0}
.bottom-nav .nav-btn{min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.25}
dialog{max-width:calc(100vw - 16px);max-height:calc(100dvh - 36px);overflow:auto}
#simulatorSection.simulator-floating{max-height:calc(100dvh - 32px)}
@media(max-width:560px){
 .topbar{gap:8px;flex-wrap:wrap}h1{font-size:clamp(21px,6vw,30px)}
 .field-grid,.history-edit-row,.sim-grid{grid-template-columns:minmax(0,1fr)}
 .history-edit-name,.history-edit-total{grid-column:auto}
 .item-card,.product-card{grid-template-columns:minmax(0,1fr)}
 .item-actions,.product-actions{justify-content:flex-start}
 .shop-fabs{bottom:calc(177px + env(safe-area-inset-bottom))}
 .checkout-stats-4{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 .checkout-bar .primary.full{min-height:44px}
 .history-card-actions>*{flex:1 1 120px;min-width:0}
}
@media(max-width:350px){.bottom-nav{padding-inline:2px}.bottom-nav .nav-btn{font-size:8px}.bottom-nav .nav-btn span{font-size:16px}.checkout-bar{padding:6px}}

/* V1.26 - mobile-first editor and overflow safeguards */
*,*::before,*::after{box-sizing:border-box}html,body{max-width:100%;overflow-x:clip}button,input,select,textarea{max-width:100%;min-width:0}button{white-space:normal;overflow-wrap:anywhere} .view,.card,.field-grid,.nav,.topbar{min-width:0;max-width:100%}
.history-editor{width:min(96vw,850px);max-width:96vw;height:min(94dvh,1000px);max-height:94dvh;padding:0;overflow:hidden;border:0;border-radius:16px;color:var(--text);background:var(--card,#fff)}.history-editor::backdrop{background:rgba(0,0,0,.68)}.history-editor form{height:100%;display:flex;flex-direction:column;min-height:0}.hist-editor-header,.hist-editor-footer{flex:none;padding:12px 16px;background:var(--card,#fff);border-bottom:1px solid var(--border,#ddd)}.hist-editor-header{display:flex;align-items:center;justify-content:space-between;gap:10px}.hist-editor-header h2{font-size:1.25rem;margin:2px 0}.hist-editor-scroll{min-height:0;flex:1;overflow:auto;overscroll-behavior:contain;padding:14px 16px 32px}.hist-editor-scroll h3{margin:20px 0 9px}.hist-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.hist-grid>label,.hist-actions>label{min-width:0;display:flex;flex-direction:column;gap:5px;overflow-wrap:anywhere;font-size:13px}.hist-grid input,.hist-grid select,.hist-grid textarea,.hist-actions select{display:block;width:100%;min-width:0;min-height:42px;font-size:16px;padding:9px;border:1px solid var(--border,#ccc);border-radius:9px;background:var(--card,#fff);color:var(--text)}.hist-wide{grid-column:1/-1}.hist-item,.hist-promo{margin:9px 0;padding:12px;max-width:100%;min-width:0}.hist-item-top{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px;flex-wrap:wrap}.hist-item-top strong{overflow-wrap:anywhere;min-width:0}.hist-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:end;margin-top:12px}.hist-actions>label{flex:1 1 170px}.hist-editor-footer{border-top:1px solid var(--border,#ddd);border-bottom:0;box-shadow:0 -8px 20px rgba(0,0,0,.06)}#heTotals{font-size:12px;line-height:1.45;overflow-wrap:anywhere;margin-bottom:9px}.hist-footer-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px}.hist-toggle{display:flex;gap:8px;align-items:center;padding:8px 0}
@media(max-width:600px){.history-editor{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;border-radius:0;margin:0}.hist-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.hist-editor-scroll{padding:12px}.hist-editor-header,.hist-editor-footer{padding:10px 12px}.hist-grid>label{font-size:12px}.hist-grid input,.hist-grid select{padding:7px;font-size:16px}.modal-actions,.hist-footer-actions{min-width:0}.nav-btn,.head-actions button,.cart-session-bar button{min-width:0;white-space:normal;overflow-wrap:anywhere}dialog:not(.history-editor){width:calc(100vw - 12px);max-width:calc(100vw - 12px);max-height:calc(100dvh - 18px);overflow:auto}#modalForm{padding:12px}.field-grid,.sim-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.field-grid .span-2{grid-column:1/-1}}
@media(max-width:370px){.hist-grid,.field-grid,.sim-grid{grid-template-columns:minmax(0,1fr)}.hist-footer-actions{grid-template-columns:minmax(0,1fr) 1fr}.hist-editor-header h2{font-size:1.05rem}}
