body {
  background: var(--bg);
  color: var(--text);
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  color: var(--text);
  font-family: "Source Serif 4", "Georgia", serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover,
a:focus {
  color: var(--primary);
  text-decoration: underline;
}

main {
  padding-top: 2rem;
  padding-bottom: 2.5rem;
}

.navbar-theme {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.navbar-theme .navbar-brand {
  color: var(--text);
  font-weight: 600;
}

.navbar-theme .nav-link {
  color: var(--text);
  font-weight: 500;
}

.navbar-theme .nav-link:hover,
.navbar-theme .nav-link:focus {
  color: var(--primary);
}

.navbar-theme .navbar-toggler {
  border-color: var(--border);
}

.navbar-theme .dropdown-menu {
  background: var(--surface);
  border-color: var(--border);
}

.nav-user-btn {
  background: none;
  border: none;
  color: var(--text);
  padding: 0.25rem;
  line-height: 1;
}

.nav-user-btn:hover,
.nav-user-btn:focus {
  color: var(--primary);
}

.nav-message-mobile {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  position: relative;
}

.nav-message-mobile:hover,
.nav-message-mobile:focus {
  color: var(--primary);
  border-color: var(--primary);
  text-decoration: none;
}

.brand-text {
  font-family: "Source Serif 4", "Georgia", serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 0;
  object-fit: cover;
  display: inline-block;
  border: 0;
  box-shadow: none;
}

.logo-wordmark {
  height: 24px;
  width: auto;
  display: inline-block;
}

@media (max-width: 575.98px) {
  .logo-wordmark {
    display: none;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

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

.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--primary-contrast);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-contrast);
}

.form-control,
.form-select,
textarea,
input {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.form-control:focus,
.form-select:focus,
textarea:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem var(--accent);
}

.form-control::placeholder,
textarea::placeholder,
input::placeholder {
  color: var(--muted-text);
}

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

.surface {
  background: var(--surface);
}

.surface-2 {
  background: var(--surface-2);
}

.border-subtle {
  border: 1px solid var(--border);
}

.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.rounded-lg {
  border-radius: var(--radius);
}

.app-footer {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.noUi-target {
  background: var(--surface-2);
  border: 1px solid var(--border);
  box-shadow: none;
}

.noUi-connect {
  background: var(--primary);
}

.noUi-handle {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.thread-list {
  max-height: 65vh;
  overflow-y: auto;
}

.thread-row-unread .fw-semibold {
  font-weight: 700;
}

.thread-unread-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--primary);
  display: inline-block;
}

.thread-message-pane {
  max-height: 60vh;
  overflow-y: auto;
}

/* ── Chat Layout ── */
.chat-layout {
  display: flex;
  height: calc(100dvh - 160px);
  min-height: 400px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.chat-sidebar {
  width: 340px;
  min-width: 280px;
  max-width: 400px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--surface);
}

.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface-2);
}

.chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 991.98px) {
  .chat-layout {
    height: calc(100dvh - 120px);
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .chat-sidebar {
    width: 100%;
    max-width: none;
    border-right: none;
  }
  .chat-main {
    width: 100%;
  }
  .chat-hide-mobile {
    display: none !important;
  }
}

/* ── Chat Sidebar Header ── */
.chat-sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

.chat-sidebar-header h2 {
  font-size: 1.1rem;
  margin: 0;
}

/* ── Chat Search ── */
.chat-search {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-search .form-control {
  border-radius: 999px;
  font-size: 0.85rem;
  padding: 0.4rem 1rem;
}

/* ── Chat Tabs ── */
.chat-tabs {
  padding: 0.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-tabs .nav-link {
  font-size: 0.78rem;
  padding: 0.25rem 0.5rem;
}

/* ── Chat Contact List ── */
.chat-contacts {
  flex: 1;
  overflow-y: auto;
}

.chat-contact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background 0.15s;
}

.chat-contact:hover {
  background: var(--surface-2);
  text-decoration: none;
  color: var(--text);
}

.chat-contact-active {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border-left: 3px solid var(--primary);
}

.chat-contact-unread .chat-contact-name {
  font-weight: 700;
}

.chat-contact-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 15%, var(--surface-2));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.chat-contact-body {
  flex: 1;
  min-width: 0;
}

.chat-contact-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.chat-contact-time {
  font-size: 0.72rem;
  color: var(--muted-text);
  white-space: nowrap;
}

.chat-contact-preview {
  font-size: 0.8rem;
  color: var(--muted-text);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-unread-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--primary);
  flex-shrink: 0;
}

