/* ============================================
   PostSwap — Premium USPS Carrier Swap Platform
   ============================================ */

:root {
  --usps-blue: #003087;
  --usps-blue-hover: #00246b;
  --usps-blue-soft: #E8F0FE;
  --usps-red: #B22234;
  --usps-red-hover: #961c2b;
  --text: #1F2937;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --bg: #FFFFFF;
  --card: #F8FAFC;
  --border: #E5E7EB;
  --border-soft: #F1F5F9;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12), 0 8px 16px rgba(15, 23, 42, 0.06);
  --shadow-blue: 0 8px 24px rgba(0, 48, 135, 0.18);
  --radius: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --nav-h: 76px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --transition: 0.22s var(--ease);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; }
ul { list-style: 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: 0;
}

.hidden { display: none !important; }

.container {
  width: min(1180px, calc(100% - 2.5rem));
  margin-inline: auto;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.25;
  transition: transform var(--transition), background var(--transition),
    box-shadow var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
  border: 1.5px solid transparent;
}

.btn:active { transform: scale(0.98); }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8125rem; border-radius: 0.625rem; }
.btn-lg { padding: 0.875rem 1.5rem; font-size: 1rem; border-radius: 0.875rem; }
.btn-block { width: 100%; }

.btn-primary {
  background: var(--usps-blue);
  color: #fff;
  box-shadow: var(--shadow-blue);
}
.btn-primary:hover {
  background: var(--usps-blue-hover);
  box-shadow: 0 10px 28px rgba(0, 48, 135, 0.28);
  transform: translateY(-1px);
}

.btn-outline {
  background: #fff;
  color: var(--usps-blue);
  border-color: #C7D2E8;
}
.btn-outline:hover {
  background: var(--usps-blue-soft);
  border-color: var(--usps-blue);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--text);
  background: transparent;
}
.btn-ghost:hover { background: var(--card); color: var(--usps-blue); }

.btn-white {
  background: #fff;
  color: var(--usps-blue);
  box-shadow: var(--shadow);
}
.btn-white:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.link-btn {
  color: var(--usps-blue);
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}
.link-btn:hover { color: var(--usps-red); text-decoration: underline; }

/* ---------- Logo ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}
.logo-img {
  height: 52px;
  width: auto;
  max-width: min(220px, 42vw);
  object-fit: contain;
  object-position: left center;
  border-radius: 0.5rem;
  display: block;
}
.logo-gif {
  /* Animated truck GIF — blend light plate into navbar */
  mix-blend-mode: multiply;
  background: transparent;
}
.logo-img-sm {
  height: 44px;
  max-width: 180px;
}
.logo-mark {
  width: 52px;
  height: 40px;
  filter: drop-shadow(0 2px 4px rgba(0, 48, 135, 0.12));
}
.logo-sm .logo-mark { width: 40px; height: 30px; }
.logo-wordmark {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}
.logo-post { color: var(--usps-blue); }
.logo-swap { color: var(--usps-red); }

@media (max-width: 480px) {
  .logo-img { height: 44px; max-width: 48vw; }
}

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.navbar.scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.navbar-inner {
  height: 100%;
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.25rem;
}
.nav-link {
  padding: 0.5rem 0.9rem;
  border-radius: 0.625rem;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover { color: var(--usps-blue); background: var(--usps-blue-soft); }

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }
.auth-guest, .auth-user { display: flex; align-items: center; gap: 0.4rem; }

