:root {
  /* NexTier Brand Colors */
  --nextier-blue: #1e40af; /* Deep Blue - Trust, Intelligence, Stability */
  --nextier-blue-dark: #1e3a8a;
  --nextier-blue-light: #3b82f6;
  --nextier-teal: #0d9488; /* Teal - Growth, Balance */
  --nextier-green: #10b981; /* Green - Health, Progress */
  --nextier-gold: #f59e0b; /* Gold/Yellow - Achievement, Aspiration */
  
  /* Updated Primary Colors to match brand */
  --primary: #1e40af; /* NexTier Blue */
  --primary-dark: #1e3a8a;
  --primary-light: #3b82f6;
  --success: #10b981; /* NexTier Green */
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0d9488; /* NexTier Teal */
  
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #ffffff;
  
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  --border-color: #e2e8f0;
  --border-radius: 12px;
  --border-radius-lg: 16px;
  
  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] {
  /* Dark Mode Overrides */
  --bg-base: #0f172a; /* Slate 900 */
  --bg-surface: #1e293b; /* Slate 800 */
  --bg-elevated: #334155; /* Slate 700 */
  
  --text-primary: #f8fafc; /* Slate 50 */
  --text-secondary: #cbd5e1; /* Slate 300 */
  --text-muted: #94a3b8; /* Slate 400 */
  
  --border-color: #334155; /* Slate 700 */
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  
  /* Adjust brand colors for dark mode contrast */
  --primary: #3b82f6; /* Lighter blue */
  --primary-dark: #2563eb;
  
  /* Link colors */
  --link-color: #60a5fa;
  --link-hover-color: #93c5fd;
}

[data-bs-theme="dark"] a:not(.btn):not(.nav-link) {
  color: var(--link-color);
}

[data-bs-theme="dark"] a:not(.btn):not(.nav-link):hover {
  color: var(--link-hover-color);
}

/* WCAG AA contrast for outline-danger buttons: Bootstrap's default #dc3545
   sits at ~4.5:1 on pure white and drops below on tinted card/table rows and
   dark surfaces. Use the danger text-emphasis shades per theme; hover/active
   keep Bootstrap's solid-fill defaults. */
.btn-outline-danger {
  --bs-btn-color: #b02a37;
  --bs-btn-border-color: #b02a37;
}
[data-bs-theme="dark"] .btn-outline-danger {
  --bs-btn-color: #ea868f;
  --bs-btn-border-color: #ea868f;
}

/* First-visit tour spotlight — dims the page and lifts the active target so the
   popover reads as a pointer to it, not a stray overlay over the next card. */
