/* ============================================
   SolveIndex - Main Stylesheet
   Mobile-first, no external dependencies
   ============================================ */

/* ---- Reset & Base ---- */
/* Ensure [hidden] always hides regardless of CSS display rules */
[hidden] {
  display: none !important;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: #111827;
  background: #ffffff;
  min-width: 320px;
  overflow-x: hidden;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: #1d4ed8;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ul,
ol {
  list-style: none;
}

/* ---- CSS Variables ---- */
:root {
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-600: #16a34a;
  --green-700: #15803d;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ---- Layout Containers ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container {
    padding: 0 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 2rem;
  }
}


/* ---- Header & Navigation ---- */
.site-header {
  background: #ffffff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.25rem;
  overflow: visible;
}

/* Brand / Logo */
.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  background: var(--blue-600);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.9375rem;
  font-weight: 800;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue-700);
  white-space: nowrap;
}

/* Keep old logo icon for any remaining uses (login/signup/dashboard pages) */
.nav-logo-icon {
  background: var(--blue-600);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  flex-shrink: 0;
}

/* Main desktop nav */
.main-nav {
  display: none;
  align-items: center;
  gap: 0.125rem;
  flex: 1;
  overflow: visible;
}

.main-nav a {
  color: var(--gray-700);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  height: 34px;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}

.main-nav a:hover {
  background: var(--gray-100);
  color: var(--blue-700);
  text-decoration: none;
}

.main-nav a[aria-current="page"] {
  color: var(--blue-600);
  font-weight: 600;
}

/* Header actions (search + auth buttons) */
.header-actions {
  display: none;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

/* Auth buttons */
.auth-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
  line-height: 1;
  flex-shrink: 0;
}

/* All auth buttons hidden by default — JS applies correct state from cache or Firebase */
.auth-login-signup {
  display: none;
  background: var(--blue-600);
  color: white !important;
}

.auth-login-signup:hover {
  background: var(--blue-700);
  text-decoration: none;
  color: white !important;
}

.auth-dashboard {
  display: none;
  background: var(--blue-600);
  color: white !important;
}

.auth-dashboard:hover {
  background: var(--blue-700);
  text-decoration: none;
  color: white !important;
}

.auth-logout {
  display: none;
  background: var(--gray-100);
  color: var(--gray-700) !important;
}

.auth-logout:hover {
  background: var(--gray-200);
}

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.375rem;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.hamburger:hover {
  background: var(--gray-100);
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gray-700);
  border-radius: 2px;
  transition: all 0.25s ease;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile nav drawer */
