:root {
  --primary: #6b21a8; /* Burple primary */
  --secondary: #a855f7; /* Burple secondary */
  --background: #ffffff; /* Page background: white */
  --success: #28a745;
  --success-hover: #218838;
  --warning: #ffc107;
  --warning-hover: #e0a800;
  --danger: #dc3545;
  --danger-hover: #c82333;
  /* authoritative footer height — used by both the fixed footer and page padding.
     Default (mobile) is the comfortable height; desktop overrides to a smaller value. */
  --auth-footer-height: 76px;
  /* topbar/app-header height (used to center content between header and footer) */
  --topbar-height: 72px;
  --topbar-compact-height: 48px;
  --topbar-gap: 2px;
}

/* ------------------------
   Auth layout — mobile keyboard adjustments
   ------------------------ */

/* Remove visual border around the link bar (link-bar wrapper) */
.auth-links-wrapper {
  border: none;
  box-shadow: none;
  background: transparent;
}

/* Make nav height transitions smooth and explicit */
nav.auth-nav {
  transition: height 180ms ease;
  overflow: visible;
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: block;
  height: var(--topbar-height);
  box-sizing: border-box;
}

body.keyboard-open nav.auth-nav {
  height: var(--topbar-compact-height);
}

nav.auth-nav .nav-inner {
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between; /* logo left, contact right */
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 10px 1rem;              /* left/right gutters */
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  max-width: none;                 /* span full width; don't center */
  margin: 0;
}

/* Desktop header links (mobile hidden by default) */
.header-links-desktop {
  display: none;
  gap: 1rem;
  align-items: center;
  font-weight: 600;
}

/* Mobile About icon: shown only on small screens */
.mobile-about-btn {
  display: none;
  background: transparent;
  border: none;
  padding: 6px;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 18px;
}

@media (min-width: 641px) {
  .header-links-desktop {
    display: flex;
  }
  /* Hide the mobile bottom links on desktop if present */
  .auth-links-bottom {
    display: none;
  }
}

@media (max-width: 640px) {
  .mobile-about-btn {
    display: inline-flex;
  }
}

/* Mobile (tighten vertical spacing so auth card fits between header & footer)
   Avoid large top spacer + large center area + large paddings which cause big gaps. */
