/* ==========================================================================
   Castes, Surnames & Gotras of Nepal — Official Brand Design System
   Themed authentically to the "CAST IN NEPAL" Official Brand Logo:
   Imperial Himalayan Navy, Flag Crimson Red, Snow White & Glacial Slate.
   ========================================================================== */

:root {
  /* Dark Mode Palette (Himalayan Midnight Navy — Starlight Stature) */
  --bg-primary: #060e1a;          /* Deepest starlit Himalayan midnight navy */
  --bg-secondary: #0c1829;
  --bg-surface: #102138;          /* Imperial navy surface */
  --bg-surface-elevated: #152b47;
  --bg-surface-hover: #1c3659;

  --border-subtle: #1c3554;
  --border-strong: #2a4c77;
  --border-active: #ef4444;       /* Flag Crimson Red */

  --text-primary: #f8fafc;        /* Glacial snow white */
  --text-secondary: #cbd5e1;      /* Crisp mountain slate */
  --text-muted: #8da4be;
  --text-subtle: #5f7793;

  /* Heritage Brand Accents from Logo */
  --brand-navy: #0b2545;          /* Imperial Himalayan Navy */
  --brand-primary: #ef4444;       /* Flag Crimson Red */
  --brand-hover: #f87171;
  --brand-soft: rgba(239, 68, 68, 0.15);
  --brand-text: #fca5a5;

  --accent-gold: #f59e0b;          /* Vedic Saffron / Pagoda Temple Gold */
  --accent-gold-soft: rgba(245, 158, 11, 0.15);
  --gold-primary: #f59e0b;
  --accent-blue: #38bdf8;          /* Groom Himalayan Sapphire / Ice Blue */
  --accent-blue-soft: rgba(56, 189, 248, 0.15);
  --accent-rose: #f43f5e;          /* Bride Flag Crimson Vermilion */
  --accent-rose-soft: rgba(244, 63, 94, 0.15);
  --accent-emerald: #10b981;       /* Mountain Jade / Compatible */
  --accent-emerald-soft: rgba(16, 185, 129, 0.15);

  /* Cultural Category Colors */
  --cat-khas: #f59e0b;
  --cat-newar: #ef4444;
  --cat-janajati: #10b981;
  --cat-madhesi: #38bdf8;
  --cat-dalit: #c084fc;
  --cat-muslim: #2dd4bf;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 36px -6px rgba(0, 0, 0, 0.6);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', 'Outfit', -apple-system, sans-serif;
  --font-deva: 'Noto Sans Devanagari', sans-serif;

  /* Motion */
  --trans-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --trans-normal: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  /* Light Mode Palette (Himalayan Snow & Imperial Navy — Exact Logo Colors) */
  --bg-primary: #f6f8fb;          /* Pure glacial ivory canvas */
  --bg-secondary: #edf2f7;
  --bg-surface: #ffffff;          /* Crisp snow white cards */
  --bg-surface-elevated: #f8fafc;
  --bg-surface-hover: #eef3f9;

  --border-subtle: #dbe3ed;
  --border-strong: #cbd5e1;
  --border-active: #c8102e;       /* Flag Crimson from Logo */

  --text-primary: #0b2545;        /* Deep Imperial Navy — Matches Logo Logotype */
  --text-secondary: #334e68;      /* Deep mountain slate */
  --text-muted: #627d98;
  --text-subtle: #829ab1;

  /* Heritage Brand Accents from Logo */
  --brand-navy: #0b2545;          /* Imperial Himalayan Navy */
  --brand-primary: #c8102e;       /* Nepali Flag Crimson */
  --brand-hover: #9b0d23;
  --brand-soft: #fff1f2;
  --brand-text: #c8102e;

  --accent-gold: #c05621;          /* Vedic Saffron / Temple Gold */
  --accent-gold-soft: #fffaf0;
  --gold-primary: #c05621;
  --accent-blue: #0b2545;          /* Groom Imperial Navy */
  --accent-blue-soft: #ebf4ff;
  --accent-rose: #c8102e;          /* Bride Flag Crimson */
  --accent-rose-soft: #fff1f2;
  --accent-emerald: #047857;       /* Mountain Jade / Compatible */
  --accent-emerald-soft: #ecfdf5;

  /* Cultural Category Colors */
  --cat-khas: #c05621;
  --cat-newar: #c8102e;
  --cat-janajati: #047857;
  --cat-madhesi: #0284c7;
  --cat-dalit: #7e22ce;
  --cat-muslim: #0f766e;

  --shadow-sm: 0 1px 3px rgba(11, 37, 69, 0.06);
  --shadow-md: 0 4px 16px -2px rgba(11, 37, 69, 0.1);
  --shadow-lg: 0 14px 34px -4px rgba(11, 37, 69, 0.15);
}