/* On mobile: hide guest auth buttons (in hamburger) but keep logged-in mailbox visible */
@media (max-width: 899px) {
  .auth-guest { display: none; }
  .auth-user .my-swaps-btn,
  .auth-user .user-chip { display: none; }
  .auth-user.hidden { display: none; }
  .auth-user:not(.hidden) { display: flex; }
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.65rem 0.25rem 0.25rem;
  background: var(--card);
  border-radius: 999px;
  border: 1px solid var(--border);
}
.user-chip-btn {
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.user-chip-btn:hover {
  border-color: #A5B8E0;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.chip-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-light);
  margin-right: 0.15rem;
  flex-shrink: 0;
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--usps-blue), #1e4db7);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  letter-spacing: 0.02em;
}
.avatar-md { width: 42px; height: 42px; font-size: 0.8rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1rem; }
.user-name { font-size: 0.875rem; font-weight: 600; }

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
  border-radius: 0.5rem;
}
.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 1rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: slideDown 0.25s var(--ease);
}
.mobile-menu[hidden] { display: none; }
.mobile-link {
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  font-weight: 500;
  color: var(--text);
}
.mobile-link:hover { background: var(--card); color: var(--usps-blue); }
.mobile-auth {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

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

@media (min-width: 900px) {
  .nav-links { display: flex; }
  .hamburger { display: none; }
  .mobile-menu { display: none !important; }
}

/* ---------- Mailbox notifications ---------- */
.mailbox {
  position: relative;
}

.mailbox-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 0.85rem;
  display: grid;
  place-items: center;
  background: var(--card);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.mailbox-btn:hover,
.mailbox-btn[aria-expanded="true"] {
  background: var(--usps-blue-soft);
  border-color: #A5B8E0;
  box-shadow: var(--shadow-sm);
}

.mailbox-btn:active { transform: scale(0.96); }

.mailbox-visual {
  position: relative;
  width: 32px;
  height: 32px;
  display: block;
}

.mailbox-svg {
  width: 32px;
  height: 32px;
  display: block;
  overflow: visible;
}

/* Flag up when has unread */
.mailbox.has-unread .mb-flag {
  transform-origin: 29px 19px;
  animation: flagWave 1.8s ease-in-out infinite;
}
.mailbox.has-unread .mb-flag path {
  fill: #B22234;
}
.mailbox:not(.has-unread) .mb-flag path {
  fill: #94A3B8;
}
.mailbox:not(.has-unread) .mb-flag {
  transform: rotate(110deg);
  transform-origin: 29px 22px;
  transition: transform 0.45s var(--ease);
}
.mailbox.has-unread .mb-flag {
  transform: rotate(0deg);
  transition: transform 0.45s var(--ease);
}

/* Body subtle pulse when filled */
.mailbox.has-unread .mb-body {
  animation: mailboxPulse 2.4s ease-in-out infinite;
}

/* Letters popping into mailbox */
.mb-letters {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.mb-letter {
  position: absolute;
  width: 10px;
  height: 7px;
  border-radius: 1px;
  background: #fff;
  border: 1.2px solid #003087;
  box-shadow: 0 1px 2px rgba(0, 48, 135, 0.15);
  opacity: 0;
  left: 11px;
  top: 2px;
}

.mb-letter::after {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 2px;
  height: 1.5px;
  background: #B22234;
  border-radius: 1px;
}

.mailbox.has-unread .mb-letter-1 {
  animation: letterDrop 2.8s ease-in-out infinite;
  animation-delay: 0s;
}
.mailbox.has-unread .mb-letter-2 {
  animation: letterDrop 2.8s ease-in-out infinite;
  animation-delay: 0.35s;
  left: 14px;
  width: 9px;
  background: #E8F0FE;
}
.mailbox.has-unread .mb-letter-3 {
  animation: letterDrop 2.8s ease-in-out infinite;
  animation-delay: 0.7s;
  left: 9px;
  width: 11px;
}

.mailbox.level-1 .mb-letter-2,
.mailbox.level-1 .mb-letter-3 { animation: none; opacity: 0; }
.mailbox.level-2 .mb-letter-3 { animation: none; opacity: 0; }

/* When empty, no letters */
.mailbox:not(.has-unread) .mb-letter {
  animation: none !important;
  opacity: 0 !important;
}

.mailbox-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--usps-red);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
  animation: badgePop 0.35s var(--ease);
}

.mailbox-badge[hidden] { display: none !important; }

@keyframes letterDrop {
  0% {
    opacity: 0;
    transform: translateY(-10px) rotate(-12deg) scale(0.7);
  }
  18% {
    opacity: 1;
    transform: translateY(4px) rotate(4deg) scale(1);
  }
  35% {
    opacity: 1;
    transform: translateY(8px) rotate(0deg) scale(0.95);
  }
  55%, 100% {
    opacity: 0;
    transform: translateY(14px) scale(0.6);
  }
}

@keyframes flagWave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-12deg); }
}

@keyframes mailboxPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.12); }
}

@keyframes badgePop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Dropdown panel */
.mailbox-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 1.5rem));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 1200;
  overflow: hidden;
  animation: panelIn 0.25s var(--ease);
  transform-origin: top right;
}

.mailbox-panel[hidden] { display: none; }

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

.mailbox-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #F8FAFC 0%, #fff 100%);
}

.mailbox-panel-header h3 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.mailbox-panel-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.mailbox-close {
  width: 32px;
  height: 32px;
  border-radius: 0.5rem;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
}

.mailbox-close:hover {
  background: var(--card);
  color: var(--text);
}

.mailbox-list {
  max-height: min(360px, 50vh);
  overflow-y: auto;
  padding: 0.5rem;
}

.mailbox-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.75rem 0.7rem;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: background var(--transition);
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
  background: transparent;
  font: inherit;
  color: inherit;
}

.mailbox-item:hover {
  background: var(--card);
  border-color: var(--border-soft);
}

.mailbox-item.unread {
  background: #F5F8FF;
  border-color: rgba(0, 48, 135, 0.08);
}

.mailbox-item.unread:hover {
  background: var(--usps-blue-soft);
}

.mailbox-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 0.65rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--usps-blue-soft);
  color: var(--usps-blue);
}

