:root{--bg:#0f0f0e;--panel:#181715;--raised:#24221f;--border:rgba(255,255,255,.08);--text:#f7f3ec;--muted:#aaa39a;--accent:#e67732;--green:#49bd77}*{box-sizing:border-box}html,body{height:100%}body{margin:0;font-family:"DM Sans",sans-serif;color:var(--text);background:radial-gradient(circle at 14% 10%,rgba(230,119,50,.13),transparent 24rem),radial-gradient(circle at 85% 86%,rgba(73,189,119,.08),transparent 25rem),var(--bg);overflow:hidden}.app-shell{width:min(1480px,calc(100% - 40px));height:min(900px,calc(100vh - 40px));margin:20px auto;display:grid;grid-template-columns:285px 1fr;border:1px solid var(--border);border-radius:24px;overflow:hidden;background:rgba(15,15,14,.8);box-shadow:0 24px 90px rgba(0,0,0,.42)}.sidebar{padding:24px 18px 18px;border-right:1px solid var(--border);background:rgba(21,20,18,.96);display:flex;flex-direction:column}.brand{display:flex;align-items:center;gap:12px;padding:0 8px 24px}.brand-mark{width:42px;height:42px;display:grid;place-items:center;border-radius:13px;background:linear-gradient(145deg,#f28a42,#b64717);font-family:"Manrope";font-weight:800;font-size:22px}.brand strong,.brand span{display:block}.brand span{color:var(--muted);font-size:12px;margin-top:2px}.new-chat{width:100%;border:1px solid rgba(230,119,50,.45);background:rgba(230,119,50,.09);color:#ffd8bf;border-radius:13px;padding:13px 14px;text-align:left;cursor:pointer}.side-nav{display:grid;gap:7px;margin-top:24px}.side-nav button{border:0;background:transparent;color:var(--muted);text-align:left;padding:11px 12px;border-radius:11px;cursor:pointer}.side-nav button:hover{color:var(--text);background:rgba(255,255,255,.05)}.sidebar-footer{margin-top:auto;display:flex;align-items:center;gap:11px;padding:14px 12px;border-radius:14px;background:rgba(255,255,255,.035)}.status-dot{width:9px;height:9px;border-radius:50%;background:var(--green);box-shadow:0 0 0 5px rgba(73,189,119,.1)}.sidebar-footer strong,.sidebar-footer small{display:block}.sidebar-footer small{color:var(--muted);font-size:11px;margin-top:2px}.chat-panel{display:flex;flex-direction:column;min-width:0}.chat-header{height:84px;display:flex;align-items:center;justify-content:space-between;padding:0 28px;border-bottom:1px solid var(--border);background:rgba(24,23,21,.72)}.assistant-profile{display:flex;align-items:center;gap:13px}.avatar{width:45px;height:45px;border-radius:15px;display:grid;place-items:center;font-size:22px;background:rgba(230,119,50,.12)}.title-row{display:flex;align-items:center;gap:7px}.title-row h1{margin:0;font-family:"Manrope";font-size:17px}.verified{display:grid;place-items:center;width:17px;height:17px;border-radius:50%;color:#12110f;background:var(--accent);font-size:11px;font-weight:800}.assistant-profile p{margin:3px 0 0;color:var(--muted);font-size:12px}.icon-button{width:38px;height:38px;border-radius:11px;border:1px solid var(--border);background:rgba(255,255,255,.035);color:var(--muted);cursor:pointer}.messages{flex:1;overflow-y:auto;padding:34px clamp(22px,5vw,74px);scroll-behavior:smooth}.message{display:flex;gap:12px;margin:0 auto 22px;max-width:900px}.message.user{justify-content:flex-end}.message-avatar{width:34px;height:34px;display:grid;place-items:center;border-radius:11px;background:rgba(230,119,50,.12)}.bubble{max-width:min(760px,88%);background:var(--raised);border:1px solid var(--border);border-radius:18px;padding:17px 19px;line-height:1.55}.message.user .bubble{background:linear-gradient(145deg,#d45f25,#aa3d15)}.bubble p{margin:0}.bubble h2{font-family:"Manrope";font-size:clamp(24px,3vw,37px);line-height:1.13;margin:3px 0 10px}.eyebrow{color:#f0a070;font-size:13px;text-transform:uppercase;letter-spacing:.12em;font-weight:700}.welcome-message .bubble{width:100%;background:transparent;border:0;padding:5px 0}.suggestion-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;margin-top:24px}.suggestion-grid button{color:var(--text);background:rgba(255,255,255,.035);border:1px solid var(--border);border-radius:15px;padding:14px;display:flex;align-items:center;gap:12px;text-align:left;cursor:pointer}.suggestion-grid button:hover{border-color:rgba(230,119,50,.34);background:rgba(230,119,50,.07)}.suggestion-grid strong,.suggestion-grid small{display:block}.suggestion-grid small{color:var(--muted);margin-top:2px}.typing{display:inline-flex;gap:4px}.typing span{width:6px;height:6px;border-radius:50%;background:#d0c8bd;animation:pulse 1.2s infinite}.typing span:nth-child(2){animation-delay:.15s}.typing span:nth-child(3){animation-delay:.3s}@keyframes pulse{0%,60%,100%{opacity:.25}30%{opacity:1;transform:translateY(-3px)}}.composer-wrap{padding:16px clamp(20px,5vw,72px) 18px;border-top:1px solid var(--border);background:rgba(20,19,17,.96)}.composer{max-width:900px;margin:0 auto;display:flex;align-items:flex-end;gap:10px;padding:9px 10px 9px 16px;border-radius:18px;background:#24221f;border:1px solid rgba(255,255,255,.1)}textarea{flex:1;resize:none;max-height:140px;border:0;outline:0;background:transparent;color:var(--text);padding:10px 0}.send-button{width:42px;height:42px;border-radius:13px;border:0;cursor:pointer;color:#fff;background:linear-gradient(145deg,#ef8240,#bc4a18)}.disclaimer{max-width:900px;margin:9px auto 0;text-align:center;font-size:10px;color:#777168}@media(max-width:820px){.app-shell{width:100%;height:100dvh;margin:0;border-radius:0;border:0;grid-template-columns:1fr}.sidebar{display:none}.chat-header{height:72px;padding:0 16px}.messages{padding:24px 15px}.composer-wrap{padding:12px}.suggestion-grid{grid-template-columns:1fr}.bubble{max-width:92%}}


/* Rolagem visível da área de conversa */
.messages {
  overflow-y: auto !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(230, 119, 50, .72) rgba(255, 255, 255, .05);
  padding-right: 12px;
}

.messages::-webkit-scrollbar {
  width: 11px;
}

.messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .04);
  border-radius: 999px;
}