@media (max-width: 640px) {
  /* Make the top spacer only the small gap (we already account for the header with the fixed nav) */
  .auth-top-spacer {
    height: var(--topbar-gap);
  }

  /* Reduce page main padding so top/bottom breathing room is smaller on mobile (AUTH PAGES ONLY) */
  .auth-page main, .auth-page .site-main {
    padding-left: 8px;
    padding-right: 8px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  /* Smaller card paddings and tighter max-height so it fills available space (AUTH PAGES ONLY) */
  .auth-page .auth-card {
    padding: 12px;
    border-radius: 8px;
    max-height: calc(100vh - var(--topbar-height) - var(--auth-footer-height) - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Small minimum gap so the card doesn't visually tuck under the fixed header
       on devices with rounding/safe-area differences. */
    margin-top: 1px;
  }

  /* Make middle area use the remaining viewport space but not larger (AUTH PAGES ONLY) */
  .auth-page .auth-middle {
    min-height: calc(100vh - var(--topbar-height) - var(--auth-footer-height) - var(--topbar-gap) - env(safe-area-inset-bottom));
    padding-left: 6px;
    padding-right: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
    align-items: center;
    justify-content: center;
  }

  /* Reduce legal disclaimer spacing so it sits closer under the card (AUTH PAGES ONLY) */
  .auth-page .auth-page-legal {
    margin-top: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  /* Reduce header mobile linkbar interference: keep auth-links-bottom compact (AUTH PAGES ONLY) */
  .auth-page .auth-links-bottom {
    padding: 6px 0;
    gap: 0.75rem;
  }
}

/* Ensure left/right containers behave as edge-aligned groups */
.nav-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Contact icon styling */
.auth-contact-btn {
  background: transparent;
  border: none;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.auth-contact-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

/* Ensure auth page root is a reference for sticky bottom row */
.auth-page-root {
  position: relative;
}

/* Bottom row inside auth container: sticky above footer */
.auth-links-bottom {
  position: sticky;
  bottom: calc(var(--auth-footer-height) + env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  padding: 10px 0;
  background: transparent;
  z-index: 3;
}
.auth-links-bottom .auth-link {
  color: #6b7280;
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}
.auth-links-bottom .auth-link:hover {
  color: #111827;
}

/* Default: mobile linkbar layout (desktop media queries still apply as before) */
nav.auth-nav .auth-links-mobile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.auth-top-spacer {
  margin: 0;
  height: var(--topbar-gap);
  transition: height 160ms ease;
  box-sizing: border-box;
  width: 100%;
}

nav.auth-nav + .auth-top-spacer {
  height: calc(var(--topbar-height) + var(--topbar-gap));
}

body.keyboard-open nav.auth-nav + .auth-top-spacer {
  height: calc(var(--topbar-compact-height) + var(--topbar-gap));
}

/* -------------------------
   Partner/footer: shrink-to-content, consistent logo sizing
   Footer will size to: label + logo + buffer. Child elements do not
   use `height: 100%` so they won't be forced to expand a large container.
   ------------------------- */
.auth-fixed-footer {
  /* Fixed footer: authoritative fixed height so all pages reserve the same space */
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--auth-footer-height);
  min-height: var(--auth-footer-height);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  /* reduced breathing room to fit the smaller footer height */
  padding-top: 4px;
  /* include safe-area bottom inset to avoid clipping on iOS */
  padding-bottom: calc(4px + env(safe-area-inset-bottom));
  /* opaque background so content underneath is visually hidden when footer overlays it */
  background: var(--background, #ffffff);
  /* subtle separation from page above so footer reads as a solid bar */
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 -4px 8px rgba(2,6,23,0.03);
  z-index: 10;
  transition: transform 160ms ease, opacity 160ms ease;
}

.auth-fixed-footer .page-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  box-sizing: border-box;
}

/* child containers must not force 100% height of parent */
.auth-fixed-footer .footer-left,
.auth-fixed-footer .footer-right,
.auth-fixed-footer .footer-center,
.auth-fixed-footer .partner-artwork {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  box-sizing: border-box;
}

.auth-fixed-footer .partner-image {
  display: block;
  width: auto;
  height: auto;
  /* allow label + paddings + small buffer — reduce image max-height so footer stays stable
     (derived from the reduced footer height) */
  max-height: calc(var(--auth-footer-height) - 12px);
  object-fit: contain;
  -webkit-user-drag: none;
  margin: 0 auto;
}

/* label and spacing */
.auth-fixed-footer .partner-label {
  font-size: 12px;
  line-height: 1;
  color: #6b7280; /* gray-500 */
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.01em;
  margin: 0 0 6px 0; /* label spacing below to logo */
  padding: 0;
}

/* Ensure footer-center always stacks vertically (label above graphic).
   This selector is deliberately specific so it overrides .page-container's row layout. */
.auth-fixed-footer .page-container .footer-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: auto;
  box-sizing: border-box;
}

/* Mobile: enforce 50vw width for the image using a specific selector,
   and centre it; keep a vertical max-height so it never overflows. */
@media (max-width: 640px) {
  /* mobile: keep width at 50vw but cap vertical size so footer height is predictable */
  .auth-fixed-footer .page-container .footer-center .partner-image {
    display: block;
    width: 50vw;
    max-width: 50vw;
    height: auto;
    max-height: calc(var(--auth-footer-height) - 12px);
    object-fit: contain;
    margin: 0 auto;
  }
  .auth-fixed-footer { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
}

/* Additional mobile overrides to remove duplicate vertical reservation and tighten spacing
   so the auth-card fits between header & footer without unnecessary page scroll. */
@media (max-width: 640px) {
  /* Make the top spacer minimal (avoid double-reserving header height) */
  nav.auth-nav + .auth-top-spacer {
    height: var(--topbar-gap);
  }
  body.keyboard-open nav.auth-nav + .auth-top-spacer {
    height: var(--topbar-gap);
  }

  /* Reduce page main padding so top/bottom breathing room is smaller on mobile.
     Ensure the main content begins below the fixed header by using the measured
     --topbar-height (keeps auth card from sliding under the nav). */
  main, .site-main {
    padding-left: 8px;
    padding-right: 8px;
    padding-top: calc(var(--topbar-height, 72px));
    padding-bottom: 6px;
    box-sizing: border-box;
  }

  /* Do not force a large min-height on the middle region; let the main/container flex handle centering.
     This prevents stacked reservation of vertical space (spacer + middle min-height). */
  .auth-middle {
    min-height: auto !important;
    padding-left: 6px;
    padding-right: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
    align-items: center;
    justify-content: center;
  }

  /* Smaller card paddings and tighter max-height so it fills available space */
  .auth-card {
    padding: 12px;
    border-radius: 8px;
    max-height: calc(100vh - var(--topbar-height) - var(--auth-footer-height) - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    /* Small minimum gap so the card doesn't visually tuck under the fixed header
       on devices with rounding/safe-area differences. */
    margin-top: 1px;
  }

  /* Reduce legal disclaimer spacing so it sits closer under the card */
  .auth-page-legal {
    margin-top: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  /* Slightly smaller linkbar bottom padding so it doesn't add too much vertical space */
  .auth-links-bottom {
    padding: 6px 0;
    gap: 0.75rem;
  }
}

/* Desktop: keep vertical constraint but allow width to be natural */
@media (min-width: 641px) {
  /* Desktop override: halve the footer height vs mobile so desktop footer is compact */
  :root {
    --auth-footer-height: 38px;
  }

  /* Desktop: compact footer and single-row center area (label + graphic inline) */
  .auth-fixed-footer {
    min-height: var(--auth-footer-height);
    height: var(--auth-footer-height);
    padding-top: 6px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
  }

  /* Layout the center area as a single row on desktop, centered horizontally */
  .auth-fixed-footer .page-container .footer-center {
    display: flex;
    flex-direction: row;       /* label and artwork side-by-side */
    gap: 12px;                /* breathing between label and artwork */
    align-items: center;      /* vertical alignment of label and artwork */
    justify-content: center;
    height: auto;
    box-sizing: border-box;
    padding: 0;
  }

  /* Label tweaks for desktop so it sits nicely to the left of the artwork */
  .auth-fixed-footer .partner-label {
    margin: 0;                /* remove bottom margin used in stacked layout */
    padding: 0;
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;      /* keep label on a single line */
  }

  /* Ensure partner artwork fits in the compact desktop footer */
  .auth-fixed-footer .partner-image {
    width: auto;
    max-width: none;
    /* ensure partner image fits the compact desktop footer */
    max-height: calc(var(--auth-footer-height) - 10px); /* small inner padding */
    height: auto;
    object-fit: contain;
    margin: 0;
  }
}
/* Make sure the legal disclaimer above the footer doesn't add extra bottom margin */
.auth-page-legal {
  margin-bottom: 0;
  padding-bottom: 0;
}

.auth-page {
  padding-bottom: calc(var(--auth-footer-height) + env(safe-area-inset-bottom));
}

/* Middle region: not a nested scroll container — page handles scrolling.
   min-height ensures the center area fills the visible region between header & footer. */
.auth-middle {
  width: 100%;
  /* Reserve at least the visible region between header and footer.
     Default (keyboard closed) subtracts full footer; when keyboard opens we use compact topbar. */
  min-height: calc(100vh - var(--topbar-height) - var(--auth-footer-height) - var(--topbar-gap) - env(safe-area-inset-bottom));
  margin-top: 0;
  display: flex;
  align-items: center;       /* vertical centering when card fits */
  justify-content: center;   /* horizontal centering */
  box-sizing: border-box;
  padding-left: 8px;
  padding-right: 8px;
  overflow: visible;         /* let page/body scroll, not this element */
  transition: min-height 160ms ease;
}

/* When keyboard opens (compact header), reduce the header subtraction and also
   avoid subtracting the footer (footer is hidden in keyboard-open). */
body.keyboard-open .auth-middle {
  min-height: calc(100vh - var(--topbar-compact-height) - var(--topbar-gap) - env(safe-area-inset-bottom));
}

/* When card is taller than available space, top-align so user can scroll to inputs */
.auth-middle--top-align {
  align-items: flex-start;
  padding-top: 12px;
}

/* Ensure main content never uses negative margin that would let content slide under the navbar */
main {
  /* ensure we keep the content below the nav even if some pages omit the spacer */
  padding-top: 0;
}


body {
  background-color: var(--background);
  font-family: "Arial", sans-serif;
}

/* --------------------------------------------------------------
   Auth card height control: keep auth-card between header & footer
   -------------------------------------------------------------- */
/* Use existing variables defined earlier: --topbar-height and --auth-footer-height.
   Fallback to sensible values already defined in :root above. */
.auth-card {
  /* Ensure the card never forces the page to exceed the viewport:
     subtract header + footer heights plus a small gap for breathing room. */
  max-height: calc(100vh - var(--topbar-height, 72px) - var(--auth-footer-height, 76px) - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS */
  /* keep existing card visual styles (padding, border radius retained by author) */
}

/* Small screens: reduce padding so the card fits better */
@media (max-height: 640px), (max-width: 420px) {
  .auth-card {
    padding: 16px;
    border-radius: 8px;
  }
  .site-main { padding: 10px; }
}

.navbar {
  background-color: #fff;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
  color: var(--primary);
  font-weight: bold;
  font-size: 1.5rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.btn-secondary {
  background-color: var(--secondary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.btn-disabled {
  background-color: #d1d5db;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  cursor: not-allowed;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.invalid {
  border-color: #ef4444;
}

.valid {
  border-color: var(--secondary);
}

#error-message,
#success-message {
  display: block;
}

/* Profile-specific styles */
.profile-container {
  max-width: 600px;
  width: 100%;
  background-color: #fff;
  padding: 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.profile-form input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.2s ease-in-out;
}

.profile-form input:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.profile-form select {
  width: 100%;
  padding: 0.75rem;
  padding-right: 2.5rem; /* Space for the icon */
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.2s ease-in-out;
  appearance: none; /* Removes default styling in some browsers */
  background-color: #fff;
}

.select-icon {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: #6b21a8; /* Match the primary color or any color you prefer */
  pointer-events: none; /* Prevents the icon from interfering with select interaction */
}

.profile-form select:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2);
}

.profile-form option {
  padding: 0.75rem;
  font-size: 1rem;
}

.profile-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 0.5rem;
}

.bg-primary {
  background-color: var(--primary);
}

.bg-secondary {
  background-color: var(--secondary);
}

.list-group.list-group-horizontal {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}

.list-group.list-group-horizontal .list-group-item {
  flex-basis: 100%;
  margin-bottom: 10px;
}

@media (min-width: 576px) {
  .list-group.list-group-horizontal .list-group-item {
    flex-basis: calc(50% - 10px);
  }
}

@media (min-width: 768px) {
  .list-group.list-group-horizontal .list-group-item {
    flex-basis: calc(33.33% - 10px);
  }
}

.last-updated-row {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  padding: 10px;
  margin-top: 20px;
}

.custom-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.custom-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 5px 5px 0 0;
}

.custom-tab.active {
    background-color: #f0f0f0;
    border: 1px solid green;
}

.tab-content {
    display: none;
    padding: 10px;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 5px 5px;
}

.tab-content.active {
    display: block;
}

.disabled-row {
  background-color: #f2f2f2; /* Light gray background for the entire row */
}

.disabled-row td {
  color: #888; /* Gray out the text in all cells */
}

.disabled-row button.disabled {
    background-color: #ccc; /* Light gray background for disabled buttons */
    color: #888; /* Gray out the text on buttons */
    cursor: not-allowed; /* Change cursor to not-allowed */
}

.disabled-row button.disabled:hover {
    background-color: #ccc; /* Keep background color on hover for disabled buttons */
}

.position-updated-time {
  background-color: #f8f9fa;
  padding: 10px;
  border-radius: 10px;
  margin-top: 20px;
}

.position-updated-time p {
  margin: 0;
}

.fixed-w {
    width: 100px; /* Set fixed width for both header cells and data cells */
}

.btn {
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.btn-success {
  background-color: var(--success);
}
.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-warning {
  background-color: var(--warning);
  color: black;
}
.btn-warning:hover {
  background-color: var(--warning-hover);
}

.btn-danger {
  background-color: var(--danger);
}
.btn-danger:hover {
  background-color: var(--danger-hover);
}

/* Desktop actions: visible on sm+ and never shrink */
.desktop-actions { display: none; }

@media (min-width: 640px) { /* Tailwind 'sm' */
  .desktop-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    /* Prevent shrinking so actions always get space */
    flex-shrink: 0;
    /* Ensure there is room for two buttons */
    min-width: 140px;
  }

  /* Keep buttons on one line */
  .desktop-actions .set-target-btn,
  .desktop-actions .close-btn {
    white-space: nowrap;
  }
}

/* Responsive site logo: scales with viewport but always fits nav */
.site-logo {
  display: block;
  width: auto;
  /* base mobile height */
  height: 28px;
  max-height: 36px; /* absolute cap to avoid increasing nav */
  object-fit: contain;
  -webkit-user-drag: none;
}

/* Small screens / sm and up (Tailwind sm = 640px) */
@media (min-width: 640px) {
  .site-logo {
    height: 32px;
    max-height: 40px;
  }
}

/* Large screens / lg and up (Tailwind lg = 1024px) */
@media (min-width: 1024px) {
  .site-logo {
    height: 36px;
    max-height: 44px;
  }
}

/* Extra safety: never let the logo's box force nav height.
   If your nav uses align-items: center this keeps the logo centered. */
nav .site-logo {
  line-height: 1;
  vertical-align: middle;
}

:root {
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --text-title: 1rem;
  --text-sm: 0.875rem;
  --text-muted: #6b7280;
  --text-heading: #111827;
  --tracking-tight: -0.01em;
  --leading-tight: 1.4;
}

body {
  font-family: var(--font-sans);
}

.card-title {
  font-family: var(--font-sans);
  font-size: var(--text-title);
  font-weight: 600;
  color: var(--text-heading);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

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

.page-container {
  width: 100%;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  box-sizing: border-box;
}

.legal-footer {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* Footer links in auth card: be responsive and fit the card */
.footer-links {
  display: flex;
  gap: 0.5rem;                 /* small visual gap between items */
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;             /* allow wrap if space is tight */
  font-size: 0.875rem;         /* 14px */
  color: var(--text-muted);
  width: 100%;
  box-sizing: border-box;
  padding: 0 0.25rem;          /* slight side padding so separators don't touch card edge */
}
.footer-links a { color: var(--text-muted); text-decoration: none; }
.footer-links a:hover, .footer-links a:focus { text-decoration: underline; color: var(--primary); }
.footer-links .separator { color: var(--text-muted); padding: 0 0.25rem; }

/* --- Mobile-friendly auth header and keyboard-open state (override, loaded last) --- */
@media (max-width: 640px) {
  /* Keep mobile linkbar in flow (not absolute bottom). */
  nav.auth-nav .auth-links-mobile {
    position: static;
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border-top: none;
    box-shadow: none;
    background: transparent;
    z-index: 5;
    transition: opacity 160ms ease, height 160ms ease, transform 160ms ease;
    overflow: hidden;
    box-sizing: border-box;
  }

  /* ensure smooth transitions */
  nav.auth-nav .auth-links-mobile,
  .auth-fixed-footer {
    transition: opacity 160ms ease, height 160ms ease, transform 160ms ease;
  }

  /* spacer between header and content on auth pages (default: mt-6).
     Collapse this spacer when the on-screen keyboard is open so login card
     hugs the header (no gap). Use a specific selector that overrides Tailwind's .mt-6. */
  .auth-top-spacer {
    transition: margin-top 160ms ease, height 160ms ease, padding 160ms ease;
    box-sizing: border-box;
  }

  /* When keyboard opens, collapse the spacer so the login card sits flush under the header */
  body.keyboard-open .auth-top-spacer {
    margin-top: 0;
    padding: 0;
    visibility: hidden;
    overflow: hidden;
  }
}

/* Password toggle button inside inputs */
.pw-toggle {
  background: transparent;
  border: none;
  color: var(--primary);
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
}
.pw-toggle:focus { outline: 2px solid rgba(99,102,241,0.25); border-radius: 4px; }

/* Auth page legal disclaimer (in page flow) */
.auth-page-footer,
.auth-page-legal {
  margin-top: 20px;
  text-align: center;
  padding: 0 0.5rem;
}
.auth-page-footer .legal-disclaimer,
.auth-page-legal .legal-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px auto;
  max-width: 36rem; /* keeps line-length sensible */
  line-height: 1.25;
}

/* small accessible eye icon sizing */
.pw-toggle .icon { display:inline-block; vertical-align: middle; width:20px; height:20px; }

/* phone row: country code + phone input */
.phone-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}
.country-select {
  width: 84px;
  min-width: 72px;
  padding: 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: #fff;
  font-size: 0.95rem;
  appearance: none;
}
.country-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(168,85,247,0.12);
  border-color: var(--secondary);
}
.phone-input {
  flex: 1 1 auto;
}
.phone-inline {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}
.phone-inline .country-select-inline {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 72px;
  min-width: 60px;
  height: 34px;
  padding: 4px 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 6px;
  font-size: 0.95rem;
  z-index: 2;
}
.phone-inline .country-select-inline:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(168,85,247,0.12);
  border-color: var(--secondary);
}
.phone-inline .phone-input {
  padding-left: 90px;
  box-sizing: border-box;
}
@media (max-width: 420px) {
  .phone-inline .country-select-inline {
    width: 64px;
    min-width: 56px;
    height: 34px;
  }
  .phone-inline .phone-input {
    padding-left: 80px;
  }
}
/* Hamburger + Side menu styles */
.hamburger-btn {
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

#side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85%;
  height: 100%;
  background: #ffffff;
  box-shadow: -12px 0 30px rgba(0,0,0,0.12);
  transform: translateX(100%);
  transition: transform 0.26s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

#side-menu.open {
  transform: translateX(0);
}

.side-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 55;
  display: none;
}
.side-menu-overlay.open { display: block; }

.side-menu-header {
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 16px;
  border-bottom: 1px solid #eef2f6;
}
.side-menu-title { font-weight:600; color:#111827; }
.side-menu-close {
  background:transparent;
  border:none;
  font-size:20px;
  line-height:1;
  cursor:pointer;
}
.side-menu-list { padding:12px 6px; list-style:none; margin:0; overflow:auto; }
.menu-link {
  display:block;
  padding:12px 14px;
  color:#111827;
  text-decoration:none;
  border-radius:6px;
}
.menu-link:hover, .menu-button:hover { background:#f3f4f6; }
.menu-button {
  background:transparent;
  border:none;
  width:100%;
  text-align:left;
  padding:0;
  font:inherit;
  cursor:pointer;
  color:inherit;
}

/* small screens: align the existing page-container padding so menu doesn't clash */
@media (max-width:640px){
  #side-menu { width: 84%; }
}

/* Partner trust footer — shared with post-login */
.partner-footer {
  background: #ffffff;
  border-top: 1px solid #ECEDEF;
  padding: 12px 0 20px;
}

.partner-footer .partner-label {
  font-size: 13px;
  color: #6B7280;
  margin: 6px 0 10px;
  font-weight: 500;
  text-align: center;
}

/* Slight size adjustments on small viewports */
@media (max-width: 420px) {
  .partner-footer .partner-label { font-size: 12px; }
}

/* Make partner image width equal to 80% of CTA/content width and preserve aspect ratio */
.partner-footer .partner-image {
  width: 80%;
  max-width: 80%;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
  object-fit: contain;
  box-sizing: border-box;
}

/* If an earlier rule set explicit height, this ensures width-driven sizing wins */
.partner-footer .partner-image[style] { height: auto !important; max-height: none !important; }

/* Small-screen safety: do not let image become tiny */
@media (max-width: 360px) {
  .partner-footer .partner-image {
    width: 80%;
    max-width: 80%;
    min-width: 140px; /* ensure visible artwork */
  }
}

/* Keep partner-artwork centered and with a little vertical breathing room */
.partner-artwork {
  display:flex;
  justify-content:center;
  align-items:center;
  margin-top:8px;
  margin-bottom:8px;
}


/* ---------- Auth header links (desktop right, mobile full-width below logo) ---------- */
nav.auth-nav .auth-links-wrapper.page-container {
  max-width: 100%;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  width: 100%;
}

/* Default icon sizing (desktop) */
.auth-contact-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
}

/* Slightly larger icon on high-density displays if you provide a 2x asset */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .auth-contact-icon {
    width: 28px;
    height: 28px;
  }
}

/* Desktop layout: show .auth-links-desktop, hide mobile row */
@media (min-width: 641px) {
  nav.auth-nav .auth-links-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
  }

  nav.auth-nav .auth-links-desktop {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
  }

  nav.auth-nav .auth-links-mobile {
    display: none;
  }

  .auth-contact-btn {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
  }
}

/* General link and focus styles */
.auth-link {
  color: var(--text-muted, #6B7280);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
}

.auth-link:hover,
.auth-link:focus,
.auth-contact-btn:hover,
.auth-contact-btn:focus {
  background: rgba(99, 102, 241, 0.06);
  color: var(--primary, #2563EB);
  outline: none;
}

.auth-link:focus-visible,
.auth-contact-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  border-radius: 6px;
}

/* ========== AUTH Header (mobile) — canonical, no-conflict block ========== */
@media (max-width: 640px) {
  nav.auth-nav {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
  }

  body.keyboard-open nav.auth-nav {
    height: var(--topbar-compact-height);
    min-height: var(--topbar-compact-height);
  }

  nav.auth-nav .nav-inner {
    align-items: center;
    justify-content: space-between;
    padding: 10px 1rem;
  }

  /* Logo: block + centered + constrained */
  nav.auth-nav .site-logo {
    display: block !important;
    background: transparent; /* prevent logo area from painting a white box */
    max-height: 44px;
    height: auto;
    width: auto;
    max-width: 90%;
    box-sizing: border-box;
  }

  /* Link bar in normal flow */
  nav.auth-nav .auth-links-mobile {
    position: static !important;
    display: flex !important;
    width: 100%;
    justify-content: space-around;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    /* Remove border around the mobile auth link bar */
    border-top: none;
    box-sizing: border-box;
    background: transparent;
    z-index: 5;
  }

  /* Uniform vertical spacing for link items in mobile bar */
  .auth-links-mobile .auth-link,
  .auth-links-mobile .auth-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 6px;
    font-size: 12px;
    line-height: 1;
    box-sizing: border-box;
  }

  /* Contact icon */
  .auth-contact-icon {
    display: block;
    width: 20px;
    height: 20px;
    margin: 0;
    object-fit: contain;
  }

}

/* ======================================================================
   Polished Left-side Site Nav + Off-canvas Menu
   ====================================================================== */

:root{
  --site-bg: #ffffff;
  --site-text: #0F1724;
  --site-muted: #6B7280;
  --site-accent: #16A34A; /* green accent */
  --panel-bg: #ffffff;
  --panel-shadow: rgba(2,6,23,0.08);
}

/* Site nav (top bar) */
.site-nav {
  background: var(--site-bg);
  border-bottom: 1px solid rgba(15,23,42,0.06);
  box-shadow: 0 4px 12px rgba(15,23,42,0.04);
  height: 64px;
  z-index: 60;
}
.site-nav .nav-inner.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 18px;
  display:flex;
  align-items:center;          /* vertically centers hamburger and logo */
  height: 64px;
}

