/* ─── Nivisha Page Variables ─── */
:root {
  --niv-grad: linear-gradient(135deg, #3673F7 0%, #6A4CF6 50%, #9C5BFF 100%);
  --niv-grad-soft: linear-gradient(135deg, rgba(54,115,247,.08), rgba(156,91,255,.08));
  --blue-accent: #3673F7;
  --purple-accent: #7C5CFF;
  --text-mute: #8394BA;
  --grey-line: #E7EAF2;
  --grey-soft: #615D70;
  --bg-soft: #F7F8FB;
  --r-pill: 999px;
  --niv-header-height: 64px;
  --shadow-card: 0 12px 40px rgba(45,66,111,.08);
  --shadow-pop: 0 24px 80px rgba(45,66,111,.18);
}

@keyframes niv-swirl { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes niv-breathe {
  0%,100% { transform: scale(1); box-shadow: 0 6px 18px rgba(108,76,246,.35); }
  50% { transform: scale(1.08); box-shadow: 0 10px 30px rgba(108,76,246,.55); }
}
@keyframes niv-msg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes niv-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ─── Layout ─── */
body {
  overflow: hidden;
  height: 100vh;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(124,92,255,.06), transparent 60%),
    radial-gradient(80% 60% at 100% 100%, rgba(54,115,247,.04), transparent 70%),
    #FAFBFE;
}

/* ─── Header ─── */
.niv-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--niv-header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--grey-line);
  gap: 16px;
}

.niv-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.niv-logo-link { display: flex; align-items: center; flex-shrink: 0; }
.niv-logo { height: 33px; width: auto; display: block; }

.niv-header-pipe {
  width: 1px;
  height: 28px;
  background: var(--grey-line);
  flex-shrink: 0;
}

.niv-header-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.niv-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--grey);
  line-height: 1.2;
  letter-spacing: -.01em;
}
.niv-brand-sub {
  font-size: 8px;
  color: var(--text-mute);
  font-weight: 500;
  line-height: 1.2;
}

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

.niv-header-vsep {
  width: 1px;
  height: 20px;
  background: var(--grey-line);
  flex-shrink: 0;
}

.niv-access-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 16px;
  border-radius: var(--r-pill);
  border: 1.5px solid rgba(124,92,255,.5);
  background: rgba(124,92,255,.06);
  color: var(--purple-accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all .2s;
}
.niv-access-btn:hover {
  background: rgba(124,92,255,.12);
  border-color: var(--purple-accent);
  color: var(--purple-accent);
}

/* ─── Loading spinner ─── */
.niv-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid;
  border-radius: 50%;
  animation: niv-spin .65s linear infinite;
  flex-shrink: 0;
  vertical-align: middle;
}
@keyframes niv-spin {
  to { transform: rotate(360deg); }
}

.niv-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--grey-line);
  background: white;
  display: grid;
  place-items: center;
  color: var(--text-mute);
  font-size: 18px;
  line-height: 1;
  text-decoration: none;
  flex-shrink: 0;
  transition: all .2s;
}
.niv-close-btn:hover { border-color: var(--grey); color: var(--grey); background: var(--bg-soft); }

/* ─── Counter ─── */
.niv-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--grey-soft);
  font-weight: 500;
}
.niv-counter strong { color: var(--grey); font-weight: 600; }
.niv-counter.warn { color: #A86A14; }
.niv-counter.warn strong { color: #7A4A0F; }
.niv-dots { display: flex; gap: 3px; }
.niv-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--grey-line); display: block; }
.niv-dots i.on { background: #6A4CF6; }

/* ─── Chat Stage ─── */
.niv-stage {
  position: fixed;
  top: var(--niv-header-height);
  left: 0;
  right: 0;
  bottom: 0;
}

/* Single scroll container — full height, native scroll */
#niv-msgs {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 4vw, 24px) 140px;
  box-sizing: border-box;
  scroll-behavior: auto;
}
/* ─── Modern Scrollbar ─── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(124, 92, 255, 0.18) transparent;
}
*::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
*::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 99px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(106,76,246,0.30) 0%, rgba(156,91,255,0.18) 100%);
  border-radius: 99px;
  transition: background 0.25s ease;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(106,76,246,0.60) 0%, rgba(156,91,255,0.45) 100%);
}
*::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #6a4cf6 0%, #9c5bff 100%);
}
*::-webkit-scrollbar-corner {
  background: transparent;
}

#niv-msgs::-webkit-scrollbar { width: 4px; }
#niv-msgs::-webkit-scrollbar-track { background: transparent; }
#niv-msgs::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(106,76,246,0.30) 0%, rgba(156,91,255,0.18) 100%);
  border-radius: 99px;
}
#niv-msgs::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(106,76,246,0.60) 0%, rgba(156,91,255,0.45) 100%);
}
#niv-msgs::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, #6a4cf6 0%, #9c5bff 100%);
}

/* ─── Orb ─── */
.niv-orb {
  width: 44px; height: 44px; position: relative; flex-shrink: 0;
  clip-path: circle(50% at 50% 50%);
  filter: drop-shadow(0 0 2px rgba(124,92,255,.45)) drop-shadow(0 3px 10px rgba(106,76,246,.13));
}
.niv-orb svg { position: absolute; inset: 0; margin: auto; width: 48%; height: 48%; color: white; z-index: 2; }
.niv-orb.sm { width: 36px; height: 36px; }
.niv-orb.thinking { animation: niv-breathe 1.4s ease-in-out infinite; }

