/* ============================================================
   Bumpology Theme System
   ============================================================ */

:root {
  --bump-navy: #2b4599;
  --bump-navy-deep: #1e3a7b;
  --bump-cyan: #29aae2;
  --bump-cyan-bright: #73cdf4;

  --surface-page: #f4f7fb;
  --surface-page-alt: #eef4ff;
  --surface-panel: rgba(255, 255, 255, 0.78);
  --surface-panel-strong: rgba(255, 255, 255, 0.9);
  --surface-panel-soft: rgba(255, 255, 255, 0.68);
  --surface-sunken: rgba(241, 245, 249, 0.95);
  --surface-nav-opaque: #ffffff;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  --border-soft: rgba(226, 232, 240, 0.9);
  --border-strong: rgba(203, 213, 225, 0.95);
  --ring: rgba(41, 170, 226, 0.22);

  --shadow-soft: 0 20px 60px rgba(15, 23, 42, 0.08);
  --shadow-strong: 0 28px 90px rgba(15, 23, 42, 0.14);
  --gradient-primary: linear-gradient(135deg, #1e3a7b 0%, #2b4599 50%, #29aae2 100%);

  /* Legacy aliases used elsewhere in the app */
  --color-surface: rgba(255, 255, 255, 0.92);
  --color-surface-raised: #f8fafc;
  --color-surface-sunken: #eef2f8;
  --color-text-primary: #0f172a;
  --color-text-secondary: #64748b;
  --color-text-tertiary: #94a3b8;
  --color-border: #e2e8f0;
  --color-border-strong: #cbd5e1;
  --color-ring: rgba(41, 170, 226, 0.25);
}

html.dark {
  --surface-page: #050816;
  --surface-page-alt: #071120;
  --surface-panel: rgba(8, 15, 32, 0.78);
  --surface-panel-strong: rgba(8, 15, 32, 0.92);
  --surface-panel-soft: rgba(15, 23, 42, 0.72);
  --surface-sunken: rgba(15, 23, 42, 0.96);
  --surface-nav-opaque: #0f172a;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #64748b;

  --border-soft: rgba(51, 65, 85, 0.88);
  --border-strong: rgba(71, 85, 105, 0.92);
  --ring: rgba(41, 170, 226, 0.28);

  --shadow-soft: 0 24px 80px rgba(2, 6, 23, 0.42);
  --shadow-strong: 0 36px 120px rgba(2, 6, 23, 0.56);

  --color-surface: rgba(8, 15, 32, 0.96);
  --color-surface-raised: rgba(15, 23, 42, 0.98);
  --color-surface-sunken: rgba(2, 6, 23, 0.96);
  --color-text-primary: #f8fafc;
  --color-text-secondary: #cbd5e1;
  --color-text-tertiary: #64748b;
  --color-border: #334155;
  --color-border-strong: #475569;
  --color-ring: rgba(41, 170, 226, 0.32);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(41, 170, 226, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(43, 69, 153, 0.07), transparent 22%),
    linear-gradient(180deg, #f7fbff 0%, #eef4ff 48%, #f4f7fb 100%);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

html.dark body {
  background:
    radial-gradient(circle at top left, rgba(41, 170, 226, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(43, 69, 153, 0.11), transparent 24%),
    linear-gradient(180deg, #050816 0%, #071120 48%, #0f172a 100%);
}

.brand-gradient-text {
  background: linear-gradient(135deg, #1e3a7b 0%, #2b5ea7 40%, #29aae2 70%, #00bfff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   Shared Utilities
   ============================================================ */

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: #cbd5e1;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.25s ease;
  flex-shrink: 0;
}

.toggle-switch.active {
  background: #29aae2;
}

.toggle-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 9999px;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch.active::before {
  transform: translateX(20px);
}

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

.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: 0.5rem;
}

html.dark .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}

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

.spinner {
  border: 2px solid #e2e8f0;
  border-top-color: var(--bump-navy);
  border-radius: 9999px;
  animation: spin 0.6s linear infinite;
}

html.dark .spinner {
  border-color: #334155;
  border-top-color: var(--bump-cyan);
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  align-items: center !important;
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
  overflow-y: auto;
}

.modal-backdrop > .modal-content {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  transform: scale(0.96) translateY(10px);
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0;
}

.modal-backdrop.active .modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Keep modals above the tasks detail drawer (z-index 200/201) and the navbar.
   The descendant selector beats Tailwind's .z-50 regardless of load order. */
body .modal-backdrop {
  z-index: 300;
}

.swatch {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swatch:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.toc-link {
  transition: color 0.15s ease, border-color 0.15s ease;
}

.dropzone {
  border: 2px dashed var(--color-border-strong);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--bump-cyan);
  background: rgba(41, 170, 226, 0.05);
}

/* ============================================================
   Navigation
   ============================================================ */

nav.main-nav {
  position: relative;
  z-index: 100;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  overflow: visible;
}

html.dark nav.main-nav {
  background: rgba(5, 8, 22, 0.88);
}

.nav-shell {
  max-width: 1440px;
  margin: 0 auto;
  position: relative;
  z-index: 101;
  min-height: 3.45rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.2rem 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-right: 1.35rem;
  text-decoration: none;
  flex-shrink: 0;
}

.brand img {
  height: 28px;
  width: auto;
  max-width: none;
  display: block;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu-item {
  position: relative;
}

.nav-trigger {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  height: 2.25rem;
  padding: 0 0.45rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-trigger:hover,
.nav-trigger[aria-expanded="true"] {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
  box-shadow: none;
}

html.dark .nav-trigger:hover,
html.dark .nav-trigger[aria-expanded="true"] {
  background: transparent;
  border-color: transparent;
}

.nav-trigger[data-active="true"] {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

html.dark .nav-trigger[data-active="true"] {
  background: transparent;
  border-color: transparent;
}

.nav-trigger:focus-visible,
.dark-toggle:focus-visible,
.hamburger-btn:focus-visible,
.mobile-menu-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.nav-trigger .nav-chevron {
  width: 0.875rem;
  height: 0.875rem;
  opacity: 0.65;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.nav-trigger[aria-expanded="true"] .nav-chevron {
  transform: rotate(180deg);
}

.nav-user-trigger {
  gap: 0.35rem;
  padding: 0 0.15rem 0 0.15rem;
}

.nav-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 9999px;
  background: var(--gradient-primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(43, 69, 153, 0.2);
  flex-shrink: 0;
}

.nav-avatar-lg {
  width: 2.3rem;
  height: 2.3rem;
  font-size: 0.82rem;
}

.nav-user-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.35rem 0.4rem;
}

.nav-user-summary-copy {
  min-width: 0;
}

.nav-user-summary-name {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
}

.nav-user-summary-role {
  color: var(--text-tertiary);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.2;
}

.nav-right-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 0.65rem);
  left: 0;
  margin-top: 0;
  padding: 0.6rem;
  border: 1px solid var(--border-soft);
  border-radius: 1.25rem;
  background: var(--surface-nav-opaque);
  box-shadow: var(--shadow-strong);
  z-index: 200;
  opacity: 0;
  transform: scale(0.96) translateY(-4px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.nav-dropdown.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.nav-dropdown.right {
  left: auto;
  right: 0;
}

.nav-dropdown.wide {
  width: min(38rem, calc(100vw - 2rem));
}

.nav-dropdown.narrow {
  min-width: 15rem;
}

.nav-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.nav-dropdown-link {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  padding: 0.95rem 1rem;
  border: 1px solid transparent;
  border-radius: 1rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav-dropdown-link:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--border-soft);
  transform: translateY(-1px);
}

html.dark .nav-dropdown-link:hover {
  background: rgba(15, 23, 42, 0.75);
}

.nav-link-title {
  font-weight: 600;
  line-height: 1.1;
}

.nav-link-desc {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.nav-dropdown-link.with-icon {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
}

.nav-link-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  opacity: 0.78;
}

.nav-dropdown-link.compact {
  padding: 0.6rem 1rem;
}

.nav-dropdown-sep {
  height: 1px;
  background: var(--border-soft);
  margin: 0.35rem 0;
}

.nav-dropdown-heading {
  padding: 0.15rem 1rem 0.35rem;
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-dropdown-link.danger {
  color: #dc2626;
}

html.dark .nav-dropdown-link.danger {
  color: #fca5a5;
}

.dark-toggle,
.hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.dark-toggle:hover,
.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--border-soft);
  color: var(--text-primary);
}

html.dark .dark-toggle:hover,
html.dark .hamburger-btn:hover {
  background: rgba(15, 23, 42, 0.76);
  border-color: var(--border-strong);
}

.hamburger-btn {
  display: none;
}

.mobile-menu {
  display: none;
  padding: 0 1rem 1rem;
}

.mobile-menu.open {
  display: block;
}

.mobile-menu-shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.8rem;
  border: 1px solid var(--border-soft);
  border-radius: 1.5rem;
  background: var(--surface-nav-opaque);
  box-shadow: var(--shadow-soft);
}

.mobile-user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.35rem 0.7rem;
}

.mobile-user-copy {
  min-width: 0;
}

.mobile-user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.mobile-user-subtitle {
  margin-top: 0.18rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.mobile-menu-section {
  padding: 0.5rem 0.7rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
}

.mobile-menu-link {
  display: block;
  padding: 0.85rem 0.9rem;
  border-radius: 1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.mobile-menu-link:hover {
  background: rgba(255, 255, 255, 0.72);
}

html.dark .mobile-menu-link:hover {
  background: rgba(15, 23, 42, 0.76);
}

.mobile-menu-link.danger {
  color: #dc2626;
}

html.dark .mobile-menu-link.danger {
  color: #fca5a5;
}

.task-inbox-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.task-inbox-trigger:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--border-soft);
  color: var(--text-primary);
}

html.dark .task-inbox-trigger:hover {
  background: rgba(15, 23, 42, 0.76);
  border-color: var(--border-strong);
}

.task-inbox-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 9999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
}

.task-inbox-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 1rem;
  color: var(--text-tertiary);
  text-align: center;
}

.task-inbox-empty p {
  font-size: 0.95rem;
}

.task-section {
  margin-bottom: 2rem;
}

.task-section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.task-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.task-section-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.task-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.4rem;
  border-radius: 9999px;
  background: var(--bump-cyan);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.mobile-task-link {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}

.mobile-task-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 9999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
}

