.topharm-ai { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 2147482000; font-family: Arial, Helvetica, sans-serif; color: #202020; line-height: 1.48; color-scheme: light; }
.topharm-ai *, .topharm-ai *::before, .topharm-ai *::after { box-sizing: border-box; }
.topharm-ai button, .topharm-ai select, .topharm-ai textarea { font-family: inherit; }

.topharm-ai-launcher { position: relative; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 50%; background: #218542; color: #fff; box-shadow: none; cursor: pointer; display: grid; place-items: center; transition: background-color .16s ease; }
.topharm-ai-launcher[hidden] { display: none !important; }
.topharm-ai-launcher:hover { background: #176f36; }
.topharm-ai-launcher:focus-visible { outline: 3px solid rgba(33,133,66,.28); outline-offset: 3px; }
.topharm-ai-launcher svg { width: 27px; height: 27px; fill: currentColor; }
.topharm-ai-launcher-status { position: absolute; top: 1px; inset-inline-end: 1px; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 50%; background: #ed1a38; }

.topharm-ai-panel { position: absolute; right: 0; bottom: 0; width: min(410px, calc(100vw - 28px)); height: min(630px, calc(100vh - 36px)); max-height: 630px; background: #fff; border: 1px solid #dfe5e1; border-radius: 22px; box-shadow: 0 18px 48px rgba(20,37,27,.18); overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
.topharm-ai-panel[hidden] { display: none !important; }

.topharm-ai-header { position: relative; z-index: 3; min-height: 70px; padding: 11px 12px 11px 14px; background: #fff; color: #202020; border-bottom: 1px solid #edf0ee; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.topharm-ai-identity { min-width: 0; display: flex; align-items: center; gap: 10px; }
.topharm-ai-avatar { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 0; background: transparent; color: #2563eb; display: grid; place-items: center; }
.topharm-ai-avatar svg { width: 29px; height: 29px; fill: currentColor; }
.topharm-ai-identity-copy { min-width: 0; }
.topharm-ai-header strong { display: block; overflow: hidden; color: #202020; font-size: 16px; font-weight: 500; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.topharm-ai-header small { display: block; max-width: 178px; margin-top: 2px; overflow: hidden; color: #626862; font-size: 12px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.topharm-ai-header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.topharm-ai-language-picker { position: relative; }
.topharm-ai-language-control { width: 58px; height: 34px; padding: 0 6px; border: 1px solid #e1e6e3; border-radius: 10px; background: transparent; color: #626862; box-shadow: none; display: grid; grid-template-columns: 14px 1fr 9px; align-items: center; justify-items: center; gap: 3px; cursor: pointer; }
.topharm-ai-language-globe { width: 14px; height: 14px; fill: currentColor; }
.topharm-ai-language-chevron { width: 9px; height: 9px; fill: currentColor; transition: transform .14s ease; }
.topharm-ai-language-control[aria-expanded="true"] .topharm-ai-language-chevron { transform: rotate(180deg); }
.topharm-ai-language-code { color: #202020; font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: .04em; text-transform: uppercase; }
.topharm-ai-language { display: none !important; }
.topharm-ai-language-control:hover, .topharm-ai-language-control[aria-expanded="true"] { border-color: #b9d4c1; background: #f6faf7; }
.topharm-ai-language-control:focus-visible { border-color: #218542; outline: 2px solid rgba(33,133,66,.18); outline-offset: 1px; }
.topharm-ai-language-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; width: 284px; padding: 7px; border: 1px solid #dfe6e1; border-radius: 14px; background: #fff; box-shadow: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.topharm-ai[dir="rtl"] .topharm-ai-language-menu { right: auto; left: 0; }
.topharm-ai-language-menu[hidden] { display: none !important; }
.topharm-ai-language-option { min-width: 0; min-height: 38px; padding: 0 8px; border: 1px solid transparent; border-radius: 10px; background: #fff; color: #202020; display: grid; grid-template-columns: 27px minmax(0, 1fr) 13px; align-items: center; gap: 6px; direction: ltr; cursor: pointer; }
.topharm-ai-language-option:hover { border-color: #e0e8e3; background: #f6f8f7; }
.topharm-ai-language-option:focus-visible { border-color: #218542; outline: 2px solid rgba(33,133,66,.16); outline-offset: -1px; }
.topharm-ai-language-option[aria-selected="true"] { border-color: #c9e1d0; background: #edf7f0; color: #176b36; }
.topharm-ai-language-option-code { width: 27px; height: 20px; border-radius: 7px; background: #f0f3f1; color: #626862; font-size: 9px; font-weight: 700; line-height: 20px; letter-spacing: .03em; text-align: center; text-transform: uppercase; }
.topharm-ai-language-option[aria-selected="true"] .topharm-ai-language-option-code { background: #dcefe2; color: #176b36; }
.topharm-ai-language-option-name { min-width: 0; overflow: hidden; font-size: 13px; font-weight: 500; line-height: 1.2; text-align: start; text-overflow: ellipsis; white-space: nowrap; }
.topharm-ai-language-option-check { color: #218542; font-size: 13px; font-weight: 700; line-height: 1; opacity: 0; }
.topharm-ai-language-option[aria-selected="true"] .topharm-ai-language-option-check { opacity: 1; }
.topharm-ai-close { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #626862; box-shadow: none; cursor: pointer; display: grid; place-items: center; }
.topharm-ai-close:hover { background: #f1f4f2; color: #202020; }
.topharm-ai-close:focus-visible { outline: 2px solid rgba(33,133,66,.25); }
.topharm-ai-close svg { width: 19px; height: 19px; fill: currentColor; }

.topharm-ai-messages { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px 10px; background: #fff; scrollbar-color: #c7d0ca transparent; scrollbar-width: thin; }
.topharm-ai-messages::-webkit-scrollbar { width: 5px; }
.topharm-ai-messages::-webkit-scrollbar-thumb { border-radius: 8px; background: #c7d0ca; }
.topharm-ai-message { position: relative; max-width: 88%; margin: 0 0 16px; padding: 10px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; color: #202020; font-size: 14.5px; line-height: 1.55; }
.topharm-ai-message-user { margin-inline-start: auto; background: #edf7f0; color: #202020; border-end-end-radius: 6px; }
.topharm-ai-message-assistant { max-width: 100%; min-height: 30px; margin-inline-end: auto; padding: 2px 0 2px 39px; border: 0; border-radius: 0; background: transparent; }
.topharm-ai[dir="rtl"] .topharm-ai-message-assistant { padding: 2px 39px 2px 0; }
.topharm-ai-message-assistant::before { content: '✦'; position: absolute; top: 0; inset-inline-start: 0; width: 29px; height: 29px; border-radius: 9px; background: #eaf5ed; color: #218542; display: grid; place-items: center; font-size: 15px; line-height: 1; }
.topharm-ai-message-system { max-width: 100%; margin-inline: auto; padding: 9px 11px; border: 1px solid #f0dfac; border-radius: 12px; background: #fff9e8; color: #5b4c24; text-align: center; font-size: 12px; }
.topharm-ai-brand-name { font-weight: 500; }
.topharm-ai-message.is-typing::after { content: ''; display: inline-block; width: 2px; height: 1.05em; margin-inline-start: 3px; border-radius: 2px; background: #218542; vertical-align: -.14em; animation: topharm-ai-cursor .75s steps(1,end) infinite; }

.topharm-ai-loading { min-height: 32px; display: flex; align-items: center; gap: 8px; color: #626862; font-size: 12.5px; }
.topharm-ai-loading-label { line-height: 1; }
.topharm-ai-loading-dots { direction: ltr; display: inline-flex; align-items: center; gap: 3px; }
.topharm-ai-loading-dots i { width: 5px; height: 5px; border-radius: 50%; background: #218542; animation: topharm-ai-dot 1.15s ease-in-out infinite; }
.topharm-ai-loading-dots i:nth-child(2) { animation-delay: .14s; }
.topharm-ai-loading-dots i:nth-child(3) { animation-delay: .28s; }

.topharm-ai-sources, .topharm-ai-products, .topharm-ai-orders { margin: 8px 0 0; padding: 0; list-style: none; }
.topharm-ai-sources a, .topharm-ai-products a { color: #146b34; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.topharm-ai-product, .topharm-ai-order { border-top: 1px solid #e3e7e4; padding: 7px 0; }
.topharm-ai-products { display: grid; gap: 9px; }
.topharm-ai-products .topharm-ai-product { border: 1px solid #dce6df; border-radius: 14px; padding: 11px; background: #fbfdfb; }
.topharm-ai-product-name { display: block; font-weight: 700; line-height: 1.35; }
.topharm-ai-product-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 7px; font-size: 12.5px; }
.topharm-ai-product-stock { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.topharm-ai-product-stock.is-in-stock { color: #176b36; background: #eaf6ee; }
.topharm-ai-product-stock.is-out-of-stock { color: #8b2f2f; background: #faeaea; }
.topharm-ai-product-price { color: #202020; font-size: 13px; }
.topharm-ai-product-reason { margin-top: 7px; color: #626862; font-size: 12.5px; line-height: 1.45; }
.topharm-ai-product-options { display: block; margin-top: 6px; color: #747a76; font-size: 12px; }
.topharm-ai-product-cart { width: 100%; min-height: 44px; margin-top: 9px; padding: 9px 14px; border: 0; border-radius: 12px; background: #ed1a38; color: #fff; box-shadow: none; display: flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 700; line-height: 1.2; cursor: pointer; transition: background-color .16s ease; }
.topharm-ai-product-cart svg { width: 20px; height: 20px; flex: 0 0 20px; fill: currentColor; }
.topharm-ai-product-cart:hover:not(:disabled) { background: #d91633; box-shadow: none; transform: none; filter: none; }
.topharm-ai-product-cart:focus-visible { outline: 3px solid rgba(237,26,56,.24); outline-offset: 2px; }
.topharm-ai-product-cart.is-loading { cursor: wait; background: #d91633; box-shadow: none; transform: none; filter: none; }
.topharm-ai-product-cart.is-disabled, .topharm-ai-product-cart:disabled:not(.is-loading) { background: #b8c1bb; color: #fff; box-shadow: none; cursor: not-allowed; }

.topharm-ai-quick { min-width: 0; max-height: 148px; overflow-x: hidden; overflow-y: auto; padding: 8px 10px; background: #fff; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 7px; scrollbar-color: #c8d1cb transparent; scrollbar-width: thin; }
.topharm-ai-quick::-webkit-scrollbar { width: 4px; }
.topharm-ai-quick::-webkit-scrollbar-thumb { border-radius: 8px; background: #c8d1cb; }
.topharm-ai-chip { min-width: 0; width: 100%; min-height: 40px; padding: 7px 8px; border: 1px solid #d3ddd6; border-radius: 13px; background: #f7faf8; color: #202020; box-shadow: none; cursor: pointer; font-size: 13.25px; font-weight: 600; line-height: 1.25; text-align: center; text-decoration: none; white-space: normal; overflow-wrap: anywhere; display: inline-flex; align-items: center; justify-content: center; transition: background-color .14s ease, border-color .14s ease, color .14s ease; }
.topharm-ai-chip:hover { border-color: #89bf99; background: #edf7f0; color: #174d29; }
.topharm-ai-chip:focus-visible { outline: 2px solid rgba(33,133,66,.22); outline-offset: 1px; }
.topharm-ai-chip-more { grid-column: span 2; border-color: #c7d8cc; background: #f1f6f2; color: #202020; }
.topharm-ai-chip-more[aria-expanded="true"] { border-color: #78b78a; background: #e6f3e9; }
.topharm-ai-quick > .topharm-ai-chip:only-child { grid-column: 1 / -1; }
.topharm-ai-rating { direction: ltr; display: flex; align-items: center; gap: 5px; margin-top: 9px; }
.topharm-ai-star { width: 34px; height: 34px; border: 1px solid #cfe0d4; border-radius: 10px; background: #fff; color: #7c8c82; box-shadow: none; cursor: pointer; font-size: 22px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; transition: color .12s ease, border-color .12s ease, background-color .12s ease; }
.topharm-ai-star.is-active { border-color: #218542; background: #eef8f1; color: #218542; }
.topharm-ai-star:hover { border-color: #218542; }
.topharm-ai-star:focus-visible { border-color: #218542; outline: 2px solid rgba(33,133,66,.22); outline-offset: 1px; }
.topharm-ai-rating.is-submitting .topharm-ai-star { cursor: wait; }

.topharm-ai-composer { margin: 4px 10px 7px; padding: 6px 6px 6px 12px; border: 1px solid #cfd8d2; border-radius: 18px; background: #fff; display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 4px; align-items: end; }
.topharm-ai[dir="rtl"] .topharm-ai-composer { padding: 6px 12px 6px 6px; }
.topharm-ai-composer:focus-within { border-color: #218542; outline: 2px solid rgba(33,133,66,.11); }
.topharm-ai-composer textarea { width: 100%; min-height: 38px; max-height: 108px; margin: 0; padding: 9px 2px 7px; resize: none; border: 0; border-radius: 0; outline: 0; background: transparent; color: #202020; font: inherit; font-size: 15px; line-height: 1.4; direction: inherit; box-shadow: none; }
.topharm-ai-composer textarea::placeholder { color: #7a817c; }
.topharm-ai-send, .topharm-ai-mic { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 12px; box-shadow: none; display: grid; place-items: center; cursor: pointer; }
.topharm-ai-send { background: #218542; color: #fff; }
.topharm-ai-send:hover:not(:disabled) { background: #176f36; }
.topharm-ai-mic { background: transparent; color: #218542; }
.topharm-ai-mic:hover:not(:disabled) { background: #edf5ef; }
.topharm-ai-send:focus-visible, .topharm-ai-mic:focus-visible { outline: 2px solid rgba(33,133,66,.25); outline-offset: 1px; }
.topharm-ai-send:disabled, .topharm-ai-mic:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }
.topharm-ai-send svg, .topharm-ai-mic svg { width: 20px; height: 20px; fill: currentColor; }
.topharm-ai-footer { min-height: 24px; padding: 3px 12px 7px; background: #fff; color: #747b76; text-align: center; font-size: 10.5px; line-height: 1.35; }

@keyframes topharm-ai-dot { 0%, 60%, 100% { opacity: .28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes topharm-ai-cursor { 0%, 48% { opacity: 1; } 49%, 100% { opacity: 0; } }

@media (max-width: 520px) {
  .topharm-ai { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .topharm-ai-launcher { width: 54px; height: 54px; }
  .topharm-ai-panel { position: fixed; top: auto; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); left: max(12px, env(safe-area-inset-left)); width: auto; height: min(620px, calc(var(--topharm-ai-viewport-height, 100dvh) - 24px)); max-height: calc(var(--topharm-ai-viewport-height, 100dvh) - 24px); border-radius: 20px; }
  .topharm-ai-header { min-height: 64px; padding: 9px 9px 9px 11px; }
  .topharm-ai-avatar { flex-basis: 32px; width: 32px; height: 32px; }
  .topharm-ai-header small { max-width: 150px; }
  .topharm-ai-language-control { width: 56px; }
  .topharm-ai-language-menu { width: min(284px, calc(100vw - 56px)); }
  .topharm-ai-messages { padding: 15px 13px 8px; }
  .topharm-ai-message { font-size: 14px; }
  .topharm-ai-quick { max-height: 150px; padding: 7px 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .topharm-ai-chip { min-height: 40px; font-size: 13px; }
  .topharm-ai-composer { margin-inline: 8px; }
}

@media (max-width: 370px) {
  .topharm-ai-header small { max-width: 112px; }
  .topharm-ai-language-control { width: 54px; padding-inline: 0 5px; }
  .topharm-ai-language-menu { width: min(264px, calc(100vw - 52px)); }
}

@media (prefers-reduced-motion: reduce) {
  .topharm-ai-launcher, .topharm-ai-product-cart { transition: none; }
  .topharm-ai-loading-dots i, .topharm-ai-message.is-typing::after { animation: none; }
  .topharm-ai-loading-dots i { opacity: 1; }
}

.header-search { position: relative !important; }
.header-search .search-input { padding-right: 44px !important; }
.header-search.topharm-ai-search-owner > .topharm-ai-search-mic { position: absolute !important; right: 8px !important; left: auto !important; top: 50% !important; z-index: 20 !important; width: 32px !important; height: 32px !important; margin: 0 !important; padding: 5px !important; transform: translateY(-50%) !important; flex: none !important; border: 0 !important; border-radius: 50% !important; background: transparent !important; color: #218542 !important; cursor: pointer; display: grid !important; place-items: center !important; pointer-events: auto !important; box-shadow: none !important; }
.header-search.topharm-ai-search-owner > .topharm-ai-search-mic::before { content: none !important; display: none !important; }
.topharm-ai-search-mic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.topharm-ai-search-mic:hover, .topharm-ai-search-mic:focus-visible { background: rgba(33,133,66,.1); outline: 2px solid rgba(33,133,66,.22); }
.topharm-ai-search-mic.is-listening { background: #218542; color: #fff; animation: topharm-ai-voice-pulse 1.1s ease-in-out infinite; }
.topharm-ai-search-mic.has-error { color: #767676; }
@keyframes topharm-ai-voice-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(33,133,66,.32); } 50% { box-shadow: 0 0 0 5px rgba(33,133,66,0); } }
@media (prefers-reduced-motion: reduce) { .topharm-ai-search-mic.is-listening { animation: none; } }
