/* Sahulat Buddy AI Assistant — premium frontend styles */
:root {
  --sb-primary: #0d3b78;
  --sb-accent: #ffd84d;
  --sb-primary-2: #1a62d7;
  --sb-ink: #14233d;
  --sb-muted: #667085;
  --sb-line: #e4ebf5;
  --sb-bg: #f6f8fc;
  --sb-white: #ffffff;
  --sb-radius: 20px;
  --sb-shadow: 0 24px 60px rgba(15, 35, 70, 0.18), 0 2px 8px rgba(15, 35, 70, 0.06);
  --sb-keyboard-offset: 0px;
}

.sb-widget,
.sb-widget * { box-sizing: border-box; }
.sb-widget {
  position: fixed;
  z-index: 2147483000;
  inset: auto auto calc(20px + env(safe-area-inset-bottom, 0px)) calc(20px + env(safe-area-inset-left, 0px));
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--sb-ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.sb-widget[data-position="bottom-right"] { left: auto; right: calc(20px + env(safe-area-inset-right, 0px)); }
.sb-widget [hidden], .sb-confirm[hidden] { display: none !important; }
.sb-widget .screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Launcher — icon only */
.sb-launcher {
  position: relative;
  width: 100px;
  height: 100px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  overflow: visible;
  transform-origin: center bottom;
  transition: transform .28s cubic-bezier(.2,.9,.2,1), filter .28s ease;
  -webkit-tap-highlight-color: transparent;
}
.sb-launcher:hover {
  transform: translateY(-4px) scale(1.05) rotate(-2deg);
  filter: drop-shadow(0 14px 24px rgba(13, 59, 120, 0.28));
}
.sb-launcher:active { transform: translateY(1px) scale(.96); filter: drop-shadow(0 6px 12px rgba(13, 59, 120, 0.2)); }
.sb-launcher:focus-visible,
.sb-icon-btn:focus-visible,
.sb-quick-chip:focus-visible,
.sb-btn:focus-visible,
.sb-send:focus-visible,
.sb-composer textarea:focus-visible,
.sb-category-chip:focus-visible,
.sb-list-remove:focus-visible,
.sb-list-qty:focus-visible {
  outline: 3px solid rgba(255, 216, 77, 0.65);
  outline-offset: 4px;
}
.sb-launcher-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  background: transparent;
  border-radius: 0;
  pointer-events: none;
}
.sb-launcher-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  background: transparent;
  filter: drop-shadow(0 10px 18px rgba(13, 59, 120, 0.22)) drop-shadow(0 2px 4px rgba(13, 59, 120, 0.12));
  transition: filter .28s ease, transform .28s ease;
  user-select: none;
  -webkit-user-drag: none;
}
.sb-header-avatar img {
  width: 38px; height: 38px; display: block; object-fit: contain;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.08));
}
.sb-launcher-pulse {
  position: absolute;
  top: 10%;
  right: 12%;
  width: 12px; height: 12px; border-radius: 50%;
  background: #34d399; border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(52,211,153,.55);
  pointer-events: none;
}
.sb-widget.sb-animated .sb-launcher { animation: sb-float 4.8s ease-in-out infinite, sb-attention 10s ease-in-out infinite; }
.sb-widget.sb-animated .sb-launcher-pulse { animation: sb-pulse 2.8s infinite; }
.sb-widget.sb-open .sb-launcher-pulse { display: none; }
.sb-cart-count {
  position: absolute; top: 2px; left: 2px;
  min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(239,68,68,.35);
  z-index: 2;
}

@keyframes sb-float {
  0%, 100% { transform: translateY(0) scale(1); }
  25% { transform: translateY(-5px) scale(1.01); }
  50% { transform: translateY(-9px) scale(1.015); }
  75% { transform: translateY(-4px) scale(1.008); }
}
@keyframes sb-attention {
  0%, 88%, 100% { filter: drop-shadow(0 0 0 rgba(255, 216, 77, 0)); }
  92% { filter: drop-shadow(0 0 10px rgba(255, 216, 77, 0.35)) drop-shadow(0 10px 18px rgba(13, 59, 120, 0.18)); }
  96% { filter: drop-shadow(0 0 14px rgba(26, 98, 215, 0.28)) drop-shadow(0 10px 18px rgba(13, 59, 120, 0.18)); }
}
@keyframes sb-pulse { 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }

/* Panel */
.sb-panel {
  position: absolute;
  bottom: calc(114px + var(--sb-keyboard-offset, 0px));
  left: 0;
  width: min(400px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  height: min(660px, calc(100dvh - 112px - env(safe-area-inset-bottom, 0px) - var(--sb-keyboard-offset, 0px)));
  max-height: calc(100dvh - 112px - env(safe-area-inset-bottom, 0px) - var(--sb-keyboard-offset, 0px));
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: var(--sb-radius);
  background: var(--sb-white);
  box-shadow: var(--sb-shadow);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(16px) scale(.985);
  transform-origin: bottom left;
  transition: transform .28s cubic-bezier(.2,.9,.2,1), opacity .22s ease, visibility .22s ease;
}
.sb-widget[data-position="bottom-right"] .sb-panel { left: auto; right: 0; transform-origin: bottom right; }
.sb-widget.sb-open .sb-panel { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); }
.sb-widget.sb-minimized .sb-panel { height: 72px; min-height: 72px; }
.sb-widget.sb-minimized .sb-quick-actions,
.sb-widget.sb-minimized .sb-messages,
.sb-widget.sb-minimized .sb-typing,
.sb-widget.sb-minimized .sb-composer,
.sb-widget.sb-minimized .sb-status { display: none !important; }

/* Header */
.sb-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #0b3570 0%, var(--sb-primary) 45%, #1a62d7 100%);
  color: #fff;
  flex: 0 0 auto;
  position: relative;
}
.sb-header::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.08), transparent 60%);
  pointer-events: none;
}
.sb-header-brand { display: flex; align-items: center; gap: 11px; min-width: 0; position: relative; }
.sb-header-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  display: grid; place-items: center; flex: 0 0 auto;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}
.sb-header-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sb-header-title {
  font-size: 15px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-header-subtitle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: rgba(255,255,255,.88);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-online-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #34d399; flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(52,211,153,.2);
}
.sb-header-actions { display: flex; gap: 6px; flex: 0 0 auto; position: relative; }
.sb-icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 10px;
  background: rgba(255,255,255,.1); color: #fff; cursor: pointer;
  font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .16s ease, transform .16s ease;
}
.sb-icon-btn:hover { background: rgba(255,255,255,.18); }
.sb-icon-btn:active { transform: scale(.95); }

/* Quick actions */
.sb-quick-actions {
  display: flex; gap: 8px; padding: 12px 14px 4px;
  overflow-x: auto; flex: 0 0 auto; background: #fff;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch;
}
.sb-quick-actions:empty { display: none; }
.sb-quick-chip {
  flex: 0 0 auto; border: 1px solid #dbe6f7; border-radius: 999px;
  background: #f7faff; color: var(--sb-primary);
  padding: 8px 13px; min-height: 36px;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: all .16s ease;
}
.sb-quick-chip:hover { background: #edf4ff; border-color: #bcd3f5; transform: translateY(-1px); }
.sb-quick-chip:active { transform: translateY(0); }

/* Messages */
.sb-messages {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, #f8fafd 0%, var(--sb-bg) 100%);
  scroll-behavior: smooth;
}
.sb-empty { display: none !important; }
.sb-msg {
  max-width: 86%; padding: 11px 14px; border-radius: 16px;
  font-size: 13.5px; line-height: 1.6;
  white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word;
  animation: sb-msg-in .18s ease-out;
}
@keyframes sb-msg-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.sb-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--sb-primary), #1860cc);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 14px rgba(13, 59, 120, 0.2);
}
.sb-msg-buddy {
  align-self: flex-start;
  background: #fff; color: var(--sb-ink);
  border: 1px solid #e6edf5;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 3px rgba(16, 35, 63, 0.03);
}
.sb-welcome-msg { max-width: 92%; }
.sb-msg-rich {
  width: 100%; max-width: 100%; align-self: stretch;
  margin: 0; padding: 0; background: transparent; border: 0; box-shadow: none;
  white-space: normal; animation: sb-msg-in .18s ease-out;
}
.sb-reply-text {
  background: #fff; color: var(--sb-ink);
  border: 1px solid #e6edf5; border-radius: 16px; border-bottom-left-radius: 6px;
  padding: 11px 14px; margin-bottom: 10px;
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 13.5px; line-height: 1.6;
  box-shadow: 0 1px 3px rgba(16, 35, 63, 0.03);
}
.sb-reply-text:last-child { margin-bottom: 0; }