.mobile-menu-sep {
  height: 1px;
  background: var(--border-soft);
  margin: 0.35rem 0;
}

@media (max-width: 900px) {
  .hamburger-btn {
    display: inline-flex;
    margin-left: auto;
  }

  .nav-menu,
  .nav-right-actions {
    display: none;
  }
}

@media (max-width: 520px) {
  .nav-shell {
    padding: 0.2rem 0;
  }
}

/* ============================================================
   Theme Primitives
   ============================================================ */

.theme-showcase-page {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(41, 170, 226, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(43, 69, 153, 0.18), transparent 22%),
    linear-gradient(180deg, #f7fbff 0%, #eef4ff 48%, #f8fafc 100%);
}

html.dark .theme-showcase-page {
  background:
    radial-gradient(circle at top left, rgba(41, 170, 226, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(43, 69, 153, 0.2), transparent 24%),
    linear-gradient(180deg, #050816 0%, #071120 48%, #0f172a 100%);
}

.theme-showcase-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

html.dark .theme-showcase-page::before {
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
}

.theme-shell {
  position: relative;
  max-width: 1440px;
  margin: 0 auto;
}

.theme-panel {
  position: relative;
  overflow: hidden;
  background: var(--surface-panel);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.theme-panel::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(41, 170, 226, 0), rgba(41, 170, 226, 0.7), rgba(43, 69, 153, 0));
  pointer-events: none;
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(255, 255, 255, 0.7);
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

html.dark .theme-chip {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(71, 85, 105, 0.72);
}

.theme-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  display: inline-block;
}

.theme-chart-grid {
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.12) 1px, transparent 1px);
  background-size: 64px 64px;
}

