/* CBE — premium design system */
:root {
  /* Brand tokens */
  --apex-navy: #071a2b;
  --apex-navy-2: #081427;
  --apex-blue: #0b5fff;
  --apex-blue-2: #0a3cff;
  --apex-cyan: #22d3ee;
  --apex-cyan-2: #3bf0ff;
  --apex-ink: #eaf2ff;
  --apex-muted: rgba(234, 242, 255, 0.72);
  --apex-border: rgba(234, 242, 255, 0.12);
  --apex-surface: rgba(255, 255, 255, 0.06);
  --apex-surface-2: rgba(255, 255, 255, 0.085);
  --neon-blue: #2f7bff;
  --neon-cyan: #22d3ee;
  --neon-cyan-2: #67f6ff;
  --glow-blue: rgba(47, 123, 255, 0.38);
  --glow-cyan: rgba(34, 211, 238, 0.30);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-2: rgba(255, 255, 255, 0.085);

  --apex-shadow-sm: 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 30px rgba(2, 6, 23, 0.38);
  --apex-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 55px rgba(2, 6, 23, 0.45);
  --apex-shadow-lg: 0 1px 0 rgba(255, 255, 255, 0.06), 0 26px 90px rgba(2, 6, 23, 0.55);

  --apex-radius: 16px;
  --apex-radius-sm: 12px;

  /* Typography */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Legacy variable aliases kept for backward compatibility */
  --bank-bg: var(--apex-navy);
  --bank-bg-alt: color-mix(in srgb, var(--apex-navy) 70%, #000 30%);
  --bank-surface: var(--apex-surface-2);
  --bank-nav: #f5fbff;
  --bank-text: var(--apex-ink);
  --bank-text-muted: var(--apex-muted);
  --bank-border: var(--apex-border);
  --bank-primary: var(--apex-blue);
  --bank-primary-hover: color-mix(in srgb, var(--apex-blue) 80%, var(--apex-cyan) 20%);
  --bank-primary-dark: color-mix(in srgb, var(--apex-navy) 65%, var(--apex-blue) 35%);
  --bank-shadow: var(--apex-shadow-sm);
  --bank-shadow-lg: var(--apex-shadow-lg);
  --bank-radius: var(--apex-radius);
  --bank-radius-sm: var(--apex-radius-sm);

  --bg: var(--apex-navy);
  --surface: color-mix(in srgb, var(--apex-navy) 70%, #0b1633 30%);
  --surface-2: var(--apex-surface-2);
  --text: var(--apex-ink);
  --text-muted: var(--apex-muted);
  --border: var(--apex-border);
  --primary: var(--apex-blue);
  --primary-hover: var(--bank-primary-hover);
  --accent: var(--apex-cyan);
  --success: #22c55e;
  --danger: #fb7185;
  --shadow: var(--apex-shadow);
  --radius: var(--apex-radius);
  --radius-sm: var(--apex-radius-sm);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--bank-text);
  background:
    radial-gradient(1200px 700px at 12% 10%, rgba(11, 95, 255, 0.30), transparent 55%),
    radial-gradient(900px 620px at 86% 18%, rgba(34, 211, 238, 0.22), transparent 55%),
    radial-gradient(900px 700px at 50% 110%, rgba(11, 95, 255, 0.12), transparent 58%),
    var(--bank-bg);
  line-height: 1.5;
}

@media (prefers-reduced-motion: no-preference) {
  html:focus-within {
    scroll-behavior: smooth;
  }
}

/* Better focus ring across the site */
:where(a, button, input, textarea, select):focus-visible {
  outline: 2px solid color-mix(in srgb, var(--apex-cyan) 72%, white 28%);
  outline-offset: 2px;
}

/* Shared: logo on white pill (for partner attribution) */
.logo-on-white {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.16);
}

.isys-logo {
  height: 18px;
  width: auto;
  display: block;
}

.container {
  width: min(1140px, calc(100% - 48px));
  margin: 0 auto;
}

/* Header — dark: light text, white launcher pops on page */
.site-header {
  background:
    linear-gradient(180deg, rgba(8, 20, 39, 0.88) 0%, rgba(7, 26, 43, 0.70) 100%);
  border-bottom: 1px solid var(--bank-border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--bank-shadow);
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--bank-nav);
  font-weight: 700;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.brand-logo {
  display: block;
  max-height: 44px;
  width: auto;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(234, 242, 255, 0.14);
  padding: 8px;
  border-radius: 12px;
  box-sizing: border-box;
  image-rendering: -webkit-optimize-contrast;
  filter: saturate(1.05);
  transform: translateZ(0);
  backface-visibility: hidden;
}

.brand .brand-name {
  display: inline;
  font-family: var(--font-display);
}

.nav {
  display: flex;
  gap: 28px;
}

.nav a {
  color: color-mix(in srgb, var(--bank-text-muted) 92%, white 8%);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav a:hover {
  color: var(--bank-nav);
  background: rgba(255, 255, 255, 0.05);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-madeby {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.header-madeby-text {
  font-size: 0.75rem;
  color: var(--bank-text-muted);
  font-weight: 600;
}

.header-madeby .logo-on-white {
  padding: 7px 12px;
}

.header-madeby .isys-logo {
  height: 22px;
}

@media (max-width: 780px) {
  .header-madeby-text {
    display: none;
  }
}

.header-cta {
  color: #fff;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.35), rgba(34, 211, 238, 0.18));
  box-shadow: 0 14px 40px rgba(11, 95, 255, 0.14);
}

.header-cta:hover {
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.45), rgba(34, 211, 238, 0.22));
}

.env-pill {
  font-size: 0.75rem;
  color: var(--bank-text-muted);
  border: 1px solid rgba(234, 242, 255, 0.14);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

/* Promo carousel — bank promos from repo images/ folder, one at a time in series */
.promo-carousel {
  position: relative;
  width: 100%;
  max-height: 320px;
  overflow: hidden;
  background: var(--bank-bg-alt);
}

.promo-track {
  display: flex;
  width: 100%;
  max-height: 320px;
  transition: transform 0.5s ease-in-out;
}

.promo-slide {
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 320px;
  background: var(--bank-surface);
}

.promo-slide img {
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
  object-position: center;
  display: block;
  image-rendering: auto;
  filter: contrast(1.02);
  transform: translateZ(0);
}

.promo-dots {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}

.promo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s;
}

.promo-dot:hover {
  background: rgba(255, 255, 255, 0.7);
}

.promo-dot.active {
  background: var(--bank-primary);
  transform: scale(1.15);
}

/* Hero — dark gradient, decorative shapes, two-column with illustration */
.hero {
  position: relative;
  padding: 56px 0 64px;
  background:
    radial-gradient(900px 520px at 20% 18%, rgba(11, 95, 255, 0.22), transparent 60%),
    radial-gradient(860px 540px at 82% 22%, rgba(34, 211, 238, 0.18), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--bank-bg) 65%, #000 35%) 0%, var(--bank-bg) 60%);
  overflow: hidden;
}

.hero-bg-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.32;
}

