:root {
  font-family: "Sora", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --primaryColor: #f8fbff;
  --secondaryColor: #ffffff;
  color: #0f172a;
  background-color: #f8fafc;
  --textColor: #0f172a;
  --hoverText: #dbeafe;
  --hoverBtn: #66a7ff;
  --hoverTxt: #314b77;
  --extraColor: #006aff;

  --pageBg: linear-gradient(180deg, #f8fbff 0%, #eff6ff 65%, #e0ecff 100%);
  --cardBg: #ffffff;
  --cardBgAlt: #f8fafc;
  --borderColor: #e2e8f0;
  --mutedText: #475569;
  --headingText: #0f172a;
  --softShadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --navBg: #ffffff;
  --navBorder: #e2e8f0;
  --navText: #334155;
  --navTextHover: #0f172a;
  --navIcon: #64748b;
  --navIconHover: #0f172a;
  --navBtnBorder: #cbd5e1;
  --navBtnText: #334155;
  --navBtnHoverBg: #f1f5f9;
  --navPrimaryBg: #2563eb;
  --navPrimaryHover: #1d4ed8;
  --footerBg: #f8fafc;
  --footerTopBorder: #e2e8f0;
  --footerBottomBorder: #cbd5e1;
  --footerText: #475569;
  --footerHeading: #0f172a;
  --footerLink: #334155;
  --footerLinkHover: #0f172a;
  --primaryGradient: linear-gradient(120deg, #2563eb, #3b82f6);
  --landingHeroGradient: radial-gradient(circle at 80% 10%, rgba(147, 197, 253, 0.25), transparent 40%),
    radial-gradient(circle at 20% 95%, rgba(59, 130, 246, 0.22), transparent 45%),
    linear-gradient(180deg, #f8fbff, #eef5ff 70%, #e2efff);
  --landingHeroGlow: radial-gradient(ellipse at center, rgba(37, 99, 235, 0.28), rgba(59, 130, 246, 0.04) 65%, transparent 75%);
  --searchHeroGradient: radial-gradient(circle at 95% 5%, rgba(37, 99, 235, 0.16), transparent 34%),
    radial-gradient(circle at 0% 100%, rgba(59, 130, 246, 0.12), transparent 38%),
    var(--cardBg);
  --selectedCardGradient: linear-gradient(180deg, #f8fbff 0%, #edf4ff 100%);
  --highlightGradient: linear-gradient(135deg, #dbeafe, #bfdbfe);
  --chatShellGradient: radial-gradient(circle at top, rgba(59, 130, 246, 0.08), transparent 45%),
    linear-gradient(180deg, var(--primaryColor), color-mix(in srgb, var(--secondaryColor) 90%, black 10%));
  --chatHeroGradient: radial-gradient(circle at 82% 8%, rgba(147, 197, 253, 0.24), transparent 40%),
    radial-gradient(circle at 15% 95%, rgba(59, 130, 246, 0.2), transparent 45%),
    linear-gradient(180deg, #f8fbff, #eef5ff 72%, #e2efff);
}

body.theme-dark {
  --primaryColor: #000d26;
  --secondaryColor: #041938;
  --textColor: rgb(177, 187, 206);
  --hoverText: #163159;
  --hoverBtn: #66a7ff;
  --hoverTxt: #314b77;
  --extraColor: #006aff;

  --pageBg: linear-gradient(180deg, #000d26 0%, #02122d 55%, #000a20 100%);
  --cardBg: #041938;
  --cardBgAlt: #0a2347;
  --borderColor: #163159;
  --mutedText: rgb(177, 187, 206);
  --headingText: #eef4ff;
  --softShadow: 0 14px 32px rgba(0, 0, 0, 0.35);
  --tableLineDark: #5b7fb8;
  --tableLineSoftDark: #4a6fa8;
  --navBg: #0f172a;
  --navBorder: #1e293b;
  --navText: #cbd5e1;
  --navTextHover: #ffffff;
  --navIcon: #94a3b8;
  --navIconHover: #ffffff;
  --navBtnBorder: #475569;
  --navBtnText: #cbd5e1;
  --navBtnHoverBg: #334155;
  --navPrimaryBg: #2563eb;
  --navPrimaryHover: #1d4ed8;
  --footerBg: #020d22;
  --footerTopBorder: #163159;
  --footerBottomBorder: #163159;
  --footerText: #9eb0cd;
  --footerHeading: #eef4ff;
  --footerLink: #c8d5ea;
  --footerLinkHover: #ffffff;
  --primaryGradient: linear-gradient(120deg, #163159, #006aff);
  --landingHeroGradient: radial-gradient(circle at 80% 10%, rgba(102, 167, 255, 0.12), transparent 40%),
    radial-gradient(circle at 20% 95%, rgba(0, 106, 255, 0.16), transparent 45%),
    linear-gradient(180deg, #041938, #001738 70%, #000d26);
  --landingHeroGlow: radial-gradient(ellipse at center, rgba(0, 106, 255, 0.24), rgba(0, 106, 255, 0.06) 65%, transparent 75%);
  --searchHeroGradient: radial-gradient(circle at 95% 5%, rgba(102, 167, 255, 0.16), transparent 34%),
    radial-gradient(circle at 0% 100%, rgba(0, 106, 255, 0.14), transparent 38%),
    var(--cardBg);
  --selectedCardGradient: linear-gradient(180deg, #10305f 0%, #0e2a53 100%);
  --highlightGradient: linear-gradient(135deg, #163159, #1f3f72);
  --chatShellGradient: radial-gradient(circle at top, rgba(102, 167, 255, 0.08), transparent 45%),
    linear-gradient(180deg, #03142f, #041938);
  --chatHeroGradient: radial-gradient(circle at 82% 8%, rgba(102, 167, 255, 0.14), transparent 40%),
    radial-gradient(circle at 15% 95%, rgba(0, 106, 255, 0.18), transparent 45%),
    linear-gradient(180deg, #041938, #001738 72%, #000d26);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 0;
  background: var(--pageBg);
  color: var(--textColor);
}

.layout {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  display: grid;
  gap: 1.5rem;
}

body.view-landing .layout {
  gap: 0.9rem;
}

.explorer-header {
  display: flex;
  align-items: center;
  padding: 0.75rem 2rem;
  background: var(--navBg);
  border-bottom: 1px solid var(--navBorder);
  box-shadow: var(--softShadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.explorer-logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.7rem;
  color: var(--headingText);
}

.explorer-logo a {
  color: var(--headingText);
  text-decoration: none;
}

.release {
  background: #2563eb;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  margin-left: 8px;
}

.explorer-nav {
  display: flex;
  gap: 1rem;
  margin-left: 2rem;
}

.explorer-nav a {
  text-decoration: none;
  color: var(--navText);
  font-size: 1.1rem;
  font-weight: 500;
}

.explorer-nav a:hover {
  color: var(--navTextHover);
}

.explorer-nav a.contextual-nav-link {
  color: #1d72ff;
}

.explorer-nav a.contextual-nav-link:hover {
  color: #0b5fff;
}

body.theme-dark .explorer-nav a.contextual-nav-link {
  color: #66a7ff;
}

body.theme-dark .explorer-nav a.contextual-nav-link:hover {
  color: #8cbcff;
}

.explorer-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

#navAuthGuest {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.explorer-icons a {
  color: var(--navIcon);
  font-size: 1.5rem;
  margin: 0 6px;
  text-decoration: none;
}

.explorer-icons a:hover {
  color: var(--navIconHover);
}

.login-btn {
  background: none;
  border: 1px solid var(--navBtnBorder);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: var(--navBtnText);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}

.login-btn:hover {
  background: var(--navBtnHoverBg);
  color: var(--navTextHover);
}

.signup-btn {
  background: var(--navPrimaryBg);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.signup-btn:hover {
  background: var(--navPrimaryHover);
}

.profile-menu-container {
  position: relative;
}

.profile-icon {
  width: 36px;
  height: 36px;
  background: var(--navPrimaryBg);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.profile-dropdown {
  position: absolute;
  top: 45px;
  right: 0;
  background: var(--cardBg);
  border: 1px solid var(--borderColor);
  border-radius: 8px;
  padding: 0.5rem;
  min-width: 200px;
  display: none;
  flex-direction: column;
  box-shadow: var(--softShadow);
  z-index: 1000;
}

.profile-dropdown.show {
  display: flex;
}

.profile-email {
  font-size: 0.85rem;
  color: var(--mutedText);
  margin-bottom: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--borderColor);
}

.profile-dropdown button {
  background: none;
  border: none;
  color: var(--navText);
  text-align: left;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
}

.profile-dropdown button:hover {
  background: var(--navBtnHoverBg);
  color: var(--navTextHover);
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.auth-modal-content {
  width: min(420px, 92vw);
  background: var(--cardBg);
  color: var(--textColor);
  border: 1px solid var(--borderColor);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--softShadow);
  position: relative;
}

.auth-close-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  font-size: 1.4rem;
  color: var(--mutedText);
  cursor: pointer;
}

.auth-tab-row {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.auth-tab {
  flex: 1;
  border: 1px solid var(--borderColor);
  background: var(--cardBgAlt);
  color: var(--textColor);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
}

.auth-tab.active {
  border-color: #66a7ff;
  background: color-mix(in srgb, var(--cardBgAlt) 82%, #66a7ff 18%);
}

.auth-form {
  display: grid;
  gap: 0.55rem;
}

.auth-form input {
  border: 1px solid var(--borderColor);
  background: var(--cardBgAlt);
  color: var(--textColor);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
}

.auth-submit-btn {
  border: none;
  border-radius: 8px;
  padding: 0.58rem 0.7rem;
  color: #fff;
  background: var(--primaryGradient);
  cursor: pointer;
  font-weight: 600;
}

.auth-feedback {
  min-height: 1.2rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--mutedText);
}

.nav-theme-toggle {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.nav-theme-toggle i {
  font-size: 0.95rem;
  color: var(--navText);
}

.nav-theme-toggle:hover i {
  color: var(--navTextHover);
}

.agent-landing-footer {
  margin-top: 1rem;
  border-top: 1px solid var(--footerTopBorder);
  background: var(--footerBg);
  border-radius: 1rem;
  overflow: hidden;
}

.agent-footer-top {
  padding: 1.2rem;
}

.agent-footer-subscribe {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  padding: 0.9rem;
  margin-bottom: 1rem;
  border: 1px solid var(--footerTopBorder);
  border-radius: 0.9rem;
  background: var(--cardBg);
}

.agent-footer-subscribe-left h3 {
  margin: 0 0 0.4rem;
  color: var(--footerHeading);
}

.agent-footer-subscribe-left p {
  margin: 0;
  color: var(--footerText);
}

.agent-footer-subscribe-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.agent-footer-agree {
  margin-top: 0.35rem;
  font-size: 0.86rem;
  color: var(--footerText);
}

.agent-footer-agree a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.agent-footer-agree a:hover {
  text-decoration: underline;
}

.agent-footer-main {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 1.2rem;
}

.agent-footer-logo-box p {
  margin: 0.5rem 0 0.75rem;
  color: var(--footerText);
  line-height: 1.45;
}

.agent-footer-logo a {
  text-decoration: none;
  color: var(--footerHeading);
  font-weight: 700;
  font-size: 1.05rem;
}

.agent-footer-icons a {
  color: var(--navIcon);
  margin-right: 0.65rem;
  text-decoration: none;
  font-size: 1.1rem;
}

.agent-footer-icons a:hover {
  color: var(--navIconHover);
}

.agent-footer-products h4,
.agent-footer-services h4,
.agent-footer-request h4 {
  margin: 0 0 0.55rem;
  color: var(--footerHeading);
  font-size: 1rem;
}

.agent-footer-products div,
.agent-footer-services div {
  margin: 0.38rem 0;
}

.agent-footer-products a,
.agent-footer-services a {
  color: var(--footerLink);
  text-decoration: none;
  font-size: 0.93rem;
}

.agent-footer-products a:hover,
.agent-footer-services a:hover {
  color: var(--footerLinkHover);
}

.agent-footer-btn {
  display: inline-block;
  text-decoration: none;
  padding: 0.55rem 0.85rem;
  border-radius: 0.55rem;
  border: 1px solid var(--navBtnBorder);
  background: var(--cardBg);
  color: var(--navBtnText);
  font-weight: 600;
}

.agent-footer-btn:hover {
  background: var(--navBtnHoverBg);
  color: var(--navTextHover);
}

.agent-footer-last {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.2rem;
  border-top: 1px solid var(--footerBottomBorder);
  color: var(--footerText);
  font-size: 0.88rem;
}

.agent-footer-last a {
  color: var(--footerLink);
  text-decoration: none;
  font-weight: 700;
}

.agent-footer-last a:hover {
  color: var(--footerLinkHover);
}

body.view-chat .agent-landing-footer {
  display: none;
}

.theme-toggle-btn {
  appearance: none;
  border: 1px solid var(--borderColor);
  background: var(--cardBg);
  color: var(--headingText);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--softShadow);
  transition: transform 120ms ease, background 120ms ease;
}

.theme-toggle-btn:hover {
  transform: translateY(-1px);
  background: var(--hoverText);
}

/* Landing View */
.landing-view {
  display: none;
  position: relative;
  min-height: clamp(380px, 58vh, 560px);
  border-radius: 1.5rem;
  padding: 2.2rem 1.25rem 1.6rem;
  align-content: center;
  justify-items: center;
  text-align: center;
  overflow: hidden;
  background: var(--landingHeroGradient);
  box-shadow: 0 20px 45px rgba(30, 64, 175, 0.12);
}

.landing-view::after {
  content: "";
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: -15%;
  height: 45%;
  background: var(--landingHeroGlow);
  pointer-events: none;
}

.landing-view.active {
  display: grid;
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem; /* Slightly increased gap for the larger font */
  color: var(--extraColor);
  /* font-size here now acts as the fallback/container base */
}

.landing-brand span {
  font-weight: 800;
  /* Increased from (1.2rem, 2vw, 1.5rem) to (1.6rem, 4vw, 2.2rem) */
  font-size: clamp(1.6rem, 4vw, 2.2rem); 
  letter-spacing: 0.05em; /* Slightly wider tracking for a premium "Web3" feel */
  line-height: 1; /* Ensures the flex centering stays pixel-perfect */
}

.landing-view h1 {
  margin: 0.45rem 0 0.35rem;
  font-size: clamp(3.6rem, 4.2vw, 2.7rem);
  line-height: 1.12;
  color: var(--extraColor);
}

.header-with-logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.header-with-logo h1,
.header-with-logo h2 {
  margin: 0;
}

.header-with-logo-landing {
  margin-top: 0.45rem;
  margin-bottom: 0.35rem;
}

/* This targets only the h1 inside your specific header div */
.header-with-logo-landing h1 {
  font-size: 1.4rem; /* Adjust this value as needed */
  line-height: 1.2;  /* Improves readability for long titles */
  font-weight: 600;  /* Makes it bold/prominent */
}

.header-with-logo-compact {
  gap: 0.55rem;
}

.smartmuv-logo {
  width: 2.2rem;
  height: 2.2rem;
  flex-shrink: 0;
}

.landing-logo {
  width: 3rem;
  height: 3rem;
}

@keyframes smartmuv-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

.logo-bounce {
  animation: smartmuv-bounce 2s ease-in-out infinite;
}

.landing-subtitle {
  max-width: 640px;
  margin: 0;
  color: var(--mutedText);
  font-size: 1.1rem;
}

.landing-actions {
  width: min(920px, 100%);
  margin-top: 4rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 0.85rem;
}

.landing-option {
  border: 2px solid var(--borderColor);
  border-radius: 1.1rem;
  padding: 1rem;
  background: color-mix(in srgb, var(--cardBg) 86%, transparent);
  backdrop-filter: blur(6px);
  text-align: left;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.landing-option:hover {
  transform: translateY(-2px);
  border-color: var(--hoverBtn);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.16);
}

.landing-option-title {
  display: block;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--extraColor);
  margin-bottom: 0.35rem;
}

.landing-option-text {
  display: block;
  color: var(--textColor);
  line-height: 1.45;
}

/* View Containers */
.view-container {
  display: none;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.view-container.active {
  display: grid;
}


.card {
  background: var(--cardBg);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: var(--softShadow);
  border: 1px solid var(--borderColor);
}

.search-hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.2rem;
  padding: 1.7rem;
  background: var(--searchHeroGradient);
  text-align: center;
}

.search-hero-back-btn {
  position: absolute;
  top: 0.875rem;
  left: 0.875rem;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid rgba(37, 99, 235, 0.2);
  color: #2563eb;
  cursor: pointer;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.search-hero-back-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.15s ease;
}

.search-hero-back-btn:hover {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.4);
  transform: translateX(-1px);
}

.search-hero-back-btn:hover svg {
  transform: translateX(-2px);
}

.search-hero-back-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.5);
}

.search-hero-back-btn:active {
  transform: scale(0.95);
}


.search-hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.06);
}

.search-hero-card .header-with-logo h1 {
  font-size: clamp(1.75rem, 2.1vw, 2.3rem);
  letter-spacing: -0.01em;
}

.search-hero-card .header-with-logo {
  justify-content: center;
}

.search-hero-card > p {
  max-width: 74ch;
  color: var(--mutedText);
  font-size: 1.03rem;
  margin-left: auto;
  margin-right: auto;
}

.search-hero-card label[for="contractAddress"] {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  font-weight: 700;
  color: var(--headingText);
  width: min(100%, 760px);
  text-align: left;
  align-self: center;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.search-hero-card .form {
  align-items: center;
}

.form input[type="text"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--borderColor);
  background: var(--cardBgAlt);
  color: var(--headingText);
  border-radius: 0.75rem;
  font-size: 1rem;
}

.form input[type="text"]::placeholder {
  color: var(--mutedText);
}

#contractAddress {
  background: var(--cardBgAlt);
  color: var(--headingText);
  border-radius: 0.9rem;
  border: 1px solid #bfd5ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
  width: min(100%, 52ch);
  align-self: center;
  min-height: 46px;
  padding: 0.78rem 0.9rem;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
  font-family: "JetBrains Mono", "SF Mono", "Cascadia Mono", "Menlo", monospace;
  letter-spacing: 0.01em;
  text-align: center;
}

#contractAddress:focus {
  outline: none;
  border-color: #66a7ff;
  box-shadow: 0 0 0 4px rgba(102, 167, 255, 0.18);
}

body.theme-dark #contractAddress:focus {
  background: #0a2347;
  color: #eef4ff;
  border-color: #66a7ff;
}

body.theme-dark .search-hero-back-btn {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(96, 165, 250, 0.25);
  color: #60a5fa;
}

body.theme-dark .search-hero-back-btn:hover {
  background: rgba(96, 165, 250, 0.1);
  border-color: rgba(96, 165, 250, 0.45);
}

body.theme-dark #contractAddress:-webkit-autofill,
body.theme-dark #contractAddress:-webkit-autofill:hover,
body.theme-dark #contractAddress:-webkit-autofill:focus {
  -webkit-text-fill-color: #eef4ff !important;
  -webkit-box-shadow: 0 0 0 1000px #0a2347 inset !important;
  box-shadow: 0 0 0 1000px #0a2347 inset !important;
  border-color: #66a7ff !important;
}

body.theme-dark #contractAddress:-moz-autofill {
  box-shadow: 0 0 0 1000px #0a2347 inset !important;
  -moz-text-fill-color: #eef4ff !important;
  color: #eef4ff !important;
  border-color: #66a7ff !important;
}

body:not(.theme-dark) #contractAddress:-webkit-autofill,
body:not(.theme-dark) #contractAddress:-webkit-autofill:hover,
body:not(.theme-dark) #contractAddress:-webkit-autofill:focus {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0 1000px #f8fafc inset !important;
  box-shadow: 0 0 0 1000px #f8fafc inset !important;
  border-color: #cbd5f5 !important;
}

body:not(.theme-dark) #contractAddress:-moz-autofill {
  box-shadow: 0 0 0 1000px #f8fafc inset !important;
  -moz-text-fill-color: #0f172a !important;
  color: #0f172a !important;
  border-color: #cbd5f5 !important;
}

.dataset-selector {
  border: 1px solid var(--borderColor);
  border-radius: 1rem;
  padding: 1.15rem;
  background: color-mix(in srgb, var(--cardBgAlt) 85%, white 15%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  text-align: left;
}

.selector-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.selector-head p {
  margin: 0.25rem 0 0;
  color: var(--mutedText);
  font-size: 0.9rem;
}

.selector-head strong {
  margin: 0.25rem 0 0;
  color: var(--extraColor);
  font-size: 1rem;
}

.selector-hint {
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid #cfe0fb;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  color: #335179;
  font-size: 0.9rem;
  line-height: 1.45;
}

#toggleAll {
  border: 1px solid #c7d7ff;
  background: #ffffff;
  color: var(--headingText);
  padding: 0.52rem 0.9rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

#toggleAll:hover {
  transform: translateY(-1px);
  border-color: #90b4ff;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.12);
}

.selector-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 0.75rem;
}

