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

:root {
  /* ---- Brand primitives ---- */
  --bump-navy: #2b4599;
  --bump-navy-deep: #1e3a7b;
  --bump-cyan: #29aae2;
  --bump-cyan-bright: #73cdf4;
  --gradient-primary: linear-gradient(135deg, #1e3a7b 0%, #2b4599 50%, #29aae2 100%);

  /* ---- Fonts ---- */
  --font-sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Spline Sans Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* ---- Surfaces (flat & opaque) ---- */
  --color-bg-app: #f5f7fa;
  --color-surface: #ffffff;
  --color-surface-alt: #f7f8fb;
  --color-surface-soft: #eef1f6;
  --surface-nav-opaque: #ffffff;

  /* ---- Text ---- */
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-text-subtle: #8792a3;

  /* ---- Borders ---- */
  --color-border: #e4e8ef;
  --color-border-strong: #d3d9e3;
  --color-border-soft: #eef1f6;

  /* ---- Primary (navy) / accent (cyan, informational only) ---- */
  --color-primary: #2b4599;
  --color-primary-hover: #1e3a7b;
  --color-primary-soft: #e9eefb;
  --color-on-soft: #1e3a7b;
  --color-link: #2b4599;
  --color-accent: #29aae2;

  /* ---- Fills ---- */
  --color-secondary: #e8ebf1;
  --color-secondary-hover: #dee3ec;
  --color-ghost-hover: #eef1f6;

  /* ---- Status ---- */
  --color-success: #16a34a;
  --color-success-soft: #e6f4ec;
  --color-success-text: #166534;
  --color-warning-soft: #faf0da;
  --color-warning-text: #9a6b2e;
  --color-warning-marker: #d69a3c;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-danger-soft: #fdecea;
  --color-danger-text: #b91c1c;

  /* ---- Geometry ---- */
  --radius-control: 10px;
  --radius-panel: 14px;
  --radius-card: 18px;
  --radius-pill: 9999px;

  /* ---- Elevation (1px hairline ring baked into card/pop shadows) ---- */
  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 0 0 1px #e9ecf2;
  --shadow-pop: 0 12px 32px rgba(15, 23, 42, 0.14), 0 0 0 1px #e7ebf1;
  --shadow-modal: 0 32px 80px rgba(10, 15, 30, 0.35);
  --focus-ring: 0 0 0 3px rgba(43, 69, 153, 0.16);

  /* ---- Motion ---- */
  --motion-fast: 130ms ease;
  --motion-med: 160ms ease;

  /* ---- Recolorable inline glyphs ---- */
  --select-chevron: 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%238792a3%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");
  --icon-check: 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=%22black%22 stroke-width=%223%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3e%3cpath d=%22M20 6 9 17l-5-5%22/%3e%3c/svg%3e");
  --icon-chevron-down: 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=%22black%22 stroke-width=%222.5%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3e%3cpath d=%22m6 9 6 6 6-6%22/%3e%3c/svg%3e");
  --icon-chevron-right: 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=%22black%22 stroke-width=%222.5%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3e%3cpath d=%22m9 6 6 6-6 6%22/%3e%3c/svg%3e");

  /* ---- Legacy aliases (navbar + feature CSS + older templates read these) ---- */
  --surface-page: var(--color-bg-app);
  --surface-page-alt: var(--color-bg-app);
  --surface-panel: var(--color-surface);
  --surface-panel-strong: var(--color-surface);
  --surface-panel-soft: var(--color-surface);
  --surface-sunken: var(--color-surface-soft);
  --text-primary: var(--color-text);
  --text-secondary: var(--color-text-muted);
  --text-tertiary: var(--color-text-subtle);
  --border-soft: var(--color-border);
  --border-strong: var(--color-border-strong);
  --ring: rgba(43, 69, 153, 0.16);
  --shadow-soft: var(--shadow-card);
  --shadow-strong: var(--shadow-pop);
  --color-surface-raised: var(--color-surface-alt);
  --color-surface-sunken: var(--color-surface-soft);
  --color-text-primary: var(--color-text);
  --color-text-secondary: var(--color-text-muted);
  --color-text-tertiary: var(--color-text-subtle);
  --color-ring: rgba(43, 69, 153, 0.16);
}

html.dark {
  --color-bg-app: #0b1220;
  --color-surface: #121b2e;
  --color-surface-alt: #172034;
  --color-surface-soft: #1c2740;
  --surface-nav-opaque: #0f172a;

  --color-text: #f1f5f9;
  --color-text-muted: #b6c2d6;
  --color-text-subtle: #8494ab;

  --color-border: #243050;
  --color-border-strong: #35415f;
  --color-border-soft: #1d2740;

  --color-primary: #4a6db8;
  --color-primary-hover: #5b7dc7;
  --color-primary-soft: #1d2c50;
  --color-on-soft: #b7c8ec;
  --color-link: #8fb0f0;

  --color-secondary: #223052;
  --color-secondary-hover: #2a3a61;
  --color-ghost-hover: #1c2740;

  --color-success: #22b268;
  --color-success-soft: rgba(16, 185, 129, 0.16);
  --color-success-text: #a7f3d0;
  --color-warning-soft: rgba(245, 158, 11, 0.16);
  --color-warning-text: #fcd34d;
  --color-warning-marker: #f59e0b;
  --color-danger: #ef4444;
  --color-danger-hover: #dc2626;
  --color-danger-soft: rgba(239, 68, 68, 0.16);
  --color-danger-text: #fca5a5;

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.45), 0 0 0 1px #202c47;
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px #243050;
  --shadow-modal: 0 32px 80px rgba(0, 0, 0, 0.6);
  --focus-ring: 0 0 0 3px rgba(122, 150, 222, 0.3);

  --select-chevron: 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%238494ab%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");

  /* Legacy aliases holding raw values */
  --ring: rgba(122, 150, 222, 0.3);
  --color-ring: rgba(122, 150, 222, 0.3);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  background: var(--color-bg-app);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.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: var(--color-border-strong);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--motion-med);
  flex-shrink: 0;
}

