/* VisaSupportAI widgets — styles
   All classes start with .vsa- so they never clash with the host site.
   Colours and fonts come from the --vsa-* tokens below; change them here only. */

:root {
  --vsa-ink: #0B1B33;
  --vsa-muted: #4A5A70;
  --vsa-line: #DCE3EC;
  --vsa-field: #B9C6D4;
  --vsa-ground: #F3F6F9;
  --vsa-surface: #FFFFFF;
  --vsa-accent: #0E7C6B;
  --vsa-accent-ink: #FFFFFF;
  --vsa-accent-strong: #0A5E51;
  --vsa-accent-soft: #E1F1EE;
  --vsa-highlight: #F2B33D;
  --vsa-highlight-ink: #0B1B33;
  --vsa-warn: #A3540C;
  --vsa-warn-soft: #FCEFD9;
  --vsa-bad: #B42318;
  --vsa-bad-soft: #FDECEA;
  --vsa-shadow: 0 10px 30px rgba(11, 27, 51, 0.14);
  --vsa-font-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --vsa-font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --vsa-radius: 14px;
}

.vsa, .vsa *, .vsa *::before, .vsa *::after { box-sizing: border-box; }
.vsa[hidden], .vsa [hidden] { display: none !important; }
.vsa { font-family: var(--vsa-font-body); color: var(--vsa-ink); font-size: 16px; line-height: 1.5; }
.vsa h2, .vsa h3, .vsa h4 { font-family: var(--vsa-font-display); margin: 0; line-height: 1.25; text-wrap: balance; }
.vsa p { margin: 0; }
.vsa :where(button, input, select, textarea) { font: inherit; color: inherit; }
.vsa :focus-visible { outline: 3px solid var(--vsa-accent); outline-offset: 2px; }

/* Card shell */
.vsa-card { background: var(--vsa-surface); border: 1px solid var(--vsa-line); border-radius: 18px; padding: clamp(20px, 4vw, 32px); display: flex; flex-direction: column; gap: 20px; }
.vsa-head { display: flex; flex-direction: column; gap: 6px; }
.vsa-head h2 { font-size: 22px; font-weight: 600; }
.vsa-sub { color: var(--vsa-muted); font-size: 15px; }
.vsa-eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--vsa-accent); }
.vsa-small { font-size: 13px; color: var(--vsa-muted); }

/* Progress */
.vsa-steps { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-size: 14px; color: var(--vsa-muted); }
.vsa-bar { height: 6px; background: var(--vsa-line); border-radius: 3px; overflow: hidden; }
.vsa-bar > span { display: block; height: 100%; background: var(--vsa-accent); border-radius: 3px; transition: width .3s ease; }

/* Fields */
.vsa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.vsa-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.vsa-label { font-size: 14px; font-weight: 600; }
.vsa-hint { font-size: 13px; color: var(--vsa-muted); font-weight: 400; }
.vsa-input, .vsa-select, .vsa-textarea { width: 100%; border: 1px solid var(--vsa-field); border-radius: 10px; padding: 11px 12px; min-height: 46px; background: var(--vsa-surface); font-size: 16px; }
.vsa-textarea { min-height: 96px; resize: vertical; }
.vsa-input:focus, .vsa-select:focus, .vsa-textarea:focus { border-color: var(--vsa-accent); outline: 2px solid var(--vsa-accent-soft); }
.vsa-field.is-invalid .vsa-input, .vsa-field.is-invalid .vsa-select { border-color: var(--vsa-bad); }
.vsa-error { font-size: 13px; color: var(--vsa-bad); }
.vsa-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.vsa-fieldset legend { padding: 0; margin-bottom: 8px; }

/* Choice chips (radio / checkbox) */
.vsa-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.vsa-chip { position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; border: 1px solid var(--vsa-field); border-radius: 10px; font-size: 15px; cursor: pointer; background: var(--vsa-surface); user-select: none; }
.vsa-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.vsa-chip:has(input:checked) { border: 2px solid var(--vsa-accent); background: var(--vsa-accent-soft); padding: 9px 13px; font-weight: 600; }
.vsa-chip:has(input:focus-visible) { outline: 3px solid var(--vsa-accent); outline-offset: 2px; }

/* Buttons */
.vsa-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.vsa-actions--split { justify-content: space-between; }
.vsa-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 20px; border-radius: 12px; border: 0; font-weight: 600; font-size: 16px; cursor: pointer; text-decoration: none; transition: background .15s ease, transform .1s ease; }
.vsa-btn:active { transform: translateY(1px); }
.vsa-btn--primary { background: var(--vsa-accent); color: var(--vsa-accent-ink); }
.vsa-btn--primary:hover { background: var(--vsa-accent-strong); }
.vsa-btn--dark { background: var(--vsa-ink); color: var(--vsa-surface); }
.vsa-btn--ghost { background: transparent; color: var(--vsa-ink); border: 1px solid var(--vsa-field); }
.vsa-btn--ghost:hover { background: var(--vsa-ground); }
.vsa-btn--link { background: none; color: var(--vsa-accent); padding: 12px 4px; min-height: 44px; }
.vsa-btn--block { width: 100%; }
.vsa-btn[disabled] { opacity: .55; cursor: not-allowed; }