.nex-tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 1055;               /* below the popover (1070) and highlighted target */
  pointer-events: none;        /* tour navigation happens via popover buttons */
}
.nex-tour-highlight {
  position: relative;
  z-index: 1060;               /* above the backdrop, below the popover */
  border-radius: var(--radius-md, 0.5rem);
  box-shadow: 0 0 0 3px var(--primary, #2563eb), 0 0 0 9999px rgba(15, 23, 42, 0.0);
  transition: box-shadow 0.15s ease-in-out;
}
.nex-tour-popover {
  z-index: 1070;
}

/* Onboarding assessment Likert scale — make the button-group options clearly
   interactive (they previously read as plain text). Clear resting border,
   primary hover, and a filled primary "selected" state. */
.assessment-radio + .btn {
  /* Filled chip at rest so the option clearly reads as tappable, not plain text. */
  background-color: var(--bs-tertiary-bg, #f1f5f9);
  border: 1px solid var(--bs-border-color, #cbd5e1);
  color: var(--bs-secondary-color, #475569);
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.assessment-radio:hover + .btn,
.assessment-radio:focus-visible + .btn {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}
.assessment-radio:checked + .btn {
  background-color: var(--primary, #2563eb);
  border-color: var(--primary, #2563eb);
  color: #fff;
  font-weight: 600;
}

/* Mobile: the fixed bottom tab-bar already exposes the main sections, so the
   footer's duplicate app links are redundant. Hide them but KEEP the last two
   (Privacy / Terms), which the bottom nav does not carry. */
@media (max-width: 575.98px) {
  .app-footer .footer-nav-links li:not(:nth-last-child(-n+2)) {
    display: none !important;
  }
}

/* Dark-mode: remap fixed-color Bootstrap utilities that don't respond to the
   theme. `bg-white`/`bg-light`/`text-dark` are hardcoded and otherwise render as
   bright panels on the dark surface (dashboard section headers, Achievements
   card, footer, badges, etc. — ~65 templates). Scoped to dark only, so light
   mode is unchanged. */
[data-bs-theme="dark"] .bg-white {
  background-color: var(--bg-surface) !important;
}
[data-bs-theme="dark"] .bg-light {
  background-color: var(--bg-surface) !important;
}
[data-bs-theme="dark"] .text-dark {
  color: var(--text-primary) !important;
}
/* Bootstrap's plain `.border` uses a light default color; align the all-around
   hairline to the dark border token. Directional/accent borders
   (`border-start border-4 border-info`, etc.) are intentionally left alone. */
[data-bs-theme="dark"] .border:not([class*="border-primary"]):not([class*="border-info"]):not([class*="border-success"]):not([class*="border-warning"]):not([class*="border-danger"]) {
  border-color: var(--border-color) !important;
}

/* Mobile Nav — fixed so it always occupies viewport width, not document width.
   position:sticky uses document width when there is horizontal overflow, which
   causes the hamburger button to be clipped off-screen on any page whose
   content is wider than the viewport. Fixed is immune to that. */
.mobile-top-nav {
  z-index: 1200 !important;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}

.top-nav {
  z-index: 2000 !important;
  position: relative;
}

/* Offcanvas nav menu — must appear above top-nav (z-index: 2000) */
.offcanvas {
  z-index: 2050 !important;
}

.offcanvas-backdrop {
  z-index: 2040 !important;
}

/* Ensure dropdowns are heavily favored */
.dropdown-menu {
  z-index: 2050 !important;
}

/* Keep modals above elevated nav layers */
.modal {
  z-index: 2100 !important;
}

.modal-backdrop {
  z-index: 2090 !important;
}

/* Base Styles - Mobile First */
* {
  box-sizing: border-box;
}

/* ── Horizontal overflow / iOS scroll containment ─────────────────────────
   Problem: on iOS Safari, position:fixed elements are NOT clipped by an
   ancestor's overflow:hidden. The Bootstrap offcanvas-end uses
   transform:translateX(100%) when closed, which places it entirely
   off-screen to the right. iOS then treats the page as scrollable from
   0→2×viewport-width, letting the user "scroll right" to see nothing.

   Fix strategy (layered):
   1. overflow-x + overscroll-behavior-x on html & body — handles non-fixed overflow.
   2. max-width:100vw — hard caps the document width to the viewport.
   3. Offcanvas-specific override below (fade instead of slide) — removes the
      translateX(100%) that extends the fixed element off-screen.
   ─────────────────────────────────────────────────────────────────────── */
html {
  overflow-x: hidden;
  max-width: 100vw;
  overscroll-behavior-x: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-base);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100vw;
  overscroll-behavior-x: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Offcanvas: swap slide-from-right for fade on mobile ───────────────────
   Bootstrap's .offcanvas-end uses transform:translateX(100%) in its closed
   state. Since the offcanvas is position:fixed, iOS Safari counts that
   off-screen transform position when computing the scrollable page width,
   making the page appear to have content 390px to the right.
   Replacing with opacity-based fade removes the off-screen transform entirely.
   Bootstrap's transitionend listener fires on the opacity transition, so
   class management (showing / show / hiding) continues to work correctly.
   ─────────────────────────────────────────────────────────────────────────── */
@media (max-width: 991px) {
  /* Override the translateX(100%) that causes iOS horizontal scroll */
  .offcanvas-end {
    transform: none !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
  }

  /* Opening: Bootstrap adds .showing just before animation starts */
  .offcanvas-end.showing {
    opacity: 0;
  }

  /* Open: Bootstrap adds .show when fully visible */
  .offcanvas-end.show {
    opacity: 1;
    pointer-events: auto;
  }

  /* Closing: Bootstrap adds .hiding while animating away */
  .offcanvas-end.hiding {
    opacity: 0;
    pointer-events: none;
  }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-top: 0;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
}

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

a:hover {
  text-decoration: underline;
}

/* Container */
.container {
  width: 100%;
  padding: var(--spacing-md);
  margin: 0 auto;
  max-width: 100%;
}

@media (max-width: 767px) {
  .container {
    padding-top: var(--spacing-md);
  }
}

@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding: var(--spacing-lg);
  }
}

@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }
  
  body {
    padding-bottom: 0; /* No bottom nav on desktop */
  }
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Cards */
.card {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.card-header {
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--border-color);
}

.card-compact {
  padding: var(--spacing-md);
}

.card-hover {
  transition: all 0.2s ease;
  cursor: pointer;
}

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

@media (prefers-reduced-motion: reduce) {
  .card-hover {
    transition: none;
  }
  .card-hover:hover {
    transform: none;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--border-radius);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  min-height: 44px; /* Touch target */
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

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

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

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-base);
}

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

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

.btn-block {
  display: flex;
  width: 100%;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

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

/* Forms */
.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--spacing-sm);
  color: var(--text-primary);
}

.form-control {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  min-height: 44px; /* Touch target */
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

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

.form-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--spacing-xs);
}

.invalid-feedback {
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: var(--spacing-xs);
}

.is-invalid {
  border-color: var(--danger);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-primary {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.badge-secondary {
  background: var(--bg-base);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Chips (Filter Buttons) */
.chips {
  display: flex;
  gap: var(--spacing-sm);
  overflow-x: auto;
  padding-bottom: var(--spacing-sm);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  min-height: 36px;
}

.chip:hover {
  background: var(--bg-base);
}

.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Mobile Top Navigation */
.mobile-top-nav {
  display: none;
}

@media (max-width: 991px) {
  :root {
    /* Mobile nav height: single top bar + safe-area inset */
    --mobile-nav-height: calc(60px + env(safe-area-inset-top, 0px));
  }

  .mobile-top-nav {
    display: block;
    position: fixed;   /* viewport-relative — immune to document overflow */
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    z-index: 1200;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding-top: env(safe-area-inset-top, 0px);
  }

  .mobile-logo {
    padding: 0.625rem 0.75rem 0.4rem;
    background: var(--bg-surface);
    /* Logo on the left, menu button on the right. */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    overflow: hidden; /* clip anything that tries to bleed out */
  }

  /* Logo link — left-aligned, must not overflow the bar. */
  .mobile-logo > a {
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
  }

  .mobile-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    justify-content: flex-end;
    min-width: 0;
    overflow: hidden;
  }

  .mobile-chat-link,
  .mobile-notifications-link,
  .mobile-community-link {
    color: var(--text-secondary);
    font-size: 1.5rem;
    text-decoration: none;
    padding: 0.25rem;
    transition: color 0.2s ease;
    flex-shrink: 0; /* icons must not compress — let overflow: hidden clip instead */
  }

  .mobile-chat-link:hover,
  .mobile-notifications-link:hover,
  .mobile-community-link:hover {
    color: var(--primary);
  }

  .mobile-menu-button {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.75rem;
    padding: 0.25rem;
    line-height: 1;
    flex-shrink: 0;
  }

  .mobile-menu-button:hover {
    color: var(--primary);
  }

  .mobile-nav-logo {
    /* Responsive within its constrained grid cell.
       height: 32px is kept as the target; max-width: 100% caps the rendered
       width to the cell width; object-fit: contain maintains aspect ratio so
       the logo never appears squished regardless of cell size. */
    height: 40px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
  }
}

/* Navbar badges (desktop + mobile) */
.nav-icon-badge-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 9999px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  line-height: 22px;
  font-weight: 600;
  text-align: center;
  border: 2px solid var(--bg-surface);
}

.habits-page-toolbar .form-label {
  font-size: 0.8rem;
  font-weight: 500;
}

.habits-list-toolbar {
  row-gap: 0.5rem;
}

.habit-frequency-tabs .nav-link {
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.habit-tier-pill {
  color: white;
  font-size: 0.72rem;
  padding: 0.35em 0.7em;
  letter-spacing: 0.01em;
}

/* Top Navigation (Desktop) */
.top-nav {
  display: none;
}

@media (min-width: 992px) {
  .top-nav {
    display: block;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
  }
  
  .top-nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  
  .top-nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
  }
  
  .top-nav-links {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
  }
  
  .top-nav-links a {
    color: var(--text-primary);
    font-weight: 500;
  }
  
  .top-nav-links a:hover {
    color: var(--primary);
  }
}

/* Public (non-authenticated) Desktop Navigation */
.public-top-nav {
  display: none;
}

@media (min-width: 992px) {
  .public-top-nav {
    display: block;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
  }
}

.public-nav-link {
  color: var(--text-primary);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.public-nav-link:hover {
  color: var(--primary);
}

/* Public view: no bottom-nav clearance on mobile */
@media (max-width: 991px) {
  body.public-view {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }
}

/* FAB pattern retired 2026-07-11 — pages use header "New" buttons instead. */

/* Modal Bottom Sheet */
.modal.bottom-sheet .modal-dialog {
  margin: 0;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 100%;
}

.modal.bottom-sheet .modal-content {
  border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
  border: none;
  max-height: 85vh;
  overflow-y: auto;
}

.modal.bottom-sheet .modal-header {
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-lg);
}

.modal.bottom-sheet .modal-body {
  padding: var(--spacing-lg);
}

.modal.bottom-sheet .modal-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-lg);
}