/* Category chips */
.sb-category-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sb-category-chip {
  border: 1px solid #dbe6f7; border-radius: 10px; background: #fff;
  padding: 8px 12px; min-height: 38px;
  font-size: 12px; font-weight: 600; cursor: pointer; color: var(--sb-primary);
  transition: all .16s ease;
}
.sb-category-chip:hover { background: #f5f9ff; border-color: #bcd3f5; }
.sb-category-chip span { color: var(--sb-muted); font-weight: 500; margin-left: 4px; }

/* Budget / product cards */
.sb-budget-summary {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 10px 12px; margin-bottom: 10px; border-radius: 12px;
  background: #edf4ff; color: #1a3f6b; font-size: 12px; font-weight: 500;
}
.sb-budget-summary:empty { display: none; }
.sb-budget-summary strong { color: var(--sb-primary); font-weight: 700; }
.sb-product-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.sb-product-grid:empty, .sb-product-actions:empty, .sb-product-meta:empty { display: none; }
.sb-product-card {
  display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 12px;
  padding: 10px; border: 1px solid #e6edf5; border-radius: 16px;
  background: #fff; min-width: 0;
  box-shadow: 0 1px 2px rgba(16,35,63,.02);
  transition: box-shadow .18s ease, border-color .18s ease;
}
.sb-product-card:hover { border-color: #d2e1f3; box-shadow: 0 4px 14px rgba(16,35,63,.05); }
.sb-product-card * { min-width: 0; }
.sb-product-media { position: relative; width: 82px; height: 82px; }
.sb-product-media a { display: block; width: 100%; height: 100%; border-radius: 12px; overflow: hidden; background: #f3f6fb; }
.sb-product-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb-card-badge {
  position: absolute; top: 6px; left: 6px;
  padding: 3px 6px; border-radius: 6px;
  background: #ef4444; color: #fff; font-size: 9px; font-weight: 700; line-height: 1.2;
  letter-spacing: .01em;
}
.sb-product-media .sb-media-action {
  position: absolute; bottom: 6px; left: 6px;
  width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 9px;
  background: rgba(255,255,255,.96); color: var(--sb-primary);
  box-shadow: 0 2px 8px rgba(16,35,63,.14);
  font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.sb-product-body { min-width: 0; overflow: hidden; padding: 1px 0; }
.sb-card-alt-label {
  display: inline-flex; align-items: center; padding: 2px 8px; margin-bottom: 5px;
  border-radius: 999px; background: #fff7e0; color: #8a6200; font-size: 10px; font-weight: 700;
}
.sb-product-name {
  margin: 0 0 4px; font-size: 13px; line-height: 1.4; font-weight: 600;
  overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sb-product-name a { color: var(--sb-ink); text-decoration: none; }
.sb-product-name a:hover { color: var(--sb-primary); }
.sb-product-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px;
  margin-bottom: 5px; font-size: 11px; color: var(--sb-muted);
}
.sb-product-vendor { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-product-rating { color: #b45309; font-weight: 600; white-space: nowrap; }
.sb-review-count { color: var(--sb-muted); font-weight: 500; }
.sb-product-stock { font-size: 11px; font-weight: 600; white-space: nowrap; }
.sb-stock-in { color: #059669; } .sb-stock-out { color: #dc2626; }
.sb-product-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; line-height: 1.2; margin-bottom: 2px; }
.sb-price-current, .sb-price-current .woocommerce-Price-amount { color: var(--sb-primary); font-size: 15px; font-weight: 700; }
.sb-price-regular { color: #94a3b8; font-size: 11.5px; }
.sb-price-regular del, .sb-price-regular .woocommerce-Price-amount { color: #94a3b8; }
.sb-card-note { margin: 5px 0 0; font-size: 11px; line-height: 1.45; color: #5f6f85; }
.sb-product-actions { display: flex; gap: 8px; margin-top: 10px; }
.sb-btn {
  border: 1px solid #dbe5f0; border-radius: 10px; background: #fff; color: var(--sb-primary);
  padding: 0 12px; min-height: 36px; font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  white-space: nowrap; transition: all .16s ease;
}
.sb-btn:hover { border-color: #bcd3f5; background: #f7fbff; }
.sb-btn:active { transform: scale(.985); }
.sb-btn:disabled, .sb-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.sb-btn-view, .sb-btn-cart { flex: 1 1 0; min-width: 0; padding: 0 10px; }
.sb-btn-primary, .sb-btn-cart {
  background: linear-gradient(135deg, var(--sb-primary), #1961d0);
  color: #fff; border-color: transparent;
  box-shadow: 0 2px 8px rgba(13, 59, 120, 0.2);
}
.sb-btn-primary:hover, .sb-btn-cart:hover {
  filter: brightness(1.04); background: linear-gradient(135deg, #0c4589, #1a6ae0);
  color: #fff; border-color: transparent;
}
.sb-btn-icon {
  flex: 0 0 36px; width: 36px; padding: 0; font-size: 15px;
}

/* Shopping list */
.sb-shopping-list {
  background: #fff; border: 1px solid #e6edf5; border-radius: 16px; padding: 12px;
  box-shadow: 0 1px 2px rgba(16,35,63,.02);
}
.sb-shopping-list h5 { margin: 10px 0 6px; font-size: 12px; font-weight: 700; color: var(--sb-ink); }
.sb-shopping-list h5:first-child { margin-top: 0; }
.sb-list-row {
  display: grid; grid-template-columns: 1fr auto 52px auto;
  gap: 8px; align-items: center; padding: 8px 0;
  border-bottom: 1px solid #edf2f7; font-size: 12px;
}
.sb-list-row:last-child { border-bottom: 0; }
.sb-list-name { font-weight: 500; overflow-wrap: anywhere; color: var(--sb-ink); }
.sb-list-price { white-space: nowrap; color: var(--sb-primary); font-weight: 600; }
.sb-list-qty {
  width: 52px; min-height: 36px; border: 1px solid #dbe5f0; border-radius: 8px;
  padding: 4px; font-size: 12px; text-align: center; color: var(--sb-ink);
}
.sb-list-remove {
  border: 0; background: transparent; color: #dc2626; cursor: pointer;
  font-size: 12px; font-weight: 600; padding: 6px 4px; min-height: 36px;
}
.sb-list-remove:hover { color: #b91c1c; text-decoration: underline; }
.sb-list-total {
  display: flex; justify-content: space-between; gap: 10px;
  margin: 10px 0; padding-top: 8px; border-top: 1px solid #edf2f7;
  font-size: 12px; flex-wrap: wrap; font-weight: 500;
}
.sb-list-total strong { color: var(--sb-primary); font-weight: 700; }
.sb-list-message .sb-shopping-list { margin-top: 0; }

/* Typing */
.sb-typing {
  display: flex; align-items: center; gap: 5px;
  padding: 2px 16px 10px; background: var(--sb-bg); flex: 0 0 auto;
}
.sb-typing span:not(.sb-typing-text) {
  width: 7px; height: 7px; border-radius: 50%; background: var(--sb-primary); opacity: .35;
}
.sb-widget.sb-animated .sb-typing span:not(.sb-typing-text) { animation: sb-dot 1.2s infinite ease-in-out; }
.sb-typing span:nth-child(2) { animation-delay: .15s; }
.sb-typing span:nth-child(3) { animation-delay: .3s; }
.sb-typing-text { font-size: 12px; color: var(--sb-muted); margin-left: 4px; }
@keyframes sb-dot { 0%,60%,100% { transform: translateY(0); opacity:.35; } 30% { transform: translateY(-3px); opacity:.9; } }

/* Composer */
.sb-composer {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e9eff6; background: #fff; flex: 0 0 auto;
}
.sb-composer textarea {
  flex: 1; min-width: 0; resize: none;
  min-height: 44px; max-height: 112px;
  border: 1px solid #dce5ef; border-radius: 14px;
  padding: 11px 14px;
  font-size: 13.5px; line-height: 1.45; font-family: inherit;
  color: var(--sb-ink); background: #fbfcfe;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.sb-composer textarea::placeholder { color: #94a3b8; }
.sb-composer textarea:focus {
  border-color: #8cb8f0; background: #fff;
  box-shadow: 0 0 0 4px rgba(26, 98, 215, 0.1); outline: none;
}
.sb-send {
  width: 44px; height: 44px; flex: 0 0 auto;
  border: 0; border-radius: 14px;
  background: linear-gradient(135deg, var(--sb-primary), #1961d0);
  color: #fff; cursor: pointer; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(13, 59, 120, 0.25);
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
.sb-send:hover { filter: brightness(1.05); box-shadow: 0 6px 16px rgba(13, 59, 120, 0.3); }
.sb-send:active { transform: scale(.96); }
.sb-status {
  padding: 0 14px 10px; background: #fff;
  color: var(--sb-muted); font-size: 11.5px; flex: 0 0 auto;
}
.sb-status:empty { display: none; }

/* Confirm */
.sb-confirm {
  position: fixed; inset: 0; z-index: 2147483001;
  display: grid; place-items: center; padding: 16px;
}
.sb-confirm-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(2px); }
.sb-confirm-box {
  position: relative; width: min(360px, 100%);
  border-radius: 18px; background: #fff; padding: 20px;
  box-shadow: 0 24px 60px rgba(15, 35, 70, 0.22);
  animation: sb-msg-in .18s ease-out;
}
.sb-confirm-box h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: var(--sb-ink); }
.sb-confirm-summary-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #edf2f7; font-size: 13px;
}
.sb-confirm-summary-row:last-child { border-bottom: 0; }
.sb-confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.sb-btn-cancel { background: #fff; color: var(--sb-muted); border-color: #dbe5f0; }
.sb-btn-cancel:hover { background: #f8fafc; color: var(--sb-ink); }

/* Busy state */
.sb-widget.sb-busy .sb-send { opacity: .7; }

/* Responsive */
@media (max-width: 900px) {
  .sb-panel { width: min(390px, calc(100vw - 20px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px))); }
}

@media (max-width: 640px) {
  .sb-widget { inset: auto calc(14px + env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) calc(14px + env(safe-area-inset-left, 0px)); }
  .sb-widget[data-position="bottom-right"] { right: calc(14px + env(safe-area-inset-right, 0px)); left: auto; }
  .sb-launcher { width: 76px; height: 76px; }
  .sb-launcher-icon { width: 76px; height: 76px; }
  .sb-launcher-icon img { width: 100%; height: 100%; }
  .sb-header-avatar img { width: 34px; height: 34px; }
  .sb-panel {
    position: fixed;
    left: calc(8px + env(safe-area-inset-left, 0px));
    right: calc(8px + env(safe-area-inset-right, 0px));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px) + var(--sb-keyboard-offset, 0px));
    top: calc(8px + env(safe-area-inset-top, 0px));
    width: auto; height: auto; max-height: none;
    border-radius: 20px;
    transform-origin: bottom center;
  }
  .sb-widget[data-position="bottom-right"] .sb-panel,
  .sb-widget .sb-panel { left: calc(8px + env(safe-area-inset-left, 0px)); right: calc(8px + env(safe-area-inset-right, 0px)); }
  .sb-header { padding: 14px; padding-top: calc(14px + env(safe-area-inset-top, 0px) * 0.2); }
  .sb-messages { padding: 12px; }
  .sb-msg { max-width: 90%; font-size: 14px; }
  .sb-reply-text { font-size: 14px; }
  .sb-quick-actions { padding: 10px 12px 4px; }
  .sb-composer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .sb-composer textarea { font-size: 16px; min-height: 44px; }
  .sb-send { width: 44px; height: 44px; }
  .sb-product-card { grid-template-columns: 74px minmax(0, 1fr); gap: 10px; padding: 9px; }
  .sb-product-media { width: 74px; height: 74px; }
  .sb-btn, .sb-quick-chip, .sb-category-chip, .sb-list-remove, .sb-icon-btn, .sb-list-qty { min-height: 40px; }
  .sb-icon-btn { width: 38px; height: 38px; }
  .sb-btn-icon { flex-basis: 40px; width: 40px; min-height: 40px; }
  .sb-product-media .sb-media-action { width: 32px; height: 32px; min-height: 32px; }
}

@media (max-width: 380px) {
  .sb-product-card { grid-template-columns: 66px minmax(0, 1fr); gap: 8px; padding: 8px; }
  .sb-product-media { width: 66px; height: 66px; }
  .sb-product-name { font-size: 12.5px; }
  .sb-price-current, .sb-price-current .woocommerce-Price-amount { font-size: 14px; }
  .sb-btn-view, .sb-btn-cart { font-size: 11.5px; padding: 0 8px; }
  .sb-header-title { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .sb-launcher, .sb-launcher-pulse, .sb-typing span:not(.sb-typing-text),
  .sb-panel, .sb-btn, .sb-icon-btn, .sb-msg, .sb-msg-rich,
  .sb-quick-chip, .sb-product-card, .sb-send, .sb-confirm-box {
    animation: none !important; transition: none !important;
  }
}