/* Base Styles & Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--trans-normal), color var(--trans-normal);
}

/* Typography Utilities */
.deva-text {
  font-family: var(--font-deva);
  font-weight: 600;
}

/* Site Navigation Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.65rem 1.5rem;
  transition: background-color var(--trans-normal), border-color var(--trans-normal);
}

.nav-container {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo-container {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(11, 37, 69, 0.16);
  border: 1.5px solid rgba(11, 37, 69, 0.12);
  flex-shrink: 0;
  transition: transform var(--trans-fast), box-shadow var(--trans-fast);
}

.brand-wrapper:hover .brand-logo-container {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(11, 37, 69, 0.25);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-pill-logo {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-title-nepali {
  font-family: var(--font-deva);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.brand-title-english {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--brand-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--trans-fast);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-icon:hover {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-primary {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.btn-primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn-outline {
  background: var(--bg-surface);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.badge-counter {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  min-width: 18px;
  text-align: center;
}

/* Hero Section */
.hero-section {
  padding: 2.75rem 1.5rem 1.75rem;
  text-align: center;
  max-width: 860px;
  margin: 0 auto;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 1.15rem;
}

.hero-title {
  font-family: var(--font-deva);
  font-size: clamp(2rem, 3.75vw, 2.85rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

/* Streamlined Hero Stats Strip */
.hero-stats-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.45rem 1.25rem;
  margin: 0 auto 1.75rem;
}

.hero-stat-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hero-stat-num {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1;
}

.hero-stat-text {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
}

.hero-stat-sep {
  color: var(--border-strong);
  font-size: 0.85rem;
}

/* Search Bar */
.search-container {
  max-width: 680px;
  margin: 0 auto 1.5rem;
  position: relative;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  transition: all var(--trans-fast);
}

.search-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 1px var(--brand-primary);
}

.search-icon-svg {
  color: var(--text-muted);
  margin-right: 0.65rem;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text-primary);
  padding: 0.25rem 0;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 50%;
  display: none;
}

.search-clear-btn:hover {
  color: var(--text-primary);
}

.search-shortcut {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 0.12rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}

/* View Mode Switcher (Segmented Control) */
.view-mode-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  margin: 0 auto 2rem;
  flex-wrap: wrap;
}

.view-tab-btn {
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--trans-fast);
}

.view-tab-btn:hover {
  color: var(--text-primary);
}

.view-tab-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  box-shadow: 0 2px 8px rgba(200, 16, 46, 0.25);
  font-weight: 600;
}

/* Main Layout */
.app-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
  width: 100%;
}

/* Category Filter Bar */
.category-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  scrollbar-width: none;
}

.category-filter-bar::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--trans-fast);
  white-space: nowrap;
}

.cat-pill:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.cat-pill.active {
  background: var(--brand-soft);
  border-color: var(--brand-primary);
  color: var(--brand-text);
}

.cat-pill .pill-count {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.8;
}

/* Secondary Filter Controls */
.secondary-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  margin-bottom: 1.25rem;
}

.filter-selects-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.filter-select {
  height: 2.125rem;
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 0 0.65rem;
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color var(--trans-fast);
}

.filter-select:focus {
  border-color: var(--brand-primary);
}

.filter-actions-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.results-count-text {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.results-count-text strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Cards Grid View */
.surnames-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1rem;
}

.surname-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.125rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.875rem;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
  cursor: pointer;
}

.surname-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-title-group {
  display: flex;
  flex-direction: column;
}

.card-devanagari {
  font-family: var(--font-deva);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.card-roman {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.card-favorite-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.2rem;
  transition: all var(--trans-fast);
}

.card-favorite-btn:hover,
.card-favorite-btn.favorited {
  color: var(--accent-crimson);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.2rem 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.8125rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.65rem;
}

.meta-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.meta-label {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.78rem;
  min-width: 75px;
  flex-shrink: 0;
}

.meta-value {
  color: var(--text-secondary);
  font-weight: 500;
  word-break: break-word;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

.card-view-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--brand-text);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.card-view-btn:hover {
  text-decoration: underline;
}

/* Data Table View */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.responsive-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
}