.chat-contact-delete {
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.chat-contact:hover .chat-contact-delete {
  opacity: 1;
}

.chat-contact-delete .btn-link {
  color: var(--muted-text);
  padding: 0;
  font-size: 0;
  line-height: 1;
}

.chat-contact-delete .material-symbols-outlined {
  font-size: 1.1rem;
}

.chat-contact-delete .btn-link:hover {
  color: var(--bs-danger, #dc3545);
}

@media (hover: none) {
  .chat-contact-delete {
    opacity: 1;
  }
}

/* ── Chat Header ── */
.chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.chat-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  text-decoration: none;
}

.chat-back-btn:hover {
  color: var(--accent);
}

.chat-header-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 15%, var(--surface-2));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--text);
  flex-shrink: 0;
}

.chat-header-info {
  min-width: 0;
  flex: 1;
}

.chat-header-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.chat-header-name a {
  color: var(--text);
  text-decoration: none;
}

.chat-header-name a:hover {
  color: var(--primary);
}

.chat-header-context a {
  color: var(--muted-text);
}

.chat-header-context a:hover {
  color: var(--primary);
}

.chat-header-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted-text);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}

.btn-icon:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn-icon .material-symbols-outlined {
  font-size: 1.2rem;
}

/* ── Chat Messages Area ── */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.chat-date-divider {
  text-align: center;
  margin: 1rem 0 0.5rem;
}

.chat-date-divider span {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted-text);
}

.chat-bubble-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 75%;
}

.chat-bubble-sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-bubble-received {
  align-self: flex-start;
}

.chat-bubble-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 15%, var(--surface));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.6rem;
  color: var(--text);
  flex-shrink: 0;
}

.chat-bubble {
  padding: 0.5rem 0.85rem;
  border-radius: 1.1rem;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.chat-bubble-sent .chat-bubble {
  background: var(--primary);
  color: var(--primary-contrast);
  border-bottom-right-radius: 0.25rem;
}

.chat-bubble-received .chat-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 0.25rem;
}

.chat-bubble-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.chat-bubble-sent .chat-bubble-text a {
  color: var(--primary-contrast);
  text-decoration: underline;
}

.chat-bubble-time {
  display: block;
  font-size: 0.65rem;
  margin-top: 0.2rem;
  opacity: 0.7;
}

.chat-bubble-sent .chat-bubble-time {
  text-align: right;
  color: var(--primary-contrast);
}

.chat-bubble-received .chat-bubble-time {
  color: var(--muted-text);
}

/* ── Chat Reply Bar ── */
.chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

.chat-reply-input {
  flex: 1;
  border-radius: 999px !important;
  font-size: 0.9rem;
  padding: 0.5rem 1rem !important;
}

.chat-reply-send {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-reply-send .material-symbols-outlined {
  font-size: 1.2rem;
}

.chat-reply-blocked {
  justify-content: center;
  padding: 1rem;
}

/* ── Chat Empty State ── */
.chat-empty-state {
  background: var(--surface-2);
}

.chat-empty-state .material-symbols-outlined {
  color: var(--muted-text);
  opacity: 0.5;
}

.location-list-item:hover {
  background: var(--surface-2);
}

.location-list-item:last-child {
  border-bottom: none !important;
}

.filter-pill a {
  text-decoration: none;
  font-weight: 700;
}

.filter-pill a:hover {
  opacity: 0.7;
}

.match-date-header {
  margin-bottom: 0.55rem;
  padding: 0 0 0.3rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--muted-text);
  font-size: 1.05rem;
  font-weight: 600;
}

.nearby-match-card {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 0.8rem 0.9rem;
  color: inherit;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.nearby-match-card:hover,
.nearby-match-card:focus {
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.match-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.73rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.match-pill .material-symbols-outlined {
  font-size: 14px;
  line-height: 1;
}

.match-pill-format-singles {
  background: #fff3cd;
  border-color: #ffe69c;
  color: #7a5a00;
}

.match-pill-format-doubles {
  background: #d1e7dd;
  border-color: #badbcc;
  color: #0f5132;
}

.match-pill-gender-male {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.match-pill-gender-female {
  background: #fce7f3;
  border-color: #fbcfe8;
  color: #be185d;
}

.match-pill-gender-nonbinary {
  background: #ede9fe;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.match-pill-neutral,
.match-pill-level {
  background: #f1f3f5;
  border-color: #dee2e6;
  color: #495057;
}

.match-pill-spots {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  color: color-mix(in srgb, var(--primary) 78%, var(--text));
}

.host-age-slider-wrap {
  padding: 0.2rem 0.65rem 0.1rem 0.25rem;
}

.home-hero {
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--accent) 18%, transparent) 0, transparent 42%),
    radial-gradient(circle at bottom left, color-mix(in srgb, var(--primary) 24%, transparent) 0, transparent 38%),
    var(--surface);
}

.hero-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--primary);
}