.messages::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ef8240, #a63e17);
  border: 3px solid #171614;
  border-radius: 999px;
}

.product-card {
  padding: 15px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.product-card:last-child {
  border-bottom: 0;
}

.product-name {
  display: block;
  line-height: 1.35;
}

.product-brand,
.product-code {
  display: block;
  margin-top: 4px;
  color: #8f887f;
  font-size: 12px;
}

.product-price {
  display: block;
  margin-top: 7px;
  color: #f0a070;
  font-weight: 800;
}

.stock-button {
  margin-top: 11px;
  padding: 8px 12px;
  border: 1px solid rgba(230,119,50,.42);
  border-radius: 10px;
  color: #ffd6be;
  background: rgba(230,119,50,.10);
  cursor: pointer;
  transition: .2s ease;
}

.stock-button:hover {
  background: rgba(230,119,50,.20);
}

.stock-button:disabled {
  opacity: .55;
  cursor: wait;
}

.stock-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.stock-store {
  padding: 13px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.035);
}

.stock-store strong,
.stock-store span,
.stock-store small {
  display: block;
}

.stock-store span {
  margin-top: 5px;
  color: #cfc7bc;
  line-height: 1.45;
}

.stock-store small {
  margin-top: 6px;
  color: #58c983;
  font-weight: 700;
}


/* Correção definitiva da rolagem do chat */
.chat-panel {
  min-height: 0 !important;
  overflow: hidden !important;
}

.messages {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 0 !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 16px !important;
}

.messages::-webkit-scrollbar {
  display: block !important;
  width: 14px !important;
}

.messages::-webkit-scrollbar-track {
  background: #1a1917 !important;
  border-left: 1px solid rgba(255,255,255,.06);
}

.messages::-webkit-scrollbar-thumb {
  background: #d9652c !important;
  border: 3px solid #1a1917 !important;
  border-radius: 999px !important;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: #f07f3d !important;
}