.selector-card {
  border: 1px solid var(--borderColor);
  border-radius: 0.9rem;
  padding: 0.9rem;
  background: var(--cardBg);
  display: flex;
  gap: 0.62rem;
  align-items: flex-start;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.selector-card:hover {
  transform: translateY(-1px);
  border-color: #b6ccff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.1);
}

.selector-card:has(input:checked) {
  border-color: #66a7ff;
  background: var(--selectedCardGradient);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.14);
}

.selector-card label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.2rem;
}

.selector-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--mutedText);
  line-height: 1.3;
}

.selector-card input[type="checkbox"] {
  margin-top: 0.22rem;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: #2563eb;
}

.form button {
  border: none;
  background: var(--primaryGradient);
  color: white;
  font-size: 1rem;
  padding: 0.98rem 1rem;
  border-radius: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
  transition: filter 150ms ease, transform 150ms ease;
}

.form button:disabled {
  filter: grayscale(0.4);
  cursor: not-allowed;
}

.form button:not(:disabled):hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.search-hero-card .form > button[type="submit"] {
  width: auto;
  min-width: 240px;
  align-self: center;
  margin-top: 3rem;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #475569;
}

.status {
  font-size: 0.9rem;
  color: var(--mutedText);
  margin-top: 1rem;
  font-weight: 600;
}