.mailbox-item-icon.dm { background: #EEF2FF; color: #4338CA; }
.mailbox-item-icon.interest { background: #FEF2F2; color: var(--usps-red); }
.mailbox-item-icon.nearby { background: #ECFDF5; color: #047857; }

.mailbox-item-icon svg {
  width: 18px;
  height: 18px;
}

.mailbox-item-body {
  min-width: 0;
  flex: 1;
}

.mailbox-item-body p {
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text);
  font-weight: 500;
}

.mailbox-item.unread .mailbox-item-body p {
  font-weight: 600;
}

.mailbox-item-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--text-light);
}

.mailbox-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--usps-red);
  flex-shrink: 0;
  margin-top: 0.35rem;
  box-shadow: 0 0 0 2px rgba(178, 34, 52, 0.15);
}

.mailbox-item:not(.unread) .mailbox-dot {
  background: transparent;
  box-shadow: none;
}

.mailbox-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.mailbox-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  background: var(--card);
  display: grid;
  place-items: center;
  color: var(--usps-blue);
}

.mailbox-empty p {
  font-size: 0.9rem;
  line-height: 1.45;
}

.mailbox-panel-footer {
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: center;
  background: #fff;
}

.mailbox-panel-footer-row {
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.mailbox-panel-footer .link-btn {
  font-size: 0.875rem;
}

/* ---------- My Messages inbox ---------- */
.modal-inbox {
  width: min(820px, calc(100% - 1.25rem));
  max-height: min(90vh, 720px);
}
.inbox-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 0.85rem;
  min-height: 420px;
}
.inbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.inbox-hint {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
}
.inbox-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
  gap: 0.85rem;
  min-height: 360px;
  flex: 1;
}
@media (max-width: 700px) {
  .inbox-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .inbox-threads {
    max-height: 200px;
  }
  .inbox-thread-messages {
    max-height: 240px;
  }
}
.inbox-threads {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow-y: auto;
  max-height: 440px;
  display: flex;
  flex-direction: column;
}
.inbox-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}
.inbox-thread-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.9rem;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition);
  font: inherit;
  color: inherit;
}
.inbox-thread-item:hover {
  background: #fff;
}
.inbox-thread-item.active {
  background: var(--usps-blue-soft);
  box-shadow: inset 3px 0 0 var(--usps-blue);
}
.inbox-thread-item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.inbox-thread-route {
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}
.inbox-thread-time {
  font-size: 0.72rem;
  color: var(--text-light);
  flex-shrink: 0;
}
.inbox-thread-item-meta {
  display: flex;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}
.inbox-thread-count {
  font-weight: 600;
  color: var(--usps-blue);
}
.inbox-thread-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.inbox-thread-view {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.inbox-empty-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem;
  color: var(--text-muted);
  gap: 0.5rem;
}
.inbox-thread-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 280px;
}
.inbox-thread-panel[hidden] { display: none !important; }
.inbox-thread-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #F8FAFC 0%, #fff 100%);
}
.inbox-thread-header h3 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.inbox-thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 40%);
  max-height: 360px;
}
.inbox-msg {
  max-width: 90%;
  padding: 0.65rem 0.85rem;
  border-radius: 0.85rem;
  font-size: 0.875rem;
  line-height: 1.45;
}
.inbox-msg.them {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.25rem;
}
.inbox-msg.me {
  align-self: flex-end;
  background: var(--usps-blue);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}
.inbox-msg-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.68rem;
  opacity: 0.7;
  margin-bottom: 0.25rem;
  font-weight: 600;
}
.inbox-msg-body {
  word-break: break-word;
}

.mailbox-panel-footer .link-btn:disabled {
  opacity: 0.45;
  cursor: default;
  text-decoration: none;
  pointer-events: none;
}

/* Mobile: panel full-bleed-ish under navbar */
@media (max-width: 480px) {
  .mailbox-panel {
    position: fixed;
    top: calc(var(--nav-h) + 6px);
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
    max-height: calc(100vh - var(--nav-h) - 1.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mailbox.has-unread .mb-letter,
  .mailbox.has-unread .mb-flag,
  .mailbox.has-unread .mb-body,
  .mailbox-panel,
  .mailbox-badge {
    animation: none !important;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: calc(var(--nav-h) + 2.75rem) 0 3.5rem;
  overflow: hidden;
  min-height: min(88vh, 760px);
  display: flex;
  align-items: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 70% 55% at 12% 40%, rgba(0, 48, 135, 0.07), transparent 55%),
    radial-gradient(ellipse 50% 45% at 90% 20%, rgba(178, 34, 52, 0.05), transparent 50%),
    radial-gradient(ellipse 40% 30% at 70% 90%, rgba(0, 48, 135, 0.04), transparent 50%),
    linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 55%, #FFFFFF 100%);
}

/* Faint route / map grid pattern */
.hero-map-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.045;
  background-image:
    linear-gradient(rgba(0, 48, 135, 0.9) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 48, 135, 0.9) 1px, transparent 1px),
    radial-gradient(circle at 30% 50%, rgba(178, 34, 52, 0.5) 0 2px, transparent 3px),
    radial-gradient(circle at 65% 35%, rgba(0, 48, 135, 0.6) 0 2px, transparent 3px),
    radial-gradient(circle at 78% 70%, rgba(178, 34, 52, 0.45) 0 1.5px, transparent 2.5px);
  background-size: 48px 48px, 48px 48px, 100% 100%, 100% 100%, 100% 100%;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 50%, #000 20%, transparent 75%);
  pointer-events: none;
}