@media (min-width: 768px) {
  .modal.bottom-sheet .modal-dialog {
    position: relative;
    margin: 1.75rem auto;
    max-width: 600px;
  }
  
  .modal.bottom-sheet .modal-content {
    border-radius: var(--border-radius-lg);
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-md);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
}

.empty-state-text {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-lg);
}

/* Utility Classes */
.text-muted {
  color: var(--text-secondary);
}

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

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

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

/* Mobile spacing adjustments */
@media (max-width: 991px) {
  .mt-3 { margin-top: 0; }
  .mb-4 { margin-bottom: var(--spacing-lg); }
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.d-flex {
  display: flex;
}

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

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

.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }

/* Flash Messages */
/* Flash Messages Container */
.flash-messages-container {
  position: relative;
  width: 100%;
  z-index: 10001;
  display: flex;
  justify-content: center;
}

.alert {
  padding: var(--spacing-md);
  border-radius: 8px;
  margin: 0.5rem auto;
  border: none;
  width: calc(100% - 2rem);
  max-width: 100%;
  animation: slideInFromTop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  /*
   * Do NOT set z-index here. Inline page alerts (alert-info, alert-warning, etc.)
   * must NOT create a stacking context above the fixed bottom nav.
   * z-index is only set on alerts that live inside .flash-messages-container.
   */
  position: relative;
}