.toggle-switch.active {
  background: var(--color-primary);
}

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

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

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

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

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

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

.spinner {
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-pill);
  animation: spin 0.6s linear infinite;
}

.modal-backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(2px);
  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.98) translateY(6px);
  transition: transform var(--motion-med), opacity var(--motion-med);
  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: box-shadow var(--motion-fast);
}

.swatch:hover {
  box-shadow: var(--shadow-pop);
}

.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(--color-primary);
  background: var(--color-primary-soft);
}

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

nav.main-nav {
  position: relative;
  z-index: 100;
  padding: 0 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  overflow: visible;
}

.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: 1rem;
  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.1rem;
  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.65rem;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--motion-fast), color var(--motion-fast);
}

.nav-trigger:hover,
.nav-trigger[aria-expanded="true"] {
  background: var(--color-ghost-hover);
  color: var(--color-text);
}

.nav-trigger[data-active="true"] {
  background: var(--color-primary-soft);
  color: var(--color-on-soft);
}

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

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

.nav-trigger .nav-chevron svg {
  width: 100%;
  height: 100%;
}

.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(--color-primary);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  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(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}

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

/* Navbar global influencer search */
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-search-icon {
  position: absolute;
  left: 0.6rem;
  display: inline-flex;
  width: 0.875rem;
  height: 0.875rem;
  color: var(--color-text-muted);
  opacity: 0.72;
  pointer-events: none;
}

.nav-search-icon svg {
  width: 100%;
  height: 100%;
}

.nav-search-input {
  width: 11rem;
  height: 2.25rem;
  padding: 0 0.65rem 0 2rem;
  border: none;
  border-radius: 9px;
  background: var(--color-ghost-hover);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text);
  transition: width var(--motion-med), background var(--motion-fast), box-shadow var(--motion-fast);
}

.nav-search-input::placeholder {
  color: var(--color-text-muted);
}

.nav-search-input:focus {
  width: 15rem;
  outline: none;
  background: var(--color-surface);
  box-shadow: var(--focus-ring);
}

.nav-search-results {
  position: absolute;
  top: calc(100% + 0.65rem);
  right: 0;
  width: 19rem;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--surface-nav-opaque);
  box-shadow: var(--shadow-pop);
  z-index: 200;
}