.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem 3rem;
  align-items: center;
  width: min(1180px, calc(100% - 2.5rem));
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 2.5rem 3.5rem;
  }
}

/* Truck visual — large, eye-catching */
.hero-visual {
  position: relative;
  order: -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(220px, 42vw, 420px);
  animation: heroVisualIn 0.9s var(--ease) both;
}

@media (min-width: 900px) {
  .hero-visual {
    order: 0;
    min-height: 420px;
  }
}

.hero-visual-glow {
  position: absolute;
  width: 78%;
  height: 70%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 48, 135, 0.12) 0%, rgba(178, 34, 52, 0.06) 40%, transparent 70%);
  filter: blur(8px);
  z-index: 0;
  animation: glowPulse 4.5s ease-in-out infinite;
}

.hero-visual-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-2xl);
  background: linear-gradient(160deg, #FFFFFF 0%, #F8FAFC 100%);
  border: 1px solid rgba(0, 48, 135, 0.08);
  box-shadow:
    0 24px 60px rgba(0, 48, 135, 0.1),
    0 4px 16px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  padding: 0.5rem;
}

.drive-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
  mix-blend-mode: multiply;
  animation: truckFloat 3.2s ease-in-out infinite;
}

/* Copy column */
.hero-copy {
  text-align: center;
  animation: heroCopyIn 0.85s var(--ease) 0.1s both;
}

@media (min-width: 900px) {
  .hero-copy {
    text-align: left;
    padding-block: 1rem;
  }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--usps-red);
  margin-bottom: 1.1rem;
}

.hero-title {
  font-size: clamp(2.35rem, 5.8vw, 3.65rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.hero-title-accent {
  color: var(--usps-blue);
  background: linear-gradient(105deg, var(--usps-blue) 0%, #1e4db7 55%, var(--usps-red) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 34rem;
  margin: 0 auto 1.85rem;
  line-height: 1.65;
}

@media (min-width: 900px) {
  .hero-sub { margin-left: 0; }
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}

@media (min-width: 900px) {
  .hero-ctas { justify-content: flex-start; }
}

.btn-hero-primary {
  background: linear-gradient(135deg, var(--usps-blue) 0%, #00246b 100%);
  color: #fff;
  border: none;
  box-shadow: 0 10px 28px rgba(0, 48, 135, 0.28);
  padding: 0.95rem 1.65rem;
  font-size: 1.05rem;
  border-radius: 0.9rem;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0, 48, 135, 0.34);
  filter: brightness(1.05);
  background: linear-gradient(135deg, #003a9e 0%, #001f5c 100%);
  color: #fff;
}
.btn-hero-primary:active { transform: scale(0.98); }

.btn-hero-secondary {
  background: #fff;
  color: var(--usps-blue);
  border: 1.5px solid #C7D2E8;
  padding: 0.95rem 1.65rem;
  font-size: 1.05rem;
  border-radius: 0.9rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.btn-hero-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--usps-blue);
  background: var(--usps-blue-soft);
  box-shadow: var(--shadow);
  color: var(--usps-blue);
}
.btn-hero-secondary:active { transform: scale(0.98); }

.hero-trust-line {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-light);
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.hero-trust-line span {
  margin: 0 0.35rem;
  color: #D1D5DB;
  font-weight: 400;
}

@keyframes heroVisualIn {
  from { opacity: 0; transform: translateY(18px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes heroCopyIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes truckFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes glowPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.06); }
}

@media (max-width: 640px) {
  .hero {
    min-height: auto;
    padding: calc(var(--nav-h) + 1.75rem) 0 2.75rem;
  }
  .hero-visual {
    min-height: clamp(200px, 52vw, 280px);
  }
  .hero-visual-card {
    aspect-ratio: 16 / 11;
  }
  .hero-ctas {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-hero-primary,
  .btn-hero-secondary {
    width: 100%;
    justify-content: center;
  }
}

/* Reduced motion: freeze on poster instead of looping video */
@media (prefers-reduced-motion: reduce) {
  .drive-video {
    display: none;
  }
  .hero-visual-card {
    background: url("assets/logo.gif") center center / contain no-repeat,
      linear-gradient(160deg, #FFFFFF 0%, #F8FAFC 100%);
    min-height: 200px;
  }
  .hero-visual,
  .hero-copy,
  .drive-video,
  .hero-visual-glow {
    animation: none !important;
  }
}

/* Legacy trust bar (used elsewhere if needed) */
.trust-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  padding: 1rem 1.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow);
  max-width: 720px;
  margin-inline: auto;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.trust-item strong { color: var(--text); font-weight: 700; }
.trust-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--usps-blue-soft);
  color: var(--usps-blue);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.trust-divider {
  width: 1px; height: 20px;
  background: var(--border);
  display: none;
}
@media (min-width: 640px) {
  .trust-divider { display: block; }
}

/* ---------- Sections ---------- */
.section { padding: 5rem 0; }
.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3rem;
}
.section-header-left {
  text-align: left;
  margin-left: 0;
  max-width: 700px;
}
.section-eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--usps-red);
  margin-bottom: 0.65rem;
}
.section-title {
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.85rem;
}
.section-lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