.hero-blob-1 {
  width: 400px;
  height: 400px;
  background: var(--bank-primary);
  top: -120px;
  right: -80px;
  animation: hero-float 12s ease-in-out infinite;
}

.hero-blob-2 {
  width: 280px;
  height: 280px;
  background: var(--bank-primary-hover);
  bottom: -60px;
  left: -60px;
  animation: hero-float 14s ease-in-out infinite reverse;
  animation-delay: -3s;
}

.hero-blob-3 {
  width: 200px;
  height: 200px;
  background: var(--bank-primary);
  top: 40%;
  left: 30%;
  animation: hero-float 10s ease-in-out infinite;
  animation-delay: -5s;
}

@keyframes hero-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -15px) scale(1.05); }
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: center;
  max-width: 1100px;
}

.hero-content {
  min-width: 0;
}

.hero-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.hero-illustration {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 32 / 28;
}

.hero-illustration svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.headline {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(2.15rem, 4.2vw, 3.1rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--bank-text);
}

.subhead {
  margin: 0 0 28px;
  color: var(--bank-text-muted);
  max-width: 560px;
  font-size: 1.125rem;
  line-height: 1.55;
}

.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-icon {
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--bank-radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.22s ease, color 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  will-change: transform;
}

.btn-primary {
  background: linear-gradient(135deg, var(--bank-primary) 0%, color-mix(in srgb, var(--bank-primary) 72%, var(--apex-cyan) 28%) 100%);
  color: white;
  border: none;
  box-shadow: 0 10px 30px rgba(11, 95, 255, 0.22), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--bank-primary-hover) 0%, color-mix(in srgb, var(--bank-primary-hover) 70%, var(--apex-cyan-2) 30%) 100%);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 18px 55px rgba(11, 95, 255, 0.24), 0 1px 0 rgba(255, 255, 255, 0.10) inset;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--bank-nav);
  border: 1px solid rgba(234, 242, 255, 0.18);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

.btn-secondary:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(34, 211, 238, 0.35);
  color: white;
}

/* Trust bar */
.trust-bar {
  background: var(--bank-bg-alt);
  border-top: 1px solid var(--bank-border);
  border-bottom: 1px solid var(--bank-border);
  padding: 14px 0;
}

.trust-inner {
  display: flex;
  justify-content: center;
  gap: 32px;
  flex-wrap: wrap;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--bank-text-muted);
  font-weight: 500;
}

.trust-icon {
  flex-shrink: 0;
  color: var(--bank-primary);
  opacity: 0.9;
}

/* Stats bar */
.stats-bar {
  background: var(--bank-surface);
  border-bottom: 1px solid var(--bank-border);
  padding: 28px 0;
}

.stats-inner {
  display: flex;
  justify-content: space-around;
  gap: 24px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
  min-width: 100px;
}

.stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--bank-primary);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--bank-text-muted);
  font-weight: 500;
}

.header-lang {
  color: var(--bank-text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

.header-lang:hover {
  color: var(--bank-nav);
}

/* Currency rates bar */
.rates-bar {
  background: var(--bank-surface);
  border-bottom: 1px solid var(--bank-border);
  padding: 24px 0;
}

.rates-bar-title {
  margin: 0 0 8px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--bank-text);
}

.rates-bar-note {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  color: var(--bank-text-muted);
}

.rates-table-wrap {
  overflow-x: auto;
  border-radius: var(--bank-radius-sm);
  border: 1px solid var(--bank-border);
}

.rates-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.rates-table th,
.rates-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--bank-border);
}

.rates-table th {
  background: var(--bank-bg-alt);
  color: var(--bank-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rates-table tbody tr:last-child td {
  border-bottom: 0;
}

.rates-table td {
  color: var(--bank-text);
}

/* Tools section (Currency converter, IBAN, etc.) */
.tools-section {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--bank-border);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--bank-border);
  border-radius: var(--bank-radius);
  background: var(--bank-bg-alt);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tool-card:hover {
  border-color: var(--bank-primary);
  box-shadow: var(--bank-shadow);
}

.tool-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bank-text);
}

.tool-card p {
  margin: 0 0 12px;
  font-size: 0.875rem;
  color: var(--bank-text-muted);
  line-height: 1.5;
  flex: 1;
}

.tool-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bank-primary);
}

/* Chat CTA strip */
.chat-cta {
  padding: 24px 0;
  border-top: 1px solid var(--bank-border);
}

.chat-cta-inner {
  text-align: center;
}

.chat-cta-text {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--bank-text-muted);
}

.chat-cta-text strong {
  color: var(--bank-primary);
}

/* How it works */
.how-section {
  padding: 48px 0 40px;
  border-top: 1px solid var(--bank-border);
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
}

.how-item {
  padding: 20px 0;
  position: relative;
}

.how-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bank-primary), var(--bank-primary-hover));
  color: white;
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 14px;
}

.how-item h4 {
  margin: 0 0 10px;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--bank-text);
}

.how-item p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--bank-text-muted);
  line-height: 1.55;
}

/* Testimonials */
.testimonials-section {
  padding: 48px 0 40px;
  border-top: 1px solid var(--bank-border);
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.testimonial-card {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--bank-border);
  border-radius: var(--bank-radius);
  background: var(--bank-bg-alt);
  box-shadow: var(--bank-shadow);
}

.testimonial-text {
  margin: 0 0 16px;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--bank-text);
  font-style: italic;
}

.testimonial-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.testimonial-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--bank-text);
}

.testimonial-role {
  font-size: 0.8125rem;
  color: var(--bank-text-muted);
}