.nav-search-result {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.5rem 0.8rem;
  border-radius: 9px;
  color: var(--color-text);
  text-decoration: none;
  transition: background var(--motion-fast);
}

.nav-search-result:hover,
.nav-search-result.is-active {
  background: var(--color-ghost-hover);
}

.nav-search-result-copy {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.nav-search-result-name {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-search-result-handle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-search-empty {
  padding: 0.6rem 0.8rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 0.65rem);
  left: 0;
  margin-top: 0;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--surface-nav-opaque);
  box-shadow: var(--shadow-pop);
  z-index: 200;
  opacity: 0;
  transform: scale(0.98) translateY(-4px);
  pointer-events: none;
  transition: opacity var(--motion-med), transform var(--motion-med);
  max-height: calc(100vh - 5rem);
  overflow-y: auto;
}

.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.mid {
  width: min(27rem, calc(100vw - 2rem));
}

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

.nav-dropdown-link {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--color-text);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}

.nav-dropdown-link:hover {
  background: var(--color-ghost-hover);
}

.nav-link-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.72;
  color: var(--color-text-muted);
  transition: color var(--motion-fast), opacity var(--motion-fast);
}

.nav-link-icon svg {
  width: 100%;
  height: 100%;
}

.nav-dropdown-link:hover .nav-link-icon {
  opacity: 1;
  color: var(--color-primary);
}

.nav-link-copy {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
}

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

.nav-link-desc {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.nav-dropdown-link.compact {
  padding: 0.5rem 0.8rem;
  align-items: center;
}

.nav-dropdown-link.compact .nav-link-icon {
  margin-top: 0;
}

.nav-dropdown-link.danger .nav-link-icon {
  color: var(--color-danger-text);
}

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

.nav-dropdown-heading {
  padding: 0.15rem 0.9rem 0.35rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-dropdown-link.danger {
  color: var(--color-danger-text);
}

.nav-dropdown-link.danger:hover {
  background: var(--color-danger-soft);
}

.dark-toggle,
.hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}

.dark-toggle:hover,
.hamburger-btn:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.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(--color-border);
  border-radius: var(--radius-panel);
  background: var(--surface-nav-opaque);
  box-shadow: var(--shadow-pop);
}

.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-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.mobile-group-trigger {
  justify-content: space-between;
  font-weight: 600;
}

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

.mobile-group-trigger .nav-chevron svg {
  width: 100%;
  height: 100%;
}

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

.mobile-group-links {
  padding-left: 0.9rem;
}

.mobile-group-links[hidden] {
  display: none;
}

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: none;
  background: none;
  border-radius: 9px;
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--motion-fast), color var(--motion-fast);
}

.mobile-menu-link .nav-link-icon {
  margin-top: 0;
}

.mobile-task-link {
  justify-content: space-between;
}

.mobile-menu-link:hover {
  background: var(--color-ghost-hover);
}

.mobile-menu-link.danger {
  color: var(--color-danger-text);
}

.mobile-menu-link.danger:hover {
  background: var(--color-danger-soft);
}

.task-inbox-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}

.task-inbox-trigger:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.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: var(--color-danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--color-surface);
}

.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(--color-primary);
  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: var(--color-danger);
  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: 1160px) {
  .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: var(--color-bg-app);
}

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

.theme-panel {
  position: relative;
  overflow: hidden;
  background: var(--color-surface);
  border: none;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 4px 9px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.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: var(--radius-pill);
  background: var(--color-primary);
}

.theme-shadow-line {
  box-shadow: inset 0 -1px 0 var(--color-border-soft);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-control);
  border: none;
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}

.theme-btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.theme-btn-xs {
  padding: 5px 10px;
  font-size: 0.72rem;
  gap: 0.3rem;
  border-radius: 7px;
}

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

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

.theme-btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(43, 69, 153, 0.3);
}

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

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

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

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

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

.theme-btn-danger {
  background: var(--color-danger);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3);
}

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

/* MUST MATCH .theme-auth-form label — copy any change there in the same commit */
.theme-field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
}

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

/* MUST MATCH .theme-auth-form input/textarea/select — copy any change there in the same commit */
.theme-input,
.theme-select,
.theme-textarea {
  width: 100%;
  border-radius: var(--radius-control);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--color-text);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}

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