/* ---------- About / Steps ---------- */
.about { background: var(--bg); }
.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) {
  .steps-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 960px) {
  .steps-grid { grid-template-columns: repeat(4, 1fr); }
}

.step-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-2xl);
  padding: 1.75rem 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.step-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: #D1D5DB;
}
.step-icon {
  width: 48px; height: 48px;
  border-radius: 0.875rem;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--usps-blue);
  display: grid;
  place-items: center;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-sm);
}
.step-icon svg { width: 22px; height: 22px; }
.step-num {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.04em;
}
.step-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.step-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.safety-note {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  padding: 1.15rem 1.35rem;
  background: #FFF8F8;
  border: 1px solid #F5D0D4;
  border-radius: var(--radius);
  max-width: 820px;
  margin-inline: auto;
}
.safety-note svg {
  width: 22px; height: 22px;
  color: var(--usps-red);
  flex-shrink: 0;
  margin-top: 2px;
}
.safety-note p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}
.safety-note strong { color: var(--text); }

/* ---------- Official Regulations ---------- */
.regulations {
  background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  border-top: 1px solid var(--border-soft);
}

.card-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.6rem;
  margin-bottom: 1.75rem;
}

.regs-intro {
  display: flex;
  gap: 1.15rem;
  align-items: flex-start;
  max-width: 900px;
  margin-inline: auto;
  margin-bottom: 1.75rem;
}
.regs-intro-icon {
  width: 48px;
  height: 48px;
  border-radius: 0.875rem;
  background: var(--usps-blue-soft);
  color: var(--usps-blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border: 1px solid rgba(0, 48, 135, 0.1);
}
.regs-intro-icon svg { width: 22px; height: 22px; }
.regs-intro h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  letter-spacing: -0.01em;
}
.regs-intro p {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.6;
}
.regs-intro strong { color: var(--text); }

.regs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
}
@media (min-width: 700px) {
  .regs-grid { grid-template-columns: 1fr 1fr; }
}

.reg-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: 1.5rem 1.4rem;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}
.reg-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.reg-card-accent {
  background: linear-gradient(160deg, #F8FAFC 0%, #EEF3FB 100%);
  border-color: #C7D2E8;
}
.reg-card-num {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--usps-blue);
  background: var(--usps-blue-soft);
  padding: 0.3rem 0.6rem;
  border-radius: 0.4rem;
  margin-bottom: 0.85rem;
}
.reg-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 0.55rem;
  line-height: 1.3;
}
.reg-card > p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.75rem;
}
.reg-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 1.15rem;
}
.reg-list:not(.numbered) { list-style: disc; }
.reg-list.numbered { list-style: decimal; }
.reg-list li::marker { color: var(--usps-blue); font-weight: 600; }
.reg-list strong { color: var(--text); }
.reg-list a {
  color: var(--usps-blue);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.reg-list a:hover { color: var(--usps-red); }
.reg-note {
  margin-top: 0.85rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  background: var(--card);
  border-left: 3px solid var(--usps-red);
  padding: 0.65rem 0.85rem;
  border-radius: 0 0.5rem 0.5rem 0;
  line-height: 1.5;
}

/* ---------- Explore ---------- */
.explore { background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 40%); }

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: stretch;
}
.filter-group { flex: 1 1 160px; min-width: 0; }
.filter-search { flex: 2 1 220px; }

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-icon svg {
  position: absolute;
  left: 0.9rem;
  width: 18px; height: 18px;
  color: var(--text-light);
  pointer-events: none;
}
.input-with-icon input {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.6rem;
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-with-icon input:focus,
select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--usps-blue);
  box-shadow: 0 0 0 3px rgba(0, 48, 135, 0.12);
}

select, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], textarea {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236B7280' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2.4rem;
  cursor: pointer;
}
textarea { resize: vertical; min-height: 90px; }