.download-btn {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 0.9rem;
  border-radius: 0.65rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.download-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #dbeafe;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.14);
}

.download-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.snapshot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.snapshot-head h2 {
  margin: 0;
}

.head-title-group {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.summary-head-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#summaryCard .summary-head,
#summaryCard #cacheStatusText,
#summaryCard #summaryStatus {
  width: 100%;
  max-width: 1500px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

.summary-status {
  position: relative;
  padding: 1rem 1.1rem;
  border-radius: 0.9rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: var(--textColor);
  font-weight: 600;
  overflow: hidden;
}

.summary-status.is-loading {
  animation: statusTextPulse 3s ease-in-out infinite;
}

.summary-status.is-loading::after {
  content: '';
  position: absolute;
  inset: -45% -90%;
  transform: translateX(-140%) skewX(-14deg);
  background: linear-gradient(
    110deg,
    transparent 30%,
    rgba(15, 23, 42, 0.06) 40%,
    rgba(15, 23, 42, 0.16) 50%,
    rgba(15, 23, 42, 0.06) 60%,
    transparent 70%
  );
  opacity: 0.85;
  mix-blend-mode: multiply;
  animation: summaryShimmer 3s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
}

@keyframes summaryShimmer {
  0% { transform: translateX(-140%) skewX(-14deg); }
  100% { transform: translateX(140%) skewX(-14deg); }
}

@keyframes statusTextPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

body.theme-dark .summary-status.is-loading::after {
  background: linear-gradient(
    110deg,
    transparent 30%,
    rgba(255, 255, 255, 0.16) 40%,
    rgba(255, 255, 255, 0.7) 50%,
    rgba(255, 255, 255, 0.16) 60%,
    transparent 70%
  );
  opacity: 1;
  mix-blend-mode: screen;
}

body.theme-dark .summary-status {
  background: #0a1f3e;
  border-color: #1b355c;
  color: #eef4ff;
}

body.theme-dark .summary-status.is-loading {
  background: linear-gradient(135deg, #0a1f3e 0%, #0f274a 100%);
}

.cache-badge {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* Chat status spacing for SSE shimmer line. */
.chat-status {
  flex-shrink: 0;
  min-height: 3rem;
  margin: 0.6rem 0 0.3rem;
}

.regenerate-btn {
  border-color: #fdba74;
  background: #fff7ed;
  color: #c2410c;
}

.regenerate-btn:hover:not(:disabled) {
  background: #ffedd5;
  box-shadow: 0 8px 16px rgba(194, 65, 12, 0.16);
}

.cache-status-text {
  margin: 0 0 0.8rem;
  color: var(--mutedText);
  font-size: 0.9rem;
  font-weight: 600;
}

.summary-placeholder,
.results-placeholder {
  min-height: 4rem;
  border-radius: 0.75rem;
  padding: 1rem;
  background: var(--cardBgAlt);
  white-space: pre-wrap;
}

.data-section {
  border: 1px solid var(--borderColor);
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  background: var(--cardBg);
}

.data-section h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.data-section p {
  margin-top: 0;
  color: var(--mutedText);
  font-size: 0.9rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.9rem;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  border: 1px solid var(--borderColor);
  padding: 0.6rem;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.data-table th {
  background: var(--cardBgAlt);
  font-weight: 600;
}

.data-table td {
  color: var(--textColor);
}

/* Keep high-entropy values (hex/bytes/long strings) from stretching viewport width. */
.data-table td:last-child {
  overflow-wrap: anywhere;
  word-break: break-all;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chip {
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
}

.chart-wrapper {
  margin-top: 1rem;
  background: var(--cardBgAlt);
  border-radius: 0.75rem;
  border: 1px solid var(--borderColor);
  padding: 1rem;
  position: relative;
  height: 320px;
}

.card-profile-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.5rem 0;
}

.card-profile-head .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--mutedText);
  margin: 0 0 0.35rem;
}

.card-profile-head h4 {
  margin: 0;
  font-size: 1.25rem;
}

.profile-highlight {
  background: var(--highlightGradient);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  text-align: right;
  min-width: 180px;
}

.profile-highlight span {
  font-size: 2rem;
  font-weight: 700;
  display: block;
  color: #1d4ed8;
}

.profile-highlight p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--textColor);
}