.responsive-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  user-select: none;
}

.responsive-table th:hover {
  color: var(--text-primary);
}

.responsive-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.responsive-table tr {
  transition: background-color var(--trans-fast);
  cursor: pointer;
}

.responsive-table tr:hover {
  background: var(--bg-surface-elevated);
}

.table-surname-cell {
  display: flex;
  flex-direction: column;
}

.table-surname-dev {
  font-family: var(--font-deva);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.table-surname-rom {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Sagotra / Lineage Finder View */
.sagotra-finder-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2rem 1.75rem;
  max-width: 1040px;
  margin: 0 auto;
}

.sagotra-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 1.75rem;
}

.sagotra-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.sagotra-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.gotra-picker-wrapper {
  max-width: 440px;
  margin: 0 auto 2rem;
}

.gotra-picker-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.gotra-big-select {
  width: 100%;
  height: 2.5rem;
  padding: 0 0.85rem;
  border-radius: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.gotra-big-select:focus {
  border-color: var(--brand-primary);
}

.sagotra-results-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.5rem;
}

.sagotra-info-banner {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sagotra-surnames-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sagotra-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--trans-fast);
}

.sagotra-chip:hover {
  border-color: var(--brand-primary);
  background: var(--bg-surface-elevated);
}

.chip-dev {
  font-family: var(--font-deva);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.chip-rom {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chip-comm {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Demographics & Insights View */
.insights-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1040px;
  margin: 0 auto;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.insight-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 1.5rem;
}

.insight-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.dist-bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dist-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dist-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.dist-bar-track {
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 4px;
}

/* Cultural Guide Accordion */
.guide-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.guide-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
}

.guide-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
}

.guide-body {
  padding: 0 1rem 1rem;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ==========================================================================
   Detail Information Modal (Polished, Ultra-Readable, Structured)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 14, 26, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--trans-normal), visibility var(--trans-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  width: 100%;
  max-width: 660px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(12px) scale(0.98);
  transition: transform var(--trans-normal), opacity var(--trans-normal);
  overflow: hidden;
}

.modal-overlay.active .modal-card {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-title-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-title-dev {
  font-family: var(--font-deva);
  font-size: 1.95rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.modal-title-rom {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brand-primary);
  margin-top: -0.1rem;
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--trans-fast);
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  transform: rotate(90deg);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.detail-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (max-width: 560px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

.detail-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: border-color var(--trans-fast), background-color var(--trans-fast);
}

.detail-box:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface-hover);
}

.detail-box-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-box-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  word-break: break-word;
}

.detail-box-value.gold-highlight {
  color: var(--accent-gold);
  font-weight: 700;
}

.notes-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--brand-primary);
  border-radius: 4px 10px 10px 4px;
  padding: 1.1rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.7;
}

.sagotra-surnames-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.sagotra-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text-primary);
  transition: all var(--trans-fast);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.sagotra-chip:hover {
  background: var(--brand-soft);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.sagotra-chip .chip-dev {
  font-family: var(--font-deva);
  font-weight: 700;
  font-size: 0.925rem;
}

.sagotra-chip .chip-rom {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sagotra-chip:hover .chip-rom {
  color: var(--brand-primary);
}

.sagotra-chip .chip-comm {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: var(--bg-surface);
  border-radius: 0 0 16px 16px;
}

/* Header Portfolio Link Button */
.portfolio-backlink-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border-color: var(--border-subtle);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--trans-fast);
}

.portfolio-backlink-btn:hover {
  color: var(--text-primary);
  border-color: var(--brand-primary);
  background: var(--brand-soft);
}

@media (max-width: 640px) {
  .portfolio-backlink-btn span {
    display: none;
  }
}

/* Quick Test Scenarios Bar in Checker */
.checker-presets-container {
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.presets-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.presets-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--trans-fast);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.preset-chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--brand-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.preset-chip:active {
  transform: translateY(0);
}

.preset-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.preset-dot.dot-collision {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

.preset-dot.dot-compatible {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.preset-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.preset-chip:hover .preset-badge {
  border-color: var(--border-strong);
  color: var(--text-secondary);
}

/* Insights / Cultural Guide View */
.insights-container {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Official Census Explorer Card */
.census-explorer-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.census-explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.census-official-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

[data-theme="dark"] .census-official-pill {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fca5a5;
}

.census-stat-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
}

.census-stat-badge-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--brand-primary);
  font-family: var(--font-mono, monospace);
  line-height: 1.1;
}