.explore-layout {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  min-height: 520px;
}
@media (min-width: 960px) {
  .explore-layout {
    grid-template-columns: 1.22fr 1fr;
    height: 620px;
  }
}

.explore-loading {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-2xl);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.explore-loading[hidden] { display: none !important; }

.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #E5E7EB;
  border-top-color: var(--usps-blue);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}
.loading-spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.35rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.btn .btn-loading[hidden],
.btn .btn-label[hidden] { display: none !important; }
.btn.is-loading .btn-label { display: none !important; }
.btn.is-loading .btn-loading { display: inline-flex !important; align-items: center; }
.btn.is-loading { pointer-events: none; opacity: 0.9; }

.map-panel {
  border-radius: var(--radius-2xl);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  min-height: 360px;
  background: var(--card);
}
.map { width: 100%; height: 100%; min-height: 360px; }
@media (min-width: 960px) {
  .map-panel, .map { height: 100%; min-height: 0; }
}

/* Leaflet popup polish */
.leaflet-popup-content-wrapper {
  border-radius: 1rem !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-content {
  margin: 0 !important;
  min-width: 240px;
}
.leaflet-popup-tip { box-shadow: none !important; }
.leaflet-container a.leaflet-popup-close-button {
  color: var(--text-muted) !important;
  font-size: 20px !important;
  padding: 8px 10px !important;
  top: 4px !important;
  right: 4px !important;
}

.popup-card { padding: 1.1rem 1.15rem 1.15rem; }
.popup-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  padding-right: 1.5rem;
  letter-spacing: -0.01em;
}
.popup-meta {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.popup-meta strong { color: var(--text); font-weight: 600; }
.popup-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--card);
  padding: 0.55rem 0.7rem;
  border-radius: 0.5rem;
  margin-bottom: 0.85rem;
  line-height: 1.45;
  font-style: italic;
}
.popup-card .btn { width: 100%; font-size: 0.875rem; }
.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Custom map markers */
.swap-marker {
  background: transparent !important;
  border: none !important;
}
.marker-pin {
  width: 36px; height: 36px;
  background: var(--usps-blue);
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 10px rgba(0, 48, 135, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s var(--ease), background 0.2s;
}
.marker-pin::after {
  content: "";
  width: 10px; height: 10px;
  background: #fff;
  border-radius: 50%;
  transform: rotate(45deg);
}
.marker-pin.highlight {
  background: var(--usps-red);
  transform: rotate(-45deg) scale(1.15);
  box-shadow: 0 4px 14px rgba(178, 34, 52, 0.4);
}

/* List panel */
.list-panel {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 360px;
}
@media (min-width: 960px) {
  .list-panel { min-height: 0; height: 100%; }
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}
.list-header h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.list-count {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--usps-blue);
  background: var(--usps-blue-soft);
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.swap-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
}
.swap-list:focus { outline: none; }

.swap-card {
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition), background var(--transition);
  cursor: pointer;
}
.swap-card:hover, .swap-card.active {
  border-color: #A5B8E0;
  box-shadow: var(--shadow);
  background: #fff;
}
.swap-card.active {
  border-color: var(--usps-blue);
  box-shadow: 0 0 0 3px rgba(0, 48, 135, 0.1);
}
.swap-card.mine {
  border-color: rgba(178, 34, 52, 0.35);
  background: linear-gradient(135deg, #FFFAFA, #F8FAFC);
}
.swap-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.swap-route {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
}
.swap-route .arrow {
  color: var(--usps-red);
  margin: 0 0.25rem;
  font-weight: 600;
}
.swap-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.5rem;
  border-radius: 0.4rem;
  background: var(--usps-blue-soft);
  color: var(--usps-blue);
}
.swap-badge.temp { background: #FEF3C7; color: #92400E; }
.swap-badge.either { background: #EDE9FE; color: #5B21B6; }

.swap-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}
.swap-meta span { display: inline-flex; align-items: center; gap: 0.3rem; }
.swap-privacy {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.swap-privacy::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}
.swap-card .btn { width: 100%; font-size: 0.875rem; }
.swap-card-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Share button — friendly, truck + label */
.btn-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--usps-blue);
  background: #fff;
  border: 1.5px solid #B22234;
  box-shadow: 0 2px 8px rgba(178, 34, 52, 0.08);
  transition: background var(--transition), border-color var(--transition),
    transform var(--transition), box-shadow var(--transition), color var(--transition);
  cursor: pointer;
}
.btn-share:hover {
  background: #FFF5F6;
  border-color: var(--usps-red);
  color: var(--usps-red);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(178, 34, 52, 0.14);
}
.btn-share:active { transform: scale(0.98); }
.share-truck-icon {
  width: 28px;
  height: 20px;
  flex-shrink: 0;
}
.share-nudge {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
  text-align: center;
  line-height: 1.4;
}