.metric-grid {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.metric-card {
  background: var(--cardBgAlt);
  border-radius: 0.85rem;
  padding: 0.75rem;
  border: 1px solid var(--borderColor);
}

.metric-label {
  margin: 0;
  color: var(--mutedText);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-value {
  margin: 0.2rem 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--headingText);
}

.metric-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--mutedText);
}

.card-highlight-list {
  margin: 1rem 0;
  padding-left: 1.25rem;
  color: var(--textColor);
}

.card-highlight-list li {
  margin: 0.35rem 0;
  font-size: 0.95rem;
}

.card-chart-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-chart {
  flex: 1 1 260px;
  background: var(--cardBgAlt);
  border-radius: 1rem;
  padding: 1rem;
  border: 1px solid var(--borderColor);
  position: relative;
  height: 280px;
}
.card-chart canvas {
  width: 100% !important;
  height: 100% !important;
}
.card-meter {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.card-meter canvas {
  max-width: 260px;
}

.chart-title {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--mutedText);
  font-weight: 600;
}

.summary-list {
  padding-left: 1rem;
  margin: 0;
}

.summary-list li {
  margin: 0.35rem 0;
}

#summary h1,
#summary h2,
#summary h3,
#summary h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--headingText);
}

#summary > * {
  margin-bottom: 0;
}