/* ─── User message orb ─── */
.niv-orb.user-orb {
  background: linear-gradient(135deg, #6A85C8 0%, #8B7FD4 100%);
}

/* Orb large — used in limit card */
.niv-orb-lg {
  position: relative;
  flex-shrink: 0;
  clip-path: circle(50% at 50% 50%);
  filter: drop-shadow(0 0 2px rgba(124,92,255,.45)) drop-shadow(0 3px 10px rgba(106,76,246,.13));
}
.niv-orb-lg svg { position: absolute; inset: 0; margin: auto; z-index: 2; color: white; width: 42%; height: 42%; }

/* Lottie always fills the orb — absolute fill so parent layout mode doesn't matter */
.niv-orb dotlottie-wc,
.niv-orb-lg dotlottie-wc {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  filter: brightness(1.35) saturate(0.75);
}

/* ─── Hero Globe (overrides main.css chat-globe absolute positioning) ─── */
.niv-hero-globe {
  position: relative !important;
  top: auto !important;
  transform: none !important;
  margin-bottom: -10px;
  width: 100px !important;
  height: 100px !important;
}
.niv-hero-globe video {
  clip-path: circle(42%) !important;
}

/* ─── Hero Welcome ─── */
.niv-hero {
  text-align: center;
  padding: clamp(32px, 5vw, 45px) 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Squircle orb */
.niv-hero-orb-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 32px;
}

.niv-ready-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--grey-line);
  border-radius: var(--r-pill);
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
  color: var(--grey);
  box-shadow: 0 2px 12px rgba(45,66,111,.1);
  position: relative;
  z-index: 2;
}
.niv-ready-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22C55E;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(34,197,94,.25);
}

/* Heading */
.niv-hero h1 {
  font-size: clamp(18px, 3vw, 35px);
  font-weight: 600;
  color: var(--grey);
  margin: 0 0 28px;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.niv-hero h1 em {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-weight: 600;
  background: linear-gradient(120deg, #6A4CF6 0%, #9C5BFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ─── Suggestion Chips ─── */
.niv-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 640px;
}
.niv-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--grey-line);
  background: white;
  font-family: 'Onest';
  font-size: 13.5px;
  font-weight: 500;
  color: var(--grey);
  cursor: pointer;
  transition: all .22s;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(45,66,111,.06);
}
.niv-chip:hover {
  border-color: rgba(106,76,246,.4);
  background: rgba(106,76,246,.04);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(45,66,111,.1);
}
.niv-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.niv-chip-dot.green { background: #22C55E; }
.niv-chip-dot.red   { background: #EF4444; }
.niv-chip-more {
  background: var(--bg-soft);
  border-color: var(--grey-line);
  color: var(--grey-soft);
  font-weight: 600;
}
.niv-chip-more:hover { color: var(--grey); }

/* ─── Messages ─── */
.niv-msg,
.niv-limit {
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}
.niv-msg {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
  animation: niv-msg-in .28s cubic-bezier(.2,.7,.2,1) both;
}
.niv-msg.user { flex-direction: row-reverse; }

/* AI bubble */
.niv-bubble {
  background: white;
  border: 1px solid rgba(231,234,242,.9);
  border-radius: 18px 18px 18px 4px;
  padding: 12px 16px;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--grey);
  max-width: 78%;
  box-shadow: 0 1px 8px rgba(45,66,111,.06);
}

/* User bubble */
.niv-msg.user .niv-bubble {
  background: #F0F0F0;
  color: #1a1a2e;
  border-color: transparent;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* Thinking indicator */
.niv-thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-mute);
  font-weight: 500;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--grey-line);
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 1px 8px rgba(45,66,111,.06);
}
.niv-thinking-text {
  background: linear-gradient(90deg, #8394BA 0%, #3673F7 50%, #8394BA 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: niv-shimmer 1.6s linear infinite;
}

/* ─── Limit Card ─── */
.niv-limit {
  margin: 16px auto 0;
  padding: 22px 24px;
  border-radius: 20px;
  border: 1px solid var(--grey-line);
  box-shadow: var(--shadow-card);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  animation: niv-msg-in .4s cubic-bezier(.2,.7,.2,1);
}
.niv-limit > * { position: relative; z-index: 1; }
.niv-limit h4 { margin: 0 0 6px; font-size: 16px; font-weight: 700; color: var(--grey); }
.niv-limit p { margin: 0 0 16px; font-size: 13.5px; color: var(--grey-soft); line-height: 1.55; }
.niv-limit-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.niv-limit-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.niv-limit-qr img {
  width: 130px;
  height: 130px;
  border-radius: 10px;
  display: block;
}
.niv-limit-qr span {
  font-size: 11px;
  color: var(--grey-soft);
  text-align: center;
}
@media (max-width: 600px) {
  .niv-limit-qr { display: none; }
}
.niv-btn-primary {
  background: var(--niv-grad);
  color: white;
  border: none;
  border-radius: var(--r-pill);
  padding: 10px 22px;
  font-family: 'Onest';
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(106,76,246,.3);
}
.niv-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(106,76,246,.4); }
.niv-btn-ghost {
  background: transparent;
  color: var(--text-mute);
  border: 1px solid var(--grey-line);
  border-radius: var(--r-pill);
  padding: 10px 16px;
  font-family: 'Onest';
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
}
.niv-btn-ghost:hover { color: var(--grey); border-color: var(--grey); background: var(--bg-soft); }