/* Share modal */
.modal-share {
  width: min(480px, calc(100% - 1.5rem));
}
.share-body {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.share-hint {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, #F5F8FF 0%, #FFF8F8 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.share-hint-icon {
  flex-shrink: 0;
  width: 40px;
  display: flex;
  align-items: center;
}
.share-hint-icon svg {
  width: 40px;
  height: 28px;
}
.share-hint p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.share-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.share-message {
  width: 100%;
  min-height: 110px;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  background: var(--card);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
  resize: vertical;
  font-family: var(--font);
}
.share-message:focus {
  outline: none;
  border-color: var(--usps-blue);
  box-shadow: 0 0 0 3px rgba(0, 48, 135, 0.12);
  background: #fff;
}
.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
@media (max-width: 420px) {
  .share-actions { grid-template-columns: 1fr; }
}
.share-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.8125rem;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
    color var(--transition), transform var(--transition);
  text-align: center;
  line-height: 1.25;
}
.share-action-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.share-action-btn:hover {
  transform: translateY(-1px);
}
.share-action-btn:active { transform: scale(0.98); }
.share-copy {
  border-color: #A5B8E0;
  color: var(--usps-blue);
  background: var(--usps-blue-soft);
}
.share-copy:hover {
  border-color: var(--usps-blue);
  background: #dce8fc;
}
.share-link {
  border-color: #F5C2C8;
  color: var(--usps-red);
  background: #FFF8F8;
}
.share-link:hover {
  border-color: var(--usps-red);
  background: #FEECEE;
}
.share-email:hover,
.share-group:hover {
  border-color: #A5B8E0;
  background: var(--card);
  color: var(--usps-blue);
}
.share-foot {
  min-height: 1.25rem;
  font-size: 0.8rem;
  color: var(--usps-blue);
  font-weight: 600;
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}
.empty-state p { margin-top: 0.5rem; font-size: 0.9rem; }

/* ---------- CTA strip ---------- */
.cta-strip {
  background: linear-gradient(135deg, var(--usps-blue) 0%, #001f5c 100%);
  padding: 3.5rem 0;
  color: #fff;
}
.cta-strip-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.cta-strip h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.cta-strip p { color: rgba(255,255,255,0.8); font-size: 1rem; }

/* ---------- Footer ---------- */
.footer {
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.footer-inner {
  display: grid;
  gap: 1.5rem;
}
.footer-brand p {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 280px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}
.footer-links a:hover, .footer-links .link-btn:hover { color: var(--usps-blue); }
.footer-copy {
  font-size: 0.8rem;
  color: var(--text-light);
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}
.modal-overlay[hidden] { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2001;
  width: min(520px, calc(100% - 1.5rem));
  max-height: min(90vh, 800px);
  background: #fff;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modalIn 0.3s var(--ease);
  overflow: hidden;
}
.modal[hidden] { display: none; }
.modal-sm { width: min(420px, calc(100% - 1.5rem)); }
.modal-chat { width: min(440px, calc(100% - 1.5rem)); height: min(560px, 90vh); }

@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%, -48%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.modal-sub {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.modal-close {
  width: 36px; height: 36px;
  border-radius: 0.625rem;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.modal-close:hover { background: var(--card); color: var(--text); }

.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* Forms */
.form { display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: flex; flex-direction: column; gap: 0.4rem; }
.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 480px) {
  .form-row.two-col { grid-template-columns: 1fr 1fr; }
}
.form-row label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.label-hint {
  font-weight: 400;
  color: var(--text-light);
  font-size: 0.8rem;
}
.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.input-row input { flex: 1; min-width: 0; }
.input-row .btn { flex-shrink: 0; }

.radio-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.radio-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.5rem;
  border: 1.5px solid var(--border);
  border-radius: 0.75rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  text-align: center;
}
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card:has(input:checked) {
  border-color: var(--usps-blue);
  background: var(--usps-blue-soft);
  color: var(--usps-blue);
}
.radio-card:hover { border-color: #A5B8E0; }

.divider-or {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-light);
  font-size: 0.8rem;
  font-weight: 500;
}
.divider-or::before, .divider-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.form-footer {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* Chat */
.chat-header { align-items: center; }
.chat-peer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
}
.chat-msg {
  max-width: 85%;
  padding: 0.7rem 0.95rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  animation: msgIn 0.25s var(--ease);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.them {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 0.3rem;
  color: var(--text);
}
.chat-msg.me {
  align-self: flex-end;
  background: var(--usps-blue);
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}
.chat-msg .msg-time {
  display: block;
  font-size: 0.68rem;
  opacity: 0.65;
  margin-top: 0.3rem;
}
.chat-compose {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
  background: #fff;
  flex-shrink: 0;
}
.chat-compose input {
  flex: 1;
  border-radius: 999px;
  padding: 0.7rem 1.1rem;
}
.chat-compose .btn { border-radius: 999px; padding-inline: 1.25rem; }

/* My swaps list in modal */
.my-swap-item {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: var(--card);
}
.my-swap-item h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.35rem; }
.my-swap-item p { font-size: 0.85rem; color: var(--text-muted); }
.my-swaps-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

/* ---------- Profile modal ---------- */
.modal-profile {
  width: min(560px, calc(100% - 1.5rem));
  max-height: min(92vh, 860px);
}
.profile-body {
  padding-top: 1rem;
}
.profile-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 0 1.25rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}
.profile-identity h3 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.profile-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}
.profile-section {
  margin-bottom: 0.25rem;
  padding-bottom: 1.15rem;
  border-bottom: 1px solid var(--border-soft);
}
.profile-section:last-of-type { border-bottom: none; }
.profile-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--usps-blue);
  margin-bottom: 0.75rem;
}
.profile-section-lead {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: -0.35rem 0 1rem;
  line-height: 1.5;
}
.field-hint {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-top: 0.35rem;
  line-height: 1.4;
}