/* Security & trust */
.security-section {
  padding: 48px 0 40px;
  border-top: 1px solid var(--bank-border);
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.security-item {
  padding: 20px;
  border: 1px solid var(--bank-border);
  border-radius: var(--bank-radius);
  background: var(--bank-bg-alt);
}

.security-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.security-item h4 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--bank-text);
}

.security-item p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--bank-text-muted);
  line-height: 1.55;
}

/* Main content — product grid */
.main-content {
  padding: 48px 0 56px;
}

.section-title {
  margin: 0 0 28px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--bank-text);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.card {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--bank-border);
  border-radius: var(--bank-radius);
  background: var(--bank-bg-alt);
  box-shadow: var(--bank-shadow);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  box-shadow: var(--bank-shadow-lg);
  border-color: rgba(248, 250, 252, 0.2);
}

.card-product {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.card-product .card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--bank-radius-sm);
  background: linear-gradient(135deg, var(--bank-primary), var(--bank-primary-hover));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  margin-bottom: 16px;
}

.card-product h3 {
  margin: 0 0 10px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--bank-text);
}

.card-product p {
  margin: 0 0 16px;
  color: var(--bank-text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
  flex: 1;
}

.card-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--bank-primary);
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

.about-section {
  padding: 32px 0;
  border-top: 1px solid var(--bank-border);
}

.about-text {
  margin: 0;
  max-width: 720px;
  color: var(--bank-text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* Footer — darker strip, multi-column */
.site-footer {
  padding: 40px 0 24px;
  background: #070d18;
  color: #94a3b8;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-col h4 {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: 8px;
}

.footer-col a {
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
}

.footer-col a:hover {
  color: #f1f5f9;
}

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid rgba(248, 250, 252, 0.1);
}

.footer-text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ——— KAI launcher: premium floating action button ——— */
@keyframes kai-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes kai-glow-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.kai-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.95);
  background: #ffffff;
  padding: 0;
  overflow: visible;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  animation: kai-float 2.5s ease-in-out infinite;
  box-shadow:
    0 0 0 2px rgba(11, 95, 255, 0.35),
    0 0 24px rgba(11, 95, 255, 0.22),
    0 12px 40px rgba(2, 6, 23, 0.50);
}

.kai-launcher::before {
  content: "";
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 2px solid rgba(11, 95, 255, 0.40);
  pointer-events: none;
  animation: kai-glow-pulse 2s ease-in-out infinite;
}

.kai-launcher::after {
  content: "";
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(34, 211, 238, 1) 0deg, rgba(11, 95, 255, 1) 120deg, rgba(34, 211, 238, 1) 240deg, rgba(11, 95, 255, 1) 360deg);
  -webkit-mask: radial-gradient(circle, transparent 80%, black 80%);
  mask: radial-gradient(circle, transparent 80%, black 80%);
  pointer-events: none;
  z-index: -1;
  animation: kai-yellow-rotate 3s linear infinite;
  opacity: 0.55;
}

@keyframes kai-yellow-rotate {
  to { transform: rotate(360deg); }
}

.kai-launcher:hover {
  animation: none;
  transform: scale(1.08) translateY(-2px);
  border-color: #ffffff;
  box-shadow:
    0 0 0 3px rgba(11, 95, 255, 0.42),
    0 0 32px rgba(11, 95, 255, 0.28),
    0 16px 55px rgba(2, 6, 23, 0.55);
}

.kai-launcher:hover::before {
  opacity: 0.8;
  animation: none;
}

.kai-launcher:focus {
  outline: none;
  animation: none;
  box-shadow:
    0 0 0 3px rgba(11, 95, 255, 0.35),
    0 0 28px rgba(11, 95, 255, 0.22),
    0 12px 40px rgba(2, 6, 23, 0.50);
}

/* Sharper rendering for KAI launcher logo image */
.kai-launcher-img {
  image-rendering: -webkit-optimize-contrast;
  filter: contrast(1.05);
  transform: translateZ(0);
  backface-visibility: hidden;
}

.kai-launcher-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  padding: 2px;
  box-sizing: border-box;
  object-position: center;
}

/* Chat panel */
.kai-panel {
  /* Opaque dark theme defaults (avoid see-through panel) */
  /* Slightly lighter + simpler dark palette */
  --surface: #111827;   /* header / top surfaces */
  --surface-2: #0f172a; /* main panel body */
  --text: #e5e7eb;
  --text-muted: rgba(229, 231, 235, 0.72);
  --border: rgba(148, 163, 184, 0.22);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 22px 70px rgba(2, 6, 23, 0.45);

  position: fixed;
  right: 24px;
  bottom: 98px;
  z-index: 9999;
  width: min(520px, calc(100% - 48px));
  height: min(90vh, 880px);
  max-height: calc(100vh - 118px);
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: none;
  isolation: isolate;
}

/* Subtle neon aurora inside the widget panel (scoped) */
.kai-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(520px 320px at 18% 8%, rgba(34, 211, 238, 0.12), transparent 60%),
    radial-gradient(520px 360px at 82% 22%, rgba(47, 123, 255, 0.14), transparent 60%);
  opacity: 0.55;
  mix-blend-mode: normal;
  z-index: 0;
}

.kai-panel > * { position: relative; z-index: 1; }

@media (prefers-reduced-motion: no-preference) {
  .kai-panel::before {
    animation: kai-aurora-shift 12s ease-in-out infinite alternate;
  }
  @keyframes kai-aurora-shift {
    0% { transform: translate3d(0, 0, 0) scale(1); filter: blur(0px); }
    100% { transform: translate3d(0, -10px, 0) scale(1.02); filter: blur(0.5px); }
  }
}

/* Widget attribution footer */
.kai-attrib {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-muted);
  font-size: 0.6875rem;
}

.kai-panel[data-theme="light"] .kai-attrib {
  background: rgba(255, 255, 255, 0.92);
}

.kai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.kai-header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Widget header logo (use crisp badge for CBE mark) */
.kai-header-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: #ffffff;
  padding: 4px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  box-sizing: border-box;
  object-position: center 14%;
}

.kai-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.kai-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.kai-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kai-icon-btn {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 700;
}

