:root{
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color:#171717;background:#e5ddd5;font-size:16px;font-synthesis:none;
  --wa-bg:#e5ddd5; --wa-green:#dcf8c6; --wa-green-border:#cfe8ba; --wa-green-dark:#1f6f42;
  --wa-white:#fff; --wa-shadow:0 1px 1px rgba(0,0,0,.08),0 1px 3px rgba(0,0,0,.05);
}
*{box-sizing:border-box} html,body{margin:0;min-height:100%;width:100%} body{background:var(--wa-bg)}
button,input,select{font:inherit} a{color:#375a7f;text-underline-offset:2px} button{cursor:pointer}
.chat-shell{height:100dvh;min-height:420px;overflow-y:auto;scroll-behavior:smooth;background:#e5ddd5 url('chat-background.png') center top/412px auto repeat;overscroll-behavior-y:contain}
.chat-column{max-width:820px;margin:0 auto;padding:10px 18px 26px}
.chat-toolbar{position:sticky;top:0;z-index:3;display:flex;justify-content:space-between;align-items:center;gap:10px;padding:8px 6px 10px;margin-bottom:4px;color:#6a6662;font-size:12px;background:linear-gradient(to bottom, rgba(229,221,213,.94), rgba(229,221,213,.82) 68%, rgba(229,221,213,0));backdrop-filter:saturate(120%) blur(1.5px)}
.toolbar-label{font-weight:600;letter-spacing:.01em;text-shadow:0 1px 1px rgba(255,255,255,.65)}
.toolbar-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.reset-button{border:0;background:rgba(255,255,255,.72);color:#5d5b57;padding:7px 12px;border-radius:999px;font-size:12px;box-shadow:0 1px 1px rgba(0,0,0,.05)}
.reset-button.secondary{background:rgba(255,255,255,.48)} .reset-button:hover{background:#fff}
.chat-history{min-height:40px;display:flex;flex-direction:column;gap:7px;padding-bottom:2px}
.message-row{display:flex;gap:8px;align-items:flex-end;will-change:transform,opacity}
.message-row.bot{justify-content:flex-start;padding-right:64px}
.message-row.user{justify-content:flex-end;padding-left:64px}
.message-row.enter .bubble,.message-row.enter .promo-card,.message-row.enter .avatar{animation:messageIn .30s cubic-bezier(.2,.7,.2,1) both;animation-delay:var(--enter-delay,0ms)}
.avatar{width:32px;height:32px;border-radius:50%;background:#fff;flex:0 0 32px;display:grid;place-items:center;box-shadow:var(--wa-shadow);overflow:hidden;border:1px solid rgba(0,0,0,.05)}
.avatar img{width:100%;height:100%;object-fit:cover;display:block}
.bubble{position:relative}
.bot .bubble{max-width:min(520px,100%);border-radius:10px 10px 10px 4px;background:var(--wa-white);color:#202020;box-shadow:var(--wa-shadow);overflow:visible;font-size:14px;line-height:1.5}
.bot .bubble::before{content:'';position:absolute;left:-8px;bottom:0;border-right:10px solid var(--wa-white);border-top:10px solid transparent;filter:drop-shadow(-1px 1px 0 rgba(0,0,0,.03))}
.bot .bubble.question{padding:12px 15px}
.bot .bubble.info{padding:15px 16px} .bot .bubble.info p{margin:8px 0 0}.bot .bubble.info p:first-child{margin-top:0}
.bot .bubble.summary{padding:16px 17px}.bot .bubble.summary .summary-title{font-weight:700;margin:0 0 8px;font-size:16px}
.promo-card{max-width:520px;background:var(--wa-white);border-radius:10px 10px 10px 4px;padding:10px 10px 14px;box-shadow:var(--wa-shadow);position:relative;overflow:hidden}
.promo-card::before{content:'';position:absolute;left:-8px;bottom:0;border-right:10px solid var(--wa-white);border-top:10px solid transparent;filter:drop-shadow(-1px 1px 0 rgba(0,0,0,.03))}
.promo-art{display:block;width:100%;height:auto;aspect-ratio:1;object-fit:cover;background:#000;border-radius:8px}
.promo-text{font-size:14px;line-height:1.58;padding:14px 4px 0}.promo-text b{font-weight:800}
.promo-links{font-size:12px;line-height:1.55;margin-top:15px;padding:0 4px}.promo-links a{word-break:break-all}
.user .bubble{max-width:min(500px,95%);background:var(--wa-green);color:#1f2d1a;border-radius:10px 10px 4px 10px;padding:10px 13px;min-width:112px;word-break:break-word;box-shadow:var(--wa-shadow);text-align:left;border:1px solid var(--wa-green-border);font-size:14px;line-height:1.45}
.user .bubble::before{content:'';position:absolute;right:-8px;bottom:0;border-left:10px solid var(--wa-green);border-top:10px solid transparent;filter:drop-shadow(1px 1px 0 rgba(0,0,0,.03))}
.user .bubble.editable{cursor:pointer}.user .bubble.editable:hover{outline:2px solid #9fc481}
.user .bubble small{display:block;color:#52644d;font-size:11px;text-align:right;margin-top:5px;opacity:0;transition:opacity .16s}.user .bubble.editable:hover small{opacity:1}
.message-row + .message-row.bot{margin-top:4px}
.typedots{display:flex;gap:4px;padding:4px 0}.typedots span{width:7px;height:7px;background:#7d7d7d;border-radius:50%;animation:typing 1.1s infinite ease-in-out}.typedots span:nth-child(2){animation-delay:.12s}.typedots span:nth-child(3){animation-delay:.24s}
.question-form{margin:10px 0 0 42px;padding:0;max-width:620px}
.editor-wrap{display:flex;flex-direction:column;gap:10px;background:rgba(229,221,213,.88);padding-top:4px}
.edit-pill{display:inline-flex;align-items:center;gap:8px;background:#fff;padding:8px 12px;border-radius:999px;font-size:12px;color:#4d4d4d;box-shadow:var(--wa-shadow);align-self:flex-start}
.edit-pill button{border:0;background:none;color:#275b86;padding:0}
.input-row{display:flex;gap:10px;align-items:stretch}
.field{border:1px solid #c9e5bb;background:var(--wa-green);border-radius:8px;color:#172014;width:100%;min-height:46px;padding:11px 13px;outline:none;font-size:15px;box-shadow:0 1px 0 rgba(255,255,255,.5) inset}
.field:focus{border-color:#8bbc68;box-shadow:0 0 0 3px rgba(155,214,128,.34)} .field::placeholder{color:#6f8a65}.select-field{appearance:auto}
.send-button,.action-button{background:#8a8a8a;color:white;border:0;border-radius:8px;padding:11px 15px;min-height:46px;font-weight:600;white-space:nowrap;transition:background .18s,transform .15s,box-shadow .18s,opacity .18s;box-shadow:0 1px 2px rgba(0,0,0,.12);display:inline-flex;align-items:center;justify-content:center;gap:7px}.send-button:hover,.action-button:hover{background:#747474}.send-button:disabled,.action-button:disabled{opacity:.55;cursor:not-allowed}.send-button.is-ready{background:#5b8f46;box-shadow:0 2px 6px rgba(70,120,50,.24)}.send-button.is-ready:hover{background:#4f7f3d}.send-button:active,.action-button:active{transform:scale(.98)}.send-icon{display:inline-flex;align-items:center;justify-content:center}.send-icon svg{width:15px;height:15px;fill:currentColor;display:block}
.back-button{border:0;background:rgba(255,255,255,.82);color:#444;min-height:38px;padding:9px 13px;border-radius:999px;align-self:flex-start;font-size:13px;box-shadow:0 1px 1px rgba(0,0,0,.04)}.back-button:hover{background:#fff}
.field-hint{color:#4b4b45;line-height:1.45;font-size:12px}.validation-error{color:#9a271d;font-size:12px;min-height:17px}
.summary-sect{margin-bottom:14px;padding-bottom:12px;border-bottom:1px solid #ece7dd}.summary-sect:last-child{border-bottom:0;margin-bottom:0;padding-bottom:0}
.summary-label{display:block;color:#6c665f;font-size:12px;margin-bottom:4px}.summary-value{font-weight:700;font-size:16px}
.strike{color:#91877c;text-decoration:line-through}.price{font-size:26px;font-weight:800;color:#2b5f30}.price-line{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap}
.summary-line{display:flex;justify-content:space-between;gap:14px;padding:4px 0}.summary-line span:last-child{text-align:right;font-weight:700}
.payment-note{padding:10px 12px;border-radius:8px;background:#f2f4e7;font-size:12px;color:#565648;margin-top:9px}
.agreement-row{margin:5px 0 8px;display:flex;gap:10px;align-items:flex-start;color:#333;background:rgba(255,255,255,.86);padding:12px;border-radius:10px;font-size:13px;line-height:1.55;box-shadow:var(--wa-shadow)} .agreement-row input{width:16px;height:16px;flex:0 0 16px;accent-color:#4b893e;margin:1px 0 0}
.done-card{background:#fff;border-radius:12px;padding:18px 18px 20px;max-width:520px;box-shadow:var(--wa-shadow)} .done-card h3{margin:2px 0 9px;font-size:18px}.done-card p{line-height:1.55;margin:8px 0}
.ref{font-family:ui-monospace,monospace;background:#e8f4dd;border-radius:6px;padding:7px 10px;display:inline-block;user-select:text}
.footer-actions{margin-top:12px;display:flex;flex-wrap:wrap;gap:10px}
.footnote{font-size:11px;color:#6f6c68;text-align:center;margin:20px 0 12px}.footnote a{color:inherit}
.toast{position:fixed;top:12px;left:50%;transform:translateX(-50%) translateY(-12px);border-radius:11px;background:#303030;color:white;padding:11px 16px;opacity:0;transition:.2s;pointer-events:none;z-index:20;max-width:95vw;text-align:center;box-shadow:0 8px 22px rgba(0,0,0,.18)} .toast.show{opacity:1;transform:translateX(-50%) translateY(0)}
@keyframes typing{0%,60%,100%{opacity:.3;transform:translateY(0)}30%{opacity:.9;transform:translateY(-3px)}}
@keyframes messageIn{from{opacity:0;transform:translateY(8px) scale(.985)}to{opacity:1;transform:translateY(0) scale(1)}}
@media(max-width:820px){.chat-column{max-width:720px}}
@media(max-width:680px){.chat-column{padding:8px 12px 20px}.chat-toolbar{padding:7px 0 10px}.toolbar-actions{gap:6px}.question-form{margin-left:0;max-width:none}.message-row.bot{padding-right:24px}.message-row.user{padding-left:24px}.promo-card,.bot .bubble,.done-card{max-width:100%}}
@media(max-width:480px){:root{font-size:15px}.chat-shell{background-size:320px auto}.toolbar-label{font-size:11px}.reset-button{font-size:11px;padding:6px 10px}.message-row{gap:6px}.avatar{width:28px;height:28px;flex-basis:28px}.bot .bubble.question,.bot .bubble.info,.bot .bubble.summary,.promo-text,.user .bubble,.field{font-size:14px}.field{padding:12px 12px;min-height:48px}.input-row{gap:7px}.send-button{padding:11px 13px}}

/* One-shot chat entrance animations after each submitted message. */
.message-row.user.enter .bubble{animation:messageOut .28s cubic-bezier(.2,.75,.25,1) both}
@keyframes messageOut{from{opacity:0;transform:translate(15px,8px) scale(.96)}to{opacity:1;transform:translate(0,0) scale(1)}}
@media (prefers-reduced-motion: reduce){
  .message-row.enter .bubble,.message-row.enter .promo-card,.message-row.enter .avatar,.message-row.user.enter .bubble,.typedots span{animation:none!important}
  .chat-shell{scroll-behavior:auto}
}

/* Lightweight keyboard-accessible currency combobox (no external library). */
.currency-combobox{width:100%;min-width:0;position:relative}
.currency-input{width:100%}
.currency-options{position:absolute;top:calc(100% + 4px);left:0;right:0;max-height:242px;overflow-y:auto;overscroll-behavior:contain;background:#fff;border:1px solid #d5d7d2;border-radius:10px;box-shadow:0 9px 24px rgba(0,0,0,.17);z-index:9;padding:5px 0}
.currency-options[hidden]{display:none}
.currency-option{cursor:pointer;padding:10px 13px;font-size:14px;line-height:1.4;color:#242424}
.currency-option.active,.currency-option:hover{background:#dcf8c7;color:#1c3b20}
.currency-empty{padding:12px;font-size:13px;color:#6b6b6b}
@media(max-width:480px){.currency-option{font-size:14px;padding:12px 13px}}

/* v1.4 — progressive Tripetto-style sequencing. Old bubbles are never rebuilt
   during normal progression; one avatar is moved to the last bot bubble. */
.message-row.bot { position:relative; padding-left:42px; }
.message-row.bot > .avatar { position:absolute; left:0; bottom:0; z-index:2; }
.message-row.bot .bubble,
.message-row.bot .promo-card { transform-origin:left bottom; }
.message-row.user .bubble { transform-origin:right bottom; }
.not-shown { visibility:hidden; opacity:0; }
.message-row .avatar { will-change:transform; }
.message-row.bot .bubble.question,
.message-row.bot .bubble.info,
.message-row.bot .bubble.summary { margin-bottom:0; }
.message-row.bot + .message-row.bot { margin-top:2px; }
.typing-exit { opacity:.25; transition:opacity .18s ease-out; }
.user-waiting { min-height:31px; }
.user-waiting .bubble.waiting-dots { display:flex; align-items:center; justify-content:center; gap:5px; min-width:46px; min-height:31px; padding:8px 10px; }
.waiting-dots span { width:6px; height:6px; display:inline-block; border-radius:100%; background:#647c5c; animation:typing 1.15s infinite ease-in-out; }
.waiting-dots span:nth-child(2) { animation-delay:.14s; }
.waiting-dots span:nth-child(3) { animation-delay:.28s; }
.editor-wrap { background:transparent; }
.send-button.is-ready { background:#518a49; }
.confirm-button.is-ready { background:#518a49; box-shadow:0 2px 8px rgba(55,117,44,.26); }
.confirm-button.is-ready:hover { background:#3e7937; }
.confirm-button:disabled { background:#898989; opacity:.55; }
@media(max-width:480px) { .message-row.bot { padding-left:36px; } }
@media(prefers-reduced-motion:reduce) {
  .waiting-dots span { animation:none; }
  .message-row .avatar { will-change:auto; }
}

/* Full-screen order transition: blocks inputs while local queue is committed. */
.submit-loading[hidden] { display:none !important; }
.submit-loading {
  position:fixed; inset:0; z-index:10000;
  display:flex; align-items:center; justify-content:center;
  text-align:center; padding:24px;
  background:rgba(11,15,16,.72);
  -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px);
  color:#fff;
}
.submit-loading-card {
  width:min(400px,100%); min-height:170px;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:24px 18px; gap:13px;
  background:transparent; border:0; box-shadow:none; color:#fff;
}
.submit-loading-spinner {
  width:48px; height:48px; border:4px solid rgba(255,255,255,.23);
  border-top-color:#b7edaa; border-radius:50%;
  animation:teefa-spinner-rotate .7s linear infinite;
}
.submit-loading-title{font-size:18px;font-weight:700;line-height:1.4;color:#fff}
.submit-loading-detail{font-size:13px;line-height:1.5;color:rgba(255,255,255,.78)}
body.order-submitting { overflow:hidden; }
@keyframes teefa-spinner-rotate { to{transform:rotate(360deg)} }
@media(prefers-reduced-motion:reduce){.submit-loading-spinner{animation-duration:1.6s}}


/* v2.2 — focused inline editing (Tripetto behaviour restored). */
.chat-history.is-editing .message-row.edit-future { display: none !important; }
.chat-history.answers-locked .message-row.user .bubble.editable { pointer-events:none; cursor:default; outline:none; }
.chat-history.answers-locked .message-row.user .bubble.editable:hover { outline:none; }
.chat-history.answers-locked .message-row.user .bubble.editable small,
.chat-history.finalized .message-row.user .bubble small { display:none !important; }
.message-row.user.inline-editing { align-items:stretch; }
.message-row.user.inline-editing .editor-wrap {
  width:min(620px,100%); max-width:100%; padding:9px 10px 8px;
  margin:0; border-radius:12px; background:rgba(234,228,220,.96);
  box-shadow:var(--wa-shadow); animation:teefaInlineEdit .28s cubic-bezier(.2,.8,.2,1) both;
}
.message-row.user.inline-editing .input-row { width:100%; }
.message-row.user.inline-editing .field { min-width:0; }
.message-row.user.inline-editing .edit-pill { max-width:100%; flex-wrap:wrap; }
.chat-history.is-editing .message-row.user.inline-editing .editor-wrap,
.chat-history.is-editing .message-row.user.inline-editing .editor-wrap * { pointer-events:auto; }
@keyframes teefaInlineEdit { from {opacity:.6;transform:translateY(-5px) scale(.985)} to {opacity:1;transform:translateY(0) scale(1)} }
@media(prefers-reduced-motion:reduce){.message-row.user.inline-editing .editor-wrap{animation:none}}
