:root {
  --brand: #075fc6;
  --brand-dark: #053d85;
  --accent: #06a96b;
  --ink: #10213a;
  --muted: #63738c;
  --line: #dfe7f2;
  --surface: #ffffff;
  --canvas: #eef3f9;
  --soft: #f5f8fc;
  --shadow: 0 24px 70px rgba(25, 55, 92, 0.16);
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 10%, rgba(7, 95, 198, .12), transparent 28rem),
    radial-gradient(circle at 92% 92%, rgba(6, 169, 107, .12), transparent 27rem),
    var(--canvas);
}
button, textarea, input { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.page-shell {
  width: min(1180px, calc(100% - 40px));
  height: min(780px, calc(100vh - 40px));
  min-height: 620px;
  margin: 20px auto;
  display: grid;
  grid-template-columns: 38% 62%;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface);
}

.brand-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px;
  color: white;
  overflow: hidden;
  background: linear-gradient(145deg, var(--brand-dark), var(--brand) 60%, #07865e);
}
.brand-panel::before, .brand-panel::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
}
.brand-panel::before { width: 340px; height: 340px; top: -170px; right: -140px; }
.brand-panel::after { width: 460px; height: 460px; bottom: -330px; left: -180px; }
.brand-lockup, .brand-copy, .trust-row { position: relative; z-index: 1; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong { display: block; font: 700 18px/1.2 "Manrope", sans-serif; }
.brand-lockup span:not(.brand-mark) { display: block; margin-top: 3px; font-size: 12px; color: rgba(255,255,255,.7); }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: white; color: var(--brand); font: 800 13px/1 "Manrope", sans-serif; }
.brand-copy { max-width: 340px; }
.eyebrow { margin: 0 0 14px; font-weight: 700; font-size: 11px; letter-spacing: .16em; color: #8ff5c6; }
.brand-copy h1 { margin: 0; font: 800 clamp(36px, 4vw, 54px)/1.04 "Manrope", sans-serif; letter-spacing: -.045em; }
.brand-copy > p:last-child { margin: 22px 0 0; font-size: 16px; line-height: 1.65; color: rgba(255,255,255,.78); }
.trust-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: rgba(255,255,255,.72); }
.trust-row span { display: flex; align-items: center; gap: 7px; }