#summary {
  width: 100%;
  max-width:1500px;
  margin: 0 auto;
  padding: 0 24px;
  font-size: 15px;
  line-height: 1.65;
}

#summary > * + * {
  margin-top: 0.22rem;
}

#summary > :first-child {
  margin-top: 0 !important;
}

#summary h1 {
  margin-top: 0;
  margin-bottom: 0.2rem;
}

#summary p {
  margin: 0.22rem 0;
  line-height: 1.42;
}
#summary strong {
  font-weight: 700;
  color: var(--headingText);
}

#summary ul,
#summary ol {
  margin: 0.04rem 0 0.12rem;
  padding-left: 0.9rem;
  color: var(--textColor);
  list-style-position: outside;
}

#summary ul {
  margin-block-start: 0.02rem !important;
  margin-block-end: 0.06rem !important;
}

#summary ol {
  margin-block-start: 0.02rem !important;
  margin-block-end: 0.06rem !important;
}

#summary ul li,
#summary ol li {
  margin: 0 !important;
  padding: 0;
  line-height: 1.18;
}

#summary ul li p,
#summary ol li p,
#summary ul li div,
#summary ol li div,
#summary ul li span,
#summary ol li span {
  margin: 0;
  padding: 0;
  display: inline;
  line-height: inherit;
}