/* Loading */
.vsa-loading { display: flex; flex-direction: column; gap: 14px; padding: 8px 0; }
.vsa-loading li { list-style: none; display: flex; gap: 12px; align-items: center; color: var(--vsa-muted); font-size: 15px; }
.vsa-loading ul { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.vsa-loading li.is-done { color: var(--vsa-ink); }
.vsa-loading li.is-active { color: var(--vsa-ink); font-weight: 600; }
.vsa-dot { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--vsa-field); display: grid; place-items: center; }
.is-active .vsa-dot { border-color: var(--vsa-accent); border-top-color: transparent; animation: vsa-spin .8s linear infinite; }
.is-done .vsa-dot { border-color: var(--vsa-accent); background: var(--vsa-accent); }
.is-done .vsa-dot::after { content: ""; width: 8px; height: 5px; border: 2px solid var(--vsa-accent-ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
@keyframes vsa-spin { to { transform: rotate(360deg); } }

/* Status pills and check lists */
.vsa-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.vsa-pill--good { background: var(--vsa-accent-soft); color: var(--vsa-accent-strong); }
.vsa-pill--warn { background: var(--vsa-warn-soft); color: var(--vsa-warn); }
.vsa-pill--bad { background: var(--vsa-bad-soft); color: var(--vsa-bad); }
.vsa-pill--info { background: var(--vsa-ground); color: var(--vsa-muted); }
.vsa-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.vsa-checks li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: 15px; }
.vsa-checks .vsa-ico { width: 22px; height: 22px; margin-top: 1px; }
.vsa-checks strong { font-weight: 600; }
.vsa-checks .vsa-small { display: block; margin-top: 2px; }

/* Result (assessment) */
.vsa-result-top { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.vsa-meter { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.vsa-meter-track { position: relative; height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--vsa-bad-soft) 0 40%, var(--vsa-warn-soft) 40% 70%, var(--vsa-accent-soft) 70% 100%); }
.vsa-meter-mark { position: absolute; top: 50%; width: 18px; height: 18px; border-radius: 50%; background: var(--vsa-ink); border: 3px solid var(--vsa-surface); transform: translate(-50%, -50%); box-shadow: 0 0 0 1px var(--vsa-ink); }
.vsa-meter-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--vsa-muted); }
.vsa-section { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 1px solid var(--vsa-line); }
.vsa-section h3 { font-size: 17px; font-weight: 600; }
.vsa-offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.vsa-offer { border: 1px solid var(--vsa-line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--vsa-surface); }
.vsa-offer.is-featured { border: 2px solid var(--vsa-accent); }
.vsa-offer-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.vsa-offer h4 { font-size: 16px; font-weight: 600; }
.vsa-price { font-family: var(--vsa-font-display); font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.vsa-offer .vsa-btn { margin-top: auto; min-height: 44px; font-size: 15px; }
.vsa-note { background: var(--vsa-ground); border-radius: 12px; padding: 14px 16px; font-size: 14px; color: var(--vsa-muted); }

/* Photo tool */
.vsa-photo { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 24px; align-items: start; }
.vsa-drop { position: relative; border: 2px dashed var(--vsa-field); border-radius: 16px; background: var(--vsa-ground); min-height: 280px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 32px 20px; text-align: center; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.vsa-drop.is-over { border-color: var(--vsa-accent); background: var(--vsa-accent-soft); }
.vsa-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.vsa-drop strong { font-family: var(--vsa-font-display); font-size: 19px; }
.vsa-preview { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.vsa-preview canvas { width: 180px; max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--vsa-field); background: var(--vsa-ground); }
.vsa-preview .vsa-checks { flex: 1 1 200px; min-width: 0; }
.vsa-buy { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 1px solid var(--vsa-line); }
.vsa-buy-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.vsa-list { margin: 0; padding-left: 20px; font-size: 15px; color: var(--vsa-muted); display: flex; flex-direction: column; gap: 4px; }

/* Document kit */
.vsa-docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.vsa-doc { border: 1px solid var(--vsa-line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--vsa-surface); min-width: 0; }
.vsa-doc-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.vsa-doc h4 { font-size: 15px; font-weight: 600; }
.vsa-doc-body { position: relative; font-size: 13px; line-height: 1.6; color: var(--vsa-muted); max-height: 7.2em; overflow: hidden; white-space: pre-line; }
.vsa-doc-body::after { content: ""; position: absolute; inset: 2.4em 0 0; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); background: linear-gradient(transparent, var(--vsa-surface)); }
.vsa-summary { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 15px; margin: 0; }
.vsa-summary dt { color: var(--vsa-muted); }
.vsa-summary dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.vsa-addon { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--vsa-line); border-radius: 12px; padding: 14px 16px; cursor: pointer; }
.vsa-addon input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--vsa-accent); flex: none; }
.vsa-addon:has(input:checked) { border: 2px solid var(--vsa-accent); background: var(--vsa-accent-soft); padding: 13px 15px; }
.vsa-addon:has(input:focus-visible) { outline: 3px solid var(--vsa-accent); outline-offset: 2px; }