.mobile-nav {
  display: none;
  flex-direction: column;
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 0.625rem;
  gap: 0.125rem;
  box-shadow: var(--shadow-md);
  max-height: calc(100vh - 52px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

.mobile-nav.open {
  display: flex;
}

/* Lock page scroll when mobile menu is open */
body.mobile-menu-open {
  overflow: hidden;
}

.mobile-nav a,
.mobile-nav button.auth-btn {
  color: var(--gray-700);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.625rem 0.875rem;
  border-radius: 6px;
  min-height: 44px;
  display: flex;
  align-items: center;
  text-decoration: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  white-space: normal;
  height: auto;
}

.mobile-nav a:hover,
.mobile-nav button.auth-btn:hover {
  background: var(--gray-100);
  text-decoration: none;
}

.mobile-auth {
  margin-top: 0.375rem;
}

.mobile-nav .auth-login-signup,
.mobile-nav .auth-dashboard {
  background: var(--blue-600);
  color: white !important;
  justify-content: center;
  font-weight: 600;
  border-radius: 8px;
}

.mobile-nav .auth-login-signup:hover,
.mobile-nav .auth-dashboard:hover {
  background: var(--blue-700);
}

.mobile-nav .auth-logout {
  background: var(--gray-100);
  color: var(--gray-700) !important;
  justify-content: center;
  font-weight: 600;
  border-radius: 8px;
}

.mobile-nav .auth-logout:hover {
  background: var(--gray-200);
}

@media (min-width: 768px) {
  .main-nav {
    display: flex;
  }

  .header-actions {
    display: flex;
  }

  .hamburger {
    display: none;
  }

  .mobile-nav {
    display: none !important;
  }
}

/* ---- Hero Section ---- */
.hero {
  background: linear-gradient(135deg, var(--blue-50) 0%, #f0f9ff 50%, var(--green-50) 100%);
  padding: clamp(2.5rem, 6vw, 5rem) 0;
  text-align: center;
}

.hero h1 {
  font-size: clamp(1.625rem, 4.5vw, 3rem);
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero h1 span {
  color: var(--blue-600);
}

.hero p {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--gray-600);
  max-width: 680px;
  margin: 0 auto 2rem;
  line-height: 1.65;
}

.hero-btns {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

@media (min-width: 480px) {
  .hero-btns {
    flex-direction: row;
  }
}

.hero-btn {
  min-height: 54px;
  min-width: 260px;
  padding: 0 1.75rem;
  font-weight: 700;
  white-space: normal;
  text-align: center;
  font-family: inherit;
}

.hero-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .hero-btns {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .hero-btn {
    width: 100%;
    min-width: 0;
  }
}

/* ---- Marketing-roi-page-comming-soon-cards ----------------*/

/* Marketing ROI - Coming Soon Calculator Cards */

.marketing-upcoming-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}

.marketing-upcoming-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 160px;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid #dbe3ec;
  border-radius: 6px;
  box-sizing: border-box;
}

.marketing-upcoming-icon {
  display: block;
  font-size: 1.2rem;
  line-height: 1;
  margin-bottom: 0.65rem;
}

.marketing-upcoming-title {
  display: block;
  color: var(--gray-800);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.marketing-upcoming-description {
  display: block;
  color: var(--gray-600);
  font-size: 0.875rem;
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.marketing-upcoming-card .coming-soon {
  display: inline-block;
  margin-top: auto;
}

/* Tablet */
@media (max-width: 1050px) {
  .marketing-upcoming-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mobile */
@media (max-width: 600px) {
  .marketing-upcoming-grid {
    grid-template-columns: 1fr;
  }

  .marketing-upcoming-card {
    min-height: auto;
  }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  min-height: 44px;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
  max-width: 100%;
}

@media (max-width: 479px) {

  /* Allow button text to wrap on very small screens so it never overflows */
  .btn {
    white-space: normal;
    text-align: center;
  }
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--blue-600);
  color: white;
  border-color: var(--blue-600);
}

.btn-primary:hover {
  background: var(--blue-700);
  border-color: var(--blue-700);
  color: white;
}

.btn-secondary {
  background: white;
  color: var(--blue-700);
  border-color: var(--blue-600);
}

.btn-secondary:hover {
  background: var(--blue-50);
  color: var(--blue-800);
}

.btn-green {
  background: var(--green-600);
  color: white;
  border-color: var(--green-600);
}

.btn-green:hover {
  background: var(--green-700);
  border-color: var(--green-700);
  color: white;
}

.btn-sm {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  min-height: 38px;
}

.btn-lg {
  font-size: 1.125rem;
  padding: 0.875rem 2rem;
  min-height: 52px;
}

/* ---- Sections ---- */
.section {
  padding: clamp(2.5rem, 5vw, 2rem) 0;
}

.section-alt {
  background: var(--gray-50);
}

.section-title {
  font-size: clamp(1.375rem, 3.5vw, 2rem);
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.125rem);
  color: var(--gray-500);
  margin-bottom: 2rem;
  max-width: 600px;
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-header .section-subtitle {
  margin-left: auto;
  margin-right: auto;
}

/* ---- Cards Grid ---- */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 480px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--blue-600);
  transform: translateY(-2px);
}

.card a {
  text-decoration: none;
  color: inherit;
}

.card-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.375rem;
}

.card-icon-blue {
  background: var(--blue-50);
}

.card-icon-green {
  background: var(--green-50);
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.4rem;
}

.card p {
  font-size: 0.875rem;
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.card .card-link {
  font-size: 0.875rem;
  font-weight: 600;
  margin-top: auto;
  color: var(--blue-600);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

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

/* ---- Calculator Box ---- */
.calc-box {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 560px;
  min-width: 0;
  box-sizing: border-box;
  margin: 0 auto;
}

.calc-box h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--gray-900);
  background: white;
  min-height: 44px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-input::placeholder {
  color: var(--gray-400);
}

.calc-results {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-200);
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.result-row:last-child {
  border-bottom: none;
}

.result-label {
  font-size: 0.875rem;
  color: var(--gray-600);
  font-weight: 500;
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--gray-900);
  min-width: 0;
  text-align: right;
}

.result-value.positive {
  color: var(--green-600);
}

.result-value.negative {
  color: #dc2626;
}

.result-value.highlight {
  color: var(--blue-600);
  font-size: 1.375rem;
}

.calc-btn {
  width: 100%;
  margin-top: 1rem;
  min-height: 48px;
  font-size: 1rem;
}

/* ---- Calculator Page Layout ---- */
.calc-page-hero {
  background: linear-gradient(135deg, var(--blue-50) 0%, #f0f9ff 100%);
  padding: clamp(1.75rem, 4vw, 3rem) 0;
  border-bottom: 1px solid var(--blue-100);
}

.calc-page-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.calc-page-hero p {
  font-size: clamp(0.95rem, 2.5vw, 1.125rem);
  color: var(--gray-600);
  max-width: 680px;
  margin-bottom: 0;
}

.calc-page-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
}

@media (min-width: 1024px) {
  .calc-page-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.875rem;
  color: var(--gray-500);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 0.25rem;
}

.breadcrumb a {
  color: var(--blue-600);
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb span {
  color: var(--gray-400);
}

/* ---- Category Links ---- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .categories-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.category-card {
  background: white;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  display: block;
  min-height: 44px;
}

.category-card:hover {
  border-color: var(--blue-600);
  background: var(--blue-50);
  text-decoration: none;
  transform: translateY(-1px);
}

.category-card .cat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.category-card span {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  display: block;
}

/* ---- Industry Links ---- */
.industry-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .industry-links {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .industry-links {
    grid-template-columns: repeat(3, 1fr);
  }
}

.industry-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  color: var(--gray-700);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  min-height: 44px;
  transition: all 0.2s ease;
}

.industry-link:hover {
  border-color: var(--blue-600);
  color: var(--blue-700);
  background: var(--blue-50);
  text-decoration: none;
}

.industry-link .arrow {
  margin-left: auto;
  color: var(--gray-400);
  font-size: 0.875rem;
}

/* ---- Educational / Prose ---- */
.prose {
  max-width: 780px;
}

.prose h2 {
  font-size: clamp(1.25rem, 3vw, 1.625rem);
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.75rem;
  margin-top: 2rem;
  letter-spacing: -0.01em;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 0.5rem;
  margin-top: 1.5rem;
}

.prose p {
  color: var(--gray-600);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.prose ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.prose ul li {
  color: var(--gray-600);
  margin-bottom: 0.35rem;
  line-height: 1.65;
}

.prose ol {
  list-style: decimal;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.prose ol li {
  color: var(--gray-600);
  margin-bottom: 0.35rem;
  line-height: 1.65;
}

/* ---- Formula Box ---- */
.formula-box {
  background: var(--gray-900);
  color: #f1f5f9;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.95rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Example Box ---- */
.example-box {
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-left: 4px solid var(--green-600);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.example-box h4 {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--green-700);
  margin-bottom: 0.75rem;
}

.example-box p,
.example-box li {
  font-size: 0.9375rem;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

.example-box strong {
  color: var(--green-700);
}

/* ── Mobile Example Toggle Button ────────────────────────────────────────── */
.example-toggle-btn {
  display: none;
}

@media (max-width: 767px) {
  .example-toggle-btn.visible {
    display: block;
    width: 100%;
    background: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--blue-600);
    cursor: pointer;
    margin-top: 0.75rem;
    text-align: center;
  }

  .example-toggle-btn.visible:hover {
    background: var(--blue-50);
    border-color: var(--blue-600);
  }

  .mobile-collapsible-example.collapsed {
    display: none;
  }
}

/* ---- Info Box ---- */
.info-box {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-left: 4px solid var(--blue-600);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}

.info-box p {
  font-size: 0.9375rem;
  color: var(--gray-700);
  margin: 0;
}

/* ---- FAQ ---- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}

.faq-question {
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  min-height: 44px;
  user-select: none;
  gap: 0.75rem;
}

.faq-question:hover {
  background: var(--gray-50);
}

.faq-icon {
  font-size: 1.25rem;
  color: var(--gray-400);
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.faq-item.open .faq-icon {
  transform: rotate(45deg);
}

.faq-answer {
  display: none;
  padding: 0 1.25rem 1rem;
  font-size: 0.9375rem;
  color: var(--gray-600);
  line-height: 1.7;
  background: white;
}

.faq-item.open .faq-answer {
  display: block;
}

/* ---- Related Calculators ---- */
.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 480px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .related-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.related-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  text-decoration: none;
  min-height: 44px;
  transition: all 0.2s ease;
}

.related-card:hover {
  border-color: var(--blue-600);
  background: var(--blue-50);
  text-decoration: none;
}

.related-card span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-800);
}

.related-card:hover span {
  color: var(--blue-700);
}

/* ---- Stats / Highlights ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  text-align: center;
  padding: 1.25rem 0.75rem;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-100);
}

.stat-number {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 800;
  color: var(--blue-600);
  line-height: 1;
  margin-bottom: 0.35rem;
}

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

/* ---- Mini ROI Calculator (Homepage) ---- */
.mini-calc {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 50%, #2563eb 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  max-width: 620px;
  margin: 0 auto;
}

.mini-calc h3 {
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.mini-calc .form-input {
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: white;
}

.mini-calc .form-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.mini-calc .form-input:focus {
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

.mini-calc .form-label {
  color: rgba(255, 255, 255, 0.9);
}

.mini-calc .calc-results {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.mini-calc .result-label {
  color: rgba(255, 255, 255, 0.8);
}

.mini-calc .result-value {
  color: white;
}

.mini-calc .result-value.positive {
  color: #4ade80;
}

.mini-calc .result-value.highlight {
  color: #fbbf24;
  font-size: 1.375rem;
}

.mini-calc .btn-full {
  background: white;
  color: var(--blue-700);
  width: 100%;
  margin-top: 1rem;
  min-height: 48px;
  font-weight: 700;
}

.mini-calc .btn-full:hover {
  background: var(--blue-50);
  color: var(--blue-800);
}

/* ---- Tables ---- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 0;
  /* Removed 500px — bare tables must not overflow. */
  border-collapse: collapse;
  font-size: 0.9rem;
}

/* Only data tables inside a scrollable wrapper should have a fixed minimum */
.table-wrap table {
  min-width: 500px;
}

th {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
  /* kept for scrollable tables; overridden on mobile below */
}

@media (max-width: 767px) {

  /* Allow th to wrap on mobile for any table NOT inside a scroll wrapper */
  th {
    white-space: normal;
  }

  /* Restore nowrap only inside the dedicated scroll wrappers */
  .table-wrap th,
  .table-scroll-wrap th,
  .breakdown-table-container th {
    white-space: nowrap;
  }
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--gray-50);
}

/* ---- Footer ---- */
.footer {
  background: var(--gray-900);
  color: var(--gray-300);
  padding: clamp(2rem, 4vw, 3.5rem) 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-brand p {
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--gray-400);
  margin-top: 0.75rem;
  max-width: 300px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.footer-logo:hover {
  text-decoration: none;
}

.footer-logo-icon {
  width: 1.75rem;
  height: 1.75rem;
  background: var(--blue-600);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.footer-col h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.875rem;
}

.footer-col ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-col a {
  font-size: 0.875rem;
  color: var(--gray-400);
  text-decoration: none;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
}

.footer-col a:hover {
  color: white;
  text-decoration: none;
}

.footer-bottom {
  border-top: 1px solid var(--gray-700);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
}

@media (min-width: 640px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.footer-bottom p {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.footer-bottom-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-bottom-links a {
  font-size: 0.8125rem;
  color: var(--gray-500);
  text-decoration: none;
}

.footer-bottom-links a:hover {
  color: var(--gray-300);
}

/* ---- Badge / Tag ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue {
  background: var(--blue-100);
  color: var(--blue-700);
}

.badge-green {
  background: var(--green-100);
  color: var(--green-700);
}

/* ---- Divider ---- */
.divider {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 0;
}

/* ---- Contact Form ---- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 480px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

textarea.form-input {
  resize: vertical;
  min-height: 120px;
}

select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ---- Alert/Success Message ---- */
.alert {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 500;
  display: none;
}

.alert-success {
  background: var(--green-50);
  border: 1px solid var(--green-100);
  color: var(--green-700);
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #b91c1c;
}

.alert.show {
  display: block;
}

/* ---- Calculator Page Sidebar ---- */
.page-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.sidebar-card h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.875rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--gray-100);
}

.sidebar-links {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.sidebar-links a {
  font-size: 0.875rem;
  color: var(--gray-600);
  padding: 0.375rem 0.5rem;
  border-radius: var(--radius-sm);
  display: block;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.sidebar-links a:hover {
  background: var(--blue-50);
  color: var(--blue-700);
  text-decoration: none;
}

/* ---- Utility classes ---- */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.mt-1 {
  margin-top: 0.25rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mt-8 {
  margin-top: 2rem;
}

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.pt-0 {
  padding-top: 0;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.font-bold {
  font-weight: 700;
}

.text-sm {
  font-size: 0.875rem;
}

.text-muted {
  color: var(--gray-500);
}

.text-blue {
  color: var(--blue-600);
}

.text-green {
  color: var(--green-600);
}

.hidden {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---- Skip to content (accessibility) ---- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--blue-600);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  font-weight: 600;
  z-index: 1000;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  top: 0;
}

/* ============================================================
   AD SLOTS — Adsterra / display ad placeholders
   Replace inner content with actual ad tag when ready
   ============================================================ */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f0f9ff;
  background: #f9fafb00;
  border: 0px dashed var(--gray-200);
  border-radius: var(--radius);
  min-height: 90px;
  overflow: hidden;
}

/* Header ad — below navigation, full width */
.ad-header {
  width: 100%;
  min-height: 90px;
  max-height: 120px;
  border-radius: 0;
  border-left: none;
  border-right: none;
}

/* Footer ad — above footer */
.ad-footer {
  width: 100%;
  min-height: 90px;
  max-height: 120px;
  border-radius: 0;
  border-left: none;
  border-right: none;
  margin-top: 0;
}

/* Sidebar ad — desktop only */
.ad-sidebar {
  min-height: 250px;
  width: 100%;
}

@media (max-width: 767px) {
  .ad-sidebar {
    display: none;
  }
}

/* In-content ad — after formula/example section */
.ad-content {
  margin: 1.5rem 0;
  min-height: 90px;
}

@media (max-width: 639px) {
  .ad-content {
    min-height: 80px;
  }
}

/* ============================================================
   AUTH — Login / Signup pages
   ============================================================ */
.auth-card {
  width: 100%;
  max-width: 440px;
  min-width: 0;
  box-sizing: border-box;
  margin: 0 auto;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 5vw, 2.5rem);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.auth-title {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--gray-900);
  text-align: center;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--gray-500);
  text-align: center;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.auth-switch {
  font-size: 0.875rem;
  color: var(--gray-500);
  text-align: center;
  margin-top: 0.5rem;
}

.auth-switch a {
  color: var(--blue-600);
  font-weight: 600;
}

.password-wrap {
  position: relative;
}

.password-wrap .form-input {
  padding-right: 2.75rem;
}

.pwd-toggle {
  position: absolute;
  right: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  color: var(--gray-400);
  line-height: 1;
  min-height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Auth nav items injected by auth.js */
.nav-auth-item {
  font-size: 0.9375rem;
  color: var(--gray-700);
  text-decoration: none;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-auth-item:hover {
  color: var(--blue-600);
  text-decoration: none;
}

.auth-login-signup,
.nav-auth-signup {
  background: var(--blue-600);
  color: white !important;
  border-radius: var(--radius);
  padding: 0.375rem 0.875rem;
  font-weight: 600;
}

.auth-login-signup:hover,
.nav-auth-signup:hover {
  background: var(--blue-700);
  text-decoration: none;
}

/* ============================================================
   SHARE BAR — Copy / Share result buttons
   ============================================================ */
.share-bar {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
  padding-bottom: 0.875rem;
  margin-bottom: 0.875rem;
  border-bottom: 1px solid var(--gray-100);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.btn-share {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 36px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-share:hover {
  background: var(--blue-50);
  border-color: var(--blue-300);
  color: var(--blue-700);
}

/* ============================================================
   HISTORY LOGIN PROMPT — shown in results when logged out
   ============================================================ */
.history-login-prompt {
  font-size: 0.825rem;
  color: var(--gray-500);
  text-align: center;
  margin-top: 0.875rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--gray-100);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  box-sizing: border-box;
}

.history-login-prompt a {
  color: var(--blue-600);
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

@media (max-width: 639px) {
  .dash-controls {
    flex-direction: column;
    align-items: flex-start;
  }
}

#dash-table th,
#dash-table td {
  vertical-align: top;
}

#dash-table td:last-child {
  vertical-align: middle;
}

.btn-delete {
  background: transparent;
  border: none;
  cursor: pointer;
}

.btn-delete:hover {
  background: #fef2f2 !important;
  border-radius: var(--radius-sm);
}

/* ============================================================
   HOME LAYOUT — main content + right sidebar (desktop)
   ============================================================ */
.home-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.home-main {
  flex: 1;
  min-width: 0;
}

.home-sidebar {
  width: 300px;
  flex-shrink: 0;
}

/* Sticky ad on large screens */
@media (min-width: 1024px) {
  .home-sidebar .ad-sidebar {
    position: sticky;
    top: 88px;
    min-height: 300px;
  }
}

/* Tablet: stack sidebar below content */
@media (max-width: 1023px) {
  .home-layout {
    flex-direction: column;
  }

  .home-sidebar {
    width: 100%;
    max-width: 728px;
  }

  .home-sidebar .ad-sidebar {
    min-height: 90px;
  }
}

/* Mobile: hide sidebar entirely */
@media (max-width: 767px) {
  .home-sidebar {
    display: none;
  }
}

/* ============================================================
   COMPACT CALCULATOR CARDS — homepage only
   ============================================================ */
.compact-calculator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .compact-calculator-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .compact-calculator-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.compact-calculator-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  min-height: 58px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--gray-800);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.compact-calculator-card:hover {
  border-color: var(--blue-400);
  background: var(--blue-50);
  color: var(--blue-700);
  text-decoration: none;
}

.ccc-arrow {
  flex-shrink: 0;
  font-style: normal;
  color: var(--blue-400);
  font-size: 0.875rem;
  transition: transform 0.15s ease, color 0.15s ease;
}

.compact-calculator-card:hover .ccc-arrow {
  color: var(--blue-600);
  transform: translateX(2px);
}

/* ============================================================
   GLOBAL CALCULATOR SEARCH
   ============================================================ */
.site-search {
  position: relative;
  flex: 0 1 320px;
  /* can shrink from 320px max so auth button is never cut off */
  min-width: 140px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  height: 38px;
  /* match auth-btn height exactly */
  padding: 0 14px 0 38px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--gray-800);
  background: white;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
}

.search-input:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-input::placeholder {
  color: var(--gray-400);
}

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 300px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  overflow-y: auto;
  max-height: 320px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  text-decoration: none;
  color: var(--gray-800);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s ease;
  outline: none;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.is-active,
.search-result-item:focus {
  background: var(--blue-50);
  color: var(--blue-700);
  text-decoration: none;
}

.search-result-title {
  font-weight: 600;
}

.search-result-category {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 0.125rem 0.45rem;
  border-radius: 999px;
}

.search-result-item:hover .search-result-category,
.search-result-item.is-active .search-result-category,
.search-result-item:focus .search-result-category {
  background: var(--blue-100);
  color: var(--blue-700);
}

.search-empty {
  padding: 0.75rem 0.875rem;
  color: var(--gray-500);
  font-size: 0.875rem;
}

.search-browse-link {
  display: block;
  padding: 0.5rem 0.875rem 0.75rem;
  color: var(--blue-600);
  font-size: 0.875rem;
  text-decoration: none;
  font-weight: 500;
}

.search-browse-link:hover {
  text-decoration: underline;
}

@media (min-width: 768px) and (max-width: 1023px) {
  .search-input {
    width: 200px;
  }
}

@media (max-width: 767px) {
  .nav-inner {
    flex-wrap: wrap;
  }

  .site-search {
    order: 10;
    width: 100%;
    padding: 0.5rem 0 0.25rem;
    border-top: 1px solid var(--gray-100);
  }

  .search-input {
    width: 100%;
  }

  .search-results {
    right: auto;
    left: 0;
    width: 100%;
  }
}

/* ============================================================
   Google Auth — .google-auth-btn / .google-icon / .auth-divider
   ============================================================ */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--gray-400);
  font-size: 0.8125rem;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

.google-auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  min-height: 44px;
  height: 44px;
  padding: 0 1rem;
  background: #ffffff;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-800);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 0.75rem;
}

.google-auth-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.google-auth-btn:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

.google-auth-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #4285F4;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: 'Google Sans', Arial, sans-serif;
  flex-shrink: 0;
  line-height: 1;
}

@media (max-width: 480px) {
  .google-auth-btn {
    font-size: 0.875rem;
    min-height: 44px;
    height: 44px;
  }
}

/* ============================================================
   Forgot Password link
   ============================================================ */
.forgot-password-link {
  font-size: 0.8125rem;
  color: var(--blue-600);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.forgot-password-link:hover {
  text-decoration: underline;
}

/* ============================================================
   Auth message (success / error) — used on forgot-password page
   ============================================================ */
.auth-message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  display: none;
}

.auth-message.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.auth-message.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* ============================================================
   Email verification banner — dashboard
   ============================================================ */
.verify-email-banner {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
  padding: 0.75rem 0;
}

.verify-email-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: #92400e;
  font-weight: 500;
}