.kai-theme-toggle {
  width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kai-theme-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* Chat theme: scoped to panel only (won't affect the page) */
.kai-panel[data-theme="light"] {
  /* Light theme: use a subtle tinted surface (not pure white) */
  --surface: rgba(243, 247, 255, 0.94);
  --surface-2: #eef5ff;
  --text: #071a2b;
  --text-muted: rgba(7, 26, 43, 0.72);
  /* Add a visible colored outline for the widget */
  --border: rgba(47, 123, 255, 0.38);
  --primary: var(--apex-blue);
  --shadow: 0 1px 0 rgba(255,255,255,0.1), 0 20px 45px rgba(2, 6, 23, 0.18);
}

.kai-panel[data-theme="light"] .kai-header {
  background: var(--surface);
}

.kai-panel[data-theme="light"] .kai-title {
  color: var(--text);
}

.kai-panel[data-theme="light"] .kai-subtitle {
  color: var(--text-muted);
}

.kai-panel[data-theme="light"] .kai-body {
  background: var(--surface-2);
}

/* Light mode: make circular logos distinct on white surfaces */
.kai-panel[data-theme="light"] .kai-header-logo {
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.kai-panel[data-theme="light"] .kai-msg-avatar {
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.kai-panel[data-theme="light"] .kai-chat-input {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(47, 123, 255, 0.22);
  color: var(--text);
}

.kai-panel[data-theme="light"] .kai-icon-btn,
.kai-panel[data-theme="light"] .kai-close {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(47, 123, 255, 0.18);
  color: var(--text);
}

.kai-panel[data-theme="light"] .kai-icon-btn:hover,
.kai-panel[data-theme="light"] .kai-close:hover {
  background: rgba(47, 123, 255, 0.10);
}

.kai-panel[data-theme="light"] .kai-msg-bubble {
  background: rgba(255, 255, 255, 0.74);
  border-color: rgba(47, 123, 255, 0.18);
}

.kai-panel[data-theme="light"] .kai-msg-row.assistant .kai-msg-bubble {
  background: rgba(255, 255, 255, 0.74);
}

.kai-panel[data-theme="light"] .kai-msg-text {
  color: var(--text);
}

.kai-panel[data-theme="light"] .kai-msg-meta {
  color: var(--text-muted);
}

.kai-panel[data-theme="light"] .kai-msg-action {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #334155;
}

.kai-panel[data-theme="light"] .kai-msg-action:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.kai-panel[data-theme="light"] .kai-msg-row.user .kai-msg-bubble {
  background: var(--bank-primary);
  border-color: var(--bank-primary);
}

.kai-panel[data-theme="light"] .kai-msg-row.user .kai-msg-text,
.kai-panel[data-theme="light"] .kai-msg-row.user .kai-msg-meta {
  color: #ffffff;
}

.kai-panel[data-theme="light"] .kai-msg-row.user .kai-msg-action {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.kai-panel[data-theme="light"] .kai-msg-row.user .kai-msg-action:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Light mode: keep voice button dark on hover (avoid base .kai-btn:hover wash-out) */
.kai-panel[data-theme="light"] .kai-btn-primary .kai-icon {
  color: #fff;
}

.kai-panel[data-theme="light"] .kai-btn.kai-btn-voice:hover {
  background: #0f172a;
  border-color: rgba(15, 23, 42, 0.18);
  color: #ffffff;
}

.kai-panel[data-theme="light"] .kai-voice-view {
  background: var(--surface-2);
}

.kai-panel[data-theme="light"] .kai-voice-top {
  background: var(--surface);
}

.kai-panel[data-theme="light"] .kai-voice-transcript-head {
  background: rgba(15, 23, 42, 0.03);
}

.kai-panel[data-theme="light"] .kai-voice-transcript {
  background: #ffffff;
}

.kai-panel[data-theme="light"] .kai-voice-transcript-line {
  color: var(--text);
  border-color: #e2e8f0;
}

.kai-panel[data-theme="light"] .kai-voice-transcript-line .label {
  color: var(--text-muted);
}

.kai-panel[data-theme="light"] .kai-voice-transcript-line.user {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.kai-panel[data-theme="light"] .kai-voice-transcript-line.user .label {
  color: rgba(255, 255, 255, 0.85);
}

.kai-panel[data-theme="light"] .kai-voice-transcript-line.assistant {
  background: #ffffff;
  border-color: #e2e8f0;
  color: var(--text);
}

.kai-icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.kai-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
}

.kai-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.kai-body {
  padding: 8px 12px 10px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-2);
}

.kai-chat-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.kai-chat-view[hidden],
.kai-voice-view[hidden],
.kai-avatar-view[hidden] {
  display: none !important;
}

.kai-voice-view {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.kai-voice-top {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.kai-voice-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.kai-voice-mic-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  display: block;
  position: relative;
  color: var(--text-muted);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.kai-voice-mic-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3z'/%3E%3Cpath fill='black' d='M19 11a7 7 0 0 1-14 0h2a5 5 0 0 0 10 0h2z'/%3E%3Cpath fill='black' d='M12 18v3h-2v-3h2z'/%3E%3Cpath fill='black' d='M8 21h8v2H8z'/%3E%3C/svg%3E") no-repeat center / 22px 22px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M12 14a3 3 0 0 0 3-3V6a3 3 0 0 0-6 0v5a3 3 0 0 0 3 3z'/%3E%3Cpath fill='black' d='M19 11a7 7 0 0 1-14 0h2a5 5 0 0 0 10 0h2z'/%3E%3Cpath fill='black' d='M12 18v3h-2v-3h2z'/%3E%3Cpath fill='black' d='M8 21h8v2H8z'/%3E%3C/svg%3E") no-repeat center / 22px 22px;
}

.kai-voice-indicator[data-state="listening"] .kai-voice-mic-icon {
  background: rgba(59, 130, 246, 0.2);
  border-color: var(--primary);
  color: var(--primary);
}

.kai-voice-indicator[data-state="processing"] .kai-voice-mic-icon {
  background: rgba(148, 163, 184, 0.2);
  border-color: var(--text-muted);
  color: var(--text-muted);
}

.kai-voice-indicator[data-state="speaking"] .kai-voice-mic-icon {
  background: rgba(16, 185, 129, 0.2);
  border-color: var(--success);
  color: var(--success);
}

.kai-voice-state {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.kai-voice-actions {
  display: flex;
  gap: 8px;
}

.kai-btn-secondary-small {
  height: 32px;
  padding: 0 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
}

.kai-btn-secondary-small:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* (moved) .kai-btn-icon styles are defined near the chat input controls */

.kai-voice-transcript-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px;
}

.kai-voice-transcript-head {
  flex: 0 0 auto;
  padding: 10px 10px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: rgba(255,255,255,0.03);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.kai-voice-transcript {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.9375rem;
  line-height: 1.5;
  border: 1px solid var(--border);
  border-radius: 0 0 12px 12px;
  background: rgba(0,0,0,0.18);
}

.kai-voice-transcript-line {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.kai-voice-transcript-line.user {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.2);
  align-self: flex-end;
  max-width: 90%;
}

.kai-voice-transcript-line.assistant {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  max-width: 90%;
}

.kai-voice-transcript-line.partial {
  opacity: 0.8;
  border-style: dashed;
}

.kai-voice-transcript-line .label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.kai-chat-history {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 2px 8px;
}

.kai-chat-history::-webkit-scrollbar {
  width: 8px;
}

.kai-chat-history::-webkit-scrollbar-thumb {
  background: rgba(248, 250, 252, 0.12);
  border-radius: 999px;
}

.kai-chat-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  position: relative;
}

.kai-chat-form::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.35), rgba(47, 123, 255, 0.25), transparent);
  opacity: 0.9;
}

.kai-form-extra {
  width: 100%;
  flex-basis: 100%;
  margin-top: -4px;
}
.kai-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.kai-attachment {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.10);
  color: var(--text);
  font-size: 0.75rem;
}
.kai-attachment-name {
  max-width: min(230px, 70vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kai-attachment-remove {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  cursor: pointer;
  line-height: 1;
}
.kai-upload-request {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}
.kai-upload-request-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.kai-upload-request-hint {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-bottom: 12px;
}
.kai-upload-request-btn {
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.98), rgba(34, 211, 238, 0.72));
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}
.kai-upload-request-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.kai-link.kai-new-topic-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}
.kai-link.kai-new-topic-btn:hover { color: var(--primary); }
.kai-link.kai-new-topic-btn[aria-pressed="true"] { color: var(--primary); }

