/*
 * TALKOLI · חלון העוזר החי בדף.
 * במחשב: חלון צף מעל הכפתור האדום, שנפתח מהפינה שלו. בטלפון: מגירה מלמטה, שאפשר לגרור כדי לסגור.
 */

.assist { position: fixed; z-index: 70; inset-inline-start: 20px; bottom: 92px; width: 392px; height: min(668px, calc(100vh - 124px)); height: min(668px, calc(100svh - 124px)); display: flex; flex-direction: column; color: var(--paper); border-radius: 24px; box-shadow: 0 44px 90px -30px rgba(0, 0, 0, 0.7); transform-origin: bottom right; opacity: 0; transform: translateY(10px) scale(0.96); visibility: hidden; transition: opacity 160ms ease, transform 180ms var(--ease-out), visibility 0s linear 180ms; }
.assist.is-open { opacity: 1; transform: none; visibility: visible; transition: opacity 200ms ease, transform 260ms var(--ease-out), visibility 0s; }
.assist:focus { outline: none; }
.as-grab { display: none; }
.as-scrim { display: none; }

.as-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 12px 12px 14px; }
.as-id { display: flex; align-items: center; gap: 12px; min-width: 0; }
.as-mark { width: 42px; height: 42px; border-radius: 50%; background: var(--ink); box-shadow: inset 0 0 0 1px var(--in-line); display: grid; place-items: center; flex: none; }
.as-mark svg { width: 26px; height: 26px; color: var(--paper); }
.as-title { margin: 0; font-size: 1.06rem; font-weight: 600; letter-spacing: -0.01em; }
.as-sub { margin: 0; font-size: 0.84rem; color: var(--gray-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-sub b { color: var(--paper); font-weight: 600; }
.as-tools { display: flex; gap: 2px; flex: none; }
.as-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--paper); transition: background-color 160ms ease, transform 140ms var(--ease-out); }
.as-ic:active { transform: scale(0.94); }
.as-ic svg { width: 20px; height: 20px; }
.as-ic .i-off { display: none; }
.as-ic[aria-pressed="true"] .i-on { display: none; }
.as-ic[aria-pressed="true"] .i-off { display: block; }
@media (hover: hover) and (pointer: fine) { .as-ic:hover { background: rgba(236, 238, 241, 0.09); } }