.census-stat-badge-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
}

.census-metric-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.85rem;
}

@media (max-width: 1024px) {
  .census-metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .census-metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .census-stat-badge {
    align-items: flex-start;
    width: 100%;
  }
}

.census-metric-tile {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.c-metric-title {
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.c-metric-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
}

.c-metric-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.75rem;
}

@media (max-width: 900px) {
  .insights-grid {
    grid-template-columns: 1fr;
  }
}

.insight-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.insight-card h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Distribution Bars */
.dist-bar-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.dist-bar-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.dist-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.dist-bar-label strong {
  color: var(--text-primary);
}

.dist-bar-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  overflow: hidden;
}

.dist-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.4s ease-out;
}

/* Accordion Guide List */
.guide-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.guide-item {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-surface-elevated);
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
}

.guide-item:hover {
  border-color: var(--border-strong);
}

.guide-header {
  padding: 0.95rem 1.15rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  transition: background-color var(--trans-fast);
}

.guide-header:hover {
  background: var(--bg-surface-hover);
}

.guide-header span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-primary);
  flex-shrink: 0;
  transition: transform var(--trans-fast);
}

.guide-body {
  display: none;
  padding: 1rem 1.15rem 1.15rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.68;
}

/* Favorites Drawer */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--trans-fast);
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--trans-normal);
}

.drawer-overlay.active .drawer {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.drawer-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: center;
  margin-top: 2rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  font-size: 0.8125rem;
  font-weight: 500;
  pointer-events: auto;
}

/* ==========================================================================
   Sagotra & Gotra Collision Checker Styles
   ========================================================================== */
.couple-checker-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 2.25rem 2rem;
  max-width: 1040px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}

.checker-hero-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 2.25rem;
}

.checker-hero-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.checker-hero-header p {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.6;
}

/* Dual selection columns */
.couple-selection-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 1.75rem;
}

.partner-card-select {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.35rem;
  position: relative;
  transition: all var(--trans-fast);
  box-shadow: var(--shadow-sm);
}

.partner-card-select.partner-card-groom {
  border-top: 4px solid var(--accent-blue);
}

.partner-card-select.partner-card-bride {
  border-top: 4px solid var(--accent-rose);
}

.partner-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.partner-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.avatar-groom {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.avatar-bride {
  background: var(--accent-rose-soft);
  color: var(--accent-rose);
  border: 1px solid rgba(225, 29, 72, 0.2);
}

.partner-title-text {
  display: flex;
  flex-direction: column;
}

.partner-role-nepali {
  font-family: var(--font-deva);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.partner-role-eng {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.partner-form-group {
  margin-bottom: 0.85rem;
  position: relative;
}

.partner-form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

/* Searchable Combobox Component */
.searchable-combobox {
  position: relative;
  width: 100%;
}

.combobox-trigger {
  width: 100%;
  min-height: 2.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--trans-fast);
  user-select: none;
}

.combobox-trigger:hover,
.combobox-trigger:focus,
.combobox-trigger.active {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-soft);
  outline: none;
}

.combobox-selected-info {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combobox-selected-deva {
  font-family: var(--font-deva);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.combobox-selected-roman {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--brand-primary);
}

.combobox-selected-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.combobox-chevron {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: transform var(--trans-fast);
  flex-shrink: 0;
}

.combobox-trigger.active .combobox-chevron {
  transform: rotate(180deg);
}

/* Floating Dropdown Panel */
.combobox-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-height: 380px;
  overflow: hidden;
  animation: comboboxOpen 0.15s ease-out;
}

@keyframes comboboxOpen {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.combobox-search-box {
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.combobox-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.combobox-search-input {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
}

.combobox-search-input::placeholder {
  color: var(--text-muted);
}

.combobox-clear-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  display: flex;
  align-items: center;
  font-size: 0.8rem;
}

.combobox-clear-btn:hover {
  color: var(--text-primary);
}

.combobox-options-list {
  overflow-y: auto;
  max-height: 270px;
  padding: 0.35rem;
}

.combobox-option {
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: background-color var(--trans-fast);
}

.combobox-option:hover,
.combobox-option.focused {
  background: var(--bg-surface-elevated);
}

.combobox-option.selected {
  background: var(--brand-soft);
  color: var(--brand-primary);
  font-weight: 600;
}

.combobox-option-title {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}

.combobox-option-deva {
  font-family: var(--font-deva);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.combobox-option-roman {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-text);
}

.combobox-option-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.combobox-footer {
  padding: 0.45rem 0.85rem;
  background: var(--bg-surface-elevated);
  border-top: 1px solid var(--border-subtle);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.combobox-no-results {
  padding: 1.75rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.partner-selected-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-top: 0.65rem;
}

.partner-gotra-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
  border: 1px solid rgba(217, 119, 6, 0.25);
  margin-top: 0.5rem;
}

.swap-btn-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 4.5rem;
}

.swap-partners-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--brand-primary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--trans-fast);
  box-shadow: var(--shadow-sm);
}