/* ─── Bottom Composer (fixed to viewport) ─── */
.niv-foot {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 10;
  border-top: 1px solid rgba(231,234,242,.8);
  background: rgba(250,251,254,.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 12px clamp(16px, 4vw, 24px) calc(20px + env(safe-area-inset-bottom));
}
.niv-foot-inner { max-width: 860px; margin: 0 auto; }
.niv-composer {
  display: flex; align-items: center; gap: 8px; background: white;
  border: 1.5px solid var(--grey-line); border-radius: var(--r-pill);
  padding: 6px 6px 6px 20px; transition: border-color .2s, box-shadow .2s;
}
.niv-composer:focus-within { border-color: var(--purple-accent); box-shadow: 0 0 0 4px rgba(124,92,255,.1); }
.niv-composer input {
  flex: 1; border: none; outline: none; font-family: 'Onest';
  font-size: 15px; color: var(--grey); background: transparent; padding: 10px 0;
}
.niv-composer input::placeholder { color: var(--text-mute); }
.niv-composer.disabled { opacity: .55; pointer-events: none; background: var(--bg-soft); }
.niv-send {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--niv-grad);
  color: white; display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
  transition: transform .2s, box-shadow .2s;
  touch-action: manipulation; /* prevent double-tap zoom delay on mobile */
  -webkit-tap-highlight-color: transparent;
}
.niv-send:hover { transform: scale(1.06); box-shadow: 0 6px 18px rgba(108,76,246,.4); }
.niv-send:active { transform: scale(0.95); }
.niv-send svg { width: 18px; height: 18px; }
.niv-foot-meta { font-size: 11px; color: var(--text-mute); margin-top: 10px; text-align: center; }
/* ─── Disclaimer Button (footer) ─── */
.niv-disclaimer-link {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  color: #4fa3e0;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(79,163,224,0.35);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.niv-disclaimer-link:hover {
  color: #2d8fd4;
  border-bottom-color: #2d8fd4;
}

/* ─── Disclaimer Modal ─── */
.niv-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 10, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.niv-modal-backdrop.niv-modal-open {
  opacity: 1;
  pointer-events: all;
}
.niv-modal-backdrop.niv-modal-closing {
  opacity: 0;
  pointer-events: none;
}
.niv-modal {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 20px;
  width: 100%;
  max-width: 860px;
  height: 88vh;
  max-height: 760px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  transform: translateY(24px) scale(0.97);
  transition: transform 0.3s cubic-bezier(0.34,1.28,0.64,1);
}
.niv-modal-backdrop.niv-modal-open .niv-modal {
  transform: translateY(0) scale(1);
}
.niv-modal-backdrop.niv-modal-closing .niv-modal {
  transform: translateY(16px) scale(0.97);
}