.theme-input:focus,
.theme-select:focus,
.theme-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.theme-select {
  appearance: none;
  background-image: var(--select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 16px;
  padding-right: 2.5rem;
}

.theme-input-sm,
.theme-select-sm {
  padding: 6px 10px !important;
  font-size: 0.8125rem !important;
  border-radius: 8px !important;
}

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

.theme-btn-sm {
  padding: 7px 12px;
  font-size: 0.75rem;
  gap: 0.35rem;
  border-radius: 7px;
}

.theme-btn-square {
  border-radius: 8px;
}

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

/* .theme-check is dual-use: a row wrapper on <label>/<div>, and (via forms.py
   widget attrs) a class directly on checkbox <input>s — both are styled here. */
label.theme-check,
div.theme-check {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 10px 12px;
}

.theme-check-sm {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8125rem;
  gap: 0.5rem;
}

input.theme-check,
.theme-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  border: 1.5px solid var(--color-border-strong);
  border-radius: 6px;
  background: var(--color-surface);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: background var(--motion-fast), border-color var(--motion-fast);
}

input.theme-check:checked,
.theme-checkbox:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

input.theme-check:checked::after,
.theme-checkbox:checked::after {
  content: "";
  width: 11px;
  height: 11px;
  background: #ffffff;
  -webkit-mask: var(--icon-check) center / contain no-repeat;
  mask: var(--icon-check) center / contain no-repeat;
}

.theme-radio {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  margin: 0;
  flex: none;
  border: 1.5px solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-surface);
  cursor: pointer;
  display: inline-grid;
  place-content: center;
  transition: border-color var(--motion-fast);
}

.theme-radio:checked {
  border-color: var(--color-primary);
}

.theme-radio:checked::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
}

input.theme-check:focus-visible,
.theme-checkbox:focus-visible,
.theme-radio:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 26px;
  flex: none;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-switch-track {
  position: absolute;
  inset: 0;
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
  transition: background var(--motion-fast);
}

.theme-switch-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: left var(--motion-fast);
}

.theme-switch input:checked + .theme-switch-track {
  background: var(--color-primary);
}

.theme-switch input:checked + .theme-switch-track::before {
  left: 21px;
}

.theme-switch input:focus-visible + .theme-switch-track {
  box-shadow: var(--focus-ring);
}

.theme-switch input:disabled + .theme-switch-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.theme-segmented {
  display: inline-flex;
  gap: 2px;
  background: var(--color-surface-soft);
  border-radius: 10px;
  padding: 3px;
}

.theme-segmented > button,
.theme-segmented > a {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 8px;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--motion-fast), color var(--motion-fast);
}

.theme-segmented > .is-active {
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1);
}

html.dark .theme-segmented > .is-active {
  background: #26324e;
}

.btn-email-quick {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff;
  border: 0;
  cursor: pointer;
  background: var(--color-primary);
  box-shadow: 0 2px 6px rgba(43, 69, 153, 0.3);
  transition: background var(--motion-fast), box-shadow var(--motion-fast);
}

.btn-email-quick svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.btn-email-quick:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

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

.theme-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--color-border-strong);
  transition: background var(--motion-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform var(--motion-fast);
}

.theme-toggle.is-on {
  background: var(--color-primary);
}

.theme-toggle.is-on::after {
  transform: translateX(18px);
}

.theme-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.1;
}

.theme-badge.is-success {
  background: #e6f4ec;
  color: #166534;
}

.theme-badge.is-warning {
  background: #faf0da;
  color: #9a6b2e;
}

.theme-badge.is-danger {
  background: #fdecea;
  color: #b91c1c;
}

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

.theme-badge.is-brand {
  background: #e9eefb;
  color: #1e3a7b;
}

.theme-badge.is-muted {
  background: var(--color-surface-soft);
  color: var(--color-text-muted);
}