#summary p + ul,
#summary p + ol,
#summary .report-intro + ul,
#summary .report-intro + ol {
  margin-top: 0.02rem !important;
}

#summary ul + p,
#summary ol + p {
  margin-top: 0.03rem !important;
}

#summary ul li + li,
#summary ol li + li {
  margin-top: 0 !important;
}

#summary li > * + * {
  margin-left: 0.08rem;
}

#summary .section-title,
#summary .report-section-title {
  font-weight: 800;
  margin-top: 0.55rem;
  margin-bottom: 0;
  color: var(--headingText);
}

#summary .report-contract-meta {
  margin: 0;
}

#summary .report-contract-name,
#summary .report-contract-address {
  margin: 0;
  font-weight: 600;
  color: var(--headingText);
}

#summary .report-intro {
  margin: 0.04rem 0 0.08rem;
}

#summary .report-contract-meta + .report-section-title,
#summary .report-note + .report-section-title,
#summary .markdown-table + .report-section-title,
#summary .chart-wrapper + .report-section-title,
#summary .summary-chart-canvas + .report-section-title,
#summary ul + .report-section-title,
#summary ol + .report-section-title {
  margin-top: 0.12rem !important;
}

#summary .report-section-title + .report-intro,
#summary .report-section-title + p,
#summary .report-section-title + ul,
#summary .report-section-title + ol,
#summary .report-section-title + .markdown-table,
#summary .report-section-title + .chart-wrapper {
  margin-top: 0.08rem !important;
}

#summary .graph-heading {
  font-weight: 700;
  margin-bottom: 0.35rem;
}

#summary .graph-description,
#summary .report-note {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--mutedText);
  margin: 0.04rem 0 0.08rem;
}

#summary .markdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.18rem 0;
  font-size: 0.9rem;
  border-radius: 0.5rem;
  overflow: hidden;
  table-layout: fixed;
}

#summary .markdown-table th {
  background: var(--primaryGradient);
  color: #fff;
  text-align: left;
  padding: 0.65rem;
  word-break: break-word; 
}

#summary .markdown-table td {
  border: 1px solid var(--borderColor);
  padding: 0.6rem;
  color: var(--textColor);
  word-break: break-all;    
  overflow-wrap: break-word;
  white-space: normal;  
}

#summary .markdown-table + .chart-wrapper {
  margin-top: 0.08rem !important;
}

#summary .chart-wrapper {
  margin-top: 0.08rem;
  margin-bottom: 0;
}

#summary h1 + .report-contract-meta {
  margin-top: 0 !important;
}

#summary .report-contract-meta + .report-section-title,
#summary .report-contract-address + .report-section-title {
  margin-top: 0.2rem !important;
}

#summary .report-contract-name + .report-contract-address {
  margin-top: 0.02rem !important;
}

#summary .report-section-title:first-of-type,
#summary .report-contract-meta + .report-section-title:first-of-type {
  margin-top: 0.18rem !important;
}

#summary p:has(+ ul),
#summary p:has(+ ol),
#summary .report-intro:has(+ ul),
#summary .report-intro:has(+ ol) {
  margin-bottom: 0.02rem !important;
}

#summary ul:has(+ .report-section-title),
#summary ol:has(+ .report-section-title) {
  margin-bottom: 0.02rem !important;
}

#summary code.inline-code {
  background: var(--cardBgAlt);
  color: #c2410c;
  border-radius: 0.3rem;
  padding: 0.1rem 0.3rem;
}

#summary .summary-chart-canvas {
  display: block;
  width: 100% !important;
  min-height: 280px;
  max-height: 380px;
  margin: 0.75rem 0;
}

.summary-insights {
  margin-top: 1rem;
  border: 1px solid var(--borderColor);
  border-radius: 1rem;
  padding: 1rem;
  background: var(--cardBgAlt);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.06);
}

.summary-insights-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.summary-insights-head .eyebrow {
  margin: 0;
}

.summary-insights-head h4 {
  margin: 0.35rem 0 0;
}

.summary-insights-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--mutedText);
}

.summary-insights-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.summary-mini-table {
  border-collapse: collapse;
  min-width: 220px;
  flex: 1 1 220px;
}

.summary-mini-table th,
.summary-mini-table td {
  border: 1px solid var(--borderColor);
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  text-align: left;
}

.summary-mini-table thead th {
  background: var(--cardBg);
  font-weight: 600;
}

.summary-mini-table td {
  color: var(--textColor);
}

.summary-mini-chart {
  flex: 1 1 240px;
  height: 180px;     
  position: relative;
  border: 1px dashed var(--borderColor);
  border-radius: 0.75rem;
  padding: 0.5rem;
  background: var(--cardBg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chart-error {
  font-size: 0.85rem;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  padding: 0.75rem;
  text-align: center;
}

.raw-json {
  margin-top: 1rem;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
  font-size: 0.85rem;
  overflow-x: auto;
}


/* Chat Styles */

.view-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

#chatView {
  min-height: calc(100vh - 4rem);
  min-height: calc(100dvh - 4rem);
}

.chat-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: calc(100vh - 8.5rem);
  height: calc(100dvh - 8.5rem);
  border-radius: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.24);
  padding: 4.4rem 1.4rem 1.4rem;
  background: var(--chatHeroGradient);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.chat-shell > .search-hero-back-btn {
  top: 0.875rem;
  left: 0.875rem;
}

