:root {
  --ai-navy: #071729;
  --ai-navy-2: #0b223b;
  --ai-gold: #e6b84e;
  --ai-gold-soft: #f8e7ad;
  --ai-panel: rgba(255, 255, 255, 0.94);
  --ai-line: rgba(17, 37, 61, 0.13);
  --ai-muted: #657184;
}

html[data-theme="dark"] {
  --ai-panel: rgba(9, 27, 47, 0.96);
  --ai-line: rgba(255, 255, 255, 0.11);
  --ai-muted: #a7b4c5;
}

.ai-page { background: var(--ai-navy); }
.ai-page .site-header { position: relative; z-index: 40; }
.ai-stage {
  min-height: calc(100svh - 122px);
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 14%, rgba(230, 184, 78, 0.16), transparent 27rem),
    linear-gradient(135deg, #061321 0%, #0a2037 52%, #071729 100%);
  padding: 18px;
}

.ai-workspace {
  width: min(1540px, 100%);
  height: calc(100svh - 158px);
  min-height: calc(100svh - 158px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 310px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 24px;
  background: var(--ai-panel);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}

.ai-rail,
.ai-context { padding: 24px 20px; background: color-mix(in srgb, var(--surface) 88%, transparent); }
.ai-rail { overflow-y: auto; border-right: 1px solid var(--ai-line); }
.ai-context { overflow-y: auto; border-left: 1px solid var(--ai-line); }
.ai-rail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; }
.ai-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  color: var(--ai-navy);
  background: linear-gradient(145deg, #ffe17d, #c88c20);
  box-shadow: 0 8px 24px rgba(200, 140, 32, 0.25);
  font-size: 21px;
}
.ai-rail-head b { display: block; font-size: 14px; }
.ai-rail-head span { display: block; margin-top: 2px; color: var(--ai-muted); font-size: 11px; }
.ai-label { display: block; margin: 0 0 10px; color: var(--ai-muted); font-size: 10px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.ai-secondary-label { margin-top: 20px; }
.ai-topic-list { display: grid; gap: 7px; }
.ai-topic {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--ink);
  background: transparent;
  font: 700 13px/1.3 "Manrope", sans-serif;
  text-align: left;
  transition: 180ms ease;
}
.ai-topic:hover,
.ai-topic:focus-visible,
.ai-topic[aria-pressed="true"] { border-color: var(--ai-line); background: var(--paper); transform: translateX(2px); }
.ai-topic[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--ai-gold); }
.ai-topic-icon { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; background: var(--paper); font-size: 15px; }
.ai-quick-list .ai-topic { color: var(--ai-muted); }
.ai-quick-list .ai-topic:hover,
.ai-quick-list .ai-topic:focus-visible { color: var(--ink); }
.ai-rail-note { margin-top: 25px; padding: 15px; border: 1px solid var(--ai-line); border-radius: 15px; color: var(--ai-muted); font-size: 11px; line-height: 1.6; }
.ai-rail-note b { color: var(--ink); }