html.dark .theme-badge.is-success { background: rgba(16, 185, 129, 0.16); color: #a7f3d0; }
html.dark .theme-badge.is-warning { background: rgba(245, 158, 11, 0.16); color: #fde68a; }
html.dark .theme-badge.is-danger { background: rgba(239, 68, 68, 0.16); color: #fecaca; }
html.dark .theme-badge.is-info { background: rgba(41, 170, 226, 0.16); color: #bae6fd; }
html.dark .theme-badge.is-brand { background: rgba(74, 109, 184, 0.2); 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: var(--radius-panel);
  border: 1px solid var(--color-border);
  padding: 14px 16px;
  background: var(--color-surface);
}

.theme-alert.is-success {
  border-color: rgba(22, 163, 74, 0.25);
  background: #e9f6ef;
}

.theme-alert.is-warning {
  border-color: rgba(214, 154, 60, 0.3);
  background: #fdf6e3;
}

.theme-alert.is-info {
  border-color: rgba(41, 170, 226, 0.25);
  background: #e9f4fd;
}

.theme-alert.is-danger {
  border-color: rgba(220, 38, 38, 0.25);
  background: #fdecea;
}

html.dark .theme-alert.is-success {
  border-color: rgba(34, 178, 104, 0.3);
  background: rgba(6, 78, 59, 0.24);
}

html.dark .theme-alert.is-warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(120, 53, 15, 0.24);
}

html.dark .theme-alert.is-info {
  border-color: rgba(41, 170, 226, 0.3);
  background: rgba(8, 47, 73, 0.24);
}

html.dark .theme-alert.is-danger {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(127, 29, 29, 0.26);
}

.theme-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: none;
  padding: 8px 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background var(--motion-fast), color var(--motion-fast);
}

.theme-tab:hover {
  background: var(--color-ghost-hover);
  color: var(--color-text);
}

.theme-tab.is-active {
  background: var(--color-primary-soft);
  color: var(--color-on-soft);
}

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

.theme-modal-card {
  width: min(100%, 35rem);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-modal);
}

/* ============================================================
   Icon buttons & action menus
   ============================================================ */

/* Standalone glyph wrapper: size/color with Tailwind utilities on the span,
   e.g. <span class="theme-glyph h-5 w-5 text-emerald-600">{% icon "check" %}</span> */
.theme-glyph {
  display: inline-flex;
  flex: none;
}

.theme-glyph svg {
  width: 100%;
  height: 100%;
}

.theme-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  flex: none;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 7px;
  color: var(--color-text-muted);
  transition: color var(--motion-fast), background var(--motion-fast);
}

.theme-icon-btn svg {
  width: 17px;
  height: 17px;
}

.theme-icon-btn:hover {
  color: var(--color-primary);
  background: var(--color-primary-soft);
  text-decoration: none;
}

.theme-icon-btn.is-on {
  color: var(--color-primary);
}

.theme-icon-btn--danger:hover {
  color: var(--color-danger-text);
  background: var(--color-danger-soft);
}

.theme-icon-btn--success:hover {
  color: var(--color-success-text);
  background: var(--color-success-soft);
}

.theme-icon-btn--sm {
  width: 26px;
  height: 26px;
}

.theme-icon-btn--sm svg {
  width: 15px;
  height: 15px;
}

.theme-menu {
  position: absolute;
  z-index: 60;
  min-width: 220px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-pop);
}

.theme-menu[hidden] {
  display: none;
}

.theme-menu-label {
  padding: 6px 10px 4px;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.theme-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--motion-fast);
}

.theme-menu-item svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--color-text-muted);
}

.theme-menu-item:hover {
  background: var(--color-ghost-hover);
}

.theme-menu-item.is-danger {
  color: var(--color-danger-text);
}

.theme-menu-item.is-danger svg {
  color: var(--color-danger-text);
}

.theme-menu-item.is-danger:hover {
  background: var(--color-danger-soft);
}

.theme-menu-sep {
  height: 1px;
  margin: 5px 4px;
  background: var(--color-border);
}