.kai-chat-input {
  flex: 1;
  min-height: 38px;
  max-height: 140px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(234, 242, 255, 0.14);
  background:
    radial-gradient(520px 180px at 20% 20%, rgba(34, 211, 238, 0.08), transparent 55%),
    rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 18px 55px rgba(2, 6, 23, 0.18);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}

.kai-chat-input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
  transform: translateY(-1px);
}

.kai-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.875rem;
  transition: transform 0.18s ease, filter 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.kai-btn-icon-only {
  width: 44px;
  min-width: 44px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kai-btn-icon-only .kai-icon {
  width: 22px;
  height: 22px;
}

.kai-btn-icon {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 12px;
}

.kai-btn-icon .kai-icon {
  width: 22px;
  height: 22px;
}

.kai-btn-voice {
  border-radius: 999px;
  background: #0b0f1a;
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.kai-btn.kai-btn-voice:hover {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.22);
}

.kai-btn-voice:disabled {
  opacity: 0.55;
}

.kai-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.kai-btn-primary {
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.95), rgba(34, 211, 238, 0.65));
  border-color: rgba(34, 211, 238, 0.22);
  color: #ffffff;
  box-shadow: 0 18px 55px rgba(11, 95, 255, 0.18);
}

/* After .kai-btn:hover so primary send keeps a visible gradient (not chat-surface wash-out). */
.kai-btn.kai-btn-primary:hover,
.kai-btn.kai-btn-primary:focus-visible {
  background: linear-gradient(135deg, #2563eb 0%, #22d3ee 100%);
  border-color: rgba(103, 246, 255, 0.55);
  color: #ffffff;
  filter: none;
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(11, 95, 255, 0.42);
}

.kai-panel[data-theme="light"] .kai-btn.kai-btn-primary:hover,
.kai-panel[data-theme="light"] .kai-btn.kai-btn-primary:focus-visible {
  background: linear-gradient(135deg, #0b5fff 0%, #06b6d4 100%);
  border-color: rgba(11, 95, 255, 0.55);
  color: #ffffff;
  box-shadow: 0 10px 26px rgba(11, 95, 255, 0.34);
}

.kai-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.kai-btn[aria-busy="true"] {
  position: relative;
  padding-right: 36px;
}

.kai-btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  animation: kai-spin 0.8s linear infinite;
}

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

/* Source badge (Orchestrate direct) */
.kai-msg-source-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  background: linear-gradient(135deg, #0f62fe 0%, #0043ce 100%);
  color: white;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: help;
}

/* Message rows: avatar + content (KAI logo for assistant) */
.kai-msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  max-width: 95%;
  min-width: 0;
}

.kai-msg-row.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.kai-msg-row.assistant {
  align-self: flex-start;
}

/* Avatar: full logo visible in circle (same as launcher – contain, not zoom/crop) */
.kai-msg-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  padding: 3px;
  box-sizing: border-box;
}

.kai-msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.kai-msg-row.user .kai-msg-avatar {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  font-size: 0.7rem;
  font-weight: 800;
}

.kai-msg-row.user .kai-msg-avatar img {
  display: none;
}

.kai-msg-bubble {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  background:
    radial-gradient(560px 220px at 20% 10%, rgba(34, 211, 238, 0.10), transparent 55%),
    radial-gradient(520px 220px at 90% 30%, rgba(47, 123, 255, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.045);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 18px 55px rgba(2, 6, 23, 0.22),
    0 0 24px rgba(34, 211, 238, 0.06);
  backdrop-filter: blur(8px);
}

.kai-msg-row.user .kai-msg-bubble {
  background:
    radial-gradient(540px 220px at 20% 0%, rgba(103, 246, 255, 0.16), transparent 55%),
    linear-gradient(135deg, rgba(47, 123, 255, 0.22), rgba(34, 211, 238, 0.10));
  border-color: rgba(34, 211, 238, 0.22);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.10) inset,
    0 18px 55px rgba(2, 6, 23, 0.20),
    0 0 30px rgba(47, 123, 255, 0.14);
}

.kai-msg-row.assistant .kai-msg-bubble {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(234, 242, 255, 0.14);
}