@media (max-width: 820px) {
  .chat-panel {
    height: 100dvh !important;
  }

  .messages {
    height: 0 !important;
    overflow-y: scroll !important;
  }
}


/* V5: layout definitivo com rolagem interna */
.app-shell {
  height: calc(100dvh - 40px) !important;
  max-height: 900px !important;
  min-height: 560px !important;
}

.chat-panel {
  display: grid !important;
  grid-template-rows: 84px minmax(0, 1fr) auto !important;
  height: 100% !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.chat-header {
  height: auto !important;
  min-height: 84px !important;
}

.messages {
  height: auto !important;
  min-height: 0 !important;
  overflow-y: scroll !important;
  overflow-x: hidden !important;
  scrollbar-gutter: stable both-edges !important;
  padding-right: 20px !important;
}

.composer-wrap {
  position: relative !important;
  z-index: 5 !important;
  flex: none !important;
}

.messages::-webkit-scrollbar {
  width: 14px !important;
}

.messages::-webkit-scrollbar-track {
  background: rgba(255,255,255,.055) !important;
  border-radius: 999px !important;
}

.messages::-webkit-scrollbar-thumb {
  min-height: 48px !important;
  background: #e36d30 !important;
  border: 3px solid #1a1917 !important;
  border-radius: 999px !important;
}

@media (max-width: 820px) {
  .app-shell {
    height: 100dvh !important;
    min-height: 0 !important;
  }

  .chat-panel {
    grid-template-rows: 72px minmax(0, 1fr) auto !important;
  }

  .chat-header {
    min-height: 72px !important;
  }
}


/* V6 — Carrinho e finalização */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-trigger {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(230,119,50,.38);
  border-radius: 12px;
  color: #ffd8bf;
  background: rgba(230,119,50,.08);
  cursor: pointer;
  transition: .2s ease;
}

.cart-trigger:hover {
  background: rgba(230,119,50,.16);
}

.cart-count {
  min-width: 21px;
  height: 21px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  color: #17120f;
  background: var(--accent);
  font-size: 11px;
  font-weight: 800;
}

.product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 11px;
}

.add-cart-button,
.stock-button {
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: .2s ease;
}

.add-cart-button {
  border: 0;
  color: #fff;
  background: linear-gradient(145deg,#ef8240,#bc4a18);
  font-weight: 700;
}

.add-cart-button:hover,
.stock-button:hover {
  transform: translateY(-1px);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0,0,0,.58);
  backdrop-filter: blur(4px);
}

.cart-drawer {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  width: min(440px, 94vw);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  color: var(--text);
  background: #181715;
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 70px rgba(0,0,0,.48);
  transform: translateX(105%);
  transition: transform .25s ease;
}

.cart-drawer.open {
  transform: translateX(0);
}

.cart-header,
.checkout-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 21px 22px;
  border-bottom: 1px solid var(--border);
}

.cart-header h2,
.checkout-header h2 {
  margin: 2px 0 0;
  font-family: "Manrope";
  font-size: 21px;
}

.cart-eyebrow {
  margin: 0;
  color: #f0a070;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.drawer-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--muted);
  background: rgba(255,255,255,.035);
  font-size: 24px;
  cursor: pointer;
}

.cart-content {
  min-height: 0;
  overflow-y: auto;
  padding: 17px 20px;
}

.empty-cart {
  min-height: 280px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty-cart > span {
  font-size: 38px;
}

.empty-cart strong {
  color: var(--text);
}

.empty-cart p {
  margin: 0;
  font-size: 13px;
}

.cart-items {
  display: grid;
  gap: 12px;
}

.cart-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}

.cart-item-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cart-item-name {
  display: block;
  line-height: 1.35;
  font-size: 13px;
}

.cart-item-brand {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.remove-item {
  border: 0;
  color: #c99680;
  background: transparent;
  cursor: pointer;
}

.cart-item-bottom {
  margin-top: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quantity-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.quantity-control button {
  width: 33px;
  height: 32px;
  border: 0;
  color: var(--text);
  background: rgba(255,255,255,.045);
  cursor: pointer;
}

.quantity-control span {
  min-width: 34px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
}

.cart-item-price {
  color: #f0a070;
  font-weight: 800;
}

.cart-footer {
  padding: 18px 20px 22px;
  border-top: 1px solid var(--border);
  background: #1b1a18;
}

.cart-total-row,
.checkout-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.cart-total-row strong,
.checkout-summary strong {
  color: #f0a070;
  font-size: 20px;
}

.cart-note,
.privacy-note {
  color: #817b73;
  font-size: 11px;
  line-height: 1.45;
}

.checkout-button,
.finish-order-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg,#ef8240,#bc4a18);
  font-weight: 800;
  cursor: pointer;
}

.checkout-button:disabled {
  opacity: .42;
  cursor: default;
}

.clear-cart-button {
  width: 100%;
  margin-top: 8px;
  min-height: 39px;
  border: 0;
  color: #a49d94;
  background: transparent;
  cursor: pointer;
}

.checkout-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(5px);
}