.verify-email-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .verify-email-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
  }
}

/* ============================================================
   Dashboard Tabs
   ============================================================ */
.dashboard-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
}

.dashboard-tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-500);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  min-height: 44px;
  max-width: 100%;
  flex: 0 1 auto;
}

.dashboard-tab:hover {
  color: var(--blue-600);
}

.dashboard-tab.active {
  color: var(--blue-600);
  border-bottom-color: var(--blue-600);
}

/* ============================================================
   Account Settings
   ============================================================ */
.account-settings {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 680px;
}

.account-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1.5rem;
}

.account-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-100);
}

.account-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-50);
  font-size: 0.9rem;
}

.account-info-row:last-child {
  border-bottom: none;
}

.account-info-label {
  color: var(--gray-500);
  font-weight: 500;
  flex-shrink: 0;
}

.account-info-value {
  color: var(--gray-800);
  font-weight: 500;
  text-align: right;
}

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

.account-message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.account-message.success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.account-message.error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.verification-box {
  padding: 0.25rem 0;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
}

.provider-google {
  background: #e8f0fe;
  color: #1a73e8;
}

.provider-email {
  background: #f0fdf4;
  color: #166534;
}

@media (max-width: 600px) {
  .account-card {
    padding: 1.25rem;
  }

  .account-info-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .account-info-value {
    text-align: left;
  }

  .dashboard-tab {
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
  }
}

/* ============================================================
   Calculator Link Grid (calculators.html compact cards)
   ============================================================ */
.calculator-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-card {
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.quick-card-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  line-height: 1;
}

.quick-card-title {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-card-arrow {
  color: #94a3b8;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.quick-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.quick-card:hover .quick-card-arrow {
  color: #2563eb;
}

@media (max-width: 900px) {
  .calculator-link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .calculator-link-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Visualization Panel ─────────────────────────────────────────────────────── */
.result-visual-panel {
  margin-top: 1.75rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.result-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.result-summary-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  width: calc(50% - 0.375rem);
  margin-left: auto;
  margin-right: auto;
}

.result-summary-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 0.875rem;
  text-align: center;
}

.result-summary-card.card-positive {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.result-summary-card.card-negative {
  border-color: #fecaca;
  background: #fef2f2;
}

.result-summary-card.card-highlight {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.summary-label {
  font-size: 0.7rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 0.375rem;
  line-height: 1.3;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
  word-break: break-word;
}

.summary-note {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 0.25rem;
  line-height: 1.3;
}

.visual-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.visual-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.visual-card-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0;
}

.visual-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.vis-btn {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.3125rem 0.625rem;
  font-size: 0.75rem;
  color: #475569;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.14s, border-color 0.14s;
  white-space: nowrap;
  line-height: 1.4;
}

.vis-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.vis-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.chart-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.svg-chart {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
  margin: 0 auto;
}

.progress-row {
  margin-bottom: 0.875rem;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: #374151;
  margin-bottom: 0.375rem;
  font-weight: 500;
}

.progress-value {
  color: #64748b;
  font-weight: 400;
  font-size: 0.8rem;
}

.progress-track {
  height: 10px;
  background: #f1f5f9;
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.55s ease;
}

.breakdown-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 6px;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  min-width: 360px;
}

.breakdown-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  text-align: left;
  padding: 0.625rem 0.875rem;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  font-size: 0.8rem;
}

.breakdown-table td {
  padding: 0.5rem 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
  vertical-align: top;
  line-height: 1.45;
}

.breakdown-table tr:last-child td {
  border-bottom: none;
}

.breakdown-table tbody tr:hover td {
  background: #f8fafc;
}

.result-insight-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: #78350f;
  margin-bottom: 1rem;
  line-height: 1.55;
}

.vis-share-row {
  margin-bottom: 0.5rem;
}

.vis-msg {
  padding: 0.5rem 0.875rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  margin-top: 0.625rem;
  line-height: 1.45;
}

.vis-msg-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.vis-msg-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Saved Reports (dashboard) */
.saved-reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1rem;
}

.saved-report-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.saved-report-card h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 0.25rem;
  line-height: 1.35;
}

.report-meta {
  font-size: 0.775rem;
  color: #94a3b8;
  margin-bottom: 0.75rem;
}

.report-summary {
  font-size: 0.8rem;
  color: #475569;
  margin-bottom: 1rem;
  line-height: 1.55;
  flex: 1;
}

.saved-report-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.saved-report-actions .vis-btn {
  font-size: 0.75rem;
}

.saved-report-actions .vis-btn.delete-btn {
  color: #dc2626;
  border-color: #fecaca;
  background: #fef2f2;
}

.saved-report-actions .vis-btn.delete-btn:hover {
  background: #fee2e2;
}

/* Responsive */
@media (max-width: 640px) {

  /* Single-column on mobile — prevents right-side cut on all result card grids */
  .result-summary-grid,
  .summary-cards,
  .metric-cards,
  .visual-grid,
  .calculator-result-grid {
    grid-template-columns: 1fr !important;
  }

  .summary-value {
    font-size: 1.0625rem;
  }

  .visual-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .breakdown-table th,
  .breakdown-table td {
    padding: 0.4375rem 0.625rem;
    font-size: 0.75rem;
  }

  .saved-reports-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Saved Report View (calculator page) ─────────────────────────────────────── */
.saved-report-view {
  margin: 0 0 2rem;
  border: 2px solid #bfdbfe;
  border-radius: 14px;
  background: #f8fbff;
  overflow: hidden;
}

.saved-report-banner {
  background: #dbeafe;
  border-bottom: 1px solid #bfdbfe;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-height: 3.5rem;
}

.saved-report-banner-text {
  font-size: 0.875rem;
  color: #1e40af;
  font-weight: 500;
  line-height: 1.45;
  flex: 1;
  min-width: 0;
}

.saved-report-banner-text a {
  color: #1d4ed8;
  text-decoration: underline;
}

.saved-report-banner-warn {
  background: #fef9c3;
  border-color: #fde68a;
}

.saved-report-banner-warn .saved-report-banner-text {
  color: #92400e;
}

.saved-report-banner-error {
  background: #fef2f2;
  border-color: #fecaca;
}

.saved-report-banner-error .saved-report-banner-text {
  color: #b91c1c;
}

.saved-report-content {
  padding: 1.25rem;
}

@media (max-width: 640px) {
  .saved-report-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── SEO Content Sections ─────────────────────────────────────────────────────── */
.content-section {
  margin-bottom: 0rem;
}

.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 460px;
}

.benchmark-table th {
  background: #f1f5f9;
  color: #374151;
  font-weight: 600;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
}

.benchmark-table td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #475569;
  vertical-align: top;
  line-height: 1.5;
}

.benchmark-table tr:last-child td {
  border-bottom: none;
}

.benchmark-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 380px;
}

.comparison-table th {
  background: #3b82f6;
  color: #fff;
  font-weight: 600;
  padding: 0.625rem 1rem;
  text-align: left;
}

.comparison-table th:first-child {
  background: #334155;
}

.comparison-table td {
  padding: 0.5625rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
  vertical-align: top;
}

.comparison-table tr:last-child td {
  border-bottom: none;
}

