:root {
  --chat-dark: #202c33;
  --chat-dark-2: #111b21;
  --chat-green: #1f9254;
  --chat-green-dark: #167843;
  --chat-user: #d9fdd3;
  --mb-gold: #fbd717;
  --mb-gold-hover: #f0ca00;
  --ink: #182229;
  --muted: #66757f;
  --line: #e1e6e9;
  --surface: #fff;
  --wallpaper: #efeae2;
  --error: #b42318;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Urbanist', 'Inter', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 18%, rgba(251, 215, 23, .17), transparent 28rem),
    radial-gradient(circle at 82% 76%, rgba(31, 146, 84, .1), transparent 25rem),
    #e9ecee;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}
button, input { font: inherit; }
button, a { touch-action: manipulation; }
a { color: inherit; }

.chat-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(820px, calc(100% - 32px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 24px 0 14px;
}
.chat-app {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: min(860px, calc(100dvh - 76px));
  min-height: 620px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(17, 27, 33, .12);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(17, 27, 33, .2), 0 3px 12px rgba(17, 27, 33, .08);
}

.chat-header {
  z-index: 3;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 12px 18px;
  color: #fff;
  background: var(--chat-dark);
}
.chat-header__back {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #d8e0e5;
  border-radius: 50%;
}
.chat-header__back svg { width: 25px; height: 25px; }
.chat-avatar { position: relative; flex: 0 0 auto; width: 48px; height: 48px; }
.chat-avatar img { display: block; width: 48px; height: 48px; object-fit: cover; border: 0; border-radius: 50%; }
.chat-avatar > span { position: absolute; right: 0; bottom: 1px; width: 13px; height: 13px; background: #25d366; border: 2px solid var(--chat-dark); border-radius: 50%; }
.chat-header__identity { min-width: 0; }
.chat-header__identity h1 { margin: 0; font-family: var(--display); font-size: 1rem; line-height: 1.25; }
.chat-header__identity p { display: flex; gap: 6px; align-items: center; margin: 3px 0 0; color: #c7d0d5; font-size: .74rem; }
.online-dot { width: 6px; height: 6px; background: #25d366; border-radius: 50%; }
.chat-header__restart {
  min-height: 44px;
  margin-left: auto;
  padding: 0 12px;
  color: #dce4e8;
  font-size: .75rem;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
}
.chat-header__restart:hover { color: #fff; background: rgba(255,255,255,.09); }

.chat-progress { position: relative; z-index: 3; height: 28px; overflow: hidden; background: #f8f9f9; border-bottom: 1px solid #e4e7e9; }
.chat-progress__bar { position: absolute; inset: auto auto 0 0; width: 0; height: 3px; background: var(--mb-gold); transition: width 280ms ease; }
.chat-progress > span { display: block; padding-top: 6px; color: var(--muted); font-size: .66rem; font-weight: 700; text-align: center; letter-spacing: .02em; }

.chat-wallpaper {
  position: relative;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background-color: var(--wallpaper);
  background-image:
    radial-gradient(circle at 18px 18px, rgba(86, 104, 112, .045) 0 2px, transparent 2.5px),
    radial-gradient(circle at 45px 52px, rgba(86, 104, 112, .035) 0 3px, transparent 3.5px),
    linear-gradient(35deg, transparent 47%, rgba(86, 104, 112, .025) 48% 52%, transparent 53%);
  background-size: 72px 72px, 88px 88px, 64px 64px;
  scrollbar-width: thin;
  scrollbar-color: rgba(84, 101, 111, .34) transparent;
}
.chat-wallpaper::-webkit-scrollbar { width: 5px; }
.chat-wallpaper::-webkit-scrollbar-thumb { background: rgba(84, 101, 111, .34); border-radius: 99px; }
.chat-day { display: flex; justify-content: center; padding: 16px 16px 8px; }
.chat-day span, .chat-encryption {
  color: #52636d;
  background: rgba(255,255,255,.88);
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(17,27,33,.08);
  font-size: .7rem;
}
.chat-day span { padding: 5px 11px; font-weight: 700; text-transform: uppercase; }
.chat-encryption {
  display: flex;
  gap: 7px;
  align-items: center;
  width: fit-content;
  max-width: calc(100% - 40px);
  margin: 0 auto 13px;
  padding: 7px 11px;
  color: #667781;
  text-align: center;
}
.chat-encryption svg { flex: 0 0 auto; width: 15px; height: 15px; color: #937c00; }
.chat-messages { display: flex; flex-direction: column; gap: 5px; padding: 0 18px; }

.message-row { display: flex; width: 100%; animation: message-in 230ms ease-out both; }
.message-row--bot { justify-content: flex-start; padding-right: 17%; }
.message-row--user { justify-content: flex-end; padding-left: 17%; }
.message-row--system { justify-content: center; padding: 6px 7%; }
.message-bubble {
  position: relative;
  width: fit-content;
  max-width: 100%;
  padding: 9px 12px 7px;
  background: #fff;
  border-radius: 4px 11px 11px 11px;
  box-shadow: 0 1px 1px rgba(17,27,33,.12);
}
.message-row--bot:first-child .message-bubble::before {
  position: absolute;
  top: 0;
  left: -7px;
  width: 12px;
  height: 12px;
  content: '';
  background: linear-gradient(225deg, #fff 50%, transparent 51%);
}
.message-row--user .message-bubble { background: var(--chat-user); border-radius: 11px 4px 11px 11px; }
.message-row--user .message-bubble::after {
  position: absolute;
  top: 0;
  right: -7px;
  width: 12px;
  height: 12px;
  content: '';
  background: linear-gradient(135deg, var(--chat-user) 50%, transparent 51%);
}
.message-row--system .message-bubble { color: #50616b; background: rgba(255,255,255,.9); border-radius: 9px; text-align: center; }
.message-content { font-size: .9rem; line-height: 1.5; white-space: pre-line; }
.message-content strong { font-weight: 750; }
.message-time { display: block; min-width: 48px; margin: 3px 0 -1px 16px; color: #83919a; font-size: .58rem; text-align: right; }
.message-row--user .message-time::after { margin-left: 4px; color: #53a4d6; content: '✓✓'; letter-spacing: -3px; }

.typing-bubble { display: flex; gap: 4px; align-items: center; min-width: 56px; min-height: 35px; padding: 10px 14px; }
.typing-bubble span { width: 7px; height: 7px; background: #8b979e; border-radius: 50%; animation: typing 1.1s ease-in-out infinite; }
.typing-bubble span:nth-child(2) { animation-delay: 140ms; }
.typing-bubble span:nth-child(3) { animation-delay: 280ms; }
@keyframes typing { 0%, 60%, 100% { opacity: .38; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@keyframes message-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }

.chat-action { display: block; padding: 10px 18px 18px; }
.chat-action:empty { display: none; }
.action-panel {
  width: min(520px, calc(100% - 14%));
  margin-left: auto;
  padding: 10px;
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(17,27,33,.09);
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(17,27,33,.1);
  animation: action-in 240ms ease-out both;
}
@keyframes action-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
.option-list { display: grid; gap: 8px; }
.chat-option {
  display: flex;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  background: #fff;
  border: 1px solid #dce2e5;
  border-radius: 10px;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.chat-option:hover { background: #fffdf0; border-color: #b89c00; box-shadow: 0 2px 8px rgba(17,27,33,.06); }
.chat-option:active { background: #fff8c9; }
.chat-option__mark { display: grid; flex: 0 0 auto; width: 31px; height: 31px; place-items: center; color: #6e5c00; background: #fff6bd; border-radius: 8px; }
.chat-option__mark svg { width: 18px; height: 18px; }
.chat-option strong { display: block; font-size: .83rem; }
.chat-option small { display: block; margin-top: 2px; color: var(--muted); font-size: .68rem; line-height: 1.35; }
.chat-option__arrow { width: 17px; height: 17px; margin-left: auto; color: #8b989f; }

.chat-form-card { padding: 4px; }
.chat-field { margin-bottom: 10px; }
.chat-field label { display: block; margin: 0 0 6px; color: #34434b; font-size: .76rem; font-weight: 750; }
.chat-input-wrap { display: flex; gap: 8px; align-items: center; }
.chat-input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 11px 13px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid #cbd3d7;
  border-radius: 10px;
}
.chat-input::placeholder { color: #98a3a9; }
.chat-input:focus { border-color: #877200; outline: 3px solid rgba(251,215,23,.26); outline-offset: 0; }
.chat-input[aria-invalid="true"] { border-color: var(--error); outline-color: rgba(180,35,24,.12); }
.chat-submit {
  display: grid;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  place-items: center;
  color: #151515;
  cursor: pointer;
  background: var(--mb-gold);
  border: 0;
  border-radius: 50%;
}
.chat-submit:hover { background: var(--mb-gold-hover); }
.chat-submit svg { width: 22px; height: 22px; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: .66rem; }
.field-error { display: block; min-height: 0; margin-top: 5px; color: var(--error); font-size: .68rem; font-weight: 700; }
.consent-check { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; margin: 10px 0; color: #5c6c75; font-size: .67rem; line-height: 1.4; }
.consent-check input { width: 19px; height: 19px; margin: 0; accent-color: var(--chat-green); }
.consent-check a { font-weight: 700; text-decoration: underline; }
.next-step-options { display: grid; gap: 8px; margin-top: 14px; }
.next-step-options__title { margin: 0 0 1px; color: #34434b; font-size: .76rem; font-weight: 750; }
.contact-submit { width: 100%; min-height: 50px; padding: 10px 16px; font-weight: 800; line-height: 1.2; cursor: pointer; border-radius: 10px; transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.contact-submit:active { transform: scale(.99); }
.contact-submit:disabled { cursor: wait; opacity: .58; }
.contact-submit--account { color: #151515; background: var(--mb-gold); border: 1px solid var(--mb-gold); }
.contact-submit--account:hover { background: var(--mb-gold-hover); border-color: var(--mb-gold-hover); }
.contact-submit--continue { color: #151515; background: var(--mb-gold); border: 1px solid var(--mb-gold); }
.contact-submit--continue:hover { background: var(--mb-gold-hover); border-color: var(--mb-gold-hover); }
.contact-submit--specialist { color: #182229; background: #fff; border: 1px solid #aebac0; }
.contact-submit--specialist:hover { background: #f5f7f8; border-color: #657680; box-shadow: 0 2px 5px rgba(17, 27, 33, .1); }

.result-card { width: min(560px, 100%); padding: 14px; }
.result-card__badge { display: inline-flex; gap: 7px; align-items: center; margin-bottom: 9px; color: var(--chat-green-dark); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.result-card__badge span { width: 8px; height: 8px; background: var(--chat-green); border-radius: 50%; }
.result-card h2 { margin: 0 0 8px; font-family: var(--display); font-size: 1.08rem; line-height: 1.35; }
.result-card > p { margin: 0; color: #51616a; font-size: .8rem; }
.result-route { margin: 13px 0; padding: 12px; background: #edf8f1; border: 1px solid #cce9d7; border-radius: 9px; }
.result-route span { display: block; margin-bottom: 4px; color: var(--chat-green-dark); font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.result-route strong { display: block; font-size: .84rem; line-height: 1.4; }
.credit-possibilities { display: grid; gap: 8px; margin: 12px 0 14px; }
.credit-possibility { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 9px; align-items: start; padding: 10px; background: #fff; border: 1px solid #dfe6e2; border-radius: 9px; }
.credit-possibility > span { display: grid; width: 28px; height: 28px; place-items: center; color: #145f38; font-size: .7rem; font-weight: 800; background: #dff4e7; border-radius: 50%; }
.credit-possibility strong { display: block; font-size: .76rem; line-height: 1.35; }
.credit-possibility p { margin: 3px 0 0; color: #66757d; font-size: .65rem; line-height: 1.42; }
.result-reasons { margin: 13px 0; color: #35454e; font-size: .74rem; }
.result-reasons > strong { display: block; margin-bottom: 6px; }
.result-reasons ul { display: grid; gap: 4px; margin: 0; padding-left: 18px; color: #596972; }
.result-next { margin: 13px 0; padding: 10px 12px; background: #f7f9f9; border-left: 3px solid var(--mb-gold); border-radius: 0 8px 8px 0; }
.result-next strong { display: block; margin-bottom: 3px; font-size: .72rem; }
.result-next p { margin: 0; color: #596972; font-size: .7rem; line-height: 1.45; }
.result-attention { margin: 0 0 13px !important; color: #6b777e !important; font-size: .66rem !important; line-height: 1.45; }
.result-summary { display: grid; gap: 1px; overflow: hidden; margin: 14px 0; background: #e0e5e7; border: 1px solid #e0e5e7; border-radius: 9px; }
.result-summary div { display: grid; grid-template-columns: 112px 1fr; gap: 10px; padding: 8px 10px; background: #f7f9f9; }
.result-summary span { color: var(--muted); font-size: .65rem; }
.result-summary strong { font-size: .72rem; line-height: 1.35; }
.whatsapp-cta { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 18px; color: #fff; font-size: .82rem; font-weight: 800; line-height: 1; text-align: center; background: var(--chat-green); border-radius: 10px; text-decoration: none; }
.whatsapp-cta:hover { background: var(--chat-green-dark); }
.whatsapp-cta__content { display: inline-flex; gap: 10px; align-items: center; justify-content: center; line-height: 1; }
.whatsapp-cta__content > span { display: block; line-height: 1; }
.whatsapp-cta svg { display: block; flex: 0 0 22px; width: 22px; height: 22px; }
.result-disclaimer { margin-top: 10px !important; color: #78868e !important; font-size: .62rem !important; line-height: 1.45; }

.chat-footer { display: flex; gap: 8px; align-items: center; justify-content: center; min-height: 42px; padding: 8px 16px; color: #687780; background: #f4f7f8; border-top: 1px solid #dde3e6; font-size: .68rem; }
.chat-footer svg { width: 18px; height: 18px; color: var(--chat-green); }
.page-legal { margin: 11px 0 0; color: #69767d; font-size: .66rem; text-align: center; }
.page-legal a { font-weight: 700; }

.chat-option:focus-visible, .chat-submit:focus-visible, .contact-submit:focus-visible, .chat-header__restart:focus-visible, .chat-header__back:focus-visible, .whatsapp-cta:focus-visible {
  outline: 3px solid rgba(251,215,23,.62);
  outline-offset: 2px;
}

.cookie-banner {
  position: fixed;
  z-index: 1200;
  right: 24px;
  bottom: 24px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 15px;
  align-items: center;
  width: min(700px, calc(100vw - 48px));
  padding: 15px;
  color: #151515;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(16,16,16,.14);
  border-radius: 15px;
  box-shadow: 0 20px 70px rgba(16,16,16,.2);
}
.cookie-banner--closing { opacity: 0; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease; }
.cookie-banner__title { margin: 0 0 3px; font-size: .9rem; font-weight: 800; }
.cookie-banner__text { margin: 0; color: #555; font-size: .76rem; line-height: 1.4; }
.cookie-banner__text a { font-weight: 700; }
.cookie-banner__actions { display: flex; gap: 8px; }
.cookie-banner__btn { min-height: 44px; padding: 0 15px; font-weight: 800; cursor: pointer; white-space: nowrap; border: 1px solid rgba(16,16,16,.15); border-radius: 99px; }
.cookie-banner__btn--primary { background: var(--mb-gold); border-color: var(--mb-gold); }
.cookie-banner__btn--ghost { background: #fff; }

@media (max-width: 640px) {
  .chat-page { width: 100%; min-height: 100dvh; padding: 0; }
  .chat-app { width: 100%; height: 100dvh; min-height: 0; border: 0; border-radius: 0; box-shadow: none; }
  .chat-header { min-height: 68px; padding: max(8px, env(safe-area-inset-top)) 11px 8px; }
  .chat-header__back { display: grid; }
  .chat-avatar, .chat-avatar img { width: 43px; height: 43px; }
  .chat-header__restart { padding: 0 8px; font-size: .67rem; }
  .chat-messages { padding: 0 10px; }
  .message-row--bot { padding-right: 9%; }
  .message-row--user { padding-left: 9%; }
  .message-content { font-size: .86rem; }
  .chat-action { padding: 9px 10px max(14px, env(safe-area-inset-bottom)); }
  .action-panel { width: calc(100% - 5%); }
  .chat-footer { display: none; }
  .page-legal { display: none; }
  .chat-encryption { max-width: calc(100% - 24px); font-size: .63rem; }
  .cookie-banner { right: 12px; bottom: 12px; left: 12px; grid-template-columns: 1fr; width: auto; }
  .cookie-banner__actions { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 390px) {
  .chat-header { gap: 8px; }
  .chat-header__restart { width: 44px; overflow: hidden; color: transparent; }
  .chat-header__restart::after { display: block; color: #dce4e8; content: '↻'; font-size: 1.25rem; }
  .result-summary div { grid-template-columns: 92px 1fr; }
}

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