.as-prog { padding: 0 16px 12px; border-bottom: 1px solid var(--line-light); }
.as-bars { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.as-bars li { height: 3px; border-radius: 3px; background: rgba(236, 238, 241, 0.18); transition: background-color 300ms ease; }
.as-bars li.is-done { background: #c3c8cf; }
.as-bars li.is-on { background: var(--accent); }
.as-stage { margin: 8px 0 0; font-size: 0.8rem; color: var(--gray-2); font-variant-numeric: tabular-nums; }
.as-stage b { color: var(--paper); font-weight: 600; }

.as-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 14px 10px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; scrollbar-color: #4a4d53 transparent; }
.msg { display: flex; flex-direction: column; gap: 8px; max-width: 92%; transition: opacity 220ms ease, transform 260ms var(--ease-out); }
@starting-style { .msg { opacity: 0; transform: translateY(6px); } }
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; max-width: 84%; }
.msg.sys { align-self: center; max-width: 100%; }
.bubble { margin: 0; padding: 10px 14px; border-radius: 16px; font-size: 1rem; line-height: 1.45; overflow-wrap: anywhere; }
.msg.bot .bubble { background: var(--in-bg); box-shadow: inset 0 0 0 1px var(--in-line); border-start-start-radius: 4px; }
.msg.user .bubble { background: rgba(236, 238, 241, 0.16); color: #fff; border-start-end-radius: 4px; }
.msg.sys .bubble { background: transparent; border: 1px dashed rgba(236, 238, 241, 0.3); font-size: 0.88rem; color: #c3c8cf; text-align: center; }
.mnote { margin: 0; font-size: 0.78rem; color: var(--gray-2); }
.replay { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 0.86rem; font-weight: 600; color: var(--paper); border-radius: 999px; padding-inline: 2px 10px; }
.replay i { width: 26px; height: 26px; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; }
.replay svg { width: 11px; height: 11px; }

.prods { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.prod { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 12px; background: var(--in-bg); box-shadow: inset 0 0 0 1px var(--in-line); }
.prod .swc { width: 34px; height: 42px; border-radius: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); }
.prod .pi { flex: 1; min-width: 0; }
.prod .pn { display: block; font-weight: 600; font-size: 0.95rem; line-height: 1.25; }
.prod .pt { display: block; font-size: 0.8rem; color: var(--gray-2); line-height: 1.3; }
.prod .pp { display: block; font-weight: 600; font-variant-numeric: tabular-nums; font-size: 0.9rem; margin-top: 2px; }
.pick { flex: none; height: 34px; padding-inline: 14px; border-radius: 999px; border: 1px solid var(--paper); background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 0.86rem; font-weight: 600; transition: transform 140ms var(--ease-out), background-color 160ms ease; }
.pick:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) { .pick:hover { background: rgba(255, 255, 255, 0.18); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { min-height: 36px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--ctl-line); background: transparent; color: #d6d9de; font-size: 0.9rem; line-height: 1.3; text-align: start; transition: border-color 160ms ease, transform 140ms var(--ease-out); }
.chipbtn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .chipbtn:hover { border-color: var(--paper); color: #fff; } }
.mdeliv { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--in-bg); box-shadow: inset 0 0 0 1px rgba(236, 238, 241, 0.14); color: var(--paper); font-size: 0.85rem; }
.mdeliv svg { width: 16px; height: 16px; }

.typing { align-self: flex-start; display: flex; gap: 5px; padding: 14px 16px; background: var(--in-bg); box-shadow: inset 0 0 0 1px var(--in-line); border-radius: 16px; border-start-start-radius: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #b4b9c1; animation: as-blink 1.1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes as-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.as-cart { margin: 0 14px; padding: 10px 12px; border-radius: 14px; background: var(--in-bg); box-shadow: inset 0 0 0 1px rgba(236, 238, 241, 0.5); display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.as-cart[hidden] { display: none; }
.as-cart svg { width: 20px; height: 20px; flex: none; }
.as-cart .ci { flex: 1; min-width: 0; line-height: 1.35; }
.as-cart .ci b { font-weight: 600; }
.as-cart .cp { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.as-cart s, .as-cart strong { unicode-bidi: isolate; }
.as-cart s { color: var(--gray-2); }
.as-cart strong { font-weight: 600; }

.as-form { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.as-mic, .as-send { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; flex: none; transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 140ms var(--ease-out), box-shadow 240ms ease; }
.as-mic { border: 1px solid var(--ctl-line); background: transparent; color: var(--paper); }
.as-mic[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.as-send { background: var(--accent); color: var(--accent-ink); }
.as-mic:active, .as-send:active { transform: scale(0.94); }
.as-mic svg, .as-send svg { width: 20px; height: 20px; }
@media (hover: hover) and (pointer: fine) { .as-send:hover { background: #c81f34; } .as-mic:not([aria-pressed="true"]):hover { border-color: var(--paper); } }
.as-input { flex: 1; min-width: 0; height: 46px; border-radius: 999px; border: 1px solid rgba(236, 238, 241, 0.2); background: rgba(236, 238, 241, 0.05); padding-inline: 16px; font-size: 1rem; color: var(--paper); }
.as-input::placeholder { color: var(--gray-2); }
.as-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 999px; }
.as-fine { margin: 0; padding: 0 16px 12px; font-size: 0.78rem; color: var(--gray-1); line-height: 1.4; }

/* ---------- הפיצ'רים: הצעה להוסיף, תמונה, צבעים וברכה ---------- */
.pick.is-add { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
@media (hover: hover) and (pointer: fine) { .pick.is-add:hover { background: #c81f34; } }
.as-img[aria-busy="true"] { opacity: 0.6; }

.msg.user .as-shot { display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px; }
.as-shot canvas { width: 56px; height: 56px; border-radius: 10px; flex: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); }
.as-shot figcaption { display: grid; gap: 2px; }
.as-shot small { font-size: 0.78rem; color: #c3c8cf; }

.tk-colors { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--gray-2); }
.tk-color { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--in-bg); box-shadow: inset 0 0 0 1px var(--in-line); color: var(--paper); }
.tk-color i { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.tk-quote { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--in-bg); box-shadow: inset 0 0 0 1px var(--in-line); white-space: pre-line; overflow-wrap: anywhere; font-size: 0.98rem; line-height: 1.5; }

/* ---------- כרטיסים בתוך השיחה: משטח פנימי כהה, לא כרטיס לבן ---------- */
.msg.has-card { align-self: stretch; max-width: 100%; }
.msg.has-card > .bubble, .msg.has-card > .mnote, .msg.has-card > .chips { align-self: flex-start; max-width: 92%; }
.tk-card { margin: 0; padding: 14px 14px 12px; border-radius: 18px; background: rgba(6, 6, 7, 0.55); box-shadow: inset 0 0 0 1px rgba(236, 238, 241, 0.14), 0 14px 28px -20px rgba(0, 0, 0, 0.9); display: grid; gap: 14px; }
.tk-card:focus { outline: none; }
.tk-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tk-head { display: flex; align-items: center; gap: 10px; }
.tk-ic { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: rgba(236, 238, 241, 0.08); color: var(--paper); }
.tk-ic svg { width: 19px; height: 19px; }
.tk-words { min-width: 0; }
.tk-title { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.3; }
.tk-sub { margin: 2px 0 0; font-size: 0.84rem; color: var(--gray-2); line-height: 1.35; }
.tk-body { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 12px; }
.tk-field { display: grid; gap: 6px; min-width: 0; }
.tk-label { font-size: 0.86rem; font-weight: 600; color: #d6d9de; }
.tk-opt { margin-inline-start: 6px; font-weight: 400; color: var(--gray-2); }
.tk-opt::before { content: "· "; }
.tk-input { width: 100%; min-width: 0; height: 44px; padding-inline: 12px; border-radius: 12px; border: 1px solid rgba(236, 238, 241, 0.22); background: rgba(236, 238, 241, 0.05); color: var(--paper); font: inherit; font-size: 1rem; color-scheme: dark; transition: border-color 160ms ease; }
.tk-input::placeholder { color: var(--gray-1); opacity: 1; }
.tk-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: 12px; }
.tk-input[aria-invalid="true"] { border-color: #ff8a98; }
.tk-input[dir="ltr"] { text-align: left; font-variant-numeric: tabular-nums; }
.tk-select { appearance: none; -webkit-appearance: none; padding-inline-end: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%23b4b9c1' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 12px; background-position: left 14px center; }
.tk-area { height: auto; min-height: 84px; padding-block: 10px; line-height: 1.5; resize: vertical; }
.tk-count { margin: 0; font-size: 0.78rem; color: var(--gray-2); font-variant-numeric: tabular-nums; }
.tk-err { margin: 0; font-size: 0.84rem; line-height: 1.4; color: #ff8a98; }
.tk-err:empty { display: none; }
.tk-row { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 10px; }
.tk-hint-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }

/* תיבת סימון אמיתית, בעיצוב כהה: ריקה עד שהלקוח מסמן */
.tk-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 0.92rem; line-height: 1.45; color: #e2e4e8; }
.tk-box { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: 0; border-radius: 7px; border: 1.5px solid rgba(236, 238, 241, 0.42); background: rgba(236, 238, 241, 0.04) center / 14px no-repeat; cursor: pointer; transition: background-color 140ms ease, border-color 140ms ease, transform 140ms var(--ease-out); }
.tk-box:checked { background-color: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.4l2.6 2.6L11 4.4' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.tk-box:active { transform: scale(0.92); }
.tk-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 7px; }
.tk-check-text { min-width: 0; }
@media (hover: hover) and (pointer: fine) { .tk-check:hover .tk-box:not(:checked) { border-color: var(--paper); } }
.tk-trans { margin: -4px 0 0; padding-inline-start: 32px; font-size: 0.84rem; color: var(--gray-2); line-height: 1.45; }
.tk-fine { margin: 0; font-size: 0.82rem; color: var(--gray-2); line-height: 1.4; }

.tk-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.tk-submit { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding-inline: 20px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: 0.95rem; font-weight: 600; transition: background-color 160ms ease, color 160ms ease, transform 140ms var(--ease-out); }
.tk-submit:active:not(:disabled) { transform: scale(0.97); }
.tk-submit:disabled { background: rgba(236, 238, 241, 0.08); color: var(--gray-1); cursor: not-allowed; }
.tk-submit svg { width: 18px; height: 18px; }
@media (hover: hover) and (pointer: fine) { .tk-submit:not(:disabled):hover { background: #c81f34; } }
.tk-card.is-done .tk-submit { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px rgba(236, 238, 241, 0.3); cursor: default; }
.tk-card.is-done .tk-body > :not(.tk-actions) { opacity: 0.7; }
.tk-need { margin: 0; font-size: 0.8rem; color: var(--gray-2); }
.tk-need:empty, .tk-form-err:empty { display: none; }
.tk-form-err { margin: 0; font-size: 0.86rem; color: #ff8a98; }
.tk-link { min-height: 32px; padding: 0; font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--paper); text-decoration: underline; text-underline-offset: 0.2em; text-decoration-color: rgba(236, 238, 241, 0.4); }
@media (hover: hover) and (pointer: fine) { .tk-link:hover { text-decoration-color: currentColor; } }
.tk-demo { margin: 0; padding-top: 10px; border-top: 1px dashed rgba(236, 238, 241, 0.18); font-size: 0.8rem; color: var(--gray-2); }

/* ניגודיות גבוהה: הכל לבן על שחור, אבל עדיין רואים מה מסומן, מה שגוי ומה לא פעיל.
   #assist בבורר, כי הכלל הכללי של כפתור הנגישות כולל מזהה ולכן חזק יותר */
html.a11y-contrast #assist .tk-input[aria-invalid="true"] { border-color: #ff8a98 !important; }
html.a11y-contrast #assist .tk-err, html.a11y-contrast #assist .tk-form-err { color: #ff8a98 !important; }
html.a11y-contrast #assist .tk-submit:disabled { border-style: dashed !important; opacity: 0.65; }
html.a11y-contrast #assist .tk-box { border-width: 2px; }
html.a11y-contrast #assist .tk-card, html.a11y-contrast #assist .tk-quote, html.a11y-contrast #assist .tk-color { border: 1px solid #fff !important; }
html.a11y-contrast #assist .tk-card.is-done .tk-body > :not(.tk-actions) { opacity: 1; }
@media (forced-colors: active) {
  .tk-box { appearance: auto; -webkit-appearance: auto; }
  .tk-card, .tk-color, .tk-quote { border: 1px solid CanvasText; }
  .tk-submit:disabled { color: GrayText; border: 1px dashed GrayText; }
}

/* טלפון: מגירה מלמטה */
@media (max-width: 640px) {
  /* המגירה מודאלית, ולכן היא מעל כפתור הנגישות הצף (שכבה 1000) כל עוד היא פתוחה */
  .assist { z-index: 1010; }
  .assist { inset-inline: 0; bottom: 0; width: auto; height: min(88vh, 760px); height: min(88svh, 760px); border-radius: 24px 24px 0 0; border-width: 0; padding-bottom: env(safe-area-inset-bottom); opacity: 1; transform: translateY(100%); transition: transform 240ms var(--ease-drawer), visibility 0s linear 240ms; }
  .assist.is-open { transform: translateY(0); transition: transform 440ms var(--ease-drawer), visibility 0s; }
  .assist.is-dragging { transition: none; }
  .as-grab { display: grid; place-items: center; height: 22px; flex: none; touch-action: none; cursor: grab; }
  .as-grab::before { content: ""; width: 40px; height: 5px; border-radius: 5px; background: rgba(236, 238, 241, 0.3); }
  .as-head { padding-top: 2px; touch-action: none; }
  .as-scrim { display: block; position: fixed; inset: 0; z-index: 1009; background: rgba(10, 10, 11, 0.55); opacity: 0; visibility: hidden; transition: opacity 240ms ease, visibility 0s linear 240ms; }
  .as-scrim.is-on { opacity: 1; visibility: visible; transition: opacity 320ms ease, visibility 0s; }
}

/* הפחתת תנועה: רק החלפת שקיפות, בלי תזוזה */
@media (prefers-reduced-motion: reduce) {
  .assist, .assist.is-open { transform: none; transition: opacity 150ms ease, visibility 0s linear 150ms; }
  .assist:not(.is-open) { opacity: 0; }
  .assist.is-open { transition: opacity 150ms ease, visibility 0s; }
  .msg { transition: none; }
  .typing i { animation: none; opacity: 0.6; }
}
.a11y-no-motion .assist, .a11y-no-motion .assist.is-open { transform: none; transition: opacity 150ms ease, visibility 0s linear 150ms; }
.a11y-no-motion .assist:not(.is-open) { opacity: 0; }
.a11y-no-motion .assist.is-open { transition: opacity 150ms ease, visibility 0s; }
.a11y-no-motion .msg { transition: none; }
.a11y-no-motion .typing i { animation: none; opacity: 0.6; }