.comparison-table tbody tr:nth-child(even) td {
  background: #f8fafc;
}

.interpretation-box {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  padding: 1.5rem;
}

.interp-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.interp-list li {
  font-size: 0.9375rem;
  color: #374151;
  line-height: 1.55;
  padding-left: 1.5rem;
  position: relative;
}

.interp-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #3b82f6;
  font-weight: 700;
}

.disclaimer-inline {
  font-size: 0.8rem;
  color: #6b7280;
  margin: 0.875rem 0 0;
  line-height: 1.5;
}

.disclaimer-box {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.125rem 1.25rem;
}

.disclaimer-box p {
  font-size: 0.8125rem;
  color: #6b7280;
  line-height: 1.6;
  margin: 0;
}

.embed-deployment-card {
  padding: clamp(1rem, 2.5vw, 1.5rem);
}

.embed-deployment-card .section-title {
  margin-bottom: 0.5rem;
}

.embed-deployment-intro {
  margin: 0 0 0.75rem;
}

.embed-license-notice {
  margin: 0 0 0.75rem;
  padding: -0.3rem 0.85rem;
}

.embed-code-box {
  background: #1e293b;
  border-radius: 10px;
  padding: 0.875rem;
  overflow: hidden;
}

.embed-code-pre {
  color: #94a3b8;
  font-size: 0.78rem;
  line-height: 1.5;
  white-space: pre;
  overflow: auto;
  max-height: 180px;
  word-break: normal;
  overflow-wrap: normal;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #64748b #1e293b;
  margin: 0 0 0.75rem;
  padding: 0 0.35rem 0.35rem 0;
  font-family: 'Courier New', Courier, monospace;
}

.embed-code-pre::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

.embed-code-pre::-webkit-scrollbar-track {
  background: #1e293b;
}

.embed-code-pre::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 999px;
  border: 2px solid #1e293b;
}

@media (max-width: 640px) {
  .embed-deployment-card {
    padding: 1rem;
  }

  .embed-code-box {
    padding: 0.75rem;
  }

  .embed-code-pre {
    max-height: 140px;
    font-size: 0.72rem;
    line-height: 1.45;
  }

  .copy-embed-btn {
    width: 100%;
    justify-content: center;
  }
}

.copy-embed-btn {
  font-size: 0.8125rem !important;
  background: #334155 !important;
  color: #f1f5f9 !important;
  border-color: #475569 !important;
}

.copy-embed-btn:hover {
  background: #475569 !important;
}

.vis-export-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

@media (max-width: 720px) {
  .content-two-col {
    grid-template-columns: 1fr !important;
  }
}

/* Embed mode */
body.embed-mode .site-header,
body.embed-mode .mobile-nav,
body.embed-mode .footer,
body.embed-mode .ad-slot {
  display: none !important;
}

body.embed-mode .calc-page-hero {
  padding: 1rem 0 0.5rem;
}

body.embed-mode nav.breadcrumb {
  display: none;
}

/* ── Mega Menu Navigation ─────────────────────────────────────── */
.main-nav button.nav-link,
.nav-dropdown-toggle {
  color: var(--gray-700);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  text-decoration: none;
  white-space: nowrap;
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background 0.15s, color 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle[aria-expanded="true"] {
  background: var(--gray-100);
  color: var(--blue-700);
}

.nav-caret {
  font-size: 0.625rem;
  display: inline-block;
  transition: transform 0.2s;
}

.nav-dropdown-toggle[aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}

.nav-dropdown {
  position: relative;
  overflow: visible;
}

.mega-menu {
  position: fixed;
  top: 3.25rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(1120px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.13), 0 4px 12px rgba(15, 23, 42, 0.06);
  padding: 1.25rem;
  z-index: 2000;
  display: none;
  overflow: visible;
  max-height: none;
  box-sizing: border-box;
}

.mega-menu[aria-hidden="false"] {
  display: block;
}

.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.mega-menu-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 0.5rem;
}

.mega-menu-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-400);
  padding: 0.375rem 0.5rem 0.25rem;
  margin: 0 0 0.125rem;
}

a.mega-menu-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  padding: 6px 8px;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  line-height: 1.3;
  min-width: 0;
}

a.mega-menu-link span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.mega-menu-link:hover {
  background: var(--blue-50);
  color: var(--blue-700);
  text-decoration: none;
}

a.mega-menu-link[aria-current="page"] {
  color: var(--blue-600);
  font-weight: 600;
  background: var(--blue-50);
}

.mega-menu-link.disabled {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--gray-400);
  padding: 6px 8px;
  cursor: default;
  border-radius: 6px;
  line-height: 1.3;
  min-width: 0;
}

.coming-soon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  background: var(--gray-100);
  color: var(--gray-500);
  border-radius: 999px;
  padding: 2px 6px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

/* Top-level nav triggers - coming soon (non-interactive placeholders) */
.nav-trigger-soon {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--gray-400);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  white-space: nowrap;
  height: 34px;
  cursor: default;
  pointer-events: none;
  user-select: none;
}

.nav-trigger-soon .coming-soon {
  font-size: 9px;
}

/* Mobile nav - coming soon link variant */
.mobile-nav-link.nav-link-soon {
  color: var(--gray-400) !important;
  cursor: default;
  pointer-events: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.mobile-nav-link.nav-link-soon .coming-soon {
  font-size: 9px;
}

/* Mobile accordion */
.mobile-accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 0.625rem 0.875rem;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  min-height: 44px;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s;
}

.mobile-accordion-toggle:hover {
  background: var(--gray-100);
}

.mobile-accordion-toggle[aria-expanded="true"] {
  background: var(--gray-50);
  color: var(--blue-700);
}

.mobile-accordion-caret {
  font-size: 0.625rem;
  display: inline-block;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.mobile-accordion-toggle[aria-expanded="true"] .mobile-accordion-caret {
  transform: rotate(180deg);
}

.mobile-accordion-body {
  display: none;
  flex-direction: column;
  padding: 0.25rem 0.375rem;
  border-left: 2px solid var(--gray-100);
  margin: 0 0.25rem 0.25rem 1rem;
  overflow-x: hidden;
  box-sizing: border-box;
}

.mobile-accordion-body[aria-hidden="false"] {
  display: flex;
}

.mobile-accordion-cat {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-400);
  padding: 0.5rem 0.5rem 0.125rem;
  margin: 0.25rem 0 0;
}

.mobile-nav-link {
  color: var(--gray-700);
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.625rem 0.875rem;
  border-radius: 6px;
  min-height: 44px;
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: background 0.15s;
}

.mobile-nav-link:hover {
  background: var(--gray-100);
  text-decoration: none;
}

.mobile-nav .mega-menu-link.disabled {
  padding-left: 0.5rem;
}

.mega-menu-all {
  border-bottom: 1px solid var(--gray-100);
  padding-bottom: 0.75rem;
  margin-bottom: 0.875rem;
}

.mega-menu-all-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--blue-600);
  text-decoration: none;
  gap: 0.25rem;
  transition: color 0.12s;
}

.mega-menu-all-link:hover {
  color: var(--blue-700);
  text-decoration: underline;
}

.category-directory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.category-directory-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 1.375rem 1.5rem;
}

.category-directory-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-directory-desc {
  
  padding-bottom: 1rem ;

}
.category-directory-link {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  text-decoration: none;
  padding: 0.3rem 0;
  border-radius: 4px;
  transition: color 0.12s;
}

a.category-directory-link:hover {
  color: var(--blue-600);
  text-decoration: none;
}