.chat-hero {
  display: flex;             /* Changed from 'none' to 'flex' to make it visible */
  flex-direction: column;    /* Stack items vertically so centering works properly */
  align-items: center;       /* Horizontal centering */
  justify-content: center;    /* Vertical centering */
  text-align: center;        /* Ensures text inside the h2 is centered */
  gap: 0.7rem;
  color: var(--headingText);
  margin-top: auto;
  margin-bottom: 1.5rem;
}

.chat-hero h2 {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  /* Adds breathing room between the lines created by your <br> */
  line-height: 1.5; 
  font-weight: 600;          /* Makes it feel more like a 'Hero' title */
}

/* Adds specific extra spacing for the <br> tag */
.chat-hero h2 br {
  display: block;
  margin-bottom: 0.5rem;    /* Adjust this for that "little space" you wanted */
  content: "";
}

.chat-shell.empty .chat-hero {
  display: flex;
  margin-top: auto;
  margin-bottom: auto;
}

.chat-shell.empty .chat-history {
  display: none;
}

.chat-shell.empty .chat-form {
  margin-top: 0;
  width: min(900px, 100%);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.6rem;
}

.chat-shell:not(.empty) .chat-hero {
  display: none;
}

.chat-shell:not(.empty) .chat-history {
  display: flex;
}

.chat-shell:not(.empty) .chat-form {
  margin-top: 0.35rem;
  margin-bottom: 0.35rem;
}

.chat-history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid #dbeafe;
  border-radius: 0.75rem;
  padding: 1rem;
  background: color-mix(in srgb, var(--cardBg) 82%, transparent);
  backdrop-filter: blur(4px);
  margin-bottom: 0;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.user-message {
  align-self: flex-end;
  background: #2563eb;
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.ai-message {
  align-self: flex-start;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(241, 247, 255, 0.94) 100%);
  border: 1px solid #d8e6fb;
  color: #0f172a;
  border-bottom-left-radius: 0.25rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 8px 18px rgba(37, 99, 235, 0.08);
}

.chat-form {
  display: flex;
  flex-shrink: 0;
  gap: 0.75rem;
  border: 1px solid #c7d2fe;
  background: color-mix(in srgb, var(--cardBg) 90%, transparent);
  border-radius: 1rem;
  padding: 0.55rem;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.1);
}

.chat-form input {
  flex: 1;
  padding: 0.8rem 1rem;
  border: none;
  background: transparent;
  border-radius: 0.75rem;
  font-size: 1rem;
  color: var(--headingText);
  caret-color: var(--extraColor);
}

.chat-form input:focus {
  outline: none;
}

.chat-form input::placeholder {
  color: var(--mutedText);
}

.chat-form button {
  background: var(--primaryGradient);
  color: white;
  border: none;
  padding: 0 1.2rem;
  border-radius: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 150ms;
}

.chat-form button:hover {
  filter: brightness(1.05);
}

.chat-form button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* Markdown Styling in Chat */
.ai-message h1,
.ai-message h2,
.ai-message h3,
.ai-message h4 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  color: #0f172a;
}

.ai-message h1 {
  font-size: 1.5rem;
}

.ai-message h2 {
  font-size: 1.3rem;
}

.ai-message h3 {
  font-size: 1.1rem;
}

.ai-message h4 {
  font-size: 1rem;
}

.ai-message p {
  margin: 0.5rem 0;
  line-height: 1.6;
  color: #334155;
}

.ai-message ul,
.ai-message ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.ai-message li {
  margin: 0.25rem 0;
  color: #334155;
}

.ai-message strong {
  font-weight: 700;
  color: #1e293b;
}

.ai-message em {
  font-style: italic;
  color: #475569;
}

.ai-message code.inline-code {
  background: linear-gradient(180deg, #f8fbff 0%, #e7f0ff 100%);
  color: #1d4ed8;
  border: 1px solid #c9dcff;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.9em;
  font-family: 'Monaco', 'Courier New', monospace;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.ai-message pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.75rem 0;
}

.ai-message pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.ai-message .markdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  border-radius: 0.5rem;
  overflow: hidden;
  table-layout: fixed;
  border: 1px solid #dbe7f7;
}

.ai-message .markdown-table th {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e3a8a;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  border-bottom: 1px solid #cfe0fb;
}

.ai-message .markdown-table td {
  padding: 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.82);
  color: #334155;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-message .markdown-table tr:hover td {
  background: #f6faff;
}

.ai-message .markdown-table tr:last-child td {
  border-bottom: none;
}

.ai-message blockquote {
  border-left: 4px solid #2563eb;
  padding-left: 1rem;
  margin: 1rem 0;
  color: #475569;
  font-style: italic;
  background: rgba(239, 246, 255, 0.7);
  border-radius: 0.35rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.ai-message hr {
  border: none;
  border-top: 2px solid #e2e8f0;
  margin: 1rem 0;
}

body.theme-dark .landing-view {
  border: 1px solid var(--borderColor);
  background: var(--landingHeroGradient);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
}

body.theme-dark .landing-view::after {
  background: var(--landingHeroGlow);
}

body.theme-dark .landing-brand {
  color: #e8f0ff;
}

body.theme-dark .landing-view h1 {
  color: #f2f7ff;
}

body.theme-dark .landing-subtitle {
  color: rgb(177, 187, 206);
}

body.theme-dark .landing-option-title {
  /* color: #cfe1ff; */
  color: var(--extraColor);
}

body.theme-dark .landing-option-text {
  color: rgb(177, 187, 206);
}

body.theme-dark .search-hero-card {
  background: var(--searchHeroGradient);
}

body.theme-dark #contractAddress {
  border-color: #2c4d83;
  box-shadow: inset 0 0 0 1px rgba(102, 167, 255, 0.12);
}