/* Brand */
.site-logo { height: 44px; width:auto; display:block; margin:0; }
.nav-brand { display:flex; align-items:center; gap:8px; }

/* Hamburger on the left */
.site-hamburger {
  display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; border-radius:8px; border:1px solid transparent;
  background:transparent; cursor:pointer; transition:background .12s, border-color .12s;
  margin-right:10px;
}
.site-hamburger:hover { background: rgba(15,23,42,0.04); border-color: rgba(15,23,42,0.06); }

/* Legacy site-menu block removed — tb- namespaced menu below is the single source of truth */

/* ------------------------------------------------------------
   Clean tb-site-menu CSS (position fixed, off-screen hide, no !important)
   ------------------------------------------------------------ */

/* --------------------------------------------------
   Global layout tokens
-------------------------------------------------- */
:root {
  --tb-nav-h: 64px;
  --tb-site-bg: #ffffff;
  --tb-site-text: #0F1724;
  --tb-site-muted: #6B7280;
  --tb-panel-bg: #ffffff;
  --tb-panel-shadow: rgba(2,6,23,0.08);
}

/* Top nav */
.tb-site-nav {
  background: var(--tb-site-bg);
  border-bottom: 1px solid rgba(15,23,42,0.06);
  box-shadow: 0 4px 12px rgba(15,23,42,0.04);
  height: var(--tb-nav-h);
  z-index: 120;
}
.tb-site-nav .tb-nav-inner {
  width: 100%;
  margin: 0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  height: var(--tb-nav-h);
  gap: 8px;
  box-sizing: border-box;
}