.kai-msg-row.assistant .kai-msg-bubble {
  position: relative;
}
.kai-msg-row.assistant .kai-msg-bubble::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(47, 123, 255, 0.16), rgba(34, 211, 238, 0.12));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: -1;
  filter: blur(10px);
}
.kai-msg-row.assistant:hover .kai-msg-bubble::before {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  @keyframes msg-in {
    from { opacity: 0; transform: translateY(10px) scale(0.99); filter: blur(1px); }
    to { opacity: 1; transform: translateY(0) scale(1); filter: blur(0px); }
  }
  .kai-msg-row {
    animation: msg-in 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
}

.kai-msg-row.error .kai-msg-bubble {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
}

.kai-msg-meta {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.kai-msg-text {
  white-space: normal;
  line-height: 1.45;
  font-size: 0.9375rem;
  color: var(--text);
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Markdown styling inside bubbles */
.kai-msg-text p { margin: 0 0 10px; }
.kai-msg-text p:last-child { margin-bottom: 0; }
.kai-msg-text h1, .kai-msg-text h2, .kai-msg-text h3, .kai-msg-text h4 {
  margin: 0 0 10px;
  line-height: 1.2;
}
.kai-msg-text h1 { font-size: 1.1rem; }
.kai-msg-text h2 { font-size: 1.05rem; }
.kai-msg-text h3 { font-size: 1.0rem; }
.kai-msg-text h4 { font-size: 0.95rem; }
.kai-msg-text ul, .kai-msg-text ol { margin: 6px 0 10px 18px; padding: 0; }
.kai-msg-text li { margin: 4px 0; }
.kai-msg-text a { color: var(--accent); text-decoration: underline; }
.kai-msg-text blockquote {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  color: var(--text-muted);
}
.kai-msg-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.875em;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
}
.kai-msg-text pre {
  margin: 10px 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.25);
  overflow: auto;
}
.kai-msg-text pre code { background: transparent; border: 0; padding: 0; }

.kai-msg-text, .kai-voice-transcript-line { direction: auto; unicode-bidi: plaintext; }
.kai-msg-text[dir="rtl"] { text-align: right; }
.kai-msg-text[dir="rtl"] ul,
.kai-msg-text[dir="rtl"] ol { margin-left: 0; margin-right: 18px; }
.kai-msg-text[dir="rtl"] blockquote { border-left: 0; border-right: 3px solid rgba(255,255,255,0.18); }
.kai-panel[data-theme="light"] .kai-msg-text[dir="rtl"] blockquote { border-right-color: rgba(15,23,42,0.18); }

.kai-msg-text .md-table {
  margin: 12px 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.kai-msg-text .md-table::-webkit-scrollbar { height: 6px; }
.kai-msg-text .md-table::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

.kai-msg-text table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  min-width: max-content;
  font-size: 0.875rem;
  line-height: 1.45;
}

.kai-msg-text th,
.kai-msg-text td {
  text-align: start;
  vertical-align: middle;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  border-inline-end: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  white-space: nowrap;
}

.kai-msg-text th:last-child,
.kai-msg-text td:last-child { border-inline-end: 0; }

.kai-msg-text tbody tr:last-child td { border-bottom: 0; }

.kai-msg-text th {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-strong, #f8fafc);
  background: rgba(255, 255, 255, 0.08);
  text-transform: none;
}

.kai-msg-text tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}

.kai-msg-text tbody tr:hover td {
  background: rgba(255, 255, 255, 0.05);
}

.kai-msg-text .md-table[dir="rtl"] {
  direction: rtl;
}
.kai-msg-text .md-table[dir="rtl"] th,
.kai-msg-text .md-table[dir="rtl"] td {
  text-align: right;
  font-family: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
}

/* Allow wrapping for cells that contain mostly Arabic prose so labels don't force wide tables */
.kai-msg-text .md-table[dir="rtl"] td:first-child,
.kai-msg-text .md-table[dir="rtl"] th:first-child {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.kai-msg-text hr.md-hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 12px 0;
  opacity: 0.7;
}

/* Google Maps embed (assistant messages) */
.kai-map-card {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.18);
}
.kai-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.kai-map-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.kai-map-open {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: underline;
}
.kai-map-status {
  padding: 10px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.kai-map-iframe {
  width: 100%;
  height: 240px;
  border: 0;
  display: block;
  background: transparent;
}

.kai-panel[data-theme="light"] .kai-map-card {
  background: rgba(15, 23, 42, 0.02);
}
.kai-panel[data-theme="light"] .kai-map-open {
  color: var(--primary);
}

.kai-panel[data-theme="light"] .kai-msg-text .md-table {
  border-color: #e2e8f0;
  background: #fff;
}

.kai-panel[data-theme="light"] .kai-msg-text th,
.kai-panel[data-theme="light"] .kai-msg-text td {
  border-bottom-color: #e2e8f0;
  border-inline-end-color: #e2e8f0;
}

.kai-panel[data-theme="light"] .kai-msg-text th {
  background: #f1f5f9;
  color: #0f172a;
}

.kai-panel[data-theme="light"] .kai-msg-text tbody tr:nth-child(even) td {
  background: rgba(15,23,42,0.025);
}

.kai-panel[data-theme="light"] .kai-msg-text tbody tr:hover td {
  background: rgba(15,23,42,0.05);
}

.kai-panel[data-theme="light"] .kai-msg-text hr.md-hr {
  background: #e2e8f0;
}

.kai-panel[data-theme="light"] .kai-msg-text a { color: var(--primary); }
.kai-panel[data-theme="light"] .kai-msg-text blockquote {
  border-left-color: rgba(15,23,42,0.18);
  background: rgba(15,23,42,0.03);
  color: var(--text-muted);
}
.kai-panel[data-theme="light"] .kai-msg-text code { background: rgba(15,23,42,0.03); }
.kai-panel[data-theme="light"] .kai-msg-text pre { background: rgba(15,23,42,0.04); }

.kai-msg-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.kai-msg-action {
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 700;
}

.kai-msg-action:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.kai-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.kai-dots {
  display: inline-flex;
  gap: 4px;
}

.kai-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: kai-bounce 1.2s infinite ease-in-out;
}

.kai-dot:nth-child(2) { animation-delay: 0.15s; }
.kai-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes kai-bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
  40% { transform: translateY(-4px); opacity: 1; }
}