body.theme-dark .dataset-selector {
  background: color-mix(in srgb, var(--cardBgAlt) 90%, black 10%);
}

body.theme-dark .selector-hint {
  border-color: #2b4f83;
  background: linear-gradient(180deg, rgba(10, 35, 71, 0.96) 0%, rgba(14, 45, 88, 0.96) 100%);
  color: #cfe1ff;
}

body.theme-dark .selector-card:has(input:checked) {
  border-color: #66a7ff;
  background: var(--selectedCardGradient);
}

body.theme-dark #toggleAll {
  background: #0a2347;
  border-color: #2b4f83;
}

body.theme-dark .screen-brand,
body.theme-dark .chat-hero h2 {
  color: #eef4ff;
}

body.theme-dark .chat-shell {
  border-color: var(--borderColor);
  background: var(--chatHeroGradient);
}

body.theme-dark .chat-history,
body.theme-dark .chat-form {
  border-color: var(--borderColor);
}

body.theme-dark .profile-highlight {
  background: var(--highlightGradient);
}

body.theme-dark .profile-highlight span {
  color: #66a7ff;
}

body.theme-dark .summary-insights,
body.theme-dark .summary-mini-chart,
body.theme-dark .metric-card,
body.theme-dark .card-chart,
body.theme-dark .chart-wrapper {
  background: #0a2347;
}

body.theme-dark .data-table th,
body.theme-dark .data-table td,
body.theme-dark .summary-mini-table th,
body.theme-dark .summary-mini-table td {
  border-color: var(--tableLineDark);
}

body.theme-dark .summary-mini-chart {
  border-color: var(--tableLineSoftDark);
}

body.theme-dark .data-section,
body.theme-dark .summary-insights,
body.theme-dark .metric-card,
body.theme-dark .card-chart,
body.theme-dark .chart-wrapper {
  border-color: var(--tableLineSoftDark);
}

/* Bright primary section headings in Search view (dark mode). */
body.theme-dark #searchView .card > h1,
body.theme-dark #searchView .card > h2,
body.theme-dark #searchView .header-with-logo h1,
body.theme-dark #searchView .snapshot-head h2 {
  color: #ffffff;
}

body.theme-dark .chat-form input {
  color: #eef4ff;
  caret-color: #66a7ff;
}

body.theme-dark .chat-form input::placeholder {
  color: rgb(177, 187, 206);
}

body.theme-dark .ai-message {
  background: #0a2347;
  border-color: #163159;
  color: rgb(177, 187, 206);
}

body.theme-dark .ai-message strong,
body.theme-dark .ai-message h1,
body.theme-dark .ai-message h2,
body.theme-dark .ai-message h3,
body.theme-dark .ai-message h4 {
  color: #eaf2ff;
}

body.theme-dark .ai-message em,
body.theme-dark .ai-message p,
body.theme-dark .ai-message li,
body.theme-dark .ai-message blockquote {
  color: rgb(177, 187, 206);
}

body.theme-dark .ai-message code.inline-code {
  background: #163159;
  color: #eaf2ff;
}

body.theme-dark .ai-message pre {
  background: #000d26;
  color: #dbe8ff;
  border: 1px solid #163159;
}

body.theme-dark .ai-message .markdown-table th {
  background: var(--primaryGradient);
  color: #eef4ff;
  border-bottom-color: #2b4f83;
}

body.theme-dark .ai-message .markdown-table td {
  background: #0a2347;
  border-bottom: 1px solid #163159;
  color: rgb(177, 187, 206);
}

body.theme-dark .ai-message .markdown-table tr:hover td {
  background: #163159;
}

body.theme-dark #summary .markdown-table th {
  background: var(--primaryGradient);
  border-bottom: 1px solid var(--tableLineDark);
}

body.theme-dark #summary .markdown-table td {
  background: #0a2347;
  border-color: var(--tableLineDark);
  color: rgb(177, 187, 206);
}

body.theme-dark #summary code.inline-code {
  background: #163159;
  color: #eaf2ff;
}

@media (min-width: 900px) {
  #searchView {
    grid-template-columns: 1fr;;
  }


  #chatView {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .explorer-header {
    flex-wrap: wrap;
    padding: 0.7rem 1rem;
    gap: 0.7rem;
  }

  .explorer-nav {
    margin-left: 0;
    order: 3;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 0.2rem;
  }

  .explorer-right {
    margin-left: auto;
    gap: 0.6rem;
  }

  .explorer-icons {
    display: none;
  }

  .agent-footer-main {
    grid-template-columns: 1fr 1fr;
  }

  .agent-footer-subscribe {
    grid-template-columns: 1fr;
  }

  .landing-actions {
    grid-template-columns: 1fr;
  }

  .snapshot-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-head-actions {
    justify-content: flex-start;
  }

  .header-with-logo {
    align-items: flex-start;
  }

  .chat-shell {
    min-height: 0;
    height: calc(100vh - 9.5rem);
    height: calc(100dvh - 9.5rem);
    padding: 4rem 1rem 1rem;
  }

  #contractAddress {
    width: 100%;
  }

  .search-hero-card .form > button[type="submit"] {
    width: 100%;
    min-width: 0;
  }

  .selector-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }

  .chat-hero h2 {
    font-size: 1.55rem;
    text-align: center;
  }

  .chat-shell.empty .chat-form {
    margin-bottom: 1rem;
  }
}

@media (max-width: 640px) {
  .explorer-right .login-btn,
  .explorer-right .signup-btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.85rem;
  }

  .release {
    display: none;
  }

  .agent-footer-main {
    grid-template-columns: 1fr;
  }

  .agent-footer-last {
    flex-direction: column;
    align-items: flex-start;
  }

  .selector-grid {
    grid-template-columns: 1fr;
  }
}