/*
 * Flash/toast alerts that overlay the top navbar DO need z-index.
 * Scoping to .flash-messages-container ensures inline page alerts
 * are unaffected and will always scroll under the fixed bottom nav.
 */
.flash-messages-container .alert {
  z-index: 10002;
}

/* Alert width matches top-nav container width */
@media (min-width: 768px) {
  .alert {
    max-width: 720px;
    width: 100%;
  }
}

@media (min-width: 992px) {
  .alert {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {
  .alert {
    max-width: 1140px;
  }
}

@keyframes slideInFromTop {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideOutToTop {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-100%);
    opacity: 0;
  }
}

.alert .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  max-width: none;
  width: 100%;
}

.alert-success {
  background: #10b981;
  border-color: var(--success);
  color: #ffffff;
}

.alert-danger,
.alert-error {
  background: #ef4444;
  border-color: var(--danger);
  color: #ffffff;
}

.alert-info {
  background: #3b82f6;
  border-color: var(--info);
  color: #ffffff;
}

.alert-warning {
  background: #f59e0b;
  border-color: var(--warning);
  color: #ffffff;
}

.alert .btn-close {
  filter: brightness(0) invert(1);
  opacity: 0.8;
}

.alert .btn-close:hover {
  opacity: 1;
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

/* Goal Cards */
.goal-card {
  position: relative;
}

.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--spacing-sm);
}

.goal-card-title {
  font-weight: 600;
  font-size: 1.125rem;
  margin: 0;
  flex: 1;
}

.goal-card-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.goal-card-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--border-color);
}

/* Shared Modern Date Navigator */
.modern-date-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.125rem;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.125rem;
  min-height: 2rem;
}

.modern-date-nav-form {
  display: flex;
  align-items: center;
  margin: 0;
}

.modern-date-nav-btn {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  text-decoration: none;
}

.modern-date-nav-btn:hover {
  color: var(--primary);
  background: var(--bg-surface);
  text-decoration: none;
}