.swap-partners-btn:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #ffffff;
  transform: rotate(180deg);
  box-shadow: var(--shadow-md);
}

/* Collision Result Card */
.collision-result-wrapper {
  margin-top: 2rem;
}

.collision-result-card {
  border-radius: 12px;
  padding: 1.75rem;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  box-shadow: var(--shadow-md);
}

.result-collision {
  border-color: rgba(244, 63, 94, 0.5);
  background: linear-gradient(180deg, rgba(244, 63, 94, 0.08) 0%, var(--bg-surface) 60px);
}

.result-warning {
  border-color: rgba(245, 158, 11, 0.5);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, var(--bg-surface) 60px);
}

.result-clean {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, var(--bg-surface) 60px);
}

.result-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.result-status-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.result-status-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-status-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.result-explanation-text {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.lineage-compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-surface);
}

.lineage-compare-table th {
  background: var(--bg-secondary);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
}

.lineage-compare-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.result-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Site Footer */
.site-footer {
  margin-top: auto;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 1.5rem 2rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.footer-content {
  max-width: 1360px;
  margin: 0 auto 1.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.footer-col h4 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.footer-col p {
  line-height: 1.6;
  color: var(--text-muted);
}

.footer-bottom {
  max-width: 1360px;
  margin: 0 auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.75rem;
}

/* ==========================================================================
   Comprehensive Responsive Design System
   Optimized for Mobile (320px - 480px), Phablets (481px - 768px),
   Tablets (769px - 1024px), and Desktop viewports.
   ========================================================================== */

/* 1. Tablet & Medium Screens (max-width: 1024px) */
@media (max-width: 1024px) {
  .app-main {
    padding: 0 1.25rem 3.5rem;
  }

  .surnames-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* 2. Small Tablets & Landscape Phablets (max-width: 900px) */
@media (max-width: 900px) {
  .hero-section {
    padding: 2.25rem 1.25rem 1.5rem;
  }

  /* Secondary Filters Grid */
  .secondary-filters-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem;
  }

  .filter-selects-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    width: 100%;
  }

  .filter-select {
    width: 100%;
  }

  .filter-actions-group {
    width: 100%;
  }

  .filter-actions-group .btn {
    width: 100%;
    justify-content: center;
  }

  /* Sagotra Checker layout */
  .couple-selection-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .swap-btn-container {
    padding-top: 0;
    margin: 0.25rem 0;
    display: flex;
    justify-content: center;
  }

  .partner-card-select {
    padding: 1.15rem 1rem;
  }

  .insights-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* 3. Phablets & Large Mobiles (max-width: 768px) */
@media (max-width: 768px) {
  .site-header {
    padding: 0.5rem 1rem;
  }

  /* Nav Tabs: Horizontal smooth touch scrolling */
  .view-mode-nav {
    display: flex;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 4px;
    gap: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    margin-bottom: 1.25rem;
  }

  .view-mode-nav::-webkit-scrollbar {
    display: none;
  }

  .view-tab-btn {
    flex-shrink: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
  }

  /* Search bar touch refinements */
  .search-shortcut {
    display: none;
  }

  .search-input {
    font-size: 1rem; /* Prevents auto-zoom on mobile safari */
  }

  /* Responsive Table Sticky Surname column */
  .responsive-table th:first-child,
  .responsive-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--bg-surface);
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.12);
  }

  .responsive-table th:first-child {
    background: var(--bg-secondary);
    z-index: 3;
  }
}