/* Header */
.niv-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 14px 18px;
  border-bottom: 1px solid #ebebeb;
  flex-shrink: 0;
  background: #fff;
}
.niv-modal-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.niv-modal-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.niv-modal-heading {
  font-size: 14px;
  font-weight: 600;
  color: #1a1a2e;
  letter-spacing: -0.01em;
}
.niv-modal-sub {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
.niv-modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.niv-modal-download {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.niv-modal-download svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.niv-modal-download:hover {
  background: #e8f5e9;
  border-color: #a5d6a7;
  color: #2e7d32;
}
.niv-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f5f5f5;
  border: 1px solid #e8e8e8;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.niv-modal-close svg {
  width: 14px;
  height: 14px;
}
.niv-modal-close:hover {
  background: #fee8e8;
  border-color: #f5c0c0;
  color: #e05555;
}

/* Body / iframe */
.niv-modal-body {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: #ffffff;
  padding: 0;
  margin: 0;
}
#niv-disclaimer-iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: none;
  padding: 0;
  margin: 0;
  color-scheme: light;
  transition: opacity 0.3s ease;
}

.niv-modal-loading {
  position: absolute;
  inset: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #aaa;
  font-size: 13px;
}
.niv-modal-spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #e8e8e8;
  border-top-color: #4fa3e0;
  border-radius: 50%;
  animation: niv-spin 0.8s linear infinite;
}
@keyframes niv-spin { to { transform: rotate(360deg); } }

/* Responsive — true fullscreen on mobile */
@media (max-width: 600px) {
  .niv-modal-backdrop {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }
  .niv-modal {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    box-shadow: none;
  }
  /* download btn is already icon-only */
}

/* ─── Follow-up Suggestion Chips (from API) ─── */
.niv-sugg-wrap {
  max-width: 860px;
  margin: 4px auto 12px auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 40px;
  animation: niv-msg-in .3s cubic-bezier(.2,.7,.2,1) both;
}
.niv-sugg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid rgba(106,76,246,.25);
  background: rgba(106,76,246,.04);
  color: var(--purple-accent);
  font-family: 'Onest';
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  text-align: left;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.niv-sugg-chip::before {
  content: '↗';
  font-size: 11px;
  opacity: .7;
  flex-shrink: 0;
}
.niv-sugg-chip:hover {
  background: rgba(106,76,246,.1);
  border-color: rgba(106,76,246,.5);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(106,76,246,.15);
}
.niv-sugg-chip:active { transform: scale(0.97); }
@media (max-width: 560px) {
  .niv-sugg-wrap { padding-left: 0; }
  .niv-sugg-chip { font-size: 12.5px; padding: 7px 12px; }
}

/* ─── Math (KaTeX) ─── */
.niv-math-block {
  margin: 10px 0;
  padding: 12px 16px;
  background: rgba(106, 76, 246, 0.04);
  border: 1px solid rgba(106, 76, 246, 0.12);
  border-radius: 10px;
  overflow-x: auto;
  text-align: center;
}
.niv-math-block .katex-display {
  margin: 0;
}
.niv-bubble .katex {
  font-size: 1.05em;
  color: var(--grey);
}

/* ─── AI Message Formatting ─── */
.niv-p  { margin: 0 0 6px; }
.niv-h2 { font-size: 15px; font-weight: 700; color: var(--grey); margin: 10px 0 4px; }
.niv-h3 { font-size: 13px; font-weight: 700; color: var(--grey); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.niv-ul,
.niv-ol { margin: 4px 0 6px; display: flex; flex-direction: column; gap: 3px; }
.niv-li,
.niv-li-num { display: flex; gap: 8px; align-items: flex-start; line-height: 1.55; }
.niv-li-dot { flex-shrink: 0; font-weight: 700; }
.niv-num    { flex-shrink: 0; font-weight: 700; min-width: 18px; }
.niv-table-wrap {
  overflow-x: auto;
  margin: 8px 0 4px;
  border-radius: 10px;
  border: 1px solid var(--grey-line);
}
.niv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.5;
}
.niv-table th {
  background: var(--bg-soft);
  color: var(--grey);
  font-weight: 700;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--grey-line);
  white-space: nowrap;
}
.niv-table td {
  padding: 7px 12px;
  color: var(--grey);
  border-bottom: 1px solid var(--grey-line);
  vertical-align: top;
}
.niv-table tr:last-child td {
  border-bottom: none;
}
.niv-table tr:nth-child(even) td {
  background: rgba(247,248,251,.6);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .niv-hero h1 { font-size: 26px; }
  .niv-chips { gap: 8px; }
  .niv-chip { font-size: 13px; padding: 8px 14px; }
}
@media (max-width: 560px) {
  .niv-header { padding: 0 16px; gap: 10px; }
  .niv-brand-sub { display: none; }
  .niv-counter span:last-child { display: none; }
  .niv-hero h1 { font-size: 22px; }
  .niv-hero-squircle { width: 76px; height: 76px; border-radius: 50%; }
  .niv-logo-link { display: none; }
  .niv-header-pipe { display: none; }
}