.modern-date-input {
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.2;
  text-align: center;
  width: 8.25rem;
  min-height: 1.875rem;
  padding: 0 0.375rem;
  outline: none;
}

.modern-date-input::-webkit-datetime-edit,
.modern-date-input::-webkit-datetime-edit-fields-wrapper,
.modern-date-input::-webkit-datetime-edit-text,
.modern-date-input::-webkit-datetime-edit-month-field,
.modern-date-input::-webkit-datetime-edit-day-field,
.modern-date-input::-webkit-datetime-edit-year-field {
  padding: 0;
  line-height: 1.2;
}

.modern-date-input::-webkit-calendar-picker-indicator {
  margin: 0;
  opacity: 0.7;
  cursor: pointer;
}

/* Journal Entry Cards */
.entry-card {
  border-left: 3px solid var(--primary);
}

.entry-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.entry-card-content {
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
  /* Break long unbroken strings (URLs, no-space text) so they can't blow out
     the card width and overflow the page on mobile. */
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Min-width utility. Bootstrap 5.3 ships no min-width helper, but several
   templates use `min-w-0` for flexbox text truncation: a flex child needs
   `min-width: 0` to shrink below its content's intrinsic width, otherwise
   `text-truncate` never ellipsizes and the text overflows (seen on mobile
   dashboard reflection titles + forum thread cards). This defines it. */
.min-w-0 {
  min-width: 0 !important;
}

/* Bootstrap ships only min-vh-100; the error pages use min-vh-75 to vertically
   centre their content without forcing a full-viewport block. Define it. */
.min-vh-75 {
  min-height: 75vh !important;
}

/* Page header — title + tagline on one side, action buttons on the other.
   On wide screens they sit on one row (space-between). On narrow screens the
   action buttons wrap onto their own full-width row BELOW the title, so the
   heading and tagline always get the full width and never bunch up in a
   squeezed column. Use:
     <div class="page-header">
       <div class="page-header-titles"><h1>…</h1><p class="text-muted small mb-0">…</p></div>
       <div class="page-header-actions"> …buttons… </div>
     </div>  */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  margin-bottom: 1.5rem;
}
.page-header-titles {
  min-width: 0;        /* long headings wrap by word instead of forcing a narrow column */
  flex: 1 1 28rem;     /* room for the tagline before the toolbar; when they can't share a row
                          the title takes the full width and the toolbar drops to its own row */
}
.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;  /* the primary CTA is the last child, so it anchors to the right */
  gap: 0.5rem;
  margin-left: auto;          /* keep the toolbar flush right, whether beside the title or wrapped below it */
}
@media (max-width: 575.98px) {
  /* Phones: actions take their own full-width row under the title, still right-aligned
     so the primary CTA stays in the same (rightmost) place it holds on wider screens. */
  .page-header-actions {
    width: 100%;
  }
}
/* The "i" info icon sitting next to a page title: subtle by default, primary on
   hover/focus, no underline (it's an icon, not a text link). Opens the page's
   "what is this page" modal — replaces the old full-width "Learn More About …" button. */
.page-info-btn {
  text-decoration: none;
  transition: color 0.12s;
}
.page-info-btn:hover,
.page-info-btn:focus-visible {
  color: var(--primary, #2563eb) !important;
}

/* Compact icon-only toolbar buttons in .page-header-actions (2026-07-11 redesign:
   icons replace text labels; search/filter live behind the search icon). Fixed
   square hit-area keeps the row tight and consistent; native title tooltips +
   aria-labels carry the meaning the labels used to. */
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
}
/* Dot on the search/filter button when a search or filter is currently applied,
   so the state isn't invisible once the big filter box is collapsed away. */
.filter-active-dot {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bs-info, #0dcaf0);
}

/* Small utility hooks the templates reference but that were never defined
   (so they silently did nothing). cursor-pointer on clickable cards; the hover
   affordances the class names promise. */
.cursor-pointer {
  cursor: pointer;
}
.hover-bg {
  transition: background-color 0.15s ease;
}
.hover-bg:hover {
  background-color: var(--bg-base);
}
.hover-shadow {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.hover-shadow:hover {
  box-shadow: var(--shadow-md);
}

/* Mood Picker */
.mood-picker {
  display: flex;
  gap: var(--spacing-sm);
  justify-content: center;
  flex-wrap: wrap;
}

.mood-option {
  font-size: 2rem;
  padding: var(--spacing-sm);
  border: 2px solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-base);
  min-width: 60px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mood-option:hover {
  border-color: var(--primary);
  transform: scale(1.1);
}

.mood-option.selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
}