html.dark .theme-chart-grid {
  background-image:
    linear-gradient(rgba(71, 85, 105, 0.34) 1px, transparent 1px),
    linear-gradient(90deg, rgba(71, 85, 105, 0.34) 1px, transparent 1px);
}

.theme-mini-bar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 0.5rem;
  height: 8rem;
}

.theme-mini-bar span {
  display: block;
  border-radius: 9999px;
  background: var(--gradient-primary);
}

.theme-shadow-line {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 1px 0 rgba(15, 23, 42, 0.04);
}

html.dark .theme-shadow-line {
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08), 0 1px 0 rgba(2, 6, 23, 0.2);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.theme-btn:hover {
  transform: translateY(-1px);
}

.theme-btn-xs {
  padding: 0.35rem 0.7rem;
  font-size: 0.72rem;
  gap: 0.3rem;
}

.inline-change-icon {
  pointer-events: none;
}

.field-error-ring {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18) !important;
}

.theme-btn-primary {
  background: var(--bump-cyan);
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(41, 170, 226, 0.22);
}

.theme-btn-primary:hover {
  background: #1f9dd3;
  box-shadow: 0 14px 30px rgba(41, 170, 226, 0.30);
}

.theme-btn-secondary {
  background: rgba(255, 255, 255, 0.76);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

html.dark .theme-btn-secondary {
  background: rgba(15, 23, 42, 0.82);
}

.theme-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.theme-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.62);
  border-color: var(--border-soft);
  color: var(--text-primary);
}