/* ============================================================
   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.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.theme-page-kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
}

.theme-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.theme-page-subtitle {
  margin-top: 6px;
  max-width: 46rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

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

.theme-panel-soft {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.theme-panel-muted {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-surface-alt);
}

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

.theme-stat-card {
  padding: 18px 20px;
  border: none;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.theme-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.theme-stat-value {
  margin-top: 0.6rem;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.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.25rem;
  border: none;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--motion-fast);
}

.theme-card-link:hover {
  box-shadow: var(--shadow-pop);
}

.theme-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.9rem;
  border-radius: 10px;
  border: none;
  background: var(--color-primary-soft);
  color: var(--color-on-soft);
}

.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.4rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

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

.theme-inline-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--motion-fast);
}

.theme-inline-link:hover {
  color: var(--color-primary-hover);
}

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

.theme-avatar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: var(--color-primary);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.theme-table-shell {
  overflow: hidden;
  border: none;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

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

.theme-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  background: var(--color-surface-alt);
  border-bottom: 1px solid var(--color-border);
}

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

.theme-table tbody tr:hover {
  background: var(--color-surface-alt);
}

.theme-table td {
  padding: 12px 16px;
  font-size: 0.8125rem;
  vertical-align: middle;
}

/* Vertical rule between column groups (put on the first cell of the new group). */
.theme-table th.theme-cell-divider,
.theme-table td.theme-cell-divider {
  border-left: 1px solid var(--color-border);
}

.theme-empty-state {
  padding: 28px 20px;
  border: 1.5px dashed var(--color-border-strong);
  border-radius: var(--radius-panel);
  background: var(--color-surface-alt);
  text-align: center;
}

.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;
}

/* MUST MATCH .theme-field-label — copy any change there in the same commit */
.theme-auth-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-text);
}

/* MUST MATCH .theme-input/.theme-select/.theme-textarea — copy any change there in the same commit */
.theme-auth-form input:not([type="checkbox"]):not([type="radio"]),
.theme-auth-form textarea,
.theme-auth-form select {
  width: 100%;
  border-radius: var(--radius-control);
  border: 1px solid var(--color-border-strong);
  background: var(--color-surface);
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--color-text);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast), background var(--motion-fast);
}

.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: var(--color-primary);
  box-shadow: var(--focus-ring);
}

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

ul.errorlist {
  margin: 0 0 0.5rem;
  padding: 0;
  list-style: none;
  font-size: 0.78125rem;
  line-height: 1.6;
  color: var(--color-danger-text);
}

.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: none;
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-pop);
}

body.theme-error-body {
  min-height: 100vh;
  margin: 0;
  background: var(--color-bg-app);
  color: var(--color-text);
}

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

.theme-error-code {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--color-text);
}

.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: 6px;
  background: var(--color-surface-soft);
  font-size: 0.76rem;
  font-family: var(--font-mono);
}

@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: 10px 12px;
  border-radius: 10px;
  margin-bottom: 0.6rem;
  font-size: 0.84375rem;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.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(22, 163, 74, 0.25);
  background: #e9f6ef;
  color: #166534;
}

.messages .msg.error {
  border-color: rgba(220, 38, 38, 0.25);
  background: #fdecea;
  color: #991b1b;
}

.messages .msg.info {
  border-color: rgba(41, 170, 226, 0.25);
  background: #e9f4fd;
  color: #0f4c81;
}

.messages .msg.warning {
  border-color: rgba(214, 154, 60, 0.3);
  background: #fdf6e3;
  color: #9a6b2e;
}

html.dark .messages .msg.success {
  border-color: rgba(34, 178, 104, 0.3);
  background: rgba(6, 78, 59, 0.35);
  color: #a7f3d0;
}

html.dark .messages .msg.error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(127, 29, 29, 0.35);
  color: #fecaca;
}

html.dark .messages .msg.info {
  border-color: rgba(41, 170, 226, 0.3);
  background: rgba(8, 47, 73, 0.4);
  color: #bae6fd;
}

html.dark .messages .msg.warning {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(120, 53, 15, 0.35);
  color: #fde68a;
}

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: var(--color-border-strong);
  transform: translateY(calc(-50% - 0.25rem));
  z-index: 0;
}

/* The arrowhead at the right end of the rail (masked so it recolors per theme) */
.workflow-stage-nav::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.5rem;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--color-text-subtle);
  -webkit-mask: var(--icon-chevron-right) center / contain no-repeat;
  mask: var(--icon-chevron-right) 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(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast);
}

/* Hover keeps the opaque background so the rail stays hidden behind the pill;
   the cue is a primary border + text + subtle ring. */