/* Category Colors */
.category-physiological { background-color: #ef4444; }
.category-safety { background-color: #f97316; }
.category-love-belonging { background-color: #ec4899; }
.category-esteem { background-color: #8b5cf6; }
.category-cognitive { background-color: #3b82f6; }
.category-aesthetic { background-color: #06b6d4; }
.category-self-actualization { background-color: #10b981; }
.category-transcendence { background-color: #84cc16; }

.dashboard-row-title-start {
  padding-left: 0.5rem !important;
}

.dashboard-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.dashboard-tile:hover {
  border-color: rgba(99, 102, 241, 0.25);
}

.dashboard-title-indent {
  padding-left: 2rem;
}

.dashboard-item-checkbox {
  width: 1.3em;
  height: 1.3em;
  cursor: pointer;
}

.dashboard-tier-pill {
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.1;
  padding: 0.2rem 0.55rem;
  margin: 0;
}

/* Logo Styles */
.nav-logo {
  height: 40px;
  width: auto;
  transition: opacity 0.2s ease;
}

.nav-logo:hover {
  opacity: 0.85;
}

@media (min-width: 768px) {
  .nav-logo {
    height: 48px;
  }
}

.landing-logo {
  /* The whole hero (logo + headline + subtext + CTAs) must fit the first
     viewport on any display, so the logo is capped by viewport HEIGHT as well
     as width. Neither dimension is forced, so aspect ratio is preserved. */
  width: auto;
  height: auto;
  max-width: min(400px, 90%);
  max-height: 26vh;
  margin: 0 auto;
  display: block;
}

@media (max-width: 576px) {
  .landing-logo {
    max-width: min(280px, 90%);
  }
}

.auth-logo {
  height: 60px;
  width: auto;
  margin: 0 auto;
  display: block;
}

/* Tier Accordion Styles */
.tier-card {
  background: var(--bg-surface);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

.tier-card:hover {
  box-shadow: var(--shadow-md);
}

.tier-header {
  padding: var(--spacing-lg);
  cursor: pointer;
  user-select: none;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  margin-right: var(--spacing-sm);
}

.tier-name {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.tier-desc {
  margin-top: var(--spacing-sm);
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

.tier-chevron {
  transition: transform 0.3s ease;
  font-size: 1.25rem;
  color: var(--text-muted);
}

.tier-chevron.rotated {
  transform: rotate(180deg);
}

.tier-body {
  padding: 0 var(--spacing-lg) var(--spacing-lg);
  animation: slideDown 0.3s ease;
}

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

/* Chip Styles */
.chip {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  margin: 0.25rem;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: all 0.2s ease;
}

.chip:hover {
  background: var(--bg-surface);
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.chip-active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.chip-active:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

.subcategory-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Tier Chips Scroll Container */
.tier-chips-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.tier-chips-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.tier-chips {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0;
  min-width: min-content;
}

@media (min-width: 768px) {
  .tier-chips {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* Subcategory Details */
.subcategory-item {
  padding: var(--spacing-md);
  background: var(--bg-base);
  border-radius: var(--border-radius);
}

.subcategory-item h6 {
  color: var(--text-primary);
  font-weight: 600;
}

.example-goals ul {
  margin-left: var(--spacing-lg);
  color: var(--text-secondary);
}

/* Tier Insight Box */
.tier-insight {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.tier-insight strong {
  color: var(--text-primary);
}

/* Pyramid Visualization */
.tier-pyramid {
  width: 100%;
}

.pyramid-level {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pyramid-level:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

/* Benefits Grid Cards */
.card.h-100 {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card.h-100:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg) !important;
}

/* Goal Template Cards */
.subcategory-template-card {
  margin-bottom: var(--spacing-lg);
}

.goal-template-item {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

.goal-template-item:last-child {
  border-bottom: none;
}

.goal-template-item:hover {
  background: var(--bg-base);
}

/* Tier Section */
.tier-section {
  margin-bottom: var(--spacing-xl);
}

/* Tier Description in Form */
.tier-description {
  padding: var(--spacing-sm);
  background: var(--bg-base);
  border-radius: var(--border-radius);
  margin-top: var(--spacing-sm);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .tier-name {
    font-size: 1.125rem;
  }
  
  .tier-header {
    padding: var(--spacing-md);
  }
  
  .tier-body {
    padding: 0 var(--spacing-md) var(--spacing-md);
  }
  
  .tier-badge {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }
  
  .goal-template-item {
    flex-direction: column;
    align-items: flex-start !important;
  }
  
  .goal-template-item .btn {
    margin-top: var(--spacing-sm);
    margin-left: 0 !important;
    width: 100%;
  }
}

/* Tier Actions */
.tier-actions {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.tier-actions .btn {
  flex: 1;
  min-width: 150px;
}

@media (max-width: 576px) {
  .tier-actions .btn {
    flex: 1 1 100%;
  }
}

/* Footer Styles */
.app-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.app-footer h6 {
    color: #374151;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.app-footer a {
    text-decoration: none;
    transition: color 0.2s;
}

/* Touch-target size: the small footer links sit adjacent in a row; pad each to
   a ≥24px hit area so neighbors don't overlap the minimum target circle. */
.app-footer .footer-nav-links .list-inline-item a {
    display: inline-block;
    padding: 0.375rem 0.25rem;
}

.app-footer a:hover {
    color: #3b82f6 !important;
}

/* Priority Badge Styles */
.priority-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.625rem;
    line-height: 1;
    color: white;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    border: 2px solid white;
}

.priority-1 {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.priority-2 {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.priority-3 {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.priority-4,
.priority-5 {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
}


/* Mobile Bottom Navigation */
.mobile-bottom-nav {
    /*
     * iOS Safari fix — Do NOT set bottom to env(safe-area-inset-bottom).
     * The bar must sit at bottom:0 (the true screen edge). Safe-area handling
     * is done via padding-bottom so the HOME INDICATOR area is painted but
     * the bar itself remains flush with the physical bottom.
     *
     * viewport-fit=cover (set on <meta viewport>) must also be present or
     * env(safe-area-inset-bottom) returns 0 on iPhone X+.
     */
    position: fixed;
    bottom: 0;                /* Always the physical bottom — NEVER override this */
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    padding: 8px 0 0 0;
    /* Push icon row above the Home Indicator on notched iPhones */
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    /* Keep below modal/backdrop layers so overlays can cover it */
    z-index: 1100;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);

    /*
     * GPU compositing — promotes the bar to its own compositor layer.
     * This prevents iOS Safari from repainting it relative to the scroll
     * position during the dynamic toolbar (address bar) show/hide animation,
     * which is what causes the visible jump/shift on scroll.
     * IMPORTANT: z-index must differ from other sticky/fixed elements or
     * iOS Safari merges compositor layers and the jump reappears.
     */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform;
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* WCAG AA: --text-muted (#94a3b8) is ~2.6:1 on the white bar */
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-decoration: none;
    flex: 1;
    padding: 4px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-bottom-nav .nav-item:active {
    background-color: rgba(0,0,0,0.05);
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
    transition: transform 0.2s ease;
}

.mobile-bottom-nav .nav-item.active {
    color: var(--primary);
    font-weight: 500;
}

.mobile-bottom-nav .nav-item.active i {
    transform: translateY(-2px);
}

/* WCAG AA: dark-mode --primary (#3b82f6) is ~4:1 on the dark bar at this
   12px label size; the link blue clears 4.5:1. */
[data-bs-theme="dark"] .mobile-bottom-nav .nav-item.active {
    color: var(--link-color);
}

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

@media (max-width: 991px) {
    body {
        /* Top: push content below the fixed mobile top nav */
        padding-top: var(--mobile-nav-height);
        /* Bottom: clear the fixed bottom nav + safe-area */
        padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
    }

}

/* Chat page layout is in app/static/css/chat.css */

/* Dark Mode Calendar Overrides */
[data-bs-theme="dark"] .fc {
  --fc-page-bg-color: var(--bg-surface);
  --fc-neutral-bg-color: var(--bg-elevated);
  --fc-list-event-hover-bg-color: var(--bg-elevated);
  --fc-today-bg-color: rgba(59, 130, 246, 0.15);
  color: var(--text-primary);
}

[data-bs-theme="dark"] .fc-theme-standard td, 
[data-bs-theme="dark"] .fc-theme-standard th,
[data-bs-theme="dark"] .fc-theme-standard .fc-scrollgrid {
  border-color: var(--border-color);
}

[data-bs-theme="dark"] .fc-daygrid-day-number,
[data-bs-theme="dark"] .fc-col-header-cell-cushion {
  color: var(--text-primary);
  text-decoration: none;
}

[data-bs-theme="dark"] .fc-list-day-cushion {
  background-color: var(--bg-elevated);
}

[data-bs-theme="dark"] .fc-list-event:hover td {
  background-color: var(--bg-elevated);
}

/* Empty State Component */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    background-color: var(--bg-surface);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    margin: 1rem 0;
}

.empty-state-icon {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-icon i {
    font-size: 3rem;
    color: var(--text-muted);
}

/* Loading Spinner Container */
.loading-spinner-container {
    padding: 2rem;
    color: var(--text-secondary); /* WCAG AA — carries "Loading…" text */
}

/* Help Tooltip Cursor */
[data-bs-toggle="tooltip"] {
    cursor: help;
}


/* ── First-visit dashboard tour (onboarding-tour.js) ─────────────────────
   Single unified walkthrough shown once after onboarding. */
.nex-tour-popover {
    max-width: 340px;
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 0.75rem 2rem rgba(15, 23, 42, 0.22);
    z-index: 1080; /* above sticky nav, below modals */
}

.nex-tour-popover .popover-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
    border-bottom: 0;
    padding: 0.7rem 1rem;
}

.nex-tour-popover .popover-body {
    padding: 0.9rem 1rem;
}

.nex-tour-popover .popover-arrow::before,
.nex-tour-popover .popover-arrow::after {
    border-bottom-color: #6a6fe0; /* blends the arrow into the header when placed below */
}

.nex-tour-popover.bs-popover-top .popover-arrow::before,
.nex-tour-popover.bs-popover-top .popover-arrow::after {
    border-top-color: #fff;
    border-bottom-color: transparent;
}

.nex-tour-popover .tour-skip {
    font-size: 0.78rem;
    text-decoration: none;
}

.nex-tour-popover .tour-back,
.nex-tour-popover .tour-next {
    white-space: nowrap;
}

/* ── WCAG contrast & link-affordance fixes (AUDIT-2026-07-16-001) ─────────── */

/* Links inside body text must not rely on color alone (WCAG 1.4.1) — the
   global `a { text-decoration: none }` above stripped the affordance.
   Scoped to PROSE contexts only: nav menus, dropdowns, tabs, and pagination
   are identified by placement, not color, and underlining them reads as
   clutter (Founder feedback 2026-07-18). */
p a:not(.btn),
li a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.list-group-item) {
    text-decoration: underline;
}

/* Blog article images (editor or CLI import): never overflow the column. */
.blog-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 0.375rem;
}

/* Bootstrap 5.3's .btn-outline-secondary text (#6c757d) sits right at/below
   4.5:1 on light backgrounds and worse in dark mode (its vars are not
   theme-aware). Darker gray in light, lighter gray in dark; borders keep the
   default look. */
.btn-outline-secondary {
    --bs-btn-color: #495057;
}
[data-bs-theme="dark"] .btn-outline-secondary {
    --bs-btn-color: #adb5bd;
}

/* Same treatment for outline-primary/info: their stock text colors sit at or
   below 4.5:1 on the tinted card/section backgrounds the marketing pages use.
   Borders/hover keep the stock look; only resting text darkens in light mode. */
.btn-outline-primary {
    --bs-btn-color: #0a58ca;
}
[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-color: #6ea8fe;
}
.btn-outline-info {
    --bs-btn-color: #087990;
}
[data-bs-theme="dark"] .btn-outline-info {
    --bs-btn-color: #6edff6;
}

/* Tier accent text: WCAG-safe darker shade on light backgrounds, the brand
   tier color in dark mode. Each element supplies both via inline CSS vars. */
.tier-accent {
    color: var(--tier-accent-light, inherit);
}
[data-bs-theme="dark"] .tier-accent {
    color: var(--tier-accent-dark, inherit);
}