.checkout-modal[hidden],
.overlay[hidden] {
  display: none !important;
}

.checkout-card {
  width: min(850px, 96vw);
  max-height: 94dvh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  background: #181715;
  box-shadow: 0 30px 100px rgba(0,0,0,.58);
}

.checkout-form {
  padding: 4px 24px 25px;
}

.form-section {
  padding: 19px 0;
  border-bottom: 1px solid var(--border);
}

.form-section h3 {
  margin: 0 0 14px;
  font-family: "Manrope";
  font-size: 15px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field-wide {
  grid-column: span 1;
}

.field-full {
  grid-column: 1 / -1;
}

.field span {
  color: #c7bfb5;
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 11px;
  outline: 0;
  padding: 11px 12px;
  color: var(--text);
  background: #24221f;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(230,119,50,.55);
  box-shadow: 0 0 0 3px rgba(230,119,50,.08);
}

.field textarea {
  resize: vertical;
}

.checkout-summary {
  margin: 19px 0 4px;
  padding: 15px;
  border-radius: 13px;
  background: rgba(255,255,255,.035);
}

.finish-order-button {
  margin-top: 14px;
}

body.modal-open {
  overflow: hidden;
}

@media (max-width: 820px) {
  .cart-label {
    display: none;
  }

  .cart-trigger {
    padding: 0 9px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field,
  .field-wide,
  .field-full {
    grid-column: 1;
  }

  .checkout-card {
    max-height: 96dvh;
  }
}


/* V8 — Checkout conversacional dentro do chat */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.quick-reply {
  padding: 10px 13px;
  border: 1px solid rgba(230,119,50,.42);
  border-radius: 11px;
  color: #ffd9c1;
  background: rgba(230,119,50,.10);
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}

.quick-reply:hover {
  background: rgba(230,119,50,.20);
  transform: translateY(-1px);
}

.order-summary {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.order-summary-item {
  padding: 11px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.order-summary-item:last-child {
  border-bottom: 0;
}

.order-summary-item strong,
.order-summary-item span {
  display: block;
}

.order-summary-item span {
  margin-top: 4px;
  color: #a59d94;
  font-size: 12px;
}

.order-summary-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.10);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #f0a070;
  font-weight: 800;
}

.checkout-progress {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  color: #9a938a;
  font-size: 11px;
}

.checkout-progress-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e36d30;
}

.confirmation-card {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.035);
}

.confirmation-card span {
  color: #cfc7bc;
  line-height: 1.45;
}

.confirmation-card strong {
  color: #f0a070;
}


/* V10 — início limpo e funcional */
.welcome-message,
.suggestion-grid,
.eyebrow {
  display: none !important;
}

.messages {
  padding-top: 28px !important;
}

.message.assistant:first-child .bubble {
  max-width: 620px;
}


/* V13 — correção visual e lógica do carrinho */
.cart-unit-price {
  display: block;
  margin-bottom: 3px;
  color: #8f887f;
  font-size: 10px;
  text-align: right;
}

.cart-item-price {
  display: block;
  text-align: right;
}

.clear-cart-button[hidden] {
  display: none !important;
}

.checkout-button:disabled {
  opacity: .42;
  cursor: not-allowed;
  transform: none !important;
}

.empty-cart[hidden],
.cart-items[hidden] {
  display: none !important;
}


/* V15 — atendimento mais humano */
.message.assistant .bubble p {
  line-height: 1.55;
}

.typing {
  min-width: 44px;
}

.version-badge{font:700 10px/1.1 Manrope,sans-serif;color:#ff8a3d;border:1px solid rgba(255,138,61,.45);border-radius:999px;padding:4px 7px;margin-left:7px;white-space:nowrap}.crm-ok{color:#55d392}.crm-pending{color:#eeb868}.crm-error{color:#ff7e7e}