.notify-master {
  margin-bottom: 0.65rem;
}
.master-toggle {
  background: var(--usps-blue-soft) !important;
  border-color: rgba(0, 48, 135, 0.15) !important;
}

.notify-options {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: opacity var(--transition);
}
.notify-options.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.toggle-row:hover {
  border-color: #C7D2E8;
  background: #fff;
}
.toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.toggle-copy strong {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.toggle-copy span {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.toggle-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  background: #D1D5DB;
  border-radius: 999px;
  transition: background var(--transition);
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform var(--transition);
}
.toggle-input:checked + .toggle-switch {
  background: var(--usps-blue);
}
.toggle-input:checked + .toggle-switch::after {
  transform: translateX(20px);
}
.toggle-input:focus-visible + .toggle-switch {
  box-shadow: 0 0 0 3px rgba(0, 48, 135, 0.2);
}

.notify-preview {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.notify-preview.email-off {
  background: #FFF8F8;
  border-color: #F5D0D4;
}
.notify-preview-icon {
  font-size: 1rem;
  line-height: 1.3;
}
.notify-preview strong { color: var(--text); }

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.profile-secondary-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

/* ---------- Quick Post FAB (mobile) ---------- */
.fab-quick-post {
  position: fixed;
  right: 1rem;
  bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 56px;
  padding: 0 1.15rem 0 0.7rem;
  border: none;
  border-radius: 999px;
  background: var(--usps-blue);
  color: #fff;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  box-shadow:
    0 8px 24px rgba(0, 48, 135, 0.35),
    0 2px 6px rgba(0, 48, 135, 0.2);
  cursor: pointer;
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    background 0.2s var(--ease),
    opacity 0.2s var(--ease);
  -webkit-tap-highlight-color: transparent;
  animation: fabIn 0.45s var(--ease) 0.4s both;
}

.fab-quick-post:hover {
  background: var(--usps-blue-hover);
  box-shadow:
    0 12px 28px rgba(0, 48, 135, 0.4),
    0 4px 10px rgba(0, 48, 135, 0.22);
  transform: translateY(-2px);
}

.fab-quick-post:active {
  transform: scale(0.96);
}

.fab-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.fab-icon svg {
  width: 24px;
  height: 24px;
}

.fab-label {
  padding-right: 0.35rem;
  white-space: nowrap;
}

/* Hide while any modal is open so it doesn’t cover the form */
body.modal-open .fab-quick-post {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.9) translateY(8px);
}

@keyframes fabIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Desktop already has Post in the nav — hide FAB */
@media (min-width: 900px) {
  .fab-quick-post {
    display: none;
  }
}

/* Compact icon-only on very small screens (optional polish) */
@media (max-width: 360px) {
  .fab-quick-post {
    width: 60px;
    height: 60px;
    min-height: 60px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }
  .fab-icon {
    width: 100%;
    height: 100%;
    background: transparent;
  }
  .fab-icon svg {
    width: 28px;
    height: 28px;
  }
  .fab-label {
    display: none;
  }
}

/* ---------- Toasts ---------- */
.toast-container {
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  right: 1rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 360px;
  animation: toastIn 0.35s var(--ease);
}
.toast.out { animation: toastOut 0.3s var(--ease) forwards; }
.toast-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #DCFCE7;
  color: #166534;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
}
.toast-body strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.toast-body p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}

/* Success pulse on new card */
@keyframes cardPulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 48, 135, 0.35); }
  70% { box-shadow: 0 0 0 12px rgba(0, 48, 135, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 48, 135, 0); }
}
.swap-card.just-added {
  animation: cardPulse 1.2s var(--ease);
  border-color: var(--usps-blue);
  background: #fff;
}

/* Body lock when modal open */
body.modal-open { overflow: hidden; }