.category-directory-link.disabled {
  color: var(--gray-400);
  cursor: default;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.coming-soon-badge {
  font-size: 0.625rem;
  font-weight: 700;
  background: var(--gray-100);
  color: var(--gray-500);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 767px) {
  .mega-menu {
    display: none !important;
  }

  .category-directory-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (min-width: 769px) {
  .mega-menu {
    max-height: none;
    overflow: visible;
    overflow-y: visible;
    overflow-x: visible;
  }

  .mega-menu-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
  }

  .mega-menu-section {
    min-width: 0;
  }

  .mega-menu-title {
    font-size: 13px;
    margin-bottom: 8px;
  }

  a.mega-menu-link,
  .mega-menu-link.disabled {
    font-size: 13px;
    padding: 6px 8px;
    line-height: 1.3;
    min-width: 0;
  }
}

@media (min-width: 1180px) {
  .mega-menu-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 1079px) {
  .category-directory-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) and (max-width: 899px) {
  .mega-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 767px) {
  .mega-menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .mega-menu-link,
  .mega-menu-link.disabled {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
}

/* ── Calculator Directory Grid ───────────────────────────────── */
.calculator-directory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

@media (max-width: 980px) {
  .calculator-directory-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .calculator-directory-grid {
    grid-template-columns: 1fr;
  }
}

.calculator-directory-card {
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.calculator-directory-card h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.3;
}

.category-short-desc {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 0.875rem;
  line-height: 1.5;
}

.directory-link-list {
  display: grid;
  gap: 8px;
}

.directory-link-card {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.directory-link-icon {
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

.directory-link-title {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.directory-link-arrow {
  color: #94a3b8;
  flex-shrink: 0;
  font-size: 0.875rem;
}

a.directory-link-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
  transform: translateY(-1px);
  text-decoration: none;
}

a.directory-link-card:hover .directory-link-arrow {
  color: #2563eb;
}

.directory-link-card.disabled {
  opacity: 0.52;
  cursor: not-allowed;
  pointer-events: none;
  background: #f8fafc;
}

.dir-badge {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.dir-badge-popular {
  background: #dbeafe;
  color: #1d4ed8;
}

.dir-badge-featured {
  background: #dcfce7;
  color: #15803d;
}

/* ── Hero Inline Search ─────────────────────────────────────── */
.hero-search-panel {
  margin: 20px auto 0;
  max-width: 640px;
  width: 100%;
  box-sizing: border-box;
}

.hero-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.hero-search-icon {
  position: absolute;
  left: 14px;
  display: flex;
  align-items: center;
  color: #64748b;
  pointer-events: none;
  flex-shrink: 0;
}

.hero-search-input {
  width: 100%;
  min-height: 54px;
  padding: 0 48px 0 46px;
  border: 0;
  outline: 0;
  font-size: 16px;
  font-family: inherit;
  background: transparent;
  border-radius: 12px;
  color: #0f172a;
  -webkit-appearance: none;
}

.hero-search-input::placeholder {
  color: #94a3b8;
}

.hero-search-close {
  position: absolute;
  right: 10px;
  width: 34px;
  height: 34px;
  border: 0;
  background: #f1f5f9;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: background 0.15s;
  flex-shrink: 0;
}

.hero-search-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.hero-search-results {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
  overflow: hidden;
  text-align: left;
  max-height: 320px;
  overflow-y: auto;
}

.hero-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  text-decoration: none;
  color: #0f172a;
  border-bottom: 1px solid #eef2f7;
  transition: background 0.12s;
}

.hero-search-result:last-child {
  border-bottom: 0;
}

.hero-search-result:hover,
.hero-search-result.is-active {
  background: #f8fafc;
  text-decoration: none;
}

.hero-search-result-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.hero-search-result-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0f172a;
}

.hero-search-result-category {
  font-size: 12px;
  color: #64748b;
}

.hero-search-result-arrow {
  color: #94a3b8;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.hero-search-empty {
  padding: 14px 16px;
  color: #64748b;
  font-size: 0.9rem;
}

.hero-search-browse {
  display: block;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  border-top: 1px solid #eef2f7;
}

.hero-search-browse:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .hero-search-panel {
    max-width: 100%;
  }

  .hero-search-input {
    min-height: 52px;
    font-size: 16px;
  }
}

/* ── Nav badges (compact) ───────────────────────────────────── */
.nav-badge,
.coming-soon-badge {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

/* ── Calculators mobile overflow safety ─────────────────────── */
.calculator-directory-grid,
.calculator-category-grid,
.calculator-directory-card,
.calculator-category-card,
.directory-link-card,
.category-link-card {
  max-width: 100%;
  min-width: 0;
}

.directory-link-title,
.category-link-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {

  .calculator-directory-grid,
  .calculator-category-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Dashboard mobile safety ────────────────────────────────── */
.dashboard-tabs {
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

@media (max-width: 640px) {
  .dashboard-tabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    border-bottom: none;
  }

  .dashboard-tab {
    width: 100%;
    justify-content: center;
    text-align: center;
    border-bottom: none;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    margin-bottom: 0;
  }

  .dashboard-tab.active {
    border-color: var(--blue-600);
    background: var(--blue-50);
  }
}

.dashboard,
.dashboard-container,
.dashboard-content,
.dashboard-card,
.dashboard-panel,
.saved-reports-grid,
.account-settings {
  max-width: 100%;
  min-width: 0;
  overflow-x: hidden;
}

.history-table-wrapper,
.table-responsive {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================
   MOBILE HORIZONTAL SCROLL FIX — result containers
   Prevents any calculator result from causing page-level
   horizontal scroll on mobile after Calculate is clicked.
   ============================================================ */

/* Part 2 — result container overflow protection */
.result-box,
.result-card,
.result-section,
.result-panel,
.result-visual-panel,
.result-summary-grid,
.result-summary-card,
.visual-card,
.chart-container,
.svg-chart,
.breakdown-table-container,
.result-insight-box,
.export-actions,
.visual-actions,
.share-actions,
.calculator-result,
.saved-report-view {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Part 3 — SVG/chart overflow */
.chart-container {
  overflow-x: hidden;
}

.svg-chart,
.chart-container svg,
.visual-card svg {
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
  display: block;
}

/* Part 4 — table containers: internal scroll only */
.breakdown-table-container,
.table-responsive,
.result-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.breakdown-table,
.result-table,
.calculation-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

/* Part 5 — action button rows: wrap on mobile */
.export-actions,
.visual-actions,
.share-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

.export-actions button,
.visual-actions button,
.share-actions button,
.result-actions button,
.export-actions a,
.visual-actions a,
.share-actions a,
.result-actions a {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {

  .export-actions,
  .share-actions,
  .result-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .export-actions button,
  .share-actions button,
  .result-actions button,
  .export-actions a,
  .share-actions a,
  .result-actions a {
    width: 100%;
    justify-content: center;
  }
}

/* Part 6 — summary cards on small screens */
@media (max-width: 640px) {
  .result-summary-card {
    width: 100%;
    min-width: 0;
  }

  .summary-value,
  .summary-label,
  .summary-note {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

/* Part 7 — long text / URLs in result content */
.result-box,
.result-card,
.result-insight-box,
.breakdown-table td,
.breakdown-table th,
.visual-card,
.saved-report-view {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* ============================================================
   MOBILE OVERFLOW FIX — PART 8
   Global page/layout wrapper guards (Part 1 of spec)
   ============================================================ */

/* Page-level wrapper containers */
main,
.main,
.page,
.section,
.calculator-page,
.calculator-shell,
.calculator-wrapper {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Calculator card + form containers (Part 2 of spec) */
.calculator-card,
.calculator-form,
.calculator-result {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Result metric rows (Part 4 of spec) */
.result-metrics,
.result-metric-list,
.result-summary,
.result-values {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Login/save note inside result box (Part 5 of spec) */
.result-note,
.save-history-note,
.login-save-note {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: center;
  box-sizing: border-box;
}

/* =========================================================
   AUTH PAGE - LOGIN
   ========================================================= */

.login-page-section {
  min-height: 70vh;
  display: flex;
  align-items: center;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.login-page-section>.container {
  width: 100%;
}

.login-page-shell {
  width: calc(100% - 2rem);
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

/*
  The outer shell controls the final card width.
  This prevents global .auth-card rules from stretching it.
*/
.login-page-shell .auth-card {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 2rem;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.06),
    0 12px 30px rgba(15, 23, 42, 0.08);
}

.login-page-shell .auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-page-shell .auth-title {
  margin-bottom: 0.5rem;
  text-align: center;
}

.login-page-shell .auth-subtitle {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
  text-align: center;
  line-height: 1.6;
}

.login-page-shell .auth-form {
  width: 100%;
}

.login-page-shell .form-group {
  width: 100%;
}

.login-page-shell .form-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.login-page-shell .btn-full,
.login-page-shell .google-auth-btn {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.login-page-shell .password-wrap {
  position: relative;
  width: 100%;
}

.login-page-shell .password-wrap .form-input {
  padding-right: 3rem;
}

.login-page-shell .pwd-toggle {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
}

.login-page-shell .pwd-toggle:hover {
  background: var(--gray-100);
  color: var(--gray-700);
}

.login-page-shell .pwd-toggle:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

.login-page-shell .auth-divider {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.login-page-shell .auth-switch {
  text-align: center;
}

@media (max-width: 600px) {
  .login-page-section {
    min-height: auto;
    align-items: flex-start;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .login-page-shell {
    width: 100%;
    max-width: 440px;
  }

  .login-page-shell .auth-card {
    padding: 1.5rem;
    border-radius: 12px;
  }
}

@media (max-width: 359px) {
  .login-page-shell .auth-card {
    padding: 1.25rem;
  }
}


/* =========================================================
   AUTH PAGE - FORGOT PASSWORD
   ========================================================= */

.forgot-password-page-section {
  min-height: 70vh;
  display: flex;
  align-items: center;
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.forgot-password-page-section>.container {
  width: 100%;
}

.forgot-password-page-shell {
  width: calc(100% - 2rem);
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.forgot-password-page-shell .auth-card {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding: 2rem;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.06),
    0 12px 30px rgba(15, 23, 42, 0.08);
}

.forgot-password-page-shell .auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.forgot-password-page-shell .auth-title {
  margin-bottom: 0.5rem;
  text-align: center;
}

.forgot-password-page-shell .auth-subtitle {
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1.5rem;
  text-align: center;
  line-height: 1.6;
}

.forgot-password-page-shell .auth-form {
  width: 100%;
}

.forgot-password-page-shell .form-group {
  width: 100%;
}

.forgot-password-page-shell .form-input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.forgot-password-page-shell .btn-full {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.forgot-password-page-shell .auth-switch {
  text-align: center;
}

@media (max-width: 600px) {
  .forgot-password-page-section {
    min-height: auto;
    align-items: flex-start;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .forgot-password-page-shell {
    width: 100%;
    max-width: 440px;
  }

  .forgot-password-page-shell .auth-card {
    padding: 1.5rem;
    border-radius: 12px;
  }
}

@media (max-width: 359px) {
  .forgot-password-page-shell .auth-card {
    padding: 1.25rem;
  }
}

/* Summary card grids */
.summary-cards,
.metric-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.summary-card,
.metric-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Missing page/layout wrappers not yet covered */
.page-container,
.content-container,
.calculator-container,
.calculator-layout,
.calculator-main {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Missing result text/message classes */
.result-description,
.result-message,
.calculation-message {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Table cell word-wrap (result-table / calculation-table variants) */
.result-table th,
.result-table td,
.calculation-table th,
.calculation-table td {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Direct children of action rows must never grow past container */
.result-actions>*,
.share-actions>*,
.visual-actions>*,
.export-actions>* {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 640px) {

  /* Single column on all card grids — prevents right-side cut */
  .summary-cards,
  .metric-cards {
    grid-template-columns: 1fr;
  }

  /* Action buttons full-width + normal text wrap */
  .result-actions button,
  .share-actions button,
  .visual-actions button,
  .export-actions button,
  .result-actions a,
  .share-actions a,
  .visual-actions a,
  .export-actions a {
    white-space: normal;
  }
}

@media (max-width: 480px) {

  /* Stack metric rows vertically on very small screens */
  .result-row,
  .metric-row,
  .result-metric-row {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: start;
  }

  .result-value,
  .metric-value {
    text-align: left;
  }
}

/* ============================================================
   SITE-WIDE MOBILE RESPONSIVENESS — final comprehensive pass
   Covers every page: home, categories, calculators, dashboard,
   auth pages, about, contact, privacy, and all calculator pages.
   Nothing here changes desktop layout or colours.
   ============================================================ */

/* 1 — Every block-level container must stay inside the viewport */
.section,
.section-alt,
.container,
.card,
.sidebar-card,
.example-box,
.info-box,
.formula-box,
.faq-item,
.faq-answer,
.related-card,
.compact-calculator-card,
.category-card,
.stat-card,
.calculator-directory-card,
.directory-link-card,
.contact-form,
.auth-card,
.saved-report-card,
.saved-report-banner,
.saved-report-content,
.dash-controls,
.ad-slot,
.ad-header,
.ad-footer,
.ad-content {
  max-width: 100%;
  box-sizing: border-box;
}

/* 2 — Flex rows that must never overflow their parent */
.header-inner,
.breadcrumb,
.visual-card-header,
.faq-question,
.compact-calculator-card,
.directory-link-card,
.search-result-item,
.hero-search-result,
.saved-report-actions,
.footer-bottom,
.footer-bottom-links {
  min-width: 0;
}

/* Flex children must also be constrainable */
.compact-calculator-card>*,
.directory-link-card>*,
.search-result-item>*,
.hero-search-result>* {
  min-width: 0;
}

/* 3 — Text that should never force its parent wider */
.stat-card,
.stat-number,
.stat-label,
.section-subtitle,
.category-card span,
.compact-calculator-card,
.sidebar-card h4,
.sidebar-links a,
.footer-col a,
.footer-bottom p {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* 4 — Cards grids: all must use minmax(0) so no column exceeds viewport */
.cards-grid,
.related-grid,
.compact-calculator-grid,
.calculator-directory-grid,
.category-directory-grid {
  max-width: 100%;
  min-width: 0;
}

/* 5 — Formula / example boxes: long code lines scroll internally */
/* Keep pre-wrap (original) — allows wrapping while preserving whitespace */
@media (max-width: 640px) {
  .formula-box {
    font-size: 0.8125rem;
    padding: 1rem;
  }
}

/* 6 — Dashboard table: force scroll wrapper to clip */
.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* 7 — Benchmark tables (in calculator pages) */
.table-scroll-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* 8 — Auth pages: inputs and buttons always full-width */
@media (max-width: 640px) {
  .auth-card {
    padding: clamp(1.25rem, 4vw, 1.75rem);
  }

  .google-auth-btn,
  .auth-card .btn {
    width: 100%;
    max-width: 100%;
  }
}

/* 9 — Form rows: always single-column on small screens */
@media (max-width: 479px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* 10 — Stats grid: ensure cards never overflow */
@media (max-width: 359px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

/* 11 — Page sidebar on mobile: full width, no cut */
@media (max-width: 1023px) {
  .page-sidebar {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}

/* 12 — Footer grid: always single column on mobile */
@media (max-width: 639px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .footer-bottom-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* 13 — Related calculators grid: always single column on smallest screens */
@media (max-width: 359px) {
  .related-grid {
    grid-template-columns: 1fr;
  }

  .compact-calculator-grid {
    grid-template-columns: 1fr;
  }
}

/* 14 — Directory link title: ellipsis truncation needs min-width:0 on parent */
.directory-link-card {
  min-width: 0;
}

.directory-link-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 15 — Dashboard controls: full width on mobile */
@media (max-width: 639px) {
  .dash-controls {
    width: 100%;
    max-width: 100%;
  }

  .dash-controls select,
  .dash-controls input {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    box-sizing: border-box;
  }
}

/* 16 — Saved reports grid: 1 column on mobile (already set above 640px; ensure for all) */
@media (max-width: 639px) {
  .saved-reports-grid {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .saved-report-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}

/* 17 — Prose content on pages like privacy policy: keep desktop max-width intact */
@media (max-width: 640px) {
  .prose {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: normal;
  }
}

/* 18 — Embed-mode calc container */
body.embed-mode .calc-box {
  max-width: 100%;
}

/* 19 — Any flex or grid container defined via utility classes */
.flex {
  min-width: 0;
  max-width: 100%;
}

/* 20 — Inline max-width styles on <p> tags won't cause overflow (max-width is safe) */
/* But ensure the container holding them doesn't overflow */
.section p[style*="max-width"],
.container p[style*="max-width"] {
  width: 100%;
}

/* ── Preview / Result Label (added by BCHVisuals preview feature) ─────────────── */
.bch-preview-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.875rem;
  line-height: 1.4;
}

.bch-preview-label--preview {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde68a;
}

.bch-preview-label--real {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

/* ── calculator-main-column — first-column wrapper added to all calculator pages ─ */
.calculator-main-column {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
  box-sizing: border-box;
}

.calculator-main-column>.calc-box,
.calculator-main-column>#bch-viz-panel,
.calculator-main-column>.result-visual-panel {
  width: 100%;
  max-width: 560px;
  min-width: 0;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .container {
    width: 100%;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
    overflow: visible;
  }

  .calc-page-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
  }

  .calculator-main-column {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .calculator-main-column>.calc-box,
  .calculator-main-column>#bch-viz-panel,
  .calculator-main-column>.result-visual-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
  }

  .result-summary-grid {
    width: 100%;
    max-width: 100%;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .result-summary-card:last-child:nth-child(odd) {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  .result-summary-card,
  .visual-card,
  .chart-container,
  .breakdown-table-container,
  .result-insight-box {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .calc-box,
  .visual-card,
  .result-summary-card {
    padding-left: 18px;
    padding-right: 18px;
  }
}

/* ── Calculator/result/visualization — actual overflow fixes ──────────────────── */
/*
 * Do NOT use overflow-x: hidden to mask problems.
 * Fix actual widths. Use overflow-x: hidden only on body as final backstop.
 */

/* 1. Every calculator/result/viz element stays within its parent */
.calculator-container,
.calc-section,
.calc-box,
.calc-results,
#bch-viz-panel,
.result-visual-panel,
.visual-card,
.result-card,
.summary-card,
.chart-container {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* 2. Grid/flex containers must allow shrinking */
.calculator-container,
.result-summary-grid,
.visual-grid,
.visual-card-header,
.visual-actions {
  min-width: 0;
}

/* 3. Tables scroll within their own wrappers only */
.breakdown-table-container,
.table-wrapper,
.visual-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 4. SVG and canvas never exceed their container */
svg,
canvas {
  max-width: 100%;
}

/* 4b. Override earlier rule that set overflow-x: hidden on .chart-container.
 *     SVG charts already use width: 100% / max-width: 100% so they don't
 *     overflow; the container must NOT clip — it should scroll if anything
 *     ever exceeds its bounds rather than hiding it silently. */
.chart-container {
  overflow-x: auto;
}

/* 5. Mobile ≤ 768px */
@media (max-width: 768px) {
  .calculator-container {
    padding-left: 16px;
    padding-right: 16px;
    width: 100%;
    max-width: 100%;
  }

  .calc-box,
  .calc-results,
  #bch-viz-panel,
  .result-visual-panel,
  .visual-card {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Safe single-column: minmax(0, 1fr) never overflows */
  .result-summary-grid,
  .visual-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Reduce card padding so content fits narrow screens */
  .visual-card {
    padding: 1rem;
  }

  .result-insight-box {
    padding: 0.75rem;
  }
}

/* 6. Very small phones ≤ 420px */
@media (max-width: 420px) {
  .calculator-container {
    padding-left: 12px;
    padding-right: 12px;
  }

  .calc-box,
  .visual-card,
  .result-card {
    padding-left: 18px;
    padding-right: 18px;
  }

  /* Action buttons wrap cleanly */
  .visual-actions {
    flex-wrap: wrap;
  }

  .vis-btn {
    max-width: 100%;
    white-space: normal;
  }

  .breakdown-table th,
  .breakdown-table td {
    padding: 0.375rem 0.5rem;
    font-size: 0.7rem;
  }

  .summary-value {
    font-size: 1rem;
  }
}

/* ── Recently Used Calculators ───────────────────────────────────────────── */
.recent-calcs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.recent-calc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 1rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.recent-calc-title {
  font-weight: 600;
  color: var(--gray-900, #0f172a);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-calc-date {
  font-size: 0.8125rem;
  color: var(--gray-500, #64748b);
  flex-shrink: 0;
}

.recent-calc-item:hover {
  border-color: var(--blue-500, #3b82f6);
  background: #f8fafc;
}

@media (max-width: 480px) {
  .recent-calc-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.25rem;
  }

  .recent-calc-title {
    white-space: normal;
  }
}

/* ── Keyboard focus-visible styles (accessibility) ─────────────────────────── */
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.auth-btn:focus-visible,
.calc-btn:focus-visible,
.vis-btn:focus-visible,
.copy-embed-btn:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.mega-menu-link:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
  border-radius: 4px;
}

.nav-dropdown-toggle:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
  border-radius: 4px;
}

.category-card:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.dashboard-tab:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
}

.recent-calc-item:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
  border-radius: 8px;
}

.industry-link:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.related-card:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* ============================================================
   PRINT STYLESHEET
   ============================================================ */
@media print {

  header,
  nav,
  footer,
  .breadcrumb,
  .calc-btn,
  .example-toggle-btn,
  .copy-embed-btn,
  .ad-slot,
  .hero-search-close,
  .hamburger {
    display: none !important;
  }

  .calculator-result,
  .result-panel,
  .result-box,
  .result-card,
  .result-section,
  .calc-results {
    display: block !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .result-box,
  .result-card {
    border: 1px solid #ccc;
    background: #fff;
    box-shadow: none;
  }

  .content-two-col {
    grid-template-columns: 1fr 1fr;
  }

  a[href]::after {
    content: none;
  }
}

/* ---- Hub & Spoke layout fixes ---- */

/* Header: use full viewport width so all nav items + search + login always fit */
/* Desktop */
header.site-header-node .header-inner {
  max-width: 100%;
  padding: 0 10rem;
}

/* Nav takes natural width; push actions to the far right */
.main-nav {
  flex: 0 0 auto;
  min-width: 0;
}

.header-actions {
  margin-left: auto;
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1100px) {
  header.site-header-node .header-inner {
    padding: 0 0.6rem;
  }

  .main-nav {
    flex: 1 1 auto;
  }
}

/* Mobile */
@media (max-width: 768px) {
  header.site-header-node .header-inner {
    padding: 0 0.5rem;
  }

  .main-nav {
    flex: 1 1 auto;
  }

  .header-actions {
    margin-left: 0;
  }
}


/* Footer shell: apply dark styling directly so it works regardless of JS cache */
footer.global-footer-node {
  background: var(--gray-900);
  color: var(--gray-300);
  padding: clamp(2rem, 4vw, 3.5rem) 0 1.5rem;
}
/* ============================================================
   PRE-DEPLOYMENT HARDENING - JULY 2026
   Shared responsive, accessibility, directory and guide styles
   ============================================================ */

html,
body {
  overflow-x: visible;
}

header.site-header-node {
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.hamburger {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
}

@media (min-width: 768px) and (max-width: 1339px) {
  header.site-header-node .main-nav,
  header.site-header-node .header-actions {
    display: none !important;
  }

  header.site-header-node .hamburger {
    display: flex !important;
  }

  header.site-header-node .mobile-nav:not(.open) {
    display: none !important;
  }
}

@media (min-width: 1340px) {
  header.site-header-node .main-nav,
  header.site-header-node .header-actions {
    display: flex !important;
  }

  header.site-header-node .hamburger {
    display: none !important;
  }

  header.site-header-node .mobile-nav {
    display: none !important;
  }
}

.kh-layout-wrapper {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.kh-main-body {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1199px) {
  .kh-layout-wrapper {
    display: block !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .calc-knowledge-hub .ad-placeholder-rail,
  .guide-article .ad-placeholder-rail {
    display: none !important;
  }

  .kh-main-body {
    max-width: 780px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

.directory-link-title {
  min-width: 0;
}

@media (max-width: 640px) {
  .directory-link-card {
    align-items: flex-start;
    min-height: 48px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .directory-link-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
  }

  .dir-badge {
    margin-top: 1px;
  }
}

.planned-tools {
  margin-top: 10px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #f8fafc;
}

.planned-tools > summary {
  min-height: 46px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  color: var(--gray-700);
  font-size: 0.875rem;
  font-weight: 700;
  list-style: none;
}

.planned-tools > summary::-webkit-details-marker {
  display: none;
}

.planned-tools > summary::after {
  content: '+';
  color: var(--blue-600);
  font-size: 1.15rem;
}

.planned-tools[open] > summary::after {
  content: '−';
}

.planned-tools-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.faq-question {
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.example-box > h3,
.sidebar-card > h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.625rem;
}

.visual-actions .vis-btn,
.vis-export-row .vis-btn,
.saved-report-actions .vis-btn {
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.table-scroll-hint {
  display: none;
  margin: 0 0 0.5rem;
  color: var(--gray-500);
  font-size: 0.75rem;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .table-scroll-hint {
    display: block;
  }
}

.table-wrap:focus-visible,
.table-scroll-wrap:focus-visible,
.breakdown-table-container:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 3px;
}

.calculator-form {
  display: block;
}

/* Business Guides hub and dedicated guide pages */
.guides-hero {
  background: linear-gradient(135deg, var(--blue-50) 0%, #f0f9ff 100%);
  padding: clamp(1.75rem, 4vw, 3rem) 0;
  border-bottom: 1px solid var(--blue-100);
}

.guides-hero h1 {
  max-width: 850px;
  margin: 0 auto 0.85rem;
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.2;
  color: var(--gray-900);
}

.guides-hero p {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  color: var(--gray-600);
  font-size: 1.05rem;
}

.guide-category {
  margin-bottom: 2.5rem;
}

.guide-category-header {
  margin-bottom: 1rem;
}

.guide-category-header h2 {
  font-size: 1.35rem;
  color: var(--blue-700);
  margin-bottom: 0.35rem;
}

.guide-category-header p {
  color: var(--gray-600);
  max-width: 760px;
}

.guide-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.guide-card {
  min-width: 0;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.guide-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue-400);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.guide-card-icon {
  font-size: 1.5rem;
  margin-bottom: 0.65rem;
}

.guide-card h3 {
  font-size: 1.05rem;
  color: var(--gray-900);
  line-height: 1.35;
  margin-bottom: 0.55rem;
}

.guide-card p {
  color: var(--gray-600);
  font-size: 0.9rem;
  line-height: 1.6;
  flex: 1;
}

.guide-card-cta {
  margin-top: 0.9rem;
  color: var(--blue-600);
  font-size: 0.875rem;
  font-weight: 700;
}

.guide-top-actions,
.guide-cta-card {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.guide-top-actions {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.guide-article {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.guide-article h2,
.guide-article h3,
.guide-article h4 {
  scroll-margin-top: 5rem;
}

.guide-article h2 {
  color: var(--blue-700);
  font-size: 1.45rem;
  margin: 2rem 0 0.75rem;
}

.guide-article h3 {
  color: var(--blue-700);
  font-size: 1.15rem;
  margin: 1.6rem 0 0.65rem;
}

.guide-article p,
.guide-article li {
  color: var(--gray-700);
  line-height: 1.8;
}

.guide-article ul,
.guide-article ol {
  list-style: initial;
  padding-left: 1.25rem;
  margin: 0.75rem 0 1.25rem;
}

.guide-cta-section {
  padding: 2.5rem 0;
  background: var(--blue-50);
  border-top: 1px solid var(--blue-100);
  border-bottom: 1px solid var(--blue-100);
}

.guide-cta-card {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--blue-200);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.guide-cta-card h2 {
  font-size: 1.3rem;
  color: var(--blue-700);
  margin-bottom: 0.6rem;
}

.guide-cta-card p {
  color: var(--gray-600);
  margin-bottom: 1rem;
}

@media (max-width: 900px) {
  .guide-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .guide-card-grid {
    grid-template-columns: 1fr;
  }

  .guide-top-actions {
    flex-direction: column;
  }

  .guide-top-actions .btn {
    width: 100%;
  }
}

/* ============================================================
   FINAL GUIDE, FORM AND CONTENT-HIERARCHY POLISH
   ============================================================ */
.currency-consistency-note {
  margin: -0.35rem 0 1rem;
  padding: 0.65rem 0.75rem;
  border-left: 3px solid var(--blue-400);
  background: var(--blue-50);
  color: var(--gray-600);
  font-size: 0.78rem;
  line-height: 1.5;
}

.contact-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.metric-caveat {
  width: 100%;
  margin-top: 0.35rem;
  color: var(--gray-500);
  font-size: 0.72rem;
  line-height: 1.4;
}

.guide-title-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  max-width: 980px;
  margin: 0 auto;
}

.guide-title-icon {
  flex: 0 0 auto;
  font-size: clamp(1.7rem, 4vw, 2.5rem);
}

.guide-category-badge {
  display: table;
  margin: 0 auto 0.75rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--blue-200);
  border-radius: 999px;
  background: #fff;
  color: var(--blue-700);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.guide-hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.35rem;
}

.guides-index-layout {
  display: grid;
  gap: 2.75rem;
}

.guide-category-section {
  min-width: 0;
}

.guide-category-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--gray-200);
}

.guide-category-heading h2 {
  color: var(--blue-700);
  font-size: 1.35rem;
  line-height: 1.3;
}

.guide-category-heading p {
  max-width: 560px;
  color: var(--gray-500);
  font-size: 0.875rem;
  text-align: right;
}

.guides-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.guide-card .guide-category-badge {
  margin: 0 0 0.55rem;
  background: var(--blue-50);
}

.guide-card h3 a {
  color: inherit;
  text-decoration: none;
}

.guide-card h3 a:hover {
  color: var(--blue-700);
}

.guide-card-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--gray-100);
}

.guide-card-links a {
  color: var(--blue-600);
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
}

.guide-card-links a:last-child {
  color: var(--gray-600);
}

.guide-reading-section {
  background: var(--gray-50);
}

.guide-reading-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 900px);
  justify-content: center;
  align-items: start;
  gap: 1.5rem;
}

.guide-reading-sidebar {
  position: sticky;
  top: 4.5rem;
  display: grid;
  gap: 0.8rem;
}

.guide-sidebar-card {
  padding: 1rem;
  border: 1px solid var(--blue-200);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.guide-sidebar-card strong {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--gray-900);
}

.guide-sidebar-card p {
  margin-bottom: 0.8rem;
  color: var(--gray-600);
  font-size: 0.82rem;
  line-height: 1.55;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.guide-back-link {
  color: var(--blue-700);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.guide-reading-layout .guide-article {
  width: 100%;
  max-width: 900px;
  margin: 0;
}

.guide-article > :first-child {
  margin-top: 0;
}

.guide-article table {
  width: 100%;
}

.guide-article img,
.guide-article svg,
.guide-article iframe {
  max-width: 100%;
}

.guide-bottom-cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem;
  border: 1px solid var(--blue-200);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.guide-bottom-cta-card h2 {
  margin-bottom: 0.35rem;
  color: var(--gray-900);
  font-size: 1.35rem;
}

.guide-bottom-cta-card p {
  color: var(--gray-600);
}

.guide-cta-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.guide-cta-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--blue-50);
  font-size: 1.55rem;
}

.guide-cta-copy {
  min-width: 0;
  flex: 1;
}

.guide-cta-copy .guide-category-badge {
  margin: 0 0 0.55rem;
  background: var(--blue-50);
}

.guide-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.calculator-form .calc-btn {
  width: 100%;
}

@media (max-width: 980px) {
  .guides-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-reading-layout {
    grid-template-columns: 1fr;
  }

  .guide-reading-sidebar {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
}

@media (max-width: 640px) {
  .guides-grid {
    grid-template-columns: 1fr;
  }

  .guide-category-heading,
  .guide-bottom-cta-card,
  .guide-cta-card {
    align-items: stretch;
    flex-direction: column;
  }

  .guide-category-heading p {
    text-align: left;
  }

  .guide-reading-sidebar {
    grid-template-columns: 1fr;
  }

  .guide-hero-actions,
  .guide-cta-actions {
    flex-direction: column;
  }

  .guide-hero-actions .btn,
  .guide-cta-actions .btn,
  .guide-bottom-cta-card .btn {
    width: 100%;
    justify-content: center;
  }

  .guide-title-row {
    align-items: flex-start;
  }

  .guide-title-icon {
    margin-top: 0.15rem;
  }

  .guide-article {
    padding: 1rem;
  }
}

/* Footer headings use H2 for a valid page outline while retaining the compact footer style. */
.footer-col h2 {
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 0.875rem;
  text-transform: none;
}

/* Primary header controls retain a comfortable touch target without altering the visual theme. */
.search-input,
.auth-btn {
  min-height: 44px;
}

/* ============================================================
   SOLVEINDEX SECOND-AUDIT HARDENING
   Layout remains visually consistent; these rules address embed,
   tablet wrapping, touch targets and guide cross-link behavior.
   ============================================================ */

.directory-link-card {
  min-height: 48px;
}

@media (min-width: 641px) and (max-width: 1180px) {
  .directory-link-card {
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .directory-link-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

body.embed-mode {
  background: #f8fafc;
  min-width: 0;
}

body.embed-mode .calc-page-hero,
body.embed-mode main > :not(#solveindex-embed-root) {
  display: none !important;
}

.solveindex-embed-root {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px;
  box-sizing: border-box;
}

.solveindex-embed-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
  color: #0f172a;
}

.solveindex-embed-heading strong,
.solveindex-embed-heading span {
  display: block;
}

.solveindex-embed-heading strong {
  font-size: 0.98rem;
  line-height: 1.35;
}

.solveindex-embed-heading div > span {
  color: #64748b;
  font-size: 0.76rem;
  margin-top: 2px;
}

.solveindex-embed-mark {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
}

body.embed-mode .calculator-main-column,
body.embed-mode .calculator-main-column > .calc-box,
body.embed-mode .calculator-main-column > #bch-viz-panel,
body.embed-mode .calculator-main-column > .result-visual-panel {
  max-width: 100%;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

body.embed-mode .calc-box,
body.embed-mode .result-visual-panel {
  box-shadow: none;
}

body.embed-mode .page-sidebar,
body.embed-mode .example-toggle-btn,
body.embed-mode .ad-slot {
  display: none !important;
}

.solveindex-embed-attribution {
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
  margin: 12px 0 2px;
}

.solveindex-embed-attribution a {
  color: #2563eb;
  font-weight: 700;
  text-decoration: none;
}

.related-guide-cluster {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--gray-200);
}

.related-guide-cluster > p {
  color: var(--gray-600);
  max-width: 760px;
  line-height: 1.7;
}

.related-guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.related-guide-card {
  min-width: 0;
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: #fff;
  color: var(--gray-900);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.related-guide-card:hover {
  border-color: var(--blue-500);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.related-guide-card span {
  color: var(--blue-600);
  font-size: 0.875rem;
  font-weight: 700;
}

.recent-calcs-heading {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 0.75rem;
}

@media (max-width: 760px) {
  .related-guide-grid {
    grid-template-columns: 1fr;
  }

  .solveindex-embed-root {
    padding: 8px;
  }

  .solveindex-embed-heading {
    align-items: flex-start;
  }
}

/* SolveIndex generated reusable presentation utilities */
.si-u-20565543 { color:#dc2626; }
.si-u-2ba2fe5d { font-size:0.65rem;color:#94a3b8;letter-spacing:0.05em;font-weight:600;text-transform:uppercase; }
.si-u-2cc20165 { color: var(--gray-700);font-size: 1rem;margin-bottom: 1.5rem; }
.si-u-2df7066e { color:var(--gray-700);font-size:1rem;margin-bottom:1rem; }
.si-u-363cdaa2 { margin-bottom:1rem; }
.si-u-43234268 { font-size:1.125rem;font-weight:700;margin-bottom:0.75rem; }
.si-u-45edc815 { color:var(--blue-600); }
.si-u-4d3214a8 { color:var(--gray-600);font-size:0.875rem;line-height:1.65;margin-top:0.875rem; }
.si-u-561f378b { margin-bottom:1.5rem; }
.si-u-8452d860 { color:var(--gray-700);font-size:1rem;margin-bottom:1.5rem; }
.si-u-89ddec83 { font-size:0.75rem;color:#cbd5e1;margin-top:2px; }
.si-u-8df3b119 { margin-bottom:0.625rem; }
.si-u-995eddd0 { font-size:0.8125rem;color:var(--gray-500);line-height:1.55;margin-top:0.625rem; }
.si-u-a810f9a9 { color:var(--green-600); }
.si-u-a90cae79 { font-size:0.875rem;color:var(--gray-600); }
.si-u-b2fcb6f3 { margin-bottom:0.45rem; }
.si-u-be382962 { font-size:1.35rem;color:var(--blue-800);margin-top:2rem;margin-bottom:0.75rem;font-weight:600; }
.si-u-c05a3c6e { margin-bottom:0.75rem; }
.si-u-d5abd26e { font-size: 1.35rem;color: var(--blue-800);margin-top: 2rem;margin-bottom: 0.75rem;font-weight: 600; }
.si-u-ef0b7a11 { margin-bottom:0; }
.si-u-fba68c74 { background:#f1f5f9;color:#64748b; }
.si-u-fc511f0c { margin-top:1.5rem; }


/* ============================================================
   HOMEPAGE CONTENT REFINEMENT AND LARGE-DISPLAY CANVAS
   Keeps the existing theme while preventing edge-stretched layouts,
   removing unused ad gaps, and making the homepage article fully responsive.
   ============================================================ */
:root {
  --site-canvas-max: 1920px;
}

html {
  background: #f8fafc;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: var(--site-canvas-max);
  margin-left: auto;
  margin-right: auto;
  overflow-x: hidden;
  background: #fff;
}

@media (min-width: 1921px) {
  body {
    box-shadow: 0 0 40px rgba(15, 23, 42, 0.08);
  }
}

/* The homepage calculator library now uses the full content column. */
.home-layout {
  width: 100%;
}

.home-layout > .home-main:only-child {
  width: 100%;
  flex-basis: 100%;
}

.home-knowledge-section {
  border-top: 1px solid var(--gray-200);
}

.home-knowledge-card {
  width: 100%;
  max-width: 980px;
  min-width: 0;
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.home-knowledge-header {
  max-width: 800px;
}

.home-knowledge-header h2 {
  margin: 0.75rem 0 0.875rem;
  color: var(--blue-800);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.25;
  overflow-wrap: break-word;
}

.home-knowledge-header p,
.home-knowledge-item p {
  color: var(--gray-700);
  line-height: 1.75;
}

.home-formula-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-width: 0;
  margin: 1.5rem 0;
  padding: 1rem 1.125rem;
  border: 1px solid var(--blue-100);
  border-radius: 10px;
  background: var(--blue-50);
}

.home-formula-strip span {
  color: var(--blue-700);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.home-formula-strip strong {
  min-width: 0;
  color: var(--blue-900, #1e3a8a);
  font-size: clamp(0.95rem, 2vw, 1.08rem);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.home-knowledge-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-knowledge-item {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
}

.home-knowledge-item h3 {
  margin: 0 0 0.625rem;
  color: var(--gray-900);
  font-size: 1rem;
  line-height: 1.4;
  overflow-wrap: break-word;
}

.home-knowledge-item p {
  margin: 0;
  font-size: 0.9375rem;
}

.home-knowledge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

@media (max-width: 899px) {
  .home-knowledge-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .home-knowledge-section {
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }

  .home-knowledge-card {
    padding: 1rem;
    border-radius: 12px;
  }

  .home-formula-strip {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.875rem;
  }

  .home-knowledge-item {
    padding: 0.875rem;
  }

  .home-knowledge-actions {
    flex-direction: column;
  }

  .home-knowledge-actions .btn {
    width: 100%;
    justify-content: center;
  }
}


/* ============================================================
   MOBILE DRAWER STABILITY AND DIRECTORY CARD EQUALITY
   Keeps the mobile menu out of document flow and gives the
   calculators directory a consistent professional desktop grid.
   ============================================================ */
@media (max-width: 1339px) {
  header.site-header-node .mobile-nav,
  header.site-header-node .mobile-nav:not(.open) {
    display: flex !important;
    position: fixed;
    top: 3.25rem;
    left: 0;
    right: 0;
    width: 100%;
    max-width: var(--site-canvas-max, 1920px);
    margin-left: auto;
    margin-right: auto;
    max-height: calc(100vh - 3.25rem);
    max-height: calc(100dvh - 3.25rem);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
    contain: layout paint;
  }

  header.site-header-node .mobile-nav.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
  }

  body.mobile-menu-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  header.site-header-node .mobile-nav {
    transition: none !important;
    transform: none !important;
  }
}

@media (min-width: 641px) {
  .calculator-directory-grid {
    align-items: stretch;
  }

  .calculator-directory-card {
    display: flex;
    flex-direction: column;
    height: 360px;
    min-height: 360px;
  }

  .calculator-directory-card .directory-link-list {
    flex: 1 1 auto;
    min-height: 0;
    align-content: start;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
  }

  .calculator-directory-card .directory-link-list::-webkit-scrollbar {
    width: 7px;
  }

  .calculator-directory-card .directory-link-list::-webkit-scrollbar-track {
    background: transparent;
  }

  .calculator-directory-card .directory-link-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
  }
}

@media (max-width: 640px) {
  .calculator-directory-card {
    height: auto;
    min-height: 0;
  }

  .calculator-directory-card .directory-link-list {
    overflow: visible;
    padding-right: 0;
  }
}

/* ============================================================
   GUIDE TABLE OF CONTENTS SIDEBAR
   ============================================================ */
.guide-toc-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.guide-toc-card summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 46px;
  padding: 0.8rem 2.4rem 0.8rem 1rem;
  color: var(--gray-900);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.35;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.guide-toc-card summary::-webkit-details-marker {
  display: none;
}

.guide-toc-card summary::after {
  position: absolute;
  right: 1rem;
  content: "−";
  color: var(--blue-600);
  font-size: 1.1rem;
  font-weight: 700;
}

.guide-toc-card:not([open]) summary::after {
  content: "+";
}

.guide-toc-card summary:hover {
  background: var(--blue-50);
  color: var(--blue-700);
}

.guide-toc-card summary:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: -2px;
}

.guide-toc-card[open] summary {
  border-bottom: 1px solid var(--gray-100);
}

.guide-toc-nav {
  max-height: calc(100vh - 10.5rem);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.45rem 0.45rem 0.65rem;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}

.guide-toc-nav::-webkit-scrollbar {
  width: 7px;
}

.guide-toc-nav::-webkit-scrollbar-track {
  background: transparent;
}

.guide-toc-nav::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: var(--gray-300);
  background-clip: padding-box;
}

.guide-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-toc-item {
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-toc-link {
  display: block;
  padding: 0.52rem 0.65rem;
  border-left: 2px solid transparent;
  border-radius: 0 7px 7px 0;
  color: var(--gray-600);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.42;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.guide-toc-level-2 .guide-toc-link {
  color: var(--gray-800);
  font-size: 0.81rem;
  font-weight: 750;
}

.guide-toc-level-3 .guide-toc-link {
  padding-left: 1rem;
}

.guide-toc-level-4 .guide-toc-link {
  padding-left: 1.35rem;
  color: var(--gray-500);
  font-size: 0.75rem;
}

.guide-toc-link:hover,
.guide-toc-link:focus-visible {
  border-left-color: var(--blue-500);
  background: var(--blue-50);
  color: var(--blue-700);
}

.guide-toc-link:focus-visible {
  outline: 2px solid var(--blue-400);
  outline-offset: -2px;
}

@media (max-width: 980px) {
  .guide-toc-nav {
    max-height: 300px;
  }
}

@media (max-width: 640px) {
  .guide-toc-card summary {
    min-height: 44px;
  }

  .guide-toc-nav {
    max-height: 260px;
  }
}


/* GUIDE RESPONSIVE CONTENT SAFETY - 2026-07-26 */
.guide-reading-layout,
.guide-reading-layout > *,
.guide-reading-layout .guide-article,
.guide-article > *,
.guide-toc-card,
.guide-toc-nav,
.faq-list,
.faq-item {
  min-width: 0;
}

.guide-reading-layout {
  width: 100%;
  max-width: 100%;
}

.guide-article {
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
}

.guide-article a,
.guide-article p,
.guide-article li,
.guide-article h2,
.guide-article h3,
.guide-toc-link,
.faq-question,
.faq-answer {
  overflow-wrap: anywhere;
  word-break: normal;
}

.guide-table-scroll {
  width: 100%;
  max-width: 100%;
  margin: 1rem 0 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  border-radius: 8px;
}

.guide-data-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.guide-data-table th,
.guide-data-table td {
  padding: 0.7rem;
  border: 1px solid var(--gray-200);
  text-align: left;
  vertical-align: top;
}

.guide-data-table th {
  background: var(--gray-50);
  color: var(--gray-900);
}

.guide-article .formula-box {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.guide-article .faq-question {
  width: 100%;
  min-width: 0;
  text-align: left;
}

.guide-article .faq-icon {
  flex: 0 0 auto;
}

@media (max-width: 980px) {
  .guide-reading-section > .container,
  .guide-reading-layout,
  .guide-reading-layout .guide-article {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .guides-hero .container,
  .guide-reading-section > .container,
  .guide-bottom-cta > .container {
    width: 100%;
    max-width: 100%;
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  .guides-hero h1 {
    font-size: clamp(1.65rem, 8vw, 2.1rem);
    line-height: 1.18;
  }

  .guides-hero p {
    font-size: 0.95rem;
    line-height: 1.65;
  }

  .guide-article {
    width: 100%;
    max-width: 100%;
    padding: 0.9rem;
    border-radius: 10px;
  }

  .guide-article h2 {
    font-size: 1.25rem;
    line-height: 1.35;
    margin-top: 1.75rem;
  }

  .guide-article h3 {
    font-size: 1.05rem;
    line-height: 1.4;
  }

  .guide-article p,
  .guide-article li {
    font-size: 0.95rem;
    line-height: 1.7;
  }

  .guide-article ul,
  .guide-article ol {
    padding-left: 1.15rem;
  }

  .guide-article .formula-box {
    padding: 0.85rem;
    font-size: 0.78rem;
    line-height: 1.6;
  }

  .guide-table-scroll {
    margin-left: 0;
    margin-right: 0;
    border: 1px solid var(--gray-200);
  }

  .guide-data-table {
    min-width: 560px;
    font-size: 0.82rem;
  }

  .guide-data-table th,
  .guide-data-table td {
    padding: 0.55rem;
  }

  .guide-toc-card summary {
    padding-left: 0.85rem;
  }

  .faq-question {
    gap: 0.75rem;
    padding: 0.9rem;
    font-size: 0.9rem;
    line-height: 1.45;
  }

  .faq-answer {
    padding: 0 0.9rem 0.95rem;
    font-size: 0.9rem;
    line-height: 1.65;
  }
}

@media (max-width: 359px) {
  .guides-hero .container,
  .guide-reading-section > .container,
  .guide-bottom-cta > .container {
    padding-left: 0.65rem;
    padding-right: 0.65rem;
  }

  .guide-article {
    padding: 0.75rem;
  }

  .guide-data-table {
    min-width: 520px;
  }
}