.ai-conversation { min-width: 0; min-height: 0; height: 100%; display: flex; overflow: hidden; flex-direction: column; background: var(--paper); }
.ai-conversation-head {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--ai-line);
}
.ai-identity { min-width: 0; display: flex; align-items: center; gap: 11px; }
.ai-live-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: #26b979; box-shadow: 0 0 0 5px rgba(38, 185, 121, 0.12); }
.ai-identity b { display: block; overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.ai-identity span { display: block; margin-top: 2px; color: var(--ai-muted); font-size: 11px; }
.ai-head-actions { display: flex; gap: 7px; }
.ai-quiet-button {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--ai-line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  font: 700 11px "Manrope", sans-serif;
}
.ai-quiet-button:hover { border-color: var(--ai-gold); }

.ai-chat {
  flex: 1;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  padding: clamp(22px, 4vw, 46px);
  scroll-behavior: smooth;
}
.ai-welcome { width: min(720px, 100%); margin: clamp(20px, 7vh, 76px) auto 30px; text-align: center; }
.ai-orb-wrap { position: relative; width: 98px; height: 98px; margin: 0 auto 26px; }
.ai-orb,
.ai-orb::before,
.ai-orb::after { position: absolute; inset: 0; border-radius: 50%; }
.ai-orb {
  display: grid;
  place-items: center;
  color: var(--ai-navy);
  background: conic-gradient(from 210deg, #f4d875, #bf7c14, #fff0ad, #d29827, #f4d875);
  box-shadow: 0 16px 45px rgba(202, 145, 36, 0.3);
  font-size: 33px;
  animation: ai-float 4s ease-in-out infinite;
}
.ai-orb::before { content: ""; inset: -10px; border: 1px solid rgba(218, 170, 58, 0.35); animation: ai-ring 2.4s ease-out infinite; }
.ai-orb::after { content: ""; inset: 7px; border: 1px solid rgba(255, 255, 255, 0.45); }
@keyframes ai-float { 50% { transform: translateY(-5px) rotate(4deg); } }
@keyframes ai-ring { 0% { transform: scale(0.85); opacity: 0; } 45% { opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.ai-welcome h1 { margin: 0; font: 400 clamp(32px, 4vw, 54px)/1.04 "DM Serif Display", Georgia, serif; }
.ai-welcome h1 span { color: var(--gold-strong); }
.ai-welcome > p { width: min(600px, 100%); margin: 15px auto 24px; color: var(--ai-muted); font-size: 14px; line-height: 1.7; }
.ai-prompt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; text-align: left; }
.ai-prompt {
  min-height: 78px;
  padding: 14px 15px;
  border: 1px solid var(--ai-line);
  border-radius: 15px;
  color: var(--ink);
  background: var(--surface);
  font: 800 13px/1.35 "Manrope", sans-serif;
  text-align: left;
  transition: 180ms ease;
}
.ai-prompt span { display: block; margin-top: 5px; color: var(--ai-muted); font-size: 11px; font-weight: 500; }
.ai-prompt:hover { border-color: var(--ai-gold); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(21, 36, 55, 0.08); }
.ai-message-row { width: min(780px, 100%); display: flex; gap: 10px; margin: 0 auto 18px; }
.ai-message-row.user { justify-content: flex-end; }
.ai-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: var(--ai-navy); background: var(--ai-gold); font-size: 13px; }
.ai-message {
  max-width: 82%;
  padding: 13px 15px;
  border: 1px solid var(--ai-line);
  border-radius: 4px 16px 16px 16px;
  color: var(--ink);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.7;
}
.ai-message:not(.ai-message-structured) { white-space: pre-wrap; }
.ai-response-answer { margin: 0; font-size: 14px; line-height: 1.68; }
.ai-response-points { display: grid; gap: 9px; margin: 13px 0 0; padding: 0; list-style: none; }
.ai-response-points li { position: relative; padding-left: 20px; line-height: 1.58; }
.ai-response-points li::before {
  content: "";
  position: absolute;
  top: 0.62em;
  left: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ai-gold);
  box-shadow: 0 0 0 4px rgba(218, 170, 58, 0.12);
}
.ai-response-next { margin-top: 15px; padding: 12px 13px; border-left: 3px solid var(--ai-gold); border-radius: 4px 11px 11px 4px; background: var(--paper); }
.ai-response-next span { display: block; margin-bottom: 4px; color: var(--gold-strong); font-size: 9px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.ai-response-next p { margin: 0; font-size: 12px; font-weight: 700; line-height: 1.55; }
.ai-response-notice { margin: 13px 0 0; padding-top: 11px; border-top: 1px solid var(--ai-line); color: var(--ai-muted); font-size: 10px; line-height: 1.55; }
.ai-message-row.user .ai-message { border-radius: 16px 16px 4px 16px; color: var(--ai-navy); background: var(--ai-gold-soft); border-color: rgba(202, 145, 36, 0.28); }
.ai-message-actions { width: min(780px, 100%); display: flex; flex-wrap: wrap; gap: 7px; margin: -8px auto 20px; padding-left: 42px; }
.ai-message-action { padding: 8px 11px; border: 1px solid var(--ai-line); border-radius: 999px; color: var(--ink); background: var(--paper); font: 800 10px "Manrope", sans-serif; text-decoration: none; }
.ai-message-action:hover { border-color: var(--ai-gold); color: var(--gold-strong); }
.ai-inline-panel {
  width: min(780px, 100%);
  margin: 0 auto 22px;
  padding: 18px;
  border: 1px solid var(--ai-line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(15, 28, 44, 0.07);
}
.ai-inline-panel h3 { margin: 0; font-size: 15px; }
.ai-inline-panel > p { margin: 6px 0 16px; color: var(--ai-muted); font-size: 11px; line-height: 1.55; }
.ai-inline-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.ai-inline-options button { min-height: 70px; padding: 13px; border: 1px solid var(--ai-line); border-radius: 13px; color: var(--ink); background: var(--paper); font: 800 12px/1.4 "Manrope", sans-serif; text-align: left; }
.ai-inline-options button span { display: block; margin-top: 4px; color: var(--ai-muted); font-size: 9px; font-weight: 500; }
.ai-inline-options button:hover { border-color: var(--ai-gold); }
.ai-inline-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-spouse-fields, .ai-spouse-language { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--ai-line); border-radius: 12px; }
.ai-spouse-fields[hidden], .ai-spouse-language[hidden] { display: none; }
.ai-spouse-fields legend, .ai-spouse-language legend { color: var(--ink); font-size: 13px; font-weight: 800; padding: 0 5px; }
.ai-inline-form .ai-crs-help { grid-column: 1 / -1; margin: 0; color: var(--ai-muted); font-size: 12px; line-height: 1.6; }
@media (max-width: 640px) {
  .ai-spouse-fields, .ai-spouse-language { grid-template-columns: minmax(0, 1fr); padding: 10px; }
}
.ai-inline-step {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
  background: color-mix(in srgb, var(--ai-gold) 11%, var(--paper));
}
.ai-inline-step span { color: var(--gold-strong); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.ai-inline-step b { font-size: 11px; }
.ai-inline-form label { display: grid; gap: 6px; color: var(--ink); font-size: 10px; font-weight: 800; }
.ai-inline-form label.full { grid-column: 1 / -1; }
.ai-inline-form input,
.ai-inline-form select { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid var(--ai-line); border-radius: 10px; outline: 0; color: var(--ink); background: var(--paper); font: 600 11px "Manrope", sans-serif; }
.ai-inline-form input:focus,
.ai-inline-form select:focus { border-color: var(--ai-gold); box-shadow: 0 0 0 3px rgba(218, 170, 58, 0.11); }
.ai-inline-form input[aria-invalid="true"] { border-color: #c94747; }
.ai-inline-form .ai-consent { display: flex; grid-column: 1 / -1; align-items: flex-start; gap: 8px; color: var(--ai-muted); font-size: 9px; font-weight: 600; line-height: 1.5; }
.ai-inline-form .ai-consent input { width: 16px; min-height: 16px; flex: 0 0 auto; margin-top: 1px; }
.ai-inline-submit { min-height: 44px; grid-column: 1 / -1; border: 0; border-radius: 11px; color: var(--ai-navy); background: var(--ai-gold); font: 800 11px "Manrope", sans-serif; }
.ai-inline-submit:disabled { cursor: wait; opacity: 0.65; }
.ai-lead-cancel { grid-column: 1 / -1; min-height:44px; border:1px solid var(--ai-line); border-radius:10px; background:transparent; color:var(--ink); font:600 13px "Manrope",sans-serif; cursor:pointer; }
.ai-followup-invite .ai-message-actions { margin:0; flex-wrap:wrap; }
.ai-followup-invite .ai-message-action { min-height:44px; font-size:13px; }
.ai-followup-invite .ai-message-action:first-child { background:var(--ai-gold); color:var(--ai-navy); }
#aiReportForm label { font-size:13px; }
#aiReportForm input:not([type="checkbox"]), #aiReportForm select { min-height:48px; font-size:16px; }
#aiReportForm .ai-consent { font-size:12px; }
#aiReportForm .ai-inline-submit { font-size:14px; }
.ai-inline-error { grid-column: 1 / -1; min-height: 14px; margin: 0; color: #c94747; font-size: 9px; }
.ai-data-note { display: flex; gap: 8px; margin: 13px 0 0; padding: 11px; border-radius: 10px; color: var(--ai-muted); background: var(--paper); font-size: 9px; line-height: 1.55; }
.ai-data-note b { color: var(--ink); }
.ai-inline-success { border-color: rgba(38, 185, 121, .35); }
.ai-inline-success h3::before { content: "✓"; display: inline-grid; width: 25px; height: 25px; margin-right: 8px; place-items: center; border-radius: 50%; color: #fff; background: #249668; font: 800 12px/1 "Manrope", sans-serif; vertical-align: 2px; }
.ai-typing { width: min(780px, 100%); display: flex; gap: 5px; margin: 0 auto 18px; padding-left: 42px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ai-gold); animation: ai-type 1s infinite; }
.ai-typing i:nth-child(2) { animation-delay: 0.13s; }
.ai-typing i:nth-child(3) { animation-delay: 0.26s; }
@keyframes ai-type { 50% { opacity: 0.25; transform: translateY(-3px); } }
.ai-typing span { margin-left: 7px; color: var(--ai-muted); font-size: 10px; font-weight: 700; }

.ai-compose-wrap { padding: 13px 20px 16px; border-top: 1px solid var(--ai-line); background: color-mix(in srgb, var(--surface) 82%, transparent); }
.ai-compose {
  width: min(820px, 100%);
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: 6px 7px 6px 15px;
  border: 1px solid var(--ai-line);
  border-radius: 17px;
  background: var(--paper);
  box-shadow: 0 8px 25px rgba(15, 28, 44, 0.08);
}
.ai-compose:focus-within { border-color: var(--ai-gold); box-shadow: 0 0 0 3px rgba(218, 170, 58, 0.12); }
.ai-compose input { min-width: 0; flex: 1; border: 0; outline: 0; color: var(--ink); background: transparent; font: 500 13px "Manrope", sans-serif; }
.ai-compose button { display: grid; width: 41px; height: 41px; flex: 0 0 auto; place-items: center; border: 0; border-radius: 12px; color: var(--ai-navy); background: var(--ai-gold); font-size: 17px; }
.ai-compose button:disabled { cursor: wait; opacity: 0.62; }
.ai-compose-note { margin: 7px 0 0; color: var(--ai-muted); font-size: 9px; text-align: center; }

.ai-context h2 { margin: 0 0 5px; font-size: 15px; }
.ai-context > p { margin: 0 0 20px; color: var(--ai-muted); font-size: 11px; line-height: 1.55; }
.ai-tool-list { display: grid; gap: 9px; }
.ai-tool-card {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--ai-line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--paper);
  text-decoration: none;
  font-family: "Manrope", sans-serif;
  text-align: left;
  transition: 180ms ease;
}
.ai-tool-card:hover { border-color: var(--ai-gold); transform: translateY(-1px); }
.ai-tool-card > span:first-child { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 11px; background: var(--surface); }
.ai-tool-card b { display: block; font-size: 11px; }
.ai-tool-card small { display: block; margin-top: 3px; color: var(--ai-muted); font-size: 9px; }
.ai-tool-card > span:last-child { color: var(--gold-strong); }
.ai-context-divider { height: 1px; margin: 22px 0; background: var(--ai-line); }
.ai-coverage { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.ai-coverage button { padding: 10px; border: 1px solid var(--ai-line); border-radius: 11px; color: var(--ink); background: transparent; font: 700 10px "Manrope", sans-serif; }
.ai-coverage button:hover { background: var(--paper); border-color: var(--ai-gold); }
.ai-trust { margin-top: 18px; padding: 13px; border-radius: 13px; color: #183329; background: #e5f5ec; font-size: 10px; line-height: 1.55; }
html[data-theme="dark"] .ai-trust { color: #bce8d1; background: rgba(42, 150, 98, 0.13); }

.ai-noscript { padding: 20px; color: #fff; text-align: center; }

@media (max-width: 1120px) {
  .ai-workspace { grid-template-columns: 230px minmax(0, 1fr); }
  .ai-context { display: none; }
}

@media (max-width: 760px) {
  html,
  body.ai-page { height: auto; overflow: auto; }
  .ai-stage { min-height: calc(100svh - 80px); padding: 0; }
  .ai-workspace { height: calc(100svh - 80px); min-height: calc(100svh - 80px); display: block; border: 0; border-radius: 0; }
  .ai-rail { display: none; }
  .ai-conversation { min-height: calc(100svh - 80px); }
  .ai-conversation-head { padding: 11px 14px; }
  .ai-identity span { display: none; }
  .ai-chat { height: calc(100svh - 230px); padding: 22px 14px; }
  .ai-welcome { margin-top: 22px; }
  .ai-orb-wrap { width: 76px; height: 76px; margin-bottom: 20px; }
  .ai-welcome h1 { font-size: 34px; }
  .ai-prompt-grid { grid-template-columns: 1fr; }
  .ai-prompt { min-height: 65px; }
  .ai-message { max-width: 90%; }
  .ai-inline-options,
  .ai-inline-form { grid-template-columns: 1fr; }
  .ai-inline-form label.full,
  .ai-inline-step,
  .ai-inline-form .ai-consent,
  .ai-inline-submit,
  .ai-inline-error { grid-column: 1; }
  .ai-inline-form input,
  .ai-inline-form select { min-width: 0; max-width: 100%; min-height: 50px; padding: 12px; font-size: 16px; box-sizing: border-box; }
  .ai-inline-submit { min-height: 50px; font-size: 13px; }
  .ai-compose-wrap { padding: 10px 10px 12px; }
  .ai-compose { min-height: 56px; padding-left: 14px; }
  .ai-compose input { min-height: 44px; font-size: 16px; }
  .ai-compose button { width: 44px; height: 44px; }
  .ai-compose-note { display: none; }
}

@media (min-width: 761px) {
  html,
  body.ai-page { height: 100%; overflow: hidden; }
  .ai-stage { height: calc(100svh - 122px); min-height: 0; overflow: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-orb,
  .ai-orb::before,
  .ai-typing i { animation: none; }
  .ai-chat { scroll-behavior: auto; }
}

/* A brief welcome animation; the complete heading stays available to readers. */
.ai-welcome-greeting { animation: ai-greeting-reveal .8s ease-out both; }
.ai-welcome h1.ai-welcome-greeting span {
  display: inline-block;
  color: var(--gold-strong);
  background: linear-gradient(110deg, var(--gold-strong) 25%, #d4ac45 44%, #f7df91 50%, #d4ac45 56%, var(--gold-strong) 75%);
  background-size: 250% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ai-greeting-shimmer 3s ease-in-out 2;
}
@keyframes ai-greeting-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ai-greeting-shimmer {
  from { background-position: 100% 50%; }
  to { background-position: 0% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .ai-welcome-greeting, .ai-welcome h1.ai-welcome-greeting span { animation: none; }
}
@media (forced-colors: active) {
  .ai-welcome h1.ai-welcome-greeting span { background: none; -webkit-text-fill-color: currentColor; }
}

.ai-prompt-grid a.ai-prompt { display: block; text-decoration: none; }
.ai-prompt-grid a.ai-prompt:focus-visible { outline: 2px solid var(--ai-gold); outline-offset: 3px; }