.chat-card { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto 1fr auto auto auto; background: var(--surface); height: 100%; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 23px 28px; border-bottom: 1px solid var(--line); }
.agent-identity { display: flex; align-items: center; gap: 13px; min-width: 0; }
.agent-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 44px; height: 44px; border-radius: 15px; color: white; background: linear-gradient(145deg, var(--brand), var(--accent)); box-shadow: 0 8px 22px rgba(7,95,198,.2); }
.agent-avatar svg { width: 23px; fill: currentColor; }
.agent-name-row { display: flex; align-items: center; gap: 8px; }
.agent-identity h2 { margin: 0; font: 700 16px/1.3 "Manrope", sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-identity p { margin: 4px 0 0; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #16c784; box-shadow: 0 0 0 3px rgba(22,199,132,.14); }
.ai-badge { padding: 2px 6px; border-radius: 6px; color: var(--brand); background: #e7f0fc; font-size: 10px; font-weight: 800; }
.icon-button { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: white; transition: .2s ease; }
.icon-button:hover { color: var(--brand); border-color: #b9cdea; background: var(--soft); }
.icon-button svg, .send-button svg { width: 19px; fill: currentColor; }

.messages { min-height: 0; overflow-y: auto; padding: 22px 28px 12px; scroll-behavior: smooth; }
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-thumb { border-radius: 20px; background: #cdd8e7; }
.date-divider { display: flex; align-items: center; gap: 12px; margin: 2px 0 22px; color: #8a98ac; font-size: 11px; }
.date-divider::before, .date-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.message-row { display: flex; gap: 10px; margin: 0 0 18px; animation: rise .24s ease-out; }
.user-row { justify-content: flex-end; }
.message-stack { max-width: min(76%, 520px); }
.user-row .message-stack { display: flex; flex-direction: column; align-items: flex-end; }
.bubble { padding: 13px 16px; border-radius: 18px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.bot-bubble { border-top-left-radius: 5px; background: var(--soft); border: 1px solid #e7edf5; }
.user-bubble { border-top-right-radius: 5px; color: white; background: linear-gradient(135deg, var(--brand), #0b70d8); }
.mini-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 28px; height: 28px; margin-top: 2px; border-radius: 9px; color: white; background: linear-gradient(145deg, var(--brand), var(--accent)); font-size: 9px; font-weight: 800; }
.message-time { display: block; margin-top: 6px; color: #96a2b4; font-size: 10px; }
.message-meta { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.feedback-controls { display: flex; gap: 2px; opacity: 0; transition: opacity .2s; }
.message-row:hover .feedback-controls, .feedback-controls.rated { opacity: 1; }
.feedback-controls button { width: 25px; height: 25px; border: 0; border-radius: 7px; color: #7d899a; background: transparent; }
.feedback-controls button:hover, .feedback-controls button.selected { color: var(--brand); background: #eaf2fd; }
.typing-message { display: none; width: fit-content; margin: 4px 0 18px 38px; padding: 14px 16px; border-radius: 5px 18px 18px; background: var(--soft); border: 1px solid #e7edf5; }
.typing-message.visible { display: flex; gap: 4px; }
.typing-message span { width: 6px; height: 6px; border-radius: 50%; background: #8da0b8; animation: bounce 1.1s infinite; }
.typing-message span:nth-child(2) { animation-delay: .12s; }.typing-message span:nth-child(3) { animation-delay: .24s; }
.handoff-note, .error-note { margin: 8px 38px 18px; padding: 11px 13px; border-radius: 12px; font-size: 12px; line-height: 1.45; }
.handoff-note { color: #705117; background: #fff7df; border: 1px solid #f4dfa3; }
.error-note { color: #9a3140; background: #fff0f2; border: 1px solid #f3cbd1; }

.suggestions { display: flex; gap: 8px; overflow-x: auto; padding: 7px 28px 14px; scrollbar-width: none; }
.suggestions::-webkit-scrollbar { display: none; }
.suggestion { flex: 0 0 auto; padding: 9px 12px; border: 1px solid #cbd9ea; border-radius: 999px; color: #2c527f; background: white; font-size: 12px; transition: .2s ease; }
.suggestion:hover { color: white; border-color: var(--brand); background: var(--brand); transform: translateY(-1px); }
.composer { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin: 0 28px; padding: 7px 7px 7px 16px; border: 1px solid #cfd9e7; border-radius: 18px; background: white; box-shadow: 0 6px 22px rgba(22,48,80,.06); }
.composer:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(7,95,198,.09); }
.composer textarea { width: 100%; max-height: 120px; resize: none; border: 0; outline: 0; padding: 9px 0; color: var(--ink); background: transparent; font-size: 14px; line-height: 1.4; }
.composer textarea::placeholder { color: #99a5b4; }
.send-button { display: grid; place-items: center; width: 43px; height: 43px; border: 0; border-radius: 14px; color: white; background: var(--brand); transition: transform .15s, opacity .2s; }
.send-button:hover { transform: translateY(-1px); }
.send-button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.disclaimer { margin: 9px 28px 14px; text-align: center; color: #929daf; font-size: 10px; }

.chat-form { margin-top: 10px; padding: 14px; border-radius: 14px; background: white; border: 1px solid var(--line); }
.chat-form h3 { margin: 0 0 4px; font-size: 14px; }.chat-form > p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.form-field { display: grid; gap: 5px; margin-top: 10px; }.form-field label { font-size: 11px; font-weight: 700; }
.form-field input { width: 100%; padding: 10px 11px; border: 1px solid #cdd8e6; border-radius: 9px; outline: none; font-size: 13px; }
.form-field input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(7,95,198,.08); }
.form-submit { width: 100%; margin-top: 12px; padding: 10px; border: 0; border-radius: 10px; color: white; background: var(--brand); font-weight: 700; font-size: 12px; }
.citation-list { margin: 9px 0 0; padding: 9px 12px; border-left: 2px solid #b7cbe5; color: var(--muted); font-size: 11px; }

/* Payment & Checkout Card */
.payment-card-wrapper { margin-top: 12px; width: 100%; max-width: 400px; animation: rise .24s ease-out; }
.payment-card { background: #ffffff; border: 1px solid #dce5f0; border-radius: 16px; box-shadow: 0 8px 24px rgba(15, 34, 58, 0.08), 0 2px 6px rgba(15, 34, 58, 0.04); overflow: hidden; font-family: inherit; }
.payment-card-header { background: linear-gradient(135deg, #0b1f38 0%, #153256 100%); color: #ffffff; padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; }
.payment-card-merchant { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: #8bbaf3; margin-bottom: 2px; }
.payment-card-desc { font-size: 13px; font-weight: 600; color: #ffffff; max-width: 190px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.payment-card-amount { font-size: 16px; font-weight: 800; color: #48df9e; background: rgba(72, 223, 158, 0.14); border: 1px solid rgba(72, 223, 158, 0.3); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.payment-card-security { display: flex; align-items: center; gap: 6px; padding: 6px 16px; background: #f3f7fd; color: #436289; font-size: 11px; font-weight: 500; border-bottom: 1px solid #e7edf5; }
.payment-card-security svg { color: #06a96b; flex-shrink: 0; }
.payment-form { padding: 14px 16px; }
.payment-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.payment-field { display: flex; flex-direction: column; gap: 4px; }
.payment-field.full { grid-column: 1 / -1; }
.payment-field label { font-size: 11px; font-weight: 700; color: #43546a; }
.payment-field input { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1.5px solid #d0dce8; border-radius: 9px; font-size: 13px; color: #162a45; background: #fafcfe; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
.payment-field input:focus { border-color: var(--brand); background: #ffffff; box-shadow: 0 0 0 3px rgba(7, 95, 198, 0.1); }
.card-num-wrap { position: relative; }
.card-num-wrap input { padding-right: 56px; }
.card-brand { position: absolute; right: 10px; bottom: 8px; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 4px; letter-spacing: 0.5px; transition: all .15s; }
.card-brand.brand-visa { background: #1a1f71; color: white; }
.card-brand.brand-mc { background: #eb001b; color: white; }
.card-brand.brand-amex { background: #007bc1; color: white; }
.card-brand.brand-disc { background: #ff6000; color: white; }
.payment-error { margin-top: 10px; padding: 8px 11px; background: #fff0f2; border: 1px solid #f3cbd1; border-radius: 8px; color: #a52e40; font-size: 12px; line-height: 1.4; }
.payment-error.hidden { display: none; }
.payment-submit { width: 100%; margin-top: 12px; padding: 11px 16px; border: 0; border-radius: 10px; color: white; background: linear-gradient(135deg, var(--brand) 0%, #004fb0 100%); font-weight: 700; font-size: 13px; cursor: pointer; display: flex; justify-content: center; align-items: center; gap: 8px; box-shadow: 0 4px 14px rgba(7, 95, 198, 0.28); transition: transform .15s, box-shadow .15s, opacity .15s; }
.payment-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(7, 95, 198, 0.35); }
.payment-submit:disabled { opacity: .65; cursor: not-allowed; }
.pay-spinner { display: inline-flex; align-items: center; gap: 6px; }
.pay-spinner::before { content: ""; width: 12px; height: 12px; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: #ffffff; border-radius: 50%; animation: spin .8s linear infinite; }
.pay-spinner.hidden { display: none; }
.pay-label.hidden { display: none; }
.payment-disclaimer { margin: 0; padding: 8px 16px 10px; text-align: center; color: #8e9eaf; font-size: 10.5px; border-top: 1px dashed #e6edf5; }
.payment-receipt { margin-top: 10px; padding: 13px 15px; background: #f0fdf4; border: 1.5px solid #bbf7d0; border-radius: 13px; display: flex; gap: 11px; align-items: flex-start; color: #166534; box-shadow: 0 3px 10px rgba(22, 101, 52, 0.05); animation: rise .24s ease-out; }
.receipt-check { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #22c55e; color: white; font-size: 10px; font-weight: 800; flex-shrink: 0; }
.receipt-text { font-size: 12px; line-height: 1.5; color: #14532d; font-family: inherit; }

/* PayHere Direct Button & Badges */
.payhere-direct-wrap { padding: 14px 16px 4px; }
.payhere-instant-btn { width: 100%; border: 0; border-radius: 12px; padding: 12px 14px; background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%); color: #ffffff; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 4px 16px rgba(2, 132, 199, 0.28); transition: transform .15s, box-shadow .15s, filter .15s; }
.payhere-instant-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(2, 132, 199, 0.38); filter: brightness(1.03); }
.payhere-instant-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.ph-btn-title { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 14px; }
.ph-badge-logo { background: #ff7a00; color: #ffffff; font-weight: 800; font-size: 11px; padding: 2px 7px; border-radius: 5px; letter-spacing: 0.5px; text-transform: uppercase; }
.ph-subtext { font-size: 11px; color: #e0f2fe; opacity: 0.9; }
.payhere-divider { display: flex; align-items: center; text-align: center; margin: 14px 0 6px; }
.payhere-divider::before, .payhere-divider::after { content: ""; flex: 1; border-bottom: 1px solid #e2e8f0; }
.payhere-divider span { padding: 0 10px; font-size: 9.5px; font-weight: 700; color: #94a3b8; letter-spacing: 0.6px; }
.payment-methods-strip { padding: 6px 16px 8px; font-size: 10.5px; color: #64748b; text-align: center; background: #f8fafc; border-top: 1px solid #f1f5f9; }

@keyframes spin { to { transform: rotate(360deg); } }


@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }

@media (max-width: 800px) {
  body { background: white; }
  .page-shell { width: 100%; height: 100dvh; min-height: 560px; margin: 0; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .brand-panel { display: none; }
  .chat-header { padding: 17px 18px; }
  .messages { padding: 18px 18px 10px; }
  .suggestions { padding: 7px 18px 12px; }
  .composer { margin: 0 14px; }
  .disclaimer { margin-bottom: max(10px, env(safe-area-inset-bottom)); }
  .message-stack { max-width: 84%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; }
}