details.kai-artifacts {
  margin-top: 10px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

details.kai-artifacts summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.kai-thinking-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.kai-thinking-list li {
  margin: 6px 0;
}

/* Like / unlike feedback under assistant messages */
.kai-msg-feedback {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.kai-msg-feedback-label { flex-shrink: 0; }
.kai-msg-feedback-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.8;
  transition: opacity 0.15s, background 0.15s, border-color 0.15s;
}
.kai-msg-feedback-btn:hover {
  opacity: 1;
  background: rgba(255,255,255,0.06);
  border-color: var(--text-muted);
}
.kai-msg-feedback-btn.selected {
  opacity: 1;
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.5);
}
.kai-msg-feedback-unlike.selected {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
}

.kai-msg-feedback-comment-wrap {
  display: none;
  margin-top: 8px;
}
.kai-msg-feedback-comment-wrap.visible {
  display: block;
}
.kai-msg-feedback-comment-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.kai-msg-feedback-comment-subtext {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.kai-msg-feedback-comment {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  resize: vertical;
  min-height: 56px;
  margin-bottom: 8px;
}
.kai-msg-feedback-comment::placeholder {
  color: var(--text-muted);
}
.kai-msg-feedback-comment:focus {
  outline: none;
  border-color: var(--text-muted);
}
.kai-msg-feedback-comment-btns {
  display: flex;
  gap: 8px;
}
.kai-msg-feedback-comment-btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.kai-msg-feedback-comment-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--text-muted);
}
.kai-msg-feedback-comment-submit {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.kai-msg-feedback-comment-submit:hover {
  filter: brightness(1.1);
}
.kai-msg-feedback-comment-cancel {
  background: transparent;
}
.kai-msg-feedback-comment-cancel:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
}

.kai-error {
  margin-top: 12px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 0.8125rem;
}

/* Empty state */
.kai-empty {
  margin: auto 0;
  padding: 18px 16px;
  border: 1px solid rgba(234, 242, 255, 0.14);
  border-radius: 18px;
  background:
    radial-gradient(520px 220px at 20% 0%, rgba(103, 246, 255, 0.14), transparent 55%),
    radial-gradient(520px 240px at 90% 40%, rgba(47, 123, 255, 0.14), transparent 55%),
    rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 0.9375rem;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.08) inset,
    0 26px 90px rgba(2, 6, 23, 0.28),
    0 0 40px rgba(34, 211, 238, 0.06);
  backdrop-filter: blur(10px);
}

.kai-welcome-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background: rgba(7, 26, 43, 0.35);
  color: rgba(234, 242, 255, 0.9);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  box-shadow: 0 0 26px rgba(34, 211, 238, 0.10);
}

.kai-empty-title {
  font-family: var(--font-display);
  font-weight: 800;
  margin-bottom: 8px;
  background: linear-gradient(90deg, rgba(234, 242, 255, 1), rgba(103, 246, 255, 0.9), rgba(47, 123, 255, 0.9));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}

.kai-empty-welcome {
  margin-bottom: 8px;
  line-height: 1.5;
}

/* Arabic welcome: start from the right */
.kai-welcome[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

.kai-welcome[dir="rtl"] .kai-welcome-badge {
  align-self: flex-end;
}

.kai-empty-powered {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 12px;
}

.kai-welcome-actions {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid rgba(234, 242, 255, 0.12);
  border-radius: 16px;
  background: rgba(7, 26, 43, 0.26);
  box-shadow: 0 14px 45px rgba(2, 6, 23, 0.18);
}

.kai-welcome-actions-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: rgba(234, 242, 255, 0.94);
  font-weight: 800;
}

.kai-welcome-actions-head small {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.kai-welcome-topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.kai-welcome-topic {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(234, 242, 255, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.025)),
    rgba(7, 26, 43, 0.28);
  color: rgba(234, 242, 255, 0.94);
  text-align: right;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.kai-welcome-topic:hover,
.kai-welcome-topic.is-active {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--topic-accent) 58%, rgba(234, 242, 255, 0.16));
  box-shadow: 0 12px 34px color-mix(in srgb, var(--topic-accent) 20%, transparent);
}

.kai-welcome-topic.is-active {
  background:
    radial-gradient(180px 80px at 100% 0%, color-mix(in srgb, var(--topic-accent) 24%, transparent), transparent 64%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.035));
}

.kai-welcome-topic strong,
.kai-welcome-topic small {
  display: block;
}

.kai-welcome-topic strong {
  font-size: 0.86rem;
  line-height: 1.3;
}

.kai-welcome-topic small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.68rem;
}

.kai-welcome-topic-dot {
  width: 8px;
  height: 34px;
  border-radius: 999px;
  background: var(--topic-accent);
  box-shadow: 0 0 22px color-mix(in srgb, var(--topic-accent) 55%, transparent);
  flex: 0 0 auto;
}