/* 4. Standard Smartphones (max-width: 640px) */
@media (max-width: 640px) {
  .site-header {
    padding: 0.45rem 0.85rem;
  }

  .brand-wrapper {
    gap: 0.65rem;
  }

  .brand-logo-container {
    width: 38px;
    height: 38px;
    border-radius: 8px;
  }

  .brand-title-nepali {
    font-size: 0.9rem;
  }

  .brand-title-english {
    display: none; /* Hide long English line on mobile for clean, single-row header */
  }

  .portfolio-backlink-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }

  .portfolio-backlink-btn span {
    display: none;
  }

  #favDrawerOpenBtn {
    padding: 0.35rem 0.55rem;
    gap: 0.25rem;
    font-size: 0.75rem;
  }

  #favDrawerOpenBtn span:first-of-type {
    display: none; /* Only show icon + counter */
  }

  .hero-section {
    padding: 1.5rem 0.85rem 1rem;
  }

  .hero-pill {
    font-size: 0.68rem;
    padding: 0.2rem 0.6rem;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero-title {
    font-size: clamp(1.65rem, 6.5vw, 2.2rem);
    line-height: 1.25;
    margin-bottom: 0.45rem;
  }

  .hero-subtitle {
    font-size: 0.86rem;
    line-height: 1.55;
    margin-bottom: 1rem;
  }

  .hero-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 0.75rem;
    width: 100%;
    max-width: 320px;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
  }

  .hero-stat-sep {
    display: none;
  }

  .hero-stat-item {
    justify-content: center;
  }

  .hero-stat-num {
    font-size: 0.9rem;
  }

  .hero-stat-text {
    font-size: 0.75rem;
  }

  .search-container {
    margin-bottom: 1rem;
  }

  .app-main {
    padding: 0 0.85rem 3rem;
  }

  .surnames-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .surname-card {
    padding: 1rem;
  }

  .card-devanagari {
    font-size: 1.25rem;
  }

  /* Gotra Explorer Container */
  .sagotra-finder-container {
    padding: 1.25rem 1rem;
    border-radius: 10px;
  }

  .sagotra-header h2 {
    font-size: 1.25rem;
  }

  .sagotra-info-banner {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Couple Checker Container */
  .couple-checker-container {
    padding: 1.25rem 0.85rem;
    border-radius: 10px;
  }

  .checker-hero-header {
    margin-bottom: 1.5rem;
  }

  .checker-hero-header h2 {
    font-size: 1.35rem;
  }

  .checker-hero-header p {
    font-size: 0.85rem;
  }

  .partner-card-select {
    padding: 1rem 0.85rem;
  }

  .partner-role-nepali {
    font-size: 0.95rem;
  }

  .collision-result-card {
    padding: 1.25rem 1rem;
  }

  .result-status-title {
    font-size: 1.05rem;
  }

  .lineage-compare-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Preset Chips Bar */
  .checker-presets-container {
    padding: 0.85rem 1rem;
  }

  .presets-chips-wrap {
    gap: 0.45rem;
  }

  .preset-chip {
    padding: 0.35rem 0.75rem;
    font-size: 0.76rem;
  }

  /* Detail Information Modal (Bottom Sheet feel on Mobile) */
  .modal-overlay {
    padding: 0.5rem;
    align-items: flex-end;
  }

  .modal-card {
    max-height: 92vh;
    border-radius: 16px 16px 8px 8px;
    width: 100%;
  }

  .modal-header {
    padding: 0.95rem 1.15rem;
  }

  .modal-title-dev {
    font-size: 1.55rem;
  }

  .modal-title-rom {
    font-size: 0.95rem;
  }

  .modal-body {
    padding: 1rem 1.15rem;
    gap: 1rem;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .modal-footer {
    padding: 0.85rem 1.15rem;
  }

  /* Drawer Mobile Full Width */
  .drawer {
    width: 100%;
    max-width: 100%;
  }

  /* Footer */
  .site-footer {
    padding: 2rem 1rem 1.5rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
}

/* 5. Ultra-Small Smartphones (max-width: 380px) */
@media (max-width: 380px) {
  .site-header {
    padding: 0.4rem 0.65rem;
  }

  .brand-title-nepali {
    font-size: 0.82rem;
  }

  .hero-stats-row {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .filter-selects-group {
    grid-template-columns: 1fr;
  }

  .sagotra-info-banner {
    grid-template-columns: 1fr;
  }
}