/* Checkout modal */
.vsa-overlay { position: fixed; inset: 0; z-index: 2147483000; background: rgba(6, 14, 28, 0.55); display: flex; align-items: center; justify-content: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.vsa-modal { width: min(460px, 100%); max-height: 100%; overflow-y: auto; background: var(--vsa-surface); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 18px; box-shadow: var(--vsa-shadow); }
.vsa-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.vsa-icon-btn { width: 44px; height: 44px; flex: none; border: 0; border-radius: 10px; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--vsa-ink); }
.vsa-icon-btn:hover { background: var(--vsa-ground); }
.vsa-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.vsa-lines li { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.vsa-lines .is-total { padding-top: 10px; border-top: 1px solid var(--vsa-line); font-weight: 700; font-size: 17px; }
.vsa-success { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 8px 0; }
.vsa-success-ico { width: 56px; height: 56px; border-radius: 50%; background: var(--vsa-accent-soft); display: grid; place-items: center; }

/* Chat */
.vsa-launcher { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 2147482000; display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 14px 20px; border: 0; border-radius: 999px; background: var(--vsa-accent); color: var(--vsa-accent-ink); font-weight: 600; font-size: 15px; box-shadow: var(--vsa-shadow); cursor: pointer; }
.vsa-launcher:hover { background: var(--vsa-accent-strong); }
.vsa-chat { display: flex; flex-direction: column; background: var(--vsa-surface); border: 1px solid var(--vsa-line); border-radius: 18px; overflow: hidden; }
.vsa-chat--floating { position: fixed; right: calc(20px + env(safe-area-inset-right, 0px)); bottom: calc(88px + env(safe-area-inset-bottom, 0px)); z-index: 2147482001; width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 120px)); box-shadow: var(--vsa-shadow); }
.vsa-chat--inline { height: 600px; max-height: 80vh; }
.vsa-chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 18px; border-bottom: 1px solid var(--vsa-line); }
.vsa-avatar { width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--vsa-accent); display: grid; place-items: center; }
.vsa-chat-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vsa-chat-title strong { font-family: var(--vsa-font-display); font-size: 16px; }
.vsa-online { font-size: 13px; color: var(--vsa-muted); display: flex; align-items: center; gap: 6px; }
.vsa-online::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--vsa-accent); }
.vsa-context { margin: 10px 14px 0; padding: 8px 12px; border-radius: 10px; background: var(--vsa-accent-soft); color: var(--vsa-accent-strong); font-size: 13px; font-weight: 600; }
.vsa-msgs { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.vsa-msg { max-width: 86%; padding: 11px 14px; border-radius: 14px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.vsa-msg--bot { align-self: flex-start; background: var(--vsa-ground); border-bottom-left-radius: 4px; }
.vsa-msg--user { align-self: flex-end; background: var(--vsa-accent); color: var(--vsa-accent-ink); border-bottom-right-radius: 4px; }
.vsa-msg ul { margin: 6px 0; padding-left: 18px; }
.vsa-msg p + p { margin-top: 8px; }
.vsa-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.vsa-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--vsa-muted); animation: vsa-blink 1.2s infinite ease-in-out; }
.vsa-typing span:nth-child(2) { animation-delay: .15s; } .vsa-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes vsa-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.vsa-suggest { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px; }
.vsa-suggest button { border: 1px solid var(--vsa-field); background: var(--vsa-surface); border-radius: 999px; padding: 8px 12px; min-height: 40px; font-size: 14px; cursor: pointer; text-align: left; }
.vsa-suggest button:hover { border-color: var(--vsa-accent); color: var(--vsa-accent-strong); }
.vsa-compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--vsa-line); align-items: flex-end; }
.vsa-compose textarea { flex: 1; min-width: 0; resize: none; border: 1px solid var(--vsa-field); border-radius: 12px; padding: 11px 12px; min-height: 46px; max-height: 120px; font-size: 15px; background: var(--vsa-surface); }
.vsa-send { width: 46px; height: 46px; flex: none; border: 0; border-radius: 12px; background: var(--vsa-accent); color: var(--vsa-accent-ink); display: grid; place-items: center; cursor: pointer; }
.vsa-send[disabled] { opacity: .5; cursor: not-allowed; }
.vsa-chat-foot { padding: 0 14px 12px; font-size: 12px; color: var(--vsa-muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; }
.vsa-chat-foot a { color: var(--vsa-accent-strong); font-weight: 600; }

.vsa-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .vsa *, .vsa *::before, .vsa *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