html.dark .theme-btn-ghost:hover {
  background: rgba(15, 23, 42, 0.75);
}

.theme-btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}

html.dark .theme-btn-danger {
  background: rgba(127, 29, 29, 0.26);
  border-color: rgba(248, 113, 113, 0.24);
  color: #fecaca;
}

.theme-field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.theme-field-help {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.theme-input,
.theme-select,
.theme-textarea {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.82);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

html.dark .theme-input,
html.dark .theme-select,
html.dark .theme-textarea {
  background: rgba(15, 23, 42, 0.84);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.05);
}

.theme-input::placeholder,
.theme-textarea::placeholder {
  color: var(--text-tertiary);
}

.theme-input:focus,
.theme-select:focus,
.theme-textarea:focus {
  outline: none;
  border-color: rgba(41, 170, 226, 0.9);
  box-shadow: 0 0 0 3px rgba(41, 170, 226, 0.15);
}

.theme-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%2394a3b8%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3e%3cpolyline points=%226 9 12 15 18 9%22%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 16px;
  padding-right: 2.75rem;
}

.theme-input-sm,
.theme-select-sm {
  padding: 0.45rem 0.85rem !important;
  font-size: 0.85rem !important;
  border-radius: 0.75rem !important;
}

.theme-select-sm {
  background-position: right 0.65rem center;
  padding-right: 2rem !important;
}

.theme-btn-sm {
  padding: 0.5rem 0.95rem;
  font-size: 0.8rem;
  gap: 0.35rem;
}

.theme-btn-square {
  border-radius: 0.75rem;
}

.theme-textarea {
  min-height: 7.5rem;
  resize: vertical;
}

.theme-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: 1rem;
  border: 1px solid var(--border-soft);
  background: rgba(255, 255, 255, 0.74);
  padding: 0.9rem 1rem;
}

html.dark .theme-check {
  background: rgba(15, 23, 42, 0.72);
}

.theme-check input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--bump-navy);
  flex-shrink: 0;
}

html.dark .theme-check input {
  accent-color: var(--bump-cyan);
}

.theme-check-sm {
  padding: 0.45rem 0.85rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  gap: 0.5rem;
}

.btn-email-quick {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.95rem;
  border-radius: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  box-shadow: 0 6px 14px -6px rgba(37, 99, 235, 0.55);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-email-quick:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 8px 18px -6px rgba(37, 99, 235, 0.7);
}

.btn-email-quick:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.theme-toggle {
  position: relative;
  width: 3rem;
  height: 1.75rem;
  border-radius: 9999px;
  border: 1px solid var(--border-strong);
  background: rgba(226, 232, 240, 0.85);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 9999px;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.15);
  transition: transform 0.2s ease;
}

.theme-toggle.is-on {
  border-color: rgba(41, 170, 226, 0.85);
  background: var(--gradient-primary);
}

.theme-toggle.is-on::after {
  transform: translateX(1.2rem);
}

html.dark .theme-toggle {
  background: rgba(30, 41, 59, 0.96);
}