.workflow-stage-pill:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring);
}

.workflow-stage-pill.is-active {
  background: var(--color-primary);
  color: #ffffff;
  border-color: var(--color-primary);
  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(--color-primary);
  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: 7px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast);
}

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

.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: 4px;
  border-radius: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-pop);
}

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

.triage-paid-menu button:hover {
  background: var(--color-ghost-hover);
}

.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 var(--color-border);
  border-radius: var(--radius-panel);
  background: var(--color-primary-soft);
}

.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: var(--color-surface-alt);
}

/* ============================================================
   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 svg,
.task-inbox-trigger svg,
.navbar-report-trigger svg,
.dark-toggle .sun-icon svg,
.dark-toggle .moon-icon svg {
  width: 18px;
  height: 18px;
}
.dark-toggle .sun-icon,
.dark-toggle .moon-icon {
  display: inline-flex;
}
/* Idle bells sit quieter than active ones */
.tasks-bell[data-empty] .tasks-bell-trigger {
  color: var(--color-text-subtle);
}
.tasks-bell-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--motion-fast), color var(--motion-fast);
}
.tasks-bell-trigger:hover {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.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: var(--color-danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--color-surface);
}
.tasks-bell-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 20rem;
  max-height: 24rem;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 70;
}
.tasks-bell-panel-head {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  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: 8px;
  text-decoration: none;
  color: var(--color-text);
}
.tasks-bell-item:hover { background: var(--color-ghost-hover); }
.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: var(--color-danger-text); white-space: nowrap; }
.tasks-bell-empty { padding: 1.5rem 0.6rem; text-align: center; color: var(--color-text-subtle); font-size: 0.9rem; }
.tasks-bell-more {
  display: block;
  padding: 0.5rem 0.6rem;
  margin-top: 0.25rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-link);
  text-decoration: none;
}

/* Personal notifications bell (shares the .tasks-bell frame) */
.tasks-bell-item.is-unread .tasks-bell-item-title { font-weight: 700; }
.tasks-bell-item.is-unread::before {
  content: "";
  flex: none;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 9999px;
  background: var(--color-accent);
}
.tasks-bell-item:not(.is-unread) .tasks-bell-item-title { font-weight: 500; color: var(--color-text-muted); }
.tasks-bell-item-when { font-size: 0.72rem; color: var(--color-text-subtle); white-space: nowrap; }
.tasks-notif-title {
  /* notifications carry a whole sentence — wrap to two lines instead of clipping */
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tasks-bell-readall {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-top: 1px solid var(--color-border);
  cursor: pointer;
  font-weight: 600;
}

/* Highlighted @mention inside comment bodies */
.tasks-mention {
  color: var(--color-accent);
  background: rgba(41, 170, 226, 0.12);
  border-radius: 0.35rem;
  padding: 0 0.25rem;
  font-weight: 600;
}
html.dark .tasks-mention { background: rgba(41, 170, 226, 0.2); }

.freshness-dot.is-info { background-color: #3b82f6; }

/* ============================================================
   Rendered agreement / contract typography — used by the
   agreement approve/view pages and contract template previews.
   ============================================================ */
.agreement-content h1 { font-size: 1.5rem; font-weight: 700; margin: 1.5em 0 0.5em; }
.agreement-content h2 { font-size: 1.25rem; font-weight: 600; margin: 1.25em 0 0.5em; }
.agreement-content h3 { font-size: 1.1rem; font-weight: 600; margin: 1em 0 0.4em; }
.agreement-content p { margin: 0.6em 0; }
.agreement-content ul,
.agreement-content ol { margin: 0.5em 0; padding-left: 1.5em; }
.agreement-content li { margin: 0.25em 0; }
.agreement-content strong { font-weight: 600; }
.agreement-content hr { border-color: var(--color-border); margin: 1.5em 0; }
.agreement-content table { width: 100%; border-collapse: collapse; margin: 1em 0; }
.agreement-content th,
.agreement-content td { border: 1px solid var(--color-border); padding: 0.5em 0.75em; text-align: left; }
.agreement-content th { background: var(--color-surface-alt); font-weight: 600; }