.hero-points {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.hero-points span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.88rem;
  color: var(--muted-text);
}

.hero-points .material-symbols-outlined {
  font-size: 1rem;
  color: var(--primary);
}

.feature-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.feature-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--primary) 40%, var(--border));
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.feature-icon .material-symbols-outlined {
  color: var(--primary);
  font-size: 1.2rem;
}

.how-steps {
  display: grid;
  gap: 1rem;
}

.how-step {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  padding: 1.1rem 1.1rem 1.1rem 1.35rem;
  box-shadow: var(--shadow-sm);
}

.how-step::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 16px 0 0 16px;
  background: color-mix(in srgb, var(--primary) 45%, var(--border));
}

.how-step h3 {
  margin-bottom: 0.4rem;
}

.how-step-number {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-contrast);
  background: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

.how-step-1::before {
  background: color-mix(in srgb, var(--primary) 38%, var(--border));
}

.how-step-2::before {
  background: color-mix(in srgb, var(--primary) 54%, var(--border));
}

.how-step-3::before {
  background: color-mix(in srgb, var(--accent) 60%, var(--primary));
}

@media (min-width: 768px) {
  .how-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.1rem;
  }

  .how-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 2.15rem;
    right: -1rem;
    width: 1rem;
    height: 2px;
    background: color-mix(in srgb, var(--primary) 35%, var(--border));
  }
}

.cta-band {
  border-radius: 18px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 90%, white 10%);
}

@media (max-width: 767.98px) {
  .hero-points {
    gap: 0.55rem;
  }
}

/* ── Onboarding: selectable option cards ── */
.option-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.option-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
  min-width: 140px;
  max-width: 220px;
  text-align: center;
  flex: 0 0 clamp(140px, 30%, 220px);
  background: var(--surface);
}

.option-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.option-card:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

.option-card:has(input:checked) .option-card-icon {
  color: var(--primary);
}

.option-card-icon {
  font-size: 2rem;
  color: var(--muted-text);
  transition: color 0.2s;
}

.option-card-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.option-card-desc {
  font-size: 0.8rem;
  color: var(--muted-text);
  line-height: 1.3;
}

/* ── Onboarding: progressive reveal ── */
.onboarding-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  display: none;
}

.onboarding-section.visible {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

.onboarding-section.show-all {
  opacity: 1;
  transform: none;
  transition: none;
  display: block;
}

.onboarding-question {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.onboarding-helper {
  color: var(--muted-text);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.onboarding-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.legal-doc section + section {
  margin-top: 1.35rem;
}

.legal-doc h2 {
  margin-bottom: 0.55rem;
}

.legal-doc h3 {
  margin-bottom: 0.4rem;
}

.legal-doc p:last-child {
  margin-bottom: 0;
}

.legal-doc ul {
  margin-bottom: 0.7rem;
}

.legal-doc-header {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

@media (max-width: 767.98px) {
  [data-picker-target] {
    display: none !important;
  }
}

@media (max-width: 575.98px) {
  .option-card {
    min-width: 120px;
    max-width: 180px;
    flex-basis: 160px;
    padding: 1rem 0.75rem;
  }

  .option-card-icon {
    font-size: 1.5rem;
  }
}

/* ── Mobile Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
  padding: 0.35rem 0;
  padding-bottom: calc(0.35rem + env(safe-area-inset-bottom));
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.25rem 0.75rem;
  color: var(--muted-text);
  text-decoration: none;
  position: relative;
  transition: color 0.15s;
  border-radius: 8px;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
  color: var(--primary);
  text-decoration: none;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item .material-symbols-outlined {
  font-size: 24px;
}

.bottom-nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.bottom-nav-badge {
  position: absolute;
  top: 0;
  right: 0.35rem;
  min-width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: var(--danger, #dc3545);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  line-height: 1;
}

@media (min-width: 992px) {
  .bottom-nav {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  body.has-bottom-nav {
    padding-bottom: 4.25rem;
  }
}