/* --------------------------------------------------
   Site nav spacer
   Prevents content from being hidden under fixed nav
-------------------------------------------------- */

.tb-site-nav-spacer {
  height: var(--tb-nav-h); /* must match .tb-site-nav height */
  width: 100%;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  :root { --tb-nav-h: 56px; }
}

@media (max-width: 640px) {
  .tb-site-nav .tb-nav-inner { padding: 0 12px; }
}
.tb-nav-left { display:flex; align-items:center; gap:8px; }
.tb-nav-spacer { flex:1; }

/* Right cluster */
.tb-nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  position: relative;
}

/* Icon trigger button */
.tb-margin-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  padding: 0;
}

.tb-margin-icon-btn:hover {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.18);
}

.tb-margin-icon-btn:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.35);
  outline-offset: 2px;
}

/* Wallet icon */
.tb-margin-icon {
  width: 18px;
  height: 18px;
  color: rgba(15, 23, 42, 0.85);
}

/* Popover */
.tb-margin-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: 280px;

  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.10);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.14);

  transform: translateY(-6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 1100;
}

.tb-margin-popover[aria-hidden="false"] {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.tb-margin-popover-header {
  font-size: 12px;
  font-weight: 700;
  color: rgba(15, 23, 42, 0.70);
  margin-bottom: 10px;
}

.tb-margin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.tb-margin-row:first-of-type {
  border-top: 0;
}

.tb-margin-k {
  font-size: 12px;
  color: rgba(15, 23, 42, 0.62);
}

.tb-margin-v {
  font-size: 13px;
  font-weight: 800;
  color: rgba(15, 23, 42, 0.92);
}

/* Margin icon remains visible on all screen sizes (icon-only is mobile-safe) */

/* Logo */
.tb-site-logo { height: 44px; width:auto; display:block; }
.tb-logo-link { display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:8px; }
.tb-logo-link:hover { background: rgba(15,23,42,0.03); }

/* Hamburger */
.tb-hamburger {
  display:inline-flex; align-items:center; justify-content:center;
  width:44px; height:44px; border-radius:8px; border:1px solid transparent;
  background:transparent; cursor:pointer; transition:background .12s, border-color .12s;
}
.tb-hamburger:hover { background: rgba(15,23,42,0.04); border-color: rgba(15,23,42,0.06); }

/* tb-site-menu container: fixed and inert when hidden */
.tb-site-menu {
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none; /* inert when hidden; JS will make it interactive when shown */
}
.tb-site-menu[aria-hidden="false"] {
  pointer-events: auto;
}

/* overlay: covers viewport but inert when hidden */
.tb-site-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7,12,18,0.45);
  opacity: 0;
  transition: opacity 220ms ease;
  pointer-events: none;
}
.tb-site-menu[aria-hidden="false"] .tb-site-menu-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* panel slides from left using translateX(-100%) to fully hide */
.tb-site-menu-panel {
  position: fixed; /* fixed so not affected by ancestor stacking contexts */
  left: 0;
  top: 0;
  bottom: 0;
  width: 320px;
  max-width: 86%;
  height: 100%;
  background: var(--tb-panel-bg);
  box-shadow: 12px 0 40px var(--tb-panel-shadow);
  transform: translateX(-100%); /* fully off-screen when hidden */
  transition: transform 280ms cubic-bezier(.2,.9,.3,1), opacity 180ms ease;
  opacity: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  padding: 18px;
  box-sizing: border-box;
}
.tb-site-menu[aria-hidden="false"] .tb-site-menu-panel {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* Panel header & body styling */
.tb-site-menu-header { display:flex; align-items:center; justify-content:space-between; padding-bottom:12px; border-bottom:1px solid rgba(15,23,42,0.05); }
.tb-site-menu-title { display:flex; align-items:center; gap:12px; }
.tb-site-menu-logo { height:28px; width:auto; }
.tb-site-menu-meta { display:flex; flex-direction:column; }
.tb-site-menu-brand { font-weight:700; color:var(--tb-site-text); font-size:16px; }
.tb-site-menu-sub { font-size:12px; color:var(--tb-site-muted); }
.tb-site-menu-close { border:none; background:transparent; cursor:pointer; padding:6px; }
.tb-site-menu-body { margin-top:12px; overflow-y:auto; -webkit-overflow-scrolling:touch; }
.tb-site-menu-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:6px; }
.tb-site-menu-list a, .tb-site-menu-list button.tb-site-menu-logout {
  display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius:8px; color:var(--tb-site-text);
  text-decoration:none; font-weight:500; transition: background .12s, transform .06s; width:100%; text-align:left; border:none; background:transparent;
}
.tb-site-menu-list a:hover, .tb-site-menu-list button.tb-site-menu-logout:hover { background: rgba(15,23,42,0.04); transform: translateY(-1px); }
.tb-menu-icon { display:inline-flex; width:22px; height:22px; align-items:center; justify-content:center; }
.tb-menu-label { flex:1; }
.tb-menu-divider { height:1px; background: rgba(15,23,42,0.04); margin:8px 0; }
.tb-site-menu-logout { color:#EF4444; font-weight:600; }

@media (max-width:640px) {
  .tb-site-menu-panel { width:280px; padding:14px; }
  .tb-site-menu-logo { height:24px; }
}
