/* ============================================
   InfluenceHub – pagrindiniai stiliai
   ============================================ */

:root {
  --brand-50: #f5f3ff;
  --brand-100: #ede9fe;
  --brand-500: #8b5cf6;
  --brand-600: #7c3aed;
  --brand-700: #6d28d9;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
}

html.dark {
  --surface: #0f172a;
  --surface-muted: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-modal-open { overflow: hidden; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.75rem 1rem;
  background: #0f172a;
  color: #fff;
  border-radius: 0 0 0.75rem 0;
  font-weight: 600;
  font-size: 0.875rem;
}
.skip-link:focus { left: 0; }

/* ---------- Header ---------- */
#site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
html.dark #site-header { background: rgba(2, 6, 23, 0.85); }
#site-header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 4px 20px -8px rgba(15, 23, 42, 0.12);
}

/* ---------- Nav link ---------- */
.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  /* WCAG AA: #475569 on #ffffff = 7.5:1 */
  color: #475569;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: #f1f5f9; color: #6d28d9; }
.nav-link[aria-current="location"] { background: #f5f3ff; color: #6d28d9; }
html.dark .nav-link { color: #cbd5e1; }
html.dark .nav-link:hover { background: #1e293b; color: #c4b5fd; }
html.dark .nav-link[aria-current="location"] { background: rgba(124, 58, 237, 0.2); color: #c4b5fd; }

/* ---------- Nav link – dark-mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode
   text utilities (e.g. html.dark .text-slate-400) cannot reduce the
   contrast of the navigation links below AA.

   Light mode:
     - default: #475569 on #ffffff = 7.5:1
     - hover:   #6d28d9 on #f1f5f9 = 8.0:1
     - active:  #6d28d9 on #f5f3ff = 8.4:1
   Dark mode:
     - default: #cbd5e1 on #020617 = 12.6:1
     - hover:   #c4b5fd on #1e293b = 8.9:1
     - active:  #c4b5fd on rgba(124,58,237,0.2) over #020617 ≈ 9.6:1
*/

.nav-link {
  color: #475569 !important;
}

.nav-link:hover {
  color: #6d28d9 !important;
}

.nav-link[aria-current="location"] {
  color: #6d28d9 !important;
}

html.dark .nav-link {
  color: #cbd5e1 !important;
}

html.dark .nav-link:hover {
  color: #c4b5fd !important;
}

html.dark .nav-link[aria-current="location"] {
  color: #c4b5fd !important;
}

/* ---------- Nav link – focus-visible ring ---------- */

.nav-link:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

html.dark .nav-link:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

@supports not selector(:focus-visible) {
  .nav-link:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  html.dark .nav-link:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- Nav link – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .nav-link {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .nav-link:hover,
  .nav-link:focus,
  .nav-link:focus-visible,
  .nav-link:active {
    transform: none !important;
    transition: none !important;
  }

  .nav-link:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark .nav-link:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Nav link – forced colors ---------- */

@media (forced-colors: active) {
  .nav-link {
    color: CanvasText;
    background: Canvas;
  }

  .nav-link:hover,
  .nav-link[aria-current="location"] {
    background: Highlight;
    color: HighlightText;
  }

  .nav-link:focus-visible,
  .nav-link:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Mobile menu ---------- */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.mobile-menu.open { max-height: 640px; }
.mobile-menu-inner { padding-bottom: 0.5rem; }

.mobile-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  /* WCAG AA: #334155 on #ffffff = 10.4:1 */
  color: #334155;
  transition: background 0.15s ease, color 0.15s ease;
}
.mobile-link:hover { background: #f1f5f9; color: #6d28d9; }
html.dark .mobile-link { color: #e2e8f0; }
html.dark .mobile-link:hover { background: #1e293b; color: #c4b5fd; }

/* ---------- Mobile link – dark-mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode
   text utilities cannot reduce the contrast of the mobile menu
   links below AA.

   Light mode:
     - default: #334155 on #ffffff = 10.4:1
     - hover:   #6d28d9 on #f1f5f9 = 8.0:1
   Dark mode:
     - default: #e2e8f0 on #020617 = 14.6:1
     - hover:   #c4b5fd on #1e293b = 8.9:1
*/

.mobile-link {
  color: #334155 !important;
}

.mobile-link:hover {
  color: #6d28d9 !important;
}

html.dark .mobile-link {
  color: #e2e8f0 !important;
}

html.dark .mobile-link:hover {
  color: #c4b5fd !important;
}

/* ---------- Mobile link – focus-visible ring ---------- */

.mobile-link:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

html.dark .mobile-link:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

@supports not selector(:focus-visible) {
  .mobile-link:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  html.dark .mobile-link:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- Mobile link – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .mobile-link {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .mobile-link:hover,
  .mobile-link:focus,
  .mobile-link:focus-visible,
  .mobile-link:active {
    transform: none !important;
    transition: none !important;
  }

  .mobile-link:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark .mobile-link:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Mobile link – forced colors ---------- */

@media (forced-colors: active) {
  .mobile-link {
    color: CanvasText;
    background: Canvas;
  }

  .mobile-link:hover {
    background: Highlight;
    color: HighlightText;
  }

  .mobile-link:focus-visible,
  .mobile-link:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: relative;
  display: grid;
  place-items: center;
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #475569;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.theme-toggle:hover { border-color: #c4b5fd; color: #6d28d9; }
html.dark .theme-toggle { color: #cbd5e1; }
html.dark .theme-toggle:hover { border-color: #7c3aed; color: #c4b5fd; }

/* ---------- Theme toggle – focus-visible ring ---------- */

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light header background and the dark-mode surface. */
#theme-toggle:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  border-color: #7c3aed;
  color: #6d28d9;
}

html.dark #theme-toggle:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  border-color: #a78bfa;
  color: #c4b5fd;
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #theme-toggle:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
    border-color: #7c3aed;
    color: #6d28d9;
  }

  html.dark #theme-toggle:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
    border-color: #a78bfa;
    color: #c4b5fd;
  }
}

/* ---------- Theme toggle – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .theme-toggle {
    transition: none !important;
  }

  .theme-toggle .theme-icon {
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  #theme-toggle:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #theme-toggle:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Theme toggle – forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  .theme-toggle {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .theme-toggle:hover {
    background: Highlight;
    color: HighlightText;
  }

  #theme-toggle:focus-visible,
  #theme-toggle:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

.theme-icon { position: absolute; transition: opacity 0.2s ease, transform 0.2s ease; }
.theme-icon-sun { opacity: 1; transform: rotate(0deg); }
.theme-icon-moon { opacity: 0; transform: rotate(-90deg); }
html.dark .theme-icon-sun { opacity: 0; transform: rotate(90deg); }
html.dark .theme-icon-moon { opacity: 1; transform: rotate(0deg); }

/* ---------- Hero ---------- */
.hero-bg {
  background:
    radial-gradient(60% 60% at 20% 10%, rgba(139, 92, 246, 0.12), transparent 60%),
    radial-gradient(50% 50% at 90% 20%, rgba(236, 72, 153, 0.10), transparent 60%),
    radial-gradient(50% 50% at 60% 90%, rgba(251, 191, 36, 0.10), transparent 60%);
}
html.dark .hero-bg {
  background:
    radial-gradient(60% 60% at 20% 10%, rgba(139, 92, 246, 0.20), transparent 60%),
    radial-gradient(50% 50% at 90% 20%, rgba(236, 72, 153, 0.16), transparent 60%),
    radial-gradient(50% 50% at 60% 90%, rgba(251, 191, 36, 0.12), transparent 60%);
}

.bg-grid {
  background-image:
    linear-gradient(to right, rgba(15, 23, 42, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15, 23, 42, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 40%, transparent 75%);
}
html.dark .bg-grid {
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
}

.gradient-text {
  background: linear-gradient(90deg, #7c3aed, #ec4899, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: #f1f5f9;
  color: #475569;
}
.chip-active {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.12), rgba(236, 72, 153, 0.12));
  color: #6d28d9;
}
html.dark .chip { background: #1e293b; color: #cbd5e1; }
html.dark .chip-active {
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.28), rgba(236, 72, 153, 0.24));
  color: #ddd6fe;
}

/* ---------- Reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Cards ---------- */
.card-lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card-lift:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -20px rgba(15, 23, 42, 0.25);
}
.card-lift.is-selected {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}

.desc-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Card select checkbox ---------- */
.card-select { cursor: pointer; }
.card-select-visual {
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1.5px solid rgba(15, 23, 42, 0.15);
  color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  backdrop-filter: blur(4px);
}
.card-select input:checked + .card-select-visual {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}
.card-select input:focus-visible + .card-select-visual {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}
html.dark .card-select-visual {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(148, 163, 184, 0.4);
}

/* ---------- Save toggle ---------- */
.save-toggle.is-saved {
  color: #e11d48;
  background: #fff1f2;
}
html.dark .save-toggle.is-saved {
  color: #fb7185;
  background: rgba(159, 18, 57, 0.35);
}

/* ---------- Profile owner actions ---------- */
.profile-owner-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.profile-owner-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 1;
  justify-content: center;
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #475569;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.profile-owner-btn:hover { border-color: #c4b5fd; color: #6d28d9; }
.profile-owner-btn-delete:hover { border-color: #fecdd3; color: #e11d48; background: #fff1f2; }
html.dark .profile-owner-btn { color: #cbd5e1; }
html.dark .profile-owner-btn:hover { border-color: #7c3aed; color: #c4b5fd; }
html.dark .profile-owner-btn-delete:hover { border-color: #9f1239; color: #fb7185; background: rgba(159, 18, 57, 0.25); }

/* ---------- Profile owner actions – dark-mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode text
   utilities (e.g. html.dark .text-slate-400) cannot reduce the contrast
   of the profile owner action buttons below AA.

   Light mode:
     - default: #475569 on #ffffff = 7.5:1
     - hover:   #6d28d9 on #ffffff = 8.4:1
     - delete hover: #e11d48 on #fff1f2 = 5.9:1
   Dark mode:
     - default: #cbd5e1 on #0f172a = 11.6:1
     - hover:   #c4b5fd on #0f172a = 9.6:1
     - delete hover: #fb7185 on rgba(159,18,57,0.25) over #0f172a ≈ 6.1:1
*/

.profile-owner-btn {
  color: #475569 !important;
}

.profile-owner-btn:hover {
  color: #6d28d9 !important;
}

.profile-owner-btn-delete:hover {
  color: #e11d48 !important;
}

html.dark .profile-owner-btn {
  color: #cbd5e1 !important;
}

html.dark .profile-owner-btn:hover {
  color: #c4b5fd !important;
}

html.dark .profile-owner-btn-delete:hover {
  color: #fb7185 !important;
}

/* ---------- Profile owner actions – focus-visible ring ---------- */

.profile-owner-btn:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

html.dark .profile-owner-btn:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

@supports not selector(:focus-visible) {
  .profile-owner-btn:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  html.dark .profile-owner-btn:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- Profile owner actions – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .profile-owner-btn {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise any hover/focus/active transform so no motion is perceived */
  .profile-owner-btn:hover,
  .profile-owner-btn:focus,
  .profile-owner-btn:focus-visible,
  .profile-owner-btn:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  .profile-owner-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark .profile-owner-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Profile owner actions – forced colors ---------- */

@media (forced-colors: active) {
  .profile-owner-btn {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .profile-owner-btn:hover {
    background: Highlight;
    color: HighlightText;
  }

  .profile-owner-btn:focus-visible,
  .profile-owner-btn:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Tabs ---------- */
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  min-height: 44px;
  min-width: 44px;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  z-index: 1;
}
.tab:hover { border-color: #c4b5fd; color: #6d28d9; }
.tab-active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}
.tab-active:hover { background: #6d28d9; border-color: #6d28d9; color: #fff; }
html.dark .tab { color: #cbd5e1; }
html.dark .tab:hover { border-color: #7c3aed; color: #c4b5fd; }
html.dark .tab-active { background: #7c3aed; border-color: #7c3aed; color: #fff; }
html.dark .tab-active:hover { background: #8b5cf6; border-color: #8b5cf6; }

/* ---------- Tabs – focus-visible ring ---------- */

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light chip background and the dark-mode surface. */
.tab:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Active tab uses a dark slate fill in light mode – add a white inner
   ring so the violet outline stays visible against the dark fill. */
.tab-active:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark .tab:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Active tab in dark mode uses the brand violet fill – add a dark inner
   ring so the light violet outline stays visible. */
html.dark .tab-active:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  .tab:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  .tab-active:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  html.dark .tab:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  html.dark .tab-active:focus {
    outline-color: #c4b5fd;
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* ---------- Tabs – small screens ---------- */

/* On very narrow viewports the tab row wraps; keep the 44px target
   so each chip remains easy to tap. */
@media (max-width: 480px) {
  .tab {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ---------- Tabs – dark-mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode
   text utilities (e.g. html.dark .text-slate-400) cannot reduce the
   contrast of the category tabs below AA.

   Light mode:
     - default: #475569 on #ffffff = 7.5:1
     - hover:   #6d28d9 on #ffffff = 8.4:1
     - active:  #ffffff on #0f172a = 17.9:1
   Dark mode:
     - default: #cbd5e1 on #0f172a = 11.6:1
     - hover:   #c4b5fd on #0f172a = 9.6:1
     - active:  #ffffff on #7c3aed = 5.9:1
*/

.tab {
  color: #475569 !important;
}

.tab:hover {
  color: #6d28d9 !important;
}

.tab-active {
  color: #ffffff !important;
}

.tab-active:hover {
  color: #ffffff !important;
}

html.dark .tab {
  color: #cbd5e1 !important;
}

html.dark .tab:hover {
  color: #c4b5fd !important;
}

html.dark .tab-active {
  color: #ffffff !important;
}

html.dark .tab-active:hover {
  color: #ffffff !important;
}

/* ---------- Tabs – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .tab {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise any hover/focus/active transform so no motion is perceived */
  .tab:hover,
  .tab:focus,
  .tab:focus-visible,
  .tab:active,
  .tab-active:hover,
  .tab-active:focus,
  .tab-active:focus-visible,
  .tab-active:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  .tab:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  .tab-active:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  html.dark .tab:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }

  html.dark .tab-active:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }
}

/* ---------- Tabs – forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  .tab {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .tab:hover {
    background: Highlight;
    color: HighlightText;
  }

  .tab-active {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }

  .tab:focus-visible,
  .tab:focus,
  .tab-active:focus-visible,
  .tab-active:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Inbox tabs ---------- */
.inbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}
.inbox-tab:hover { border-color: #c4b5fd; color: #6d28d9; }
.inbox-tab-active { background: #0f172a; border-color: #0f172a; color: #fff; }
.inbox-tab-active:hover { background: #6d28d9; border-color: #6d28d9; color: #fff; }
html.dark .inbox-tab { color: #cbd5e1; }
html.dark .inbox-tab:hover { border-color: #7c3aed; color: #c4b5fd; }
html.dark .inbox-tab-active { background: #7c3aed; border-color: #7c3aed; color: #fff; }

.inbox-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
}
html.dark .inbox-tab-count { background: rgba(255, 255, 255, 0.15); }

/* ---------- Inputs ---------- */
.auth-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-input::placeholder { color: var(--text-subtle); }
.auth-input:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
.auth-input-error {
  border-color: #e11d48 !important;
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12) !important;
}
html.dark .auth-input {
  background: #0f172a;
  color: #f1f5f9;
  border-color: #334155;
}
html.dark .auth-input::placeholder { color: #94a3b8; }
html.dark .auth-input:focus { border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2); }

/* ---------- Search clear button ---------- */
.catalog-search-clear {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.catalog-search-clear:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.catalog-search-clear:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}
.catalog-search-clear.hidden {
  display: none;
}
html.dark .catalog-search-clear {
  color: #94a3b8;
}
html.dark .catalog-search-clear:hover {
  background: #1e293b;
  color: #f1f5f9;
}
html.dark .catalog-search-clear:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Hide native search clear (WebKit) so our custom button is the only one */
#catalog-search::-webkit-search-cancel-button,
#catalog-search::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

@media (prefers-reduced-motion: reduce) {
  .catalog-search-clear {
    transition: none !important;
  }
}

.catalog-select {
  width: 100%;
  padding: 0.65rem 2.25rem 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.catalog-select:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
html.dark .catalog-select {
  background-color: #0f172a;
  color: #f1f5f9;
  border-color: #334155;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
html.dark .catalog-select:focus { border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2); }
html.dark .catalog-select option { background: #0f172a; color: #f1f5f9; }

.auth-error {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #e11d48;
  min-height: 1rem;
}
html.dark .auth-error { color: #fb7185; }

/* ---------- Auth form – dark-mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode
   text utilities (e.g. html.dark .text-slate-400) cannot reduce the
   contrast of the auth form fields below AA.

   Light mode:
     - input text: #0f172a on #ffffff = 17.9:1
     - placeholder: #94a3b8 on #ffffff = 3.0:1 (decorative, not required)
     - error text: #e11d48 on #ffffff = 5.9:1
   Dark mode:
     - input text: #f1f5f9 on #0f172a = 15.9:1
     - placeholder: #94a3b8 on #0f172a = 6.9:1
     - error text: #fb7185 on #0f172a = 6.1:1
*/

.auth-input {
  color: #0f172a !important;
}

.auth-input::placeholder {
  color: #94a3b8 !important;
}

html.dark .auth-input {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

html.dark .auth-input::placeholder {
  color: #94a3b8 !important;
}

.auth-error {
  color: #e11d48 !important;
}

html.dark .auth-error {
  color: #fb7185 !important;
}

/* ---------- Auth role button – dark-mode contrast (WCAG AA) ----------
   Re-assert the active role button colors so generic dark-mode text
   utilities cannot reduce the contrast below AA.

   Light mode:
     - active: #6d28d9 on #f5f3ff = 8.4:1
   Dark mode:
     - active: #ddd6fe on rgba(124,58,237,0.2) over #0f172a ≈ 9.6:1
*/

.auth-role-active {
  color: #6d28d9 !important;
}

html.dark .auth-role-active {
  color: #ddd6fe !important;
}

/* ---------- Auth form – prefers-reduced-motion guard ----------
   Disable all transitions/animations on the auth inputs, error
   messages and role buttons so users who prefer reduced motion
   are not exposed to focus/hover motion. */

@media (prefers-reduced-motion: reduce) {
  .auth-input,
  .auth-error,
  .auth-role-btn,
  .auth-role-active {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .auth-input:hover,
  .auth-input:focus,
  .auth-input:focus-visible,
  .auth-input:active,
  .auth-role-btn:hover,
  .auth-role-btn:focus,
  .auth-role-btn:focus-visible,
  .auth-role-btn:active,
  .auth-role-active:hover,
  .auth-role-active:focus,
  .auth-role-active:focus-visible,
  .auth-role-active:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  .auth-input:focus,
  .auth-input:focus-visible {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15) !important;
  }

  html.dark .auth-input:focus,
  html.dark .auth-input:focus-visible {
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2) !important;
  }

  .auth-role-btn:focus-visible,
  .auth-role-active:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark .auth-role-btn:focus-visible,
  html.dark .auth-role-active:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Auth form – forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  .auth-input {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .auth-input:focus,
  .auth-input:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }

  .auth-error {
    color: CanvasText;
  }

  .auth-role-btn {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .auth-role-btn:hover {
    background: Highlight;
    color: HighlightText;
  }

  .auth-role-active {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }

  .auth-role-btn:focus-visible,
  .auth-role-active:focus-visible,
  .auth-role-btn:focus,
  .auth-role-active:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }
}

/* ---------- Auth modal ---------- */
.auth-modal { animation: fadeIn 0.2s ease; }
.auth-panel { animation: slideUp 0.25s ease; }

/* ---------- Auth modal – close button + submit button a11y ---------- */

/* WCAG 2.5.5 – minimum 44x44px touch target for the auth modal's
   close button and the primary submit button so keyboard and mobile
   users can dismiss or submit the auth form reliably. */
#auth-modal [data-auth-close],
#auth-form button[type="submit"] {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light panel background and the dark-mode surface. */
#auth-modal [data-auth-close]:focus-visible,
#auth-form button[type="submit"]:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* The submit button uses a dark slate fill in light mode – add a white
   inner ring so the violet outline stays visible against the dark fill. */
#auth-form button[type="submit"]:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark #auth-modal [data-auth-close]:focus-visible,
html.dark #auth-form button[type="submit"]:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* In dark mode the submit button uses the brand violet fill – add a
   dark inner ring so the light violet outline stays visible. */
html.dark #auth-form button[type="submit"]:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #auth-modal [data-auth-close]:focus,
  #auth-form button[type="submit"]:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  #auth-form button[type="submit"]:focus {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  html.dark #auth-modal [data-auth-close]:focus,
  html.dark #auth-form button[type="submit"]:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  html.dark #auth-form button[type="submit"]:focus {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* Small screens: keep the 44px target when the button stretches */
@media (max-width: 480px) {
  #auth-modal [data-auth-close],
  #auth-form button[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion – keep the ring visible but static */
@media (prefers-reduced-motion: reduce) {
  #auth-modal [data-auth-close],
  #auth-form button[type="submit"] {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #auth-modal [data-auth-close]:hover,
  #auth-modal [data-auth-close]:focus,
  #auth-modal [data-auth-close]:active,
  #auth-form button[type="submit"]:hover,
  #auth-form button[type="submit"]:focus,
  #auth-form button[type="submit"]:active {
    transform: none !important;
    transition: none !important;
  }

  #auth-modal [data-auth-close]:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  #auth-form button[type="submit"]:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  html.dark #auth-modal [data-auth-close]:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }

  html.dark #auth-form button[type="submit"]:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  #auth-modal [data-auth-close],
  #auth-form button[type="submit"] {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #auth-modal [data-auth-close]:hover,
  #auth-form button[type="submit"]:hover {
    background: Highlight;
    color: HighlightText;
  }

  #auth-modal [data-auth-close]:focus-visible,
  #auth-modal [data-auth-close]:focus,
  #auth-form button[type="submit"]:focus-visible,
  #auth-form button[type="submit"]:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-mode-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.auth-mode-btn:hover { color: #6d28d9; }
.auth-mode-active { background: #fff; color: #0f172a; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1); }
html.dark .auth-mode-btn { color: #94a3b8; }
html.dark .auth-mode-btn:hover { color: #c4b5fd; }
html.dark .auth-mode-active { background: #1e293b; color: #f1f5f9; }

/* ---------- Auth mode switcher – dark-mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode text
   utilities (e.g. html.dark .text-slate-400) cannot reduce the contrast
   of the auth mode switcher buttons below AA.

   Light mode:
     - inactive: #64748b on #f1f5f9 = 4.8:1 (passes AA)
     - inactive hover: #6d28d9 on #f1f5f9 = 8.0:1
     - active: #0f172a on #ffffff = 17.9:1
   Dark mode:
     - inactive: #cbd5e1 on #1e293b = 9.6:1
     - inactive hover: #c4b5fd on #1e293b = 8.9:1
     - active: #f1f5f9 on #1e293b = 12.6:1
*/

.auth-mode-btn {
  color: #64748b !important;
}

.auth-mode-btn:hover {
  color: #6d28d9 !important;
}

.auth-mode-active {
  color: #0f172a !important;
}

html.dark .auth-mode-btn {
  color: #cbd5e1 !important;
}

html.dark .auth-mode-btn:hover {
  color: #c4b5fd !important;
}

html.dark .auth-mode-active {
  color: #f1f5f9 !important;
}

/* ---------- Auth mode switcher – focus-visible ring ---------- */

.auth-mode-btn:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Active button uses a white fill in light mode – add a violet inner
   ring so the outline stays visible against the light surface. */
.auth-mode-active:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

html.dark .auth-mode-btn:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

html.dark .auth-mode-active:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

@supports not selector(:focus-visible) {
  .auth-mode-btn:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  .auth-mode-active:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  html.dark .auth-mode-btn:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  html.dark .auth-mode-active:focus {
    outline-color: #c4b5fd;
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* ---------- Auth mode switcher – 44px touch target ---------- */

.auth-mode-btn {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 480px) {
  .auth-mode-btn {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ---------- Auth mode switcher – prefers-reduced-motion guard ----------
   Disable all transitions/animations on the auth mode switcher buttons
   so users who prefer reduced motion are not exposed to hover/focus
   motion. Keep the focus ring visible but static. */

@media (prefers-reduced-motion: reduce) {
  .auth-mode-btn,
  .auth-mode-active {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .auth-mode-btn:hover,
  .auth-mode-btn:focus,
  .auth-mode-btn:focus-visible,
  .auth-mode-btn:active,
  .auth-mode-active:hover,
  .auth-mode-active:focus,
  .auth-mode-active:focus-visible,
  .auth-mode-active:active {
    transform: none !important;
    transition: none !important;
  }

  .auth-mode-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  .auth-mode-active:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  html.dark .auth-mode-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }

  html.dark .auth-mode-active:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }
}

/* ---------- Auth mode switcher – forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  .auth-mode-btn {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .auth-mode-btn:hover {
    background: Highlight;
    color: HighlightText;
  }

  .auth-mode-active {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }

  .auth-mode-btn:focus-visible,
  .auth-mode-btn:focus,
  .auth-mode-active:focus-visible,
  .auth-mode-active:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

.auth-role-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.auth-role-btn:hover { border-color: #c4b5fd; color: #6d28d9; }
.auth-role-active {
  border-color: #7c3aed;
  background: #f5f3ff;
  color: #6d28d9;
}
html.dark .auth-role-btn { color: #cbd5e1; }
html.dark .auth-role-btn:hover { border-color: #7c3aed; color: #c4b5fd; }
html.dark .auth-role-active { border-color: #a78bfa; background: rgba(124, 58, 237, 0.2); color: #ddd6fe; }

/* ---------- User dropdown ---------- */
.user-dropdown { animation: slideUp 0.15s ease; }

/* ---------- User dropdown – dark-mode contrast (WCAG AA) ----------
   Re-assert the base surface, border and text colors with !important
   so generic dark-mode text utilities (e.g. html.dark .text-slate-400)
   cannot reduce the contrast of the account menu below AA.

   Light mode:
     - surface: #ffffff
     - border:  #e2e8f0
     - name:    #0f172a on #ffffff = 17.9:1
     - email:   #64748b on #ffffff = 4.8:1
   Dark mode:
     - surface: #0f172a
     - border:  #334155
     - name:    #f1f5f9 on #0f172a = 15.9:1
     - email:   #cbd5e1 on #0f172a = 11.6:1
*/

#user-dropdown {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}

#user-dropdown #user-dropdown-name {
  color: #0f172a !important;
}

#user-dropdown #user-dropdown-email {
  color: #64748b !important;
}

html.dark #user-dropdown {
  background: #0f172a !important;
  border-color: #334155 !important;
}

html.dark #user-dropdown #user-dropdown-name {
  color: #f1f5f9 !important;
}

html.dark #user-dropdown #user-dropdown-email {
  color: #cbd5e1 !important;
}

/* ---------- User dropdown – prefers-reduced-motion guard ----------
   Disable the entrance animation and any hover/focus transitions on
   the account menu so users who prefer reduced motion are not exposed
   to motion. */

@media (prefers-reduced-motion: reduce) {
  .user-dropdown,
  #user-dropdown {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }

  #user-dropdown a,
  #user-dropdown [data-auth-logout] {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #user-dropdown a:hover,
  #user-dropdown a:focus,
  #user-dropdown a:active,
  #user-dropdown [data-auth-logout]:hover,
  #user-dropdown [data-auth-logout]:focus,
  #user-dropdown [data-auth-logout]:active {
    transform: none !important;
    transition: none !important;
  }
}

/* ---------- User dropdown – forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  #user-dropdown {
    background: Canvas !important;
    border: 1px solid CanvasText !important;
  }

  #user-dropdown #user-dropdown-name,
  #user-dropdown #user-dropdown-email {
    color: CanvasText !important;
  }
}

/* ---------- User dropdown links + logout – 44px touch targets + focus-visible ring ---------- */

/* WCAG 2.5.5 – minimum 44x44px touch target for mobile users.
   Every link and the logout button inside the account menu
   (#user-dropdown) must be easy to tap on small screens. */
#user-dropdown a,
#user-dropdown [data-auth-logout] {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light dropdown surface and the dark-mode surface. */
#user-dropdown a:focus-visible,
#user-dropdown [data-auth-logout]:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark #user-dropdown a:focus-visible,
html.dark #user-dropdown [data-auth-logout]:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #user-dropdown a:focus,
  #user-dropdown [data-auth-logout]:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  html.dark #user-dropdown a:focus,
  html.dark #user-dropdown [data-auth-logout]:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* Small screens: keep the 44px target when the menu stretches */
@media (max-width: 480px) {
  #user-dropdown a,
  #user-dropdown [data-auth-logout] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion – keep the ring visible but static */
@media (prefers-reduced-motion: reduce) {
  #user-dropdown a,
  #user-dropdown [data-auth-logout] {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #user-dropdown a:hover,
  #user-dropdown a:focus,
  #user-dropdown a:active,
  #user-dropdown [data-auth-logout]:hover,
  #user-dropdown [data-auth-logout]:focus,
  #user-dropdown [data-auth-logout]:active {
    transform: none !important;
    transition: none !important;
  }

  #user-dropdown a:focus-visible,
  #user-dropdown [data-auth-logout]:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #user-dropdown a:focus-visible,
  html.dark #user-dropdown [data-auth-logout]:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  #user-dropdown a,
  #user-dropdown [data-auth-logout] {
    color: CanvasText;
    background: Canvas;
  }

  #user-dropdown a:hover,
  #user-dropdown [data-auth-logout]:hover {
    background: Highlight;
    color: HighlightText;
  }

  #user-dropdown a:focus-visible,
  #user-dropdown a:focus,
  #user-dropdown [data-auth-logout]:focus-visible,
  #user-dropdown [data-auth-logout]:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Header menu buttons – 44px touch targets + focus-visible ring ---------- */

/* WCAG 2.5.5 – minimum 44x44px touch target for mobile users.
   Both the account menu toggle (#user-menu-toggle) and the mobile
   menu toggle (#menu-toggle) must be easy to tap on small screens. */
#user-menu-toggle,
#menu-toggle {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light header background and the dark-mode surface. */
#user-menu-toggle:focus-visible,
#menu-toggle:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  border-color: #7c3aed;
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark #user-menu-toggle:focus-visible,
html.dark #menu-toggle:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  border-color: #a78bfa;
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #user-menu-toggle:focus,
  #menu-toggle:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
    border-color: #7c3aed;
  }

  html.dark #user-menu-toggle:focus,
  html.dark #menu-toggle:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
    border-color: #a78bfa;
  }
}

/* Small screens: keep the 44px target when the buttons shrink */
@media (max-width: 480px) {
  #user-menu-toggle,
  #menu-toggle {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion – keep the ring visible but static */
@media (prefers-reduced-motion: reduce) {
  #user-menu-toggle,
  #menu-toggle {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #user-menu-toggle:hover,
  #user-menu-toggle:focus,
  #user-menu-toggle:active,
  #menu-toggle:hover,
  #menu-toggle:focus,
  #menu-toggle:active {
    transform: none !important;
    transition: none !important;
  }

  #user-menu-toggle:focus-visible,
  #menu-toggle:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #user-menu-toggle:focus-visible,
  html.dark #menu-toggle:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  #user-menu-toggle,
  #menu-toggle {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #user-menu-toggle:hover,
  #menu-toggle:hover {
    background: Highlight;
    color: HighlightText;
  }

  #user-menu-toggle:focus-visible,
  #menu-toggle:focus-visible,
  #user-menu-toggle:focus,
  #menu-toggle:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Bulk action bar ---------- */
#bulk-action-bar {
  transform: translateY(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  visibility: hidden;
}
#bulk-action-bar.is-visible {
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}

/* Reserve space for the bar only while it is actually visible,
   so the "Rodyti daugiau" button is never covered. */
body.has-bulk-bar .catalog-content {
  padding-bottom: 5.5rem;
}
@media (min-width: 640px) {
  body.has-bulk-bar .catalog-content {
    padding-bottom: 6rem;
  }
}
body.has-bulk-bar #catalog-load-more-wrap {
  margin-bottom: 1rem;
}

@media (prefers-reduced-motion: reduce) {
  #bulk-action-bar {
    transition: none;
  }
}

/* ---------- Active filters ---------- */
.active-filters-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.active-filters-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
}
.active-filters-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
}
.active-filters-actions {
  display: flex;
  gap: 0.4rem;
  margin-left: auto;
}
.active-filters-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.85rem;
  border-radius: 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}
.active-filters-btn:hover { border-color: #c4b5fd; color: #6d28d9; }
.active-filters-btn-clear:hover { border-color: #fecdd3; color: #e11d48; background: #fff1f2; }
html.dark .active-filters-btn { color: #cbd5e1; }
html.dark .active-filters-btn:hover { border-color: #7c3aed; color: #c4b5fd; }
html.dark .active-filters-btn-clear:hover { border-color: #9f1239; color: #fb7185; background: rgba(159, 18, 57, 0.25); }

/* ---------- Active filters buttons – focus-visible ring ---------- */

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light chip background and the dark-mode surface. */
#active-filters-clear:focus-visible,
#active-filters-copy:focus-visible,
.active-filters-btn:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Clear button uses a rose hover accent – keep the violet ring for
   consistency with the rest of the UI, but ensure it is not clipped. */
#active-filters-clear:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark #active-filters-clear:focus-visible,
html.dark #active-filters-copy:focus-visible,
html.dark .active-filters-btn:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #active-filters-clear:focus,
  #active-filters-copy:focus,
  .active-filters-btn:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  html.dark #active-filters-clear:focus,
  html.dark #active-filters-copy:focus,
  html.dark .active-filters-btn:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- Active filters buttons – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .active-filters-btn {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise any hover/focus transform so no motion is perceived */
  .active-filters-btn:hover,
  .active-filters-btn:focus,
  .active-filters-btn:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  #active-filters-clear:focus-visible,
  #active-filters-copy:focus-visible,
  .active-filters-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #active-filters-clear:focus-visible,
  html.dark #active-filters-copy:focus-visible,
  html.dark .active-filters-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Active filters buttons – dark mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode text
   utilities (e.g. html.dark .text-slate-400) cannot reduce the contrast
   of the filter action buttons below AA.

   Light mode:
     - default: #475569 on #ffffff = 7.5:1
     - hover:   #6d28d9 on #ffffff = 8.4:1
   Dark mode:
     - default: #cbd5e1 on #0f172a = 11.6:1
     - hover:   #c4b5fd on #0f172a = 9.6:1
*/

.active-filters-btn {
  color: #475569 !important;
}

.active-filters-btn:hover {
  color: #6d28d9 !important;
}

html.dark .active-filters-btn {
  color: #cbd5e1 !important;
}

html.dark .active-filters-btn:hover {
  color: #c4b5fd !important;
}

/* Clear button keeps its rose accent on hover – re-assert for AA. */
.active-filters-btn-clear:hover {
  color: #e11d48 !important;
}

html.dark .active-filters-btn-clear:hover {
  color: #fb7185 !important;
}

/* ---------- Active filters buttons – forced colors ---------- */

@media (forced-colors: active) {
  .active-filters-btn {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .active-filters-btn:hover {
    background: Highlight;
    color: HighlightText;
  }

  #active-filters-clear:focus-visible,
  #active-filters-copy:focus-visible,
  .active-filters-btn:focus-visible,
  #active-filters-clear:focus,
  #active-filters-copy:focus,
  .active-filters-btn:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }
}

/* ---------- Active filters actions – small screens ---------- */

/* On very narrow viewports the two buttons may wrap; keep the 44px
   touch target and let them stretch so they remain easy to tap. */
@media (max-width: 480px) {
  .active-filters-actions {
    width: 100%;
    margin-left: 0;
  }

  .active-filters-actions .active-filters-btn {
    flex: 1 1 auto;
    min-height: 44px;
  }
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  /* WCAG AA: #6d28d9 on #f5f3ff = 8.4:1 */
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}
.filter-chip button {
  display: inline-grid;
  place-items: center;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}
.filter-chip button:hover { opacity: 1; }
.filter-chip button:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  opacity: 1;
}
html.dark .filter-chip {
  /* WCAG AA: #ddd6fe on rgba(124,58,237,0.2) over #0f172a ≈ 9.6:1 */
  background: rgba(124, 58, 237, 0.2);
  color: #ddd6fe;
  border-color: rgba(167, 139, 250, 0.4);
}
html.dark .filter-chip button:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* ---------- Filter chip – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .filter-chip,
  .filter-chip button {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Filter chip – forced colors ---------- */

@media (forced-colors: active) {
  .filter-chip {
    background: Canvas;
    color: CanvasText;
    border: 1px solid CanvasText;
  }

  .filter-chip button:focus-visible,
  .filter-chip button:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }
}

/* ---------- Skeleton ---------- */
.skeleton-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
}
.skeleton-block {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 0.5rem;
}
html.dark .skeleton-block {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}
.skeleton-hero { height: 10rem; border-radius: 0; }
.skeleton-line { height: 0.9rem; }
.skeleton-line-sm { height: 0.65rem; }
.skeleton-pill { height: 1.5rem; width: 4rem; border-radius: 999px; }

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- FAQ ---------- */
.faq-item { overflow: hidden; }
.faq-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  border-radius: 0.75rem;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.faq-trigger:hover { background: #f8fafc; }
html.dark .faq-trigger:hover { background: #1e293b; }
.faq-trigger::-webkit-details-marker { display: none; }

/* ---------- FAQ trigger – focus-visible ring ---------- */

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light card background and the dark-mode surface. */
.faq-trigger:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

html.dark .faq-trigger:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  .faq-trigger:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  html.dark .faq-trigger:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- FAQ trigger – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .faq-trigger {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .faq-trigger:hover,
  .faq-trigger:focus,
  .faq-trigger:focus-visible,
  .faq-trigger:active {
    transform: none !important;
    transition: none !important;
  }

  .faq-trigger:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark .faq-trigger:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- FAQ trigger – forced colors ---------- */

@media (forced-colors: active) {
  .faq-trigger {
    color: CanvasText;
    background: Canvas;
  }

  .faq-trigger:hover {
    background: Highlight;
    color: HighlightText;
  }

  .faq-trigger:focus-visible,
  .faq-trigger:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

.faq-icon {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--text-subtle);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.faq-item[open] .faq-icon { transform: rotate(180deg); }
.faq-panel {
  padding: 0 1.25rem 1.1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ---------- Footer ---------- */
.footer-link {
  font-size: 0.875rem;
  /* WCAG AA: #64748b on #ffffff = 4.8:1 */
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.footer-link:hover { color: #6d28d9; }
html.dark .footer-link:hover { color: #c4b5fd; }

/* ---------- Footer link – dark-mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode
   text utilities cannot reduce the contrast of the footer links
   below AA.

   Light mode:
     - default: #64748b on #ffffff = 4.8:1
     - hover:   #6d28d9 on #ffffff = 8.4:1
   Dark mode:
     - default: #cbd5e1 on #020617 = 12.6:1
     - hover:   #c4b5fd on #020617 = 10.1:1
*/

.footer-link {
  color: #64748b !important;
}

.footer-link:hover {
  color: #6d28d9 !important;
}

html.dark .footer-link {
  color: #cbd5e1 !important;
}

html.dark .footer-link:hover {
  color: #c4b5fd !important;
}

/* ---------- Footer link – focus-visible ring ---------- */

.footer-link:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  border-radius: 0.25rem;
}

html.dark .footer-link:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

@supports not selector(:focus-visible) {
  .footer-link:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
    border-radius: 0.25rem;
  }

  html.dark .footer-link:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- Footer link – reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .footer-link {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .footer-link:hover,
  .footer-link:focus,
  .footer-link:focus-visible,
  .footer-link:active {
    transform: none !important;
    transition: none !important;
  }

  .footer-link:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark .footer-link:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Footer link – forced colors ---------- */

@media (forced-colors: active) {
  .footer-link {
    color: CanvasText;
  }

  .footer-link:hover {
    color: Highlight;
  }

  .footer-link:focus-visible,
  .footer-link:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    color: Highlight;
  }
}

.footer-social {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s ease;
}
.footer-social:hover { border-color: #c4b5fd; color: #6d28d9; }
html.dark .footer-social:hover { border-color: #7c3aed; color: #c4b5fd; }

/* ---------- Toast ---------- */
#toast-container {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 22rem;
}
.toast-item.toast-visible { opacity: 1; transform: translateY(0); }
.toast-item.toast-error { background: #be123c; }
.toast-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: #a78bfa;
  flex-shrink: 0;
}
.toast-item.toast-error .toast-dot { background: #fecdd3; }

/* ---------- Toast – dark-mode contrast (WCAG AA) ----------
   Re-assert the toast surface and text colors with !important so
   generic dark-mode text utilities cannot reduce the contrast below
   AA.

   Light mode:
     - default: #ffffff on #0f172a = 17.9:1
     - error:   #ffffff on #be123c = 6.3:1
   Dark mode:
     - default: #f1f5f9 on #1e293b = 12.6:1
     - error:   #ffffff on #9f1239 = 7.1:1
*/

.toast-item {
  color: #ffffff !important;
  background: #0f172a !important;
}

.toast-item.toast-error {
  color: #ffffff !important;
  background: #be123c !important;
}

html.dark .toast-item {
  color: #f1f5f9 !important;
  background: #1e293b !important;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

html.dark .toast-item.toast-error {
  color: #ffffff !important;
  background: #9f1239 !important;
}

/* ---------- Toast – prefers-reduced-motion guard ----------
   Disable the slide/fade entrance animation and any transitions on
   the toast items so users who prefer reduced motion are not exposed
   to motion. The toast still appears/disappears, just without motion. */

@media (prefers-reduced-motion: reduce) {
  .toast-item {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .toast-item.toast-visible {
    transform: none !important;
    transition: none !important;
  }

  .toast-item:hover,
  .toast-item:focus,
  .toast-item:active {
    transform: none !important;
    transition: none !important;
  }
}

/* ---------- Toast – forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  .toast-item {
    background: Canvas !important;
    color: CanvasText !important;
    border: 1px solid CanvasText;
    box-shadow: none !important;
  }

  .toast-item.toast-error {
    background: Canvas !important;
    color: CanvasText !important;
    border: 1px solid CanvasText;
  }

  .toast-dot {
    background: CanvasText !important;
  }

  .toast-item.toast-error .toast-dot {
    background: CanvasText !important;
  }
}

/* ---------- Card fade in ---------- */
.card-fade-in { animation: cardFadeIn 0.4s ease; }
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Load more ---------- */
#catalog-load-more-wrap.is-visible { display: flex; }

/* ---------- Load more button – 44px touch target + focus-visible ring ---------- */

/* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
#catalog-load-more {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light button background and the dark-mode surface. */
#catalog-load-more:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark #catalog-load-more:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #catalog-load-more:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  html.dark #catalog-load-more:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* Small screens: keep the 44px target when the button stretches */
@media (max-width: 480px) {
  #catalog-load-more {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion – keep the ring visible but static */
@media (prefers-reduced-motion: reduce) {
  #catalog-load-more {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #catalog-load-more:hover,
  #catalog-load-more:focus,
  #catalog-load-more:active {
    transform: none !important;
    transition: none !important;
  }

  #catalog-load-more:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #catalog-load-more:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  #catalog-load-more {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #catalog-load-more:hover {
    background: Highlight;
    color: HighlightText;
  }

  #catalog-load-more:focus-visible,
  #catalog-load-more:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Dark mode text contrast fixes (WCAG AA) ---------- */
html.dark .text-slate-400 { color: #94a3b8; }
html.dark .text-slate-500 { color: #cbd5e1; }
html.dark .text-slate-600 { color: #e2e8f0; }

/* Kortelių aprašymai – tamsiame režime pakeltas kontrastas */
html.dark .desc-clamp { color: #cbd5e1; }

/* Skeleton tamsiame režime – matomas, bet ne per ryškus */
html.dark .skeleton-card { background: #0f172a; border-color: #334155; }

/* Focus visible */
:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
}
html.dark :focus-visible { outline-color: #a78bfa; }

/* ---------- Filters toggle (mobile) – 44px touch target + focus ring ---------- */

/* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
#filters-toggle {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light panel background and the dark-mode surface. */
#filters-toggle:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark #filters-toggle:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #filters-toggle:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  html.dark #filters-toggle:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* Small screens: keep the 44px target when the toggle stretches */
@media (max-width: 480px) {
  #filters-toggle {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion – keep the ring visible but static */
@media (prefers-reduced-motion: reduce) {
  #filters-toggle {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #filters-toggle:hover,
  #filters-toggle:focus,
  #filters-toggle:active {
    transform: none !important;
    transition: none !important;
  }

  #filters-toggle:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #filters-toggle:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  #filters-toggle {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #filters-toggle:hover {
    background: Highlight;
    color: HighlightText;
  }

  #filters-toggle:focus-visible,
  #filters-toggle:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Select-all-visible checkbox label – 44px touch target + focus ring ---------- */

/* WCAG 2.5.5 – minimum 44x44px touch target for mobile users.
   The label wraps the checkbox, so making the label itself a 44px
   target ensures the whole row is easy to tap. */
label[for="select-all-visible"] {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light card background and the dark-mode surface. */
label[for="select-all-visible"]:focus-within {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  border-color: #7c3aed;
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark label[for="select-all-visible"]:focus-within {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  border-color: #a78bfa;
}

/* Fallback for browsers without :focus-within support */
@supports not selector(:focus-within) {
  label[for="select-all-visible"]:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
    border-color: #7c3aed;
  }

  html.dark label[for="select-all-visible"]:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
    border-color: #a78bfa;
  }
}

/* The checkbox itself – keep a visible focus ring on the native input
   as well, so keyboard users see focus even if :focus-within is not
   supported by the browser. */
#select-all-visible:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

html.dark #select-all-visible:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* Small screens: keep the 44px target when the label stretches */
@media (max-width: 480px) {
  label[for="select-all-visible"] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion – keep the ring visible but static */
@media (prefers-reduced-motion: reduce) {
  label[for="select-all-visible"],
  #select-all-visible {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  label[for="select-all-visible"]:hover,
  label[for="select-all-visible"]:focus,
  label[for="select-all-visible"]:active {
    transform: none !important;
    transition: none !important;
  }

  label[for="select-all-visible"]:focus-within {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark label[for="select-all-visible"]:focus-within {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }

  #select-all-visible:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #select-all-visible:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  label[for="select-all-visible"] {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  label[for="select-all-visible"]:hover {
    background: Highlight;
    color: HighlightText;
  }

  label[for="select-all-visible"]:focus-within,
  label[for="select-all-visible"]:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }

  #select-all-visible:focus-visible,
  #select-all-visible:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }
}

/* ---------- Request recipients chips ---------- */

/* The recipient list inside the request modal (#request-recipients)
   renders one chip per selected creator. Each chip shows the creator's
   name and a small avatar. The styles below give the chips a readable
   surface in both themes, meet WCAG AA contrast, and respect the
   user's reduced-motion preference. */

#request-recipients {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.request-recipient-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.3rem 0.65rem 0.3rem 0.3rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  /* WCAG AA: #4c1d95 on #f5f3ff = 10.4:1 */
  background: #f5f3ff;
  color: #4c1d95;
  border: 1px solid #ddd6fe;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

.request-recipient-chip .request-recipient-avatar {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  border-radius: 9999px;
  overflow: hidden;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 0.625rem;
  font-weight: 700;
}

.request-recipient-chip .request-recipient-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.request-recipient-chip .request-recipient-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Optional "+N" overflow chip shown when many creators are selected. */
.request-recipient-chip.request-recipient-more {
  padding: 0.3rem 0.65rem;
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
}

/* ---------- Request recipients chips – dark mode (WCAG AA) ----------
   Re-assert the chip colors with !important so generic dark-mode text
   utilities (e.g. html.dark .text-slate-400) cannot reduce the contrast
   below AA.

   Light mode:
     - chip text: #4c1d95 on #f5f3ff = 10.4:1
     - more chip: #5b21b6 on #ede9fe = 8.9:1
   Dark mode:
     - chip text: #ddd6fe on rgba(76,29,149,0.35) over #0f172a ≈ 8.6:1
     - more chip: #e9d5ff on rgba(91,33,182,0.45) over #0f172a ≈ 8.1:1
*/

.request-recipient-chip {
  color: #4c1d95 !important;
}

.request-recipient-chip.request-recipient-more {
  color: #5b21b6 !important;
}

.dark .request-recipient-chip {
  background: rgba(76, 29, 149, 0.35) !important;
  color: #ddd6fe !important;
  border-color: rgba(167, 139, 250, 0.45) !important;
}

.dark .request-recipient-chip .request-recipient-avatar {
  background: rgba(124, 58, 237, 0.35);
  color: #ddd6fe;
}

.dark .request-recipient-chip.request-recipient-more {
  background: rgba(91, 33, 182, 0.45) !important;
  color: #e9d5ff !important;
  border-color: rgba(196, 181, 253, 0.5) !important;
}

/* ---------- Request recipients chips – focus-visible ring ---------- */

.request-recipient-chip:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

.dark .request-recipient-chip:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

@supports not selector(:focus-visible) {
  .request-recipient-chip:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  .dark .request-recipient-chip:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }
}

/* ---------- Request recipients chips – reduced motion ----------
   Disable all transitions/animations on the chips and their inner
   elements so users who prefer reduced motion are not exposed to
   hover/focus motion. */

@media (prefers-reduced-motion: reduce) {
  .request-recipient-chip,
  .request-recipient-chip * {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  .request-recipient-chip:hover,
  .request-recipient-chip:focus,
  .request-recipient-chip:focus-visible,
  .request-recipient-chip:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  .request-recipient-chip:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  .dark .request-recipient-chip:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* ---------- Request recipients chips – forced colors ---------- */

@media (forced-colors: active) {
  .request-recipient-chip {
    background: Canvas;
    color: CanvasText;
    border: 1px solid CanvasText;
  }

  .request-recipient-chip .request-recipient-avatar {
    background: Canvas;
    color: CanvasText;
    border: 1px solid CanvasText;
  }

  .request-recipient-chip:focus-visible,
  .request-recipient-chip:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Request modal – submit button + form inputs a11y ---------- */

/* WCAG 2.5.5 – minimum 44x44px touch target for the request submit
   button and every input/textarea inside the request form. */
#request-form button[type="submit"],
#request-form .auth-input,
#request-form textarea,
#request-form input,
#request-form select {
  min-height: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* The submit button is the primary action – make it a full-width,
   comfortably tappable target on every viewport. */
#request-form button[type="submit"] {
  min-width: 44px;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.15s ease;
}

/* High-contrast, always-visible focus ring for keyboard users. The
   ring is drawn with both an outline and a box-shadow halo so it
   stays visible against the light button background and the
   dark-mode surface. */
#request-form button[type="submit"]:focus-visible,
#request-form .auth-input:focus-visible,
#request-form textarea:focus-visible,
#request-form input:focus-visible,
#request-form select:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* The submit button uses a dark slate fill in light mode – add a
   white inner ring so the violet outline stays visible against the
   dark fill. */
#request-form button[type="submit"]:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark #request-form button[type="submit"]:focus-visible,
html.dark #request-form .auth-input:focus-visible,
html.dark #request-form textarea:focus-visible,
html.dark #request-form input:focus-visible,
html.dark #request-form select:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* In dark mode the submit button uses the brand violet fill – add a
   dark inner ring so the light violet outline stays visible. */
html.dark #request-form button[type="submit"]:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #request-form button[type="submit"]:focus,
  #request-form .auth-input:focus,
  #request-form textarea:focus,
  #request-form input:focus,
  #request-form select:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  #request-form button[type="submit"]:focus {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  html.dark #request-form button[type="submit"]:focus,
  html.dark #request-form .auth-input:focus,
  html.dark #request-form textarea:focus,
  html.dark #request-form input:focus,
  html.dark #request-form select:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  html.dark #request-form button[type="submit"]:focus {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* Small screens: keep the 44px target when the button stretches */
@media (max-width: 480px) {
  #request-form button[type="submit"],
  #request-form .auth-input,
  #request-form textarea,
  #request-form input,
  #request-form select {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion – keep the ring visible but static */
@media (prefers-reduced-motion: reduce) {
  #request-form button[type="submit"],
  #request-form .auth-input,
  #request-form textarea,
  #request-form input,
  #request-form select {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #request-form button[type="submit"]:hover,
  #request-form button[type="submit"]:focus,
  #request-form button[type="submit"]:active {
    transform: none !important;
    transition: none !important;
  }

  #request-form button[type="submit"]:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  html.dark #request-form button[type="submit"]:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }

  #request-form .auth-input:focus-visible,
  #request-form textarea:focus-visible,
  #request-form input:focus-visible,
  #request-form select:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #request-form .auth-input:focus-visible,
  html.dark #request-form textarea:focus-visible,
  html.dark #request-form input:focus-visible,
  html.dark #request-form select:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  #request-form button[type="submit"],
  #request-form .auth-input,
  #request-form textarea,
  #request-form input,
  #request-form select {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #request-form button[type="submit"]:hover {
    background: Highlight;
    color: HighlightText;
  }

  #request-form button[type="submit"]:focus-visible,
  #request-form button[type="submit"]:focus,
  #request-form .auth-input:focus-visible,
  #request-form .auth-input:focus,
  #request-form textarea:focus-visible,
  #request-form textarea:focus,
  #request-form input:focus-visible,
  #request-form input:focus,
  #request-form select:focus-visible,
  #request-form select:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }
}

/* ---------- Profile form modal – submit/cancel a11y ---------- */

/* WCAG 2.5.5 – minimum 44x44px touch target for the profile edit
   modal's primary (save) and secondary (cancel) actions. */
#profile-form button[type="submit"],
#profile-form [data-profile-form-close] {
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light panel background and the dark-mode surface. */
#profile-form button[type="submit"]:focus-visible,
#profile-form [data-profile-form-close]:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* The submit button uses a dark slate fill in light mode – add a white
   inner ring so the violet outline stays visible against the dark fill. */
#profile-form button[type="submit"]:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* Dark mode – lighter violet ring for AA contrast on dark surfaces. */
html.dark #profile-form button[type="submit"]:focus-visible,
html.dark #profile-form [data-profile-form-close]:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* In dark mode the submit button uses the brand violet fill – add a
   dark inner ring so the light violet outline stays visible. */
html.dark #profile-form button[type="submit"]:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

/* Fallback for browsers without :focus-visible support */
@supports not selector(:focus-visible) {
  #profile-form button[type="submit"]:focus,
  #profile-form [data-profile-form-close]:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  #profile-form button[type="submit"]:focus {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  html.dark #profile-form button[type="submit"]:focus,
  html.dark #profile-form [data-profile-form-close]:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  html.dark #profile-form button[type="submit"]:focus {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* Small screens: keep the 44px target when the buttons stack */
@media (max-width: 480px) {
  #profile-form button[type="submit"],
  #profile-form [data-profile-form-close] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion – keep the ring visible but static */
@media (prefers-reduced-motion: reduce) {
  #profile-form button[type="submit"],
  #profile-form [data-profile-form-close] {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #profile-form button[type="submit"]:hover,
  #profile-form button[type="submit"]:focus,
  #profile-form button[type="submit"]:active,
  #profile-form [data-profile-form-close]:hover,
  #profile-form [data-profile-form-close]:focus,
  #profile-form [data-profile-form-close]:active {
    transform: none !important;
    transition: none !important;
  }

  #profile-form button[type="submit"]:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  html.dark #profile-form button[type="submit"]:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }

  #profile-form [data-profile-form-close]:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  html.dark #profile-form [data-profile-form-close]:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }
}

/* Forced colors (Windows High Contrast) */
@media (forced-colors: active) {
  #profile-form button[type="submit"],
  #profile-form [data-profile-form-close] {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #profile-form button[type="submit"]:hover,
  #profile-form [data-profile-form-close]:hover {
    background: Highlight;
    color: HighlightText;
  }

  #profile-form button[type="submit"]:focus-visible,
  #profile-form button[type="submit"]:focus,
  #profile-form [data-profile-form-close]:focus-visible,
  #profile-form [data-profile-form-close]:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* ---------- Profile avatar preview ---------- */

/* The avatar preview inside the profile edit modal (#profile-avatar-preview)
   shows the current profile image (or a fallback icon). It must stay
   legible in both themes and must not animate when the user prefers
   reduced motion. */

#profile-avatar-preview {
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

#profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#profile-avatar-preview svg,
#profile-avatar-preview i {
  width: 1.75rem;
  height: 1.75rem;
  color: inherit;
}

/* Dark mode – re-assert the surface + icon colors so generic dark-mode
   text utilities cannot reduce the contrast below AA.

   Light mode:
     - icon: #64748b on #f1f5f9 = 4.6:1 (passes AA for large icons)
   Dark mode:
     - icon: #cbd5e1 on #1e293b = 9.6:1 (passes AA) */

.dark #profile-avatar-preview {
  background: #1e293b !important;
  color: #cbd5e1 !important;
  border-color: #334155 !important;
}

/* ---------- Profile form inputs – dark-mode contrast (WCAG AA) ----------
   Re-assert the base colors with !important so generic dark-mode text
   utilities (e.g. html.dark .text-slate-400) cannot reduce the contrast
   of the profile edit form fields below AA.

   Light mode:
     - input text: #0f172a on #ffffff = 17.9:1
     - placeholder: #94a3b8 on #ffffff = 3.0:1 (decorative, not required)
     - error text: #e11d48 on #ffffff = 5.9:1
   Dark mode:
     - input text: #f1f5f9 on #0f172a = 15.9:1
     - placeholder: #94a3b8 on #0f172a = 6.9:1
     - error text: #fb7185 on #0f172a = 6.1:1 */

#profile-form .auth-input,
#profile-form textarea,
#profile-form input,
#profile-form select {
  color: #0f172a !important;
}

#profile-form .auth-input::placeholder,
#profile-form textarea::placeholder,
#profile-form input::placeholder {
  color: #94a3b8 !important;
}

.dark #profile-form .auth-input,
.dark #profile-form textarea,
.dark #profile-form input,
.dark #profile-form select {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

.dark #profile-form .auth-input::placeholder,
.dark #profile-form textarea::placeholder,
.dark #profile-form input::placeholder {
  color: #94a3b8 !important;
}

#profile-form .auth-error {
  color: #e11d48 !important;
}

.dark #profile-form .auth-error {
  color: #fb7185 !important;
}

/* ---------- Profile form – prefers-reduced-motion guard ----------
   Disable all transitions/animations on the avatar preview and the
   form inputs so users who prefer reduced motion are not exposed to
   focus/hover motion. */

@media (prefers-reduced-motion: reduce) {
  #profile-avatar-preview,
  #profile-avatar-preview *,
  #profile-form .auth-input,
  #profile-form textarea,
  #profile-form input,
  #profile-form select {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #profile-avatar-preview:hover,
  #profile-avatar-preview:focus,
  #profile-avatar-preview:active,
  #profile-form .auth-input:hover,
  #profile-form .auth-input:focus,
  #profile-form .auth-input:focus-visible,
  #profile-form .auth-input:active,
  #profile-form textarea:hover,
  #profile-form textarea:focus,
  #profile-form textarea:focus-visible,
  #profile-form textarea:active,
  #profile-form input:hover,
  #profile-form input:focus,
  #profile-form input:focus-visible,
  #profile-form input:active,
  #profile-form select:hover,
  #profile-form select:focus,
  #profile-form select:focus-visible,
  #profile-form select:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  #profile-form .auth-input:focus,
  #profile-form .auth-input:focus-visible,
  #profile-form textarea:focus,
  #profile-form textarea:focus-visible,
  #profile-form input:focus,
  #profile-form input:focus-visible,
  #profile-form select:focus,
  #profile-form select:focus-visible {
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15) !important;
  }

  .dark #profile-form .auth-input:focus,
  .dark #profile-form .auth-input:focus-visible,
  .dark #profile-form textarea:focus,
  .dark #profile-form textarea:focus-visible,
  .dark #profile-form input:focus,
  .dark #profile-form input:focus-visible,
  .dark #profile-form select:focus,
  .dark #profile-form select:focus-visible {
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2) !important;
  }
}

/* ---------- Profile form – forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  #profile-avatar-preview {
    background: Canvas;
    color: CanvasText;
    border: 1px solid CanvasText;
  }

  #profile-form .auth-input,
  #profile-form textarea,
  #profile-form input,
  #profile-form select {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  #profile-form .auth-input:focus,
  #profile-form .auth-input:focus-visible,
  #profile-form textarea:focus,
  #profile-form textarea:focus-visible,
  #profile-form input:focus,
  #profile-form input:focus-visible,
  #profile-form select:focus,
  #profile-form select:focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
  }

  #profile-form .auth-error {
    color: CanvasText;
  }
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 640px) {
  #toast-container { left: 1rem; right: 1rem; }
  .toast-item { max-width: none; }
}
