/* مساعد طلب عرض السعر */
.qb-page { max-width: 760px; padding-top: 18px; padding-bottom: 30px; }
.qb-intro { text-align: center; margin-bottom: 16px; }
.qb-intro h1 { font-size: clamp(22px, 5vw, 30px); margin: 0 0 6px; }
.qb-intro p { margin: 0; }

.qb { display: flex; flex-direction: column; height: min(72vh, 680px); min-height: 460px; border: 1px solid var(--line-soft); border-radius: 22px; background: var(--card); overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.qb-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: linear-gradient(180deg, rgba(212, 175, 55, .14), transparent); border-bottom: 1px solid var(--line-soft); }
.qb-head > div { flex: 1; min-width: 0; display: grid; }
.qb-head b { font-size: 15.5px; }
.qb-head small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.qb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(79, 191, 138, .2); }
.qb-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--gold-grad); color: #1a1406; display: grid; place-items: center; flex: none; }
.qb-avatar svg { width: 24px; height: 24px; }
.qb-restart { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-soft); background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.qb-restart:hover { color: var(--gold); border-color: var(--gold); }

.qb-log { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; overscroll-behavior: contain; }
.qb-msg { position: relative; max-width: 82%; padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.7; overflow-wrap: anywhere; animation: qbIn .25s ease both; }
.qb-msg.bot { align-self: flex-start; background: rgba(255, 255, 255, .05); border: 1px solid var(--line-soft); border-start-start-radius: 4px; }
.qb-msg.me { align-self: flex-end; background: var(--gold-grad); color: #1a1406; font-weight: 600; border-start-end-radius: 4px; }
.qb-msg.typing { display: flex; gap: 4px; padding: 13px 14px; }
.qb-msg.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: qbDot 1s infinite; }
.qb-msg.typing span:nth-child(2) { animation-delay: .15s; } .qb-msg.typing span:nth-child(3) { animation-delay: .3s; }
.qb-edit { border: 0; background: transparent; color: inherit; opacity: .6; font: inherit; font-size: 11.5px; text-decoration: underline; cursor: pointer; padding: 0; margin-inline-start: 8px; }
.qb-msg.me .qb-edit { color: #1a1406; }
.qb-edit:hover { opacity: 1; }

.qb-dock { border-top: 1px solid var(--line-soft); padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 8px; background: rgba(0, 0, 0, .15); max-height: 46%; overflow-y: auto; }
.qb-dock:empty { display: none; }
.qb-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.qb-chip { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 999px; border: 1px solid rgba(212, 175, 55, .45); background: var(--gold-soft); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: .15s; }
.qb-chip:hover { border-color: var(--gold); color: var(--gold); }
.qb-chip.main { background: var(--gold-grad); color: #1a1406; border-color: transparent; }
.qb-chip.main:hover { color: #1a1406; filter: brightness(1.06); }
.qb-chip.ghost { background: transparent; border-color: var(--line-soft); color: var(--muted); }
.qb-chip.wa { background: #25d366; color: #fff; }
.qb-chip.wa:hover { color: #fff; }

.qb-input, .qb-size { display: flex; gap: 8px; align-items: flex-end; }
.qb-field { flex: 1; min-width: 0; padding: 11px 14px; border-radius: 14px; border: 1px solid var(--line-soft); background: var(--bg, #0b0b0c); color: var(--text); font: inherit; font-size: 15px; resize: none; }
.qb-field:focus { outline: none; border-color: var(--gold); }
.qb-field.ltr { direction: ltr; text-align: right; }
.qb-send { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; background: var(--gold-grad); color: #1a1406; display: grid; place-items: center; cursor: pointer; }
.qb-size label { flex: 1; display: grid; gap: 3px; font-size: 12px; color: var(--muted); }
.qb-size > b { padding-bottom: 12px; color: var(--gold); }
.qb-unit { padding-bottom: 12px; font-size: 13px; color: var(--muted); }
.qb-err { color: var(--bad); font-size: 13px; }
.qb-err:empty { display: none; }
.qb-wait { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; padding: 6px 2px; }
.qb-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--gold); border-top-color: transparent; animation: qbSpin .7s linear infinite; }

.qb-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.qb-thumbs:empty { display: none; }
.qb-thumb { position: relative; width: 62px; height: 62px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, .04); }
.qb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qb-file { display: grid; place-items: center; height: 100%; font-size: 11px; font-weight: 800; color: var(--gold); }
.qb-x { position: absolute; top: 2px; inset-inline-end: 2px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .75); color: #fff; font-size: 14px; line-height: 1; cursor: pointer; }

.qb-card { align-self: stretch; border: 1px solid rgba(212, 175, 55, .45); border-radius: 16px; overflow: hidden; animation: qbIn .25s ease both; transition: opacity .2s; }
.qb-card.stale { opacity: .45; pointer-events: none; }
.qb-card-h { padding: 9px 14px; background: var(--gold-soft); color: var(--gold); font-weight: 800; font-size: 14px; }
.qb-card dl { margin: 0; }
.qb-card dl > div { display: grid; grid-template-columns: 112px 1fr auto; gap: 8px; align-items: baseline; padding: 8px 14px; border-top: 1px solid var(--line-soft); font-size: 14px; }
.qb-card dt { color: var(--muted); font-size: 13px; }
.qb-card dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

.qb-contacts { margin-top: 18px; }
.qb-noscript { padding: 16px; }

@keyframes qbIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes qbDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes qbSpin { to { transform: rotate(360deg); } }

:root[data-theme="light"] .qb { box-shadow: 0 14px 40px rgba(60, 45, 10, .12); }
:root[data-theme="light"] .qb-msg.bot { background: #f6f2e8; }
:root[data-theme="light"] .qb-dock { background: #faf8f2; }

@media (max-width: 600px) {
  .qb-page { padding-inline: 10px; padding-top: 10px; }
  .qb-intro { margin-bottom: 10px; }
  .qb-intro h1 { font-size: 20px; margin: 0; }
  .qb-intro p { display: none; }
  .qb { height: calc(100svh - 285px); min-height: 380px; border-radius: 18px; scroll-margin-bottom: calc(var(--nav-h, 64px) + 24px); }
  .qb-head { padding: 9px 12px; }
  .qb-avatar { width: 36px; height: 36px; }
  .qb-msg { max-width: 88%; font-size: 14px; }
  .qb-card dl > div { grid-template-columns: 92px 1fr auto; padding: 8px 10px; }
  .qb-chip { padding: 8px 12px; font-size: 13.5px; }
}