.theme-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 9999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.theme-badge.is-success {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.theme-badge.is-warning {
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.theme-badge.is-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.theme-badge.is-info {
  background: rgba(41, 170, 226, 0.14);
  color: #0369a1;
}

.theme-badge.is-brand {
  background: rgba(43, 69, 153, 0.14);
  color: #1d4ed8;
}

.theme-badge.is-muted {
  background: rgba(148, 163, 184, 0.14);
  color: #475569;
}

html.dark .theme-badge.is-success { color: #a7f3d0; }
html.dark .theme-badge.is-warning { color: #fde68a; }
html.dark .theme-badge.is-danger { color: #fecaca; }
html.dark .theme-badge.is-info { color: #bae6fd; }
html.dark .theme-badge.is-brand { color: #bfdbfe; }
html.dark .theme-badge.is-muted { color: #cbd5e1; }

.freshness-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  vertical-align: middle;
  margin-right: 6px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}
.freshness-dot.is-success { background-color: #10b981; }
.freshness-dot.is-warning { background-color: #f59e0b; }
.freshness-dot.is-danger  { background-color: #ef4444; }
.freshness-dot.is-muted   { background-color: #94a3b8; }
html.dark .freshness-dot { box-shadow: 0 0 0 1px rgba(226, 232, 240, 0.15); }

.theme-alert {
  display: flex;
  gap: 0.875rem;
  border-radius: 1.25rem;
  border: 1px solid var(--border-soft);
  padding: 1rem 1rem 1rem 1.1rem;
  background: rgba(255, 255, 255, 0.8);
}

html.dark .theme-alert {
  background: rgba(15, 23, 42, 0.78);
}

.theme-alert.is-success {
  border-color: rgba(16, 185, 129, 0.24);
  background: rgba(236, 253, 245, 0.82);
}

.theme-alert.is-warning {
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(255, 251, 235, 0.82);
}

.theme-alert.is-info {
  border-color: rgba(41, 170, 226, 0.22);
  background: rgba(239, 248, 255, 0.82);
}

html.dark .theme-alert.is-success {
  background: rgba(6, 78, 59, 0.24);
}

html.dark .theme-alert.is-warning {
  background: rgba(120, 53, 15, 0.24);
}

html.dark .theme-alert.is-info {
  background: rgba(8, 47, 73, 0.24);
}

.theme-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid transparent;
  padding: 0.65rem 0.95rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.theme-tab.is-active {
  border-color: rgba(41, 170, 226, 0.25);
  background: rgba(41, 170, 226, 0.12);
  color: var(--text-primary);
}

html.dark .theme-tab.is-active {
  border-color: rgba(41, 170, 226, 0.32);
  background: rgba(41, 170, 226, 0.18);
}

.theme-demo-table tbody tr + tr {
  border-top: 1px solid rgba(226, 232, 240, 0.72);
}

html.dark .theme-demo-table tbody tr + tr {
  border-top-color: rgba(51, 65, 85, 0.82);
}

.theme-modal-card {
  width: min(100%, 34rem);
  border-radius: 1.75rem;
  border: 1px solid var(--border-soft);
  background: var(--surface-panel-strong);
  box-shadow: 0 40px 110px rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(18px);
}

html.dark .theme-modal-card {
  box-shadow: 0 40px 110px rgba(2, 6, 23, 0.55);
}

/* ============================================================
   Shared App Pages
   ============================================================ */

.theme-page {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 0 3rem;
}

.theme-page--compact {
  max-width: 1100px;
}

.theme-page--narrow {
  max-width: 760px;
}

.theme-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.theme-page-copy {
  max-width: 44rem;
}

.theme-page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #60a5fa;
}

.theme-page-kicker::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #29aae2, #2b4599);
  box-shadow: 0 0 0 5px rgba(41, 170, 226, 0.1);
}

.theme-page-title {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.theme-page-subtitle {
  margin-top: 0.75rem;
  max-width: 46rem;
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.theme-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.theme-panel-soft {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

html.dark .theme-panel-soft {
  background: rgba(15, 23, 42, 0.72);
}

.theme-panel-muted {
  border: 1px solid var(--border-soft);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.52);
}

html.dark .theme-panel-muted {
  background: rgba(15, 23, 42, 0.56);
}

.theme-stat-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.theme-stat-card {
  padding: 1.25rem 1.3rem;
  border: 1px solid var(--border-soft);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--shadow-soft);
}

html.dark .theme-stat-card {
  background: rgba(15, 23, 42, 0.72);
}

.theme-stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.theme-stat-value {
  margin-top: 0.7rem;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 600;
  line-height: 1;
  color: var(--text-primary);
}

.theme-stat-meta {
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.theme-card-grid {
  display: grid;
  gap: 1rem;
}

.theme-card-link {
  display: block;
  padding: 1.4rem;
  border: 1px solid var(--border-soft);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-soft);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-card-link:hover {
  transform: translateY(-1px);
  border-color: rgba(41, 170, 226, 0.28);
  box-shadow: var(--shadow-strong);
}

html.dark .theme-card-link {
  background: rgba(15, 23, 42, 0.72);
}

.theme-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 2.8rem;
  margin-bottom: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.66);
  color: #2563eb;
}

html.dark .theme-card-icon {
  background: rgba(15, 23, 42, 0.76);
  color: #7dd3fc;
}

.theme-card-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.theme-card-desc {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.theme-data-grid {
  display: grid;
  gap: 1rem;
}

.theme-data-item dt {
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.theme-data-item dd {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.theme-inline-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
  transition: color 0.15s ease;
}

.theme-inline-link:hover {
  color: #1d4ed8;
}

html.dark .theme-inline-link {
  color: #7dd3fc;
}

html.dark .theme-inline-link:hover {
  color: #bae6fd;
}

.theme-avatar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 1rem;
  background: var(--gradient-primary);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 16px 32px rgba(43, 69, 153, 0.18);
}

.theme-table-shell {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 1.75rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

html.dark .theme-table-shell {
  background: rgba(15, 23, 42, 0.74);
}

.theme-table {
  width: 100%;
  border-collapse: collapse;
}

.theme-table thead th {
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  background: rgba(255, 255, 255, 0.76);
  border-bottom: 1px solid var(--border-soft);
}

html.dark .theme-table thead th {
  background: rgba(2, 6, 23, 0.4);
}

.theme-table tbody tr + tr {
  border-top: 1px solid var(--border-soft);
}

.theme-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.54);
}

html.dark .theme-table tbody tr:hover {
  background: rgba(2, 6, 23, 0.24);
}

.theme-table td {
  padding: 1rem 1.25rem;
  vertical-align: top;
}

.theme-empty-state {
  padding: 2.2rem 1.5rem;
  border: 1px dashed var(--border-strong);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.56);
  text-align: center;
}

html.dark .theme-empty-state {
  background: rgba(15, 23, 42, 0.56);
}

.theme-empty-title {
  margin-top: 0.9rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.theme-empty-copy {
  margin-top: 0.45rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.theme-auth-form {
  display: grid;
  gap: 1.25rem;
}

.theme-auth-form p {
  margin: 0;
}

.theme-auth-form label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.theme-auth-form input:not([type="checkbox"]):not([type="radio"]),
.theme-auth-form textarea,
.theme-auth-form select {
  width: 100%;
  border-radius: 1rem;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.82);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

html.dark .theme-auth-form input:not([type="checkbox"]):not([type="radio"]),
html.dark .theme-auth-form textarea,
html.dark .theme-auth-form select {
  background: rgba(15, 23, 42, 0.84);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.05);
}

.theme-auth-form input:not([type="checkbox"]):not([type="radio"]):focus,
.theme-auth-form textarea:focus,
.theme-auth-form select:focus {
  outline: none;
  border-color: rgba(41, 170, 226, 0.9);
  box-shadow: 0 0 0 3px rgba(41, 170, 226, 0.15);
}

.theme-auth-form .helptext {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

ul.errorlist {
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #dc2626;
}

html.dark ul.errorlist {
  color: #fca5a5;
}

.theme-error-wrap {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.theme-error-card {
  width: min(100%, 40rem);
  padding: 2.5rem 2rem;
  text-align: center;
  border: 1px solid var(--border-soft);
  border-radius: 2rem;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(18px);
}

html.dark .theme-error-card {
  background: rgba(15, 23, 42, 0.74);
}

body.theme-error-body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(41, 170, 226, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(43, 69, 153, 0.18), transparent 22%),
    linear-gradient(180deg, #f7fbff 0%, #eef4ff 48%, #f8fafc 100%);
  color: var(--text-primary);
}

html.dark body.theme-error-body {
  background:
    radial-gradient(circle at top left, rgba(41, 170, 226, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(43, 69, 153, 0.2), transparent 24%),
    linear-gradient(180deg, #050816 0%, #071120 48%, #0f172a 100%);
}

.theme-error-symbol {
  display: block;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1.5rem;
}

.theme-error-code {
  font-size: clamp(4rem, 12vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
  color: var(--text-primary);
}

.theme-error-message {
  max-width: 30rem;
  margin: 1rem auto 0;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.theme-error-note {
  margin-top: 0.65rem;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-tertiary);
}

.theme-error-title {
  margin-top: 1rem;
}

.theme-error-action {
  margin-top: 2rem;
}

.theme-code-inline {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.45rem;
  border-radius: 0.6rem;
  background: rgba(148, 163, 184, 0.12);
  font-size: 0.76rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

@media (max-width: 900px) {
  .theme-page {
    padding: 0.5rem 0 2.5rem;
  }

  .theme-stat-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Layout, Messages, Footer
   ============================================================ */

main.main-content {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.messages {
  margin-bottom: 1.5rem;
}

.messages .msg {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  margin-bottom: 0.6rem;
  font-size: 0.92rem;
  border: 1px solid var(--border-soft);
  background: var(--surface-panel-strong);
  box-shadow: var(--shadow-soft);
}

.messages .msg .msg-body {
  flex: 1;
  min-width: 0;
}

.alert-close {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  color: currentColor;
  background: transparent;
  opacity: 0.55;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.alert-close:hover,
.alert-close:focus-visible {
  opacity: 1;
  background: rgba(15, 23, 42, 0.08);
  outline: none;
}

html.dark .alert-close:hover,
html.dark .alert-close:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.alert-close svg {
  width: 1rem;
  height: 1rem;
}

.messages .msg.success {
  border-color: rgba(16, 185, 129, 0.22);
  background: rgba(236, 253, 245, 0.88);
  color: #166534;
}

.messages .msg.error {
  border-color: rgba(239, 68, 68, 0.22);
  background: rgba(254, 242, 242, 0.9);
  color: #991b1b;
}

.messages .msg.info {
  border-color: rgba(41, 170, 226, 0.22);
  background: rgba(239, 248, 255, 0.9);
  color: #0f4c81;
}

footer.main-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

/* ============================================================
   Workflow stage nav — rail with stops
   ============================================================ */

/* Lock the header copy area to a stable height so switching stages
   doesn't shift the stage-nav (and everything below) vertically. */
.theme-page--workflow .theme-page-copy {
  min-height: 6.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.theme-page--workflow .theme-page-header {
  align-items: flex-end;
}

.workflow-stage-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.5rem 2.5rem 1rem 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

/* The horizontal rail behind the pills */
.workflow-stage-nav::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.5rem;
  right: 2.75rem;
  height: 2px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.28), rgba(41, 170, 226, 0.6));
  transform: translateY(calc(-50% - 0.25rem));
  z-index: 0;
}

/* The arrowhead at the right end of the rail */
.workflow-stage-nav::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2329aae2' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='9 6 15 12 9 18'/></svg>") center/contain no-repeat;
  transform: translateY(calc(-50% - 0.25rem));
  z-index: 1;
}

.workflow-stage-pill {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  /* Opaque background hides the rail running behind every pill. */
  background: var(--surface-page);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Hover keeps the opaque background so the rail stays hidden behind the pill;
   the cue is a cyan border + text + subtle ring. */
.workflow-stage-pill:hover {
  color: var(--text-primary);
  border-color: var(--bump-cyan);
  box-shadow: 0 0 0 3px rgba(41, 170, 226, 0.14);
}

.workflow-stage-pill.is-active {
  background: var(--bump-cyan);
  color: #ffffff;
  border-color: var(--bump-cyan);
  font-weight: 600;
}

.workflow-stage-pill.is-active:hover {
  box-shadow: none;
}

/* Station-stop dot only on the active pill, marking the current position
   on the rail. */
.workflow-stage-pill.is-active::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -0.55rem;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: var(--bump-cyan);
  transform: translateX(-50%);
}

.workflow-stage-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2rem;
  height: 1.2rem;
  padding: 0 0.35rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.10);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  color: inherit;
}

html.dark .workflow-stage-count {
  background: rgba(148, 163, 184, 0.22);
}

.workflow-stage-pill.is-active .workflow-stage-count {
  background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 640px) {
  .workflow-stage-nav {
    font-size: 0.78rem;
    padding-right: 2rem;
  }
  .workflow-stage-pill {
    padding: 0.35rem 0.65rem;
  }
}

/* ============================================================
   Leads triage button group
   ============================================================ */

.triage-group {
  position: relative;
}

.triage-btn {
  display: inline-flex;
  align-items: center;
  height: 1.7rem;
  padding: 0 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border-soft);
  background: var(--surface-page);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.triage-btn:hover {
  border-color: var(--bump-cyan);
  color: var(--text-primary);
}

.triage-btn--gifted:hover {
  color: #047857;
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.triage-btn--paid:hover {
  color: #1d4ed8;
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
}

.triage-btn--reject {
  color: #b91c1c;
}
.triage-btn--reject:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.10);
  color: #b91c1c;
}

html.dark .triage-btn--gifted:hover { color: #6ee7b7; }
html.dark .triage-btn--paid:hover   { color: #93c5fd; }
html.dark .triage-btn--reject       { color: #fca5a5; }
html.dark .triage-btn--reject:hover { color: #fca5a5; }

.triage-paid-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 7rem;
  padding: 0.25rem;
  border-radius: 0.6rem;
  background: var(--surface-page);
  border: 1px solid var(--border-soft);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

.triage-paid-menu button {
  padding: 0.4rem 0.7rem;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  border-radius: 0.35rem;
}

.triage-paid-menu button:hover {
  background: rgba(41, 170, 226, 0.10);
}

.triage-error {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.7rem;
  color: #b91c1c;
}

html.dark .triage-error { color: #fca5a5; }

/* Prominent triage card on the influencer detail page when tier='' */
.triage-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(41, 170, 226, 0.4);
  border-radius: 1rem;
  background: linear-gradient(135deg, rgba(41, 170, 226, 0.08), rgba(43, 69, 153, 0.05));
  box-shadow: 0 0 0 4px rgba(41, 170, 226, 0.06);
}

html.dark .triage-card {
  background: linear-gradient(135deg, rgba(41, 170, 226, 0.14), rgba(43, 69, 153, 0.10));
  border-color: rgba(41, 170, 226, 0.5);
}

.triage-card__copy {
  flex: 1 1 18rem;
  min-width: 0;
}

.triage-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.triage-card__hint {
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.triage-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Row-level click affordance for the HView quick-modal */
tr[data-quick-modal] {
  transition: background-color 0.12s ease;
}

tr[data-quick-modal]:hover {
  background-color: rgba(41, 170, 226, 0.06);
}

html.dark tr[data-quick-modal]:hover {
  background-color: rgba(41, 170, 226, 0.10);
}

/* ============================================================
   Tasks notification bell (global — lives in the navbar).
   Separate from the influencer .task-inbox-* bell.
   ============================================================ */
.tasks-bell { position: relative; }
.tasks-bell > summary { list-style: none; display: inline-flex; }
.tasks-bell > summary::-webkit-details-marker { display: none; }
.tasks-bell > summary::marker { content: ""; }
.tasks-bell-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tasks-bell-trigger:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--border-soft);
  color: var(--text-primary);
}
html.dark .tasks-bell-trigger:hover {
  background: rgba(15, 23, 42, 0.76);
  border-color: var(--border-strong);
}
.tasks-bell-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  border-radius: 9999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
}
.tasks-bell-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 20rem;
  max-height: 24rem;
  overflow-y: auto;
  background: var(--surface-panel-strong);
  border: 1px solid var(--border-strong);
  border-radius: 0.9rem;
  box-shadow: var(--shadow-strong);
  padding: 0.5rem;
  z-index: 70;
}
.tasks-bell-panel-head {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 0.35rem 0.6rem;
}
.tasks-bell-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
}
.tasks-bell-item:hover { background: var(--surface-sunken); }
.tasks-bell-item-title { font-size: 0.85rem; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tasks-bell-item-due { font-size: 0.72rem; color: #b91c1c; white-space: nowrap; }
html.dark .tasks-bell-item-due { color: #fca5a5; }
.tasks-bell-empty { padding: 1.5rem 0.6rem; text-align: center; color: var(--text-tertiary); font-size: 0.9rem; }
.tasks-bell-more {
  display: block;
  padding: 0.5rem 0.6rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--border-soft);
  font-size: 0.8rem;
  color: var(--bump-cyan);
  text-decoration: none;
}