.kai-welcome-topic.is-red { --topic-accent: #ef4444; }
.kai-welcome-topic.is-blue { --topic-accent: #38bdf8; }
.kai-welcome-topic.is-green { --topic-accent: #22c55e; }
.kai-welcome-topic.is-yellow { --topic-accent: #facc15; }

.kai-welcome-prompt-panels {
  margin-top: 10px;
}

.kai-welcome-prompts[hidden] {
  display: none !important;
}

.kai-welcome-prompts {
  padding: 10px;
  border: 1px solid rgba(234, 242, 255, 0.10);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.kai-welcome-prompts-title {
  margin-bottom: 8px;
  color: rgba(234, 242, 255, 0.9);
  font-size: 0.8rem;
  font-weight: 800;
}

.kai-welcome-prompt-list {
  display: grid;
  gap: 7px;
}

.kai-welcome-prompt {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid rgba(34, 211, 238, 0.17);
  border-radius: 11px;
  background: rgba(2, 6, 23, 0.18);
  color: rgba(234, 242, 255, 0.9);
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.45;
  text-align: right;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.kai-welcome-prompt:hover {
  transform: translateX(-2px);
  border-color: rgba(34, 211, 238, 0.42);
  background: rgba(34, 211, 238, 0.10);
}

/* Widget light theme: keep welcome title readable and less "washed out" */
.kai-panel[data-theme="light"] .kai-empty {
  border-color: rgba(15, 23, 42, 0.12);
  background:
    radial-gradient(520px 220px at 20% 0%, rgba(34, 211, 238, 0.12), transparent 55%),
    radial-gradient(520px 240px at 90% 40%, rgba(47, 123, 255, 0.10), transparent 55%),
    rgba(255, 255, 255, 0.92);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.9) inset,
    0 26px 90px rgba(2, 6, 23, 0.14),
    0 0 40px rgba(34, 211, 238, 0.06);
}

.kai-panel[data-theme="light"] .kai-welcome-badge {
  background: rgba(15, 23, 42, 0.06);
  color: rgba(7, 26, 43, 0.86);
  border-color: rgba(34, 211, 238, 0.28);
}

.kai-panel[data-theme="light"] .kai-empty-title {
  background: none;
  -webkit-background-clip: initial;
  background-clip: initial;
  color: #071a2b;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
}

.kai-panel[data-theme="light"] .kai-welcome-actions {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.72);
}

.kai-panel[data-theme="light"] .kai-welcome-actions-head {
  color: #071a2b;
}

.kai-panel[data-theme="light"] .kai-welcome-topic {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.84);
  color: #071a2b;
}

.kai-panel[data-theme="light"] .kai-welcome-prompts {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.82);
}

.kai-panel[data-theme="light"] .kai-welcome-prompts-title {
  color: #071a2b;
}

.kai-panel[data-theme="light"] .kai-welcome-prompt {
  border-color: rgba(15, 23, 42, 0.10);
  background: rgba(241, 247, 255, 0.92);
  color: #0f172a;
}

.kai-panel[data-theme="light"] .kai-welcome-prompt:hover {
  border-color: rgba(15, 96, 168, 0.34);
  background: rgba(224, 242, 254, 0.9);
}

@media (max-width: 768px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 32px;
    text-align: center;
  }

  .hero-content {
    order: 0;
  }

  .hero-visual {
    order: 1;
  }

  .hero-illustration {
    max-width: 260px;
    margin: 0 auto;
  }

  .hero-cta {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
  }

  .hero-blob {
    opacity: 0.2;
  }

  .trust-inner {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .stats-inner {
    gap: 20px;
    justify-content: center;
  }

  .stat-value {
    font-size: 1.5rem;
  }
}

@media (max-width: 640px) {
  .nav {
    display: none;
  }

  .header-cta {
    font-size: 0.8125rem;
  }

  .kai-panel {
    left: 12px;
    right: 12px;
    bottom: 86px;
    width: auto;
    height: calc(100vh - 102px);
    max-height: calc(100vh - 102px);
  }

  .kai-launcher {
    right: 16px;
    bottom: 16px;
    width: 60px;
    height: 60px;
  }
}

/* ——— KAI widget: avatar view (same size as chat area, replaces chat when Avatar is used) ——— */
.kai-avatar-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
}

.kai-panel[data-theme="light"] .kai-avatar-view {
  background: var(--surface-2);
}

.kai-avatar-view-bar {
  flex-shrink: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kai-avatar-back-btn {
  padding: 8px 12px;
  font-size: 0.8125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  cursor: pointer;
}

.kai-avatar-back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Avatar STT language toggle (widget + embed) */
.kai-avatar-view-bar .avatar-stt-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(234, 242, 255, 0.14);
  background: rgba(7, 26, 43, 0.25);
  backdrop-filter: blur(10px);
}
.kai-avatar-view-bar .avatar-stt-lang-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 8px 0 10px;
  user-select: none;
  white-space: nowrap;
}
.kai-avatar-view-bar .avatar-stt-lang-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(234, 242, 255, 0.88);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}
.kai-avatar-view-bar .avatar-stt-lang-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(34, 211, 238, 0.22);
}
.kai-avatar-view-bar .avatar-stt-lang-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, rgba(11, 95, 255, 0.85), rgba(34, 211, 238, 0.45));
  border-color: rgba(34, 211, 238, 0.28);
  color: #ffffff;
  filter: saturate(1.08);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12);
}
.kai-avatar-view-bar .avatar-stt-lang-btn:active { transform: translateY(0px); }

.kai-panel[data-theme="light"] .kai-avatar-view-bar .avatar-stt-lang {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(15, 23, 42, 0.12);
}
.kai-panel[data-theme="light"] .kai-avatar-view-bar .avatar-stt-lang-label {
  color: rgba(7, 26, 43, 0.72);
}
.kai-panel[data-theme="light"] .kai-avatar-view-bar .avatar-stt-lang-btn {
  color: rgba(7, 26, 43, 0.86);
}

.kai-avatar-view-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 16px 20px;
  background: var(--surface-2);
}

.kai-avatar-player-area {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
  align-self: stretch;
  background: var(--surface-2);
}

#kai-avatar-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--surface-2);
}

#kai-avatar-player video {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.kai-avatar-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    radial-gradient(700px 360px at 18% 25%, rgba(11, 95, 255, 0.22), transparent 60%),
    radial-gradient(700px 360px at 84% 35%, rgba(34, 211, 238, 0.16), transparent 60%),
    rgba(7, 26, 43, 0.65);
  color: var(--text-muted);
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.kai-avatar-loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(234, 242, 255, 0.22);
  border-top-color: rgba(34, 211, 238, 0.85);
  border-right-color: rgba(11, 95, 255, 0.85);
  animation: apex-spin 0.9s linear infinite;
}

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

.kai-avatar-loading[hidden] {
  display: none !important;
}

.kai-avatar-mic-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-shrink: 0;
  margin-top: 8px;
}

.kai-avatar-mic {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.15s;
  flex-shrink: 0;
}

.kai-avatar-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-width: 5em;
}

.kai-avatar-mic:hover:not(:disabled) {
  opacity: 0.9;
  transform: scale(1.05);
}

.kai-avatar-mic:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.kai-avatar-mic.listening {
  animation: kai-avatar-pulse 1.2s ease-in-out infinite;
}

@keyframes kai-avatar-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(35, 55, 138, 0.5); }
  50% { box-shadow: 0 0 0 14px rgba(35, 55, 138, 0); }
}

/* CBE launch: hide avatar/voice entry points — remove this block and `hidden` on buttons to re-enable. */
#kai-avatar-btn,
#kai-voice-btn {
  display: none !important;
}
