/* ============================================================
   TribePeer v2.0 — Global Stylesheet
   Brand Accent: #5850ec
   Fonts: Sora (display) + DM Sans (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&display=swap');

/* ============================================================
   1. CSS Custom Properties (Tokens)
   ============================================================ */

:root {
  /* --- Brand --- */
  --primary: #5850ec;
  --primary-dark: #3730a3;
  --primary-deeper: #2521a0;
  --primary-light: #818cf8;
  --primary-muted: #ede9fe;
  --primary-faint: #f5f3ff;

  /* --- Neutrals (Light) --- */
  --bg: #f7f6fe;
  --surface: #ffffff;
  --surface-alt: #f3f2fc;
  --surface-hover: #eeecfb;
  --border: #e4e2f5;
  --border-strong: #cbc8ee;

  /* --- Text --- */
  --text: #16151f;
  --text-secondary: #4b4869;
  --text-muted: #7c7a9e;
  --text-faint: #b0aec8;
  --text-inverse: #ffffff;

  /* --- Semantic --- */
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --info: #2563eb;
  --info-bg: #dbeafe;

  /* --- Shadows --- */
  --shadow-xs: 0 1px 2px rgba(88, 80, 236, 0.06);
  --shadow-sm: 0 1px 4px rgba(88, 80, 236, 0.08), 0 1px 2px rgba(88, 80, 236, 0.04);
  --shadow-md: 0 4px 16px rgba(88, 80, 236, 0.10), 0 1px 4px rgba(88, 80, 236, 0.06);
  --shadow-lg: 0 8px 32px rgba(88, 80, 236, 0.14), 0 2px 8px rgba(88, 80, 236, 0.08);
  --shadow-xl: 0 20px 60px rgba(88, 80, 236, 0.18), 0 4px 16px rgba(88, 80, 236, 0.10);
  --shadow-glow: 0 0 0 3px rgba(88, 80, 236, 0.22);
  --shadow-glow-sm: 0 0 0 2px rgba(88, 80, 236, 0.18);

  /* --- Radii --- */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-2xl: 30px;
  --r-full: 9999px;

  /* --- Spacing --- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 28px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* --- Typography --- */
  --font-display: 'Sora', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --text-xs: 0.72rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  /* --- Layout --- */
  --sidebar-w: 240px;
  --panel-right-w: 350px;
  --navbar-h: 60px;
  --bottom-nav-h: 62px;

  /* --- Transitions --- */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 350ms;

  /* --- Z-index scale --- */
  --z-base: 1;
  --z-sticky: 50;
  --z-sidebar: 100;
  --z-navbar: 110;
  --z-overlay: 200;
  --z-drawer: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* Scrollbars (used by *::-webkit-scrollbar and scrollbar-color) */
  --scrollbar-thumb: rgba(88, 80, 236, 0.28);
  --scrollbar-thumb-hover: rgba(88, 80, 236, 0.45);
  --scrollbar-track: transparent;
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #0c0b14;
  --surface: #13121f;
  --surface-alt: #1a192a;
  --surface-hover: #211f34;
  --border: #2a2840;
  --border-strong: #3d3a5c;

  --text: #f0effe;
  --text-secondary: #b8b5d8;
  --text-muted: #7875a0;
  --text-faint: #4d4b6a;

  --primary-muted: #1e1b4b;
  --primary-faint: #16133d;

  --success-bg: #052e16;
  --warning-bg: #431407;
  --danger-bg: #450a0a;
  --info-bg: #0f1f4a;

  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.5);

  --scrollbar-thumb: rgba(165, 158, 230, 0.32);
  --scrollbar-thumb-hover: rgba(200, 194, 245, 0.5);
}

/* Slim scrollbars — hidden until interaction; html.show-scrollbars set by ScrollbarAutoHide (global.js) */
* {
  scrollbar-width: thin;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color 0.45s var(--ease);
}

html.show-scrollbars * {
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: var(--r-full);
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background 0.45s var(--ease);
}

html.show-scrollbars *::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
}

html.show-scrollbars *::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  border: 1px solid transparent;
  background-clip: padding-box;
}

/* ============================================================
   2. Reset & Base
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease);
}

img,
video,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  outline: none;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
}

/* ============================================================
   3. Layout Shell
   ============================================================ */

.app-body {
  min-height: 100vh;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-5);
  gap: var(--sp-4);
  z-index: var(--z-navbar);
  transition: background var(--dur-slow) var(--ease), border-color var(--dur-slow) var(--ease);
}

.navbar-logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--primary);
  letter-spacing: -0.03em;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.logo-dark-mode {
  display: none;
}

[data-theme="dark"] .logo-dark-mode {
  display: block;
}

[data-theme="dark"] .logo-light-mode {
  display: none;
}

.navbar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.navbar-logo-icon svg {
  width: 18px;
  height: 18px;
  color: #fff;
}

.navbar-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}

.navbar-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: var(--text-sm);
  color: var(--text);
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), background var(--dur-slow) var(--ease);
}

.navbar-search input::placeholder {
  color: var(--text-faint);
}

.navbar-search input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: var(--surface);
}

.navbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.navbar-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: var(--z-overlay);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}

.navbar-search-results.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.search-result-group-label {
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-family: var(--font-display);
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
}

.search-result-item:hover {
  background: var(--surface-alt);
}

.search-result-item .sr-name {
  font-size: var(--text-sm);
  font-weight: 500;
}

.search-result-item .sr-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-left: auto;
}

.navbar-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  position: relative;
}

.navbar-icon-btn:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.navbar-icon-btn svg {
  width: 20px;
  height: 20px;
}

.navbar-badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--r-full);
  border: 2px solid var(--surface);
}

.navbar-avatar-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 4px 4px 4px;
  border-radius: var(--r-full);
  transition: background var(--dur-fast) var(--ease);
  cursor: pointer;
}

.navbar-avatar-btn:hover {
  background: var(--surface-alt);
}

/* Hamburger (mobile only) */
.hamburger {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-direction: column;
  gap: 5px;
  transition: background var(--dur-fast) var(--ease);
}

.hamburger:hover {
  background: var(--surface-alt);
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: var(--r-full);
  transition: transform var(--dur-base) var(--ease), opacity var(--dur-base) var(--ease);
}

.hamburger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--navbar-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-sidebar);
  /* padding: var(--sp-4) 0 var(--sp-10); */
  display: flex;
  flex-direction: column;
  transition: transform var(--dur-slow) var(--ease), background var(--dur-slow) var(--ease), border-color var(--dur-slow) var(--ease);
}

/* custom scrollbar on sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--r-full);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-2);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 700;
  font-size: var(--text-sm);
  font-family: var(--font-display);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
}

.sidebar-section-label {
  padding: var(--sp-4) var(--sp-5) var(--sp-1);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  font-family: var(--font-display);
}

.sidebar-item {
  position: relative;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-left: 3px solid transparent;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
  position: relative;
}

.sidebar-link:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.sidebar-link.active {
  color: var(--primary);
  background: var(--primary-muted);
  border-left-color: var(--primary);
  font-weight: 600;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-link-label {
  flex: 1;
}

.sidebar-nav-badge {
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-display);
  padding: 1px 7px;
  border-radius: var(--r-full);
  line-height: 16px;
}

/* Subnav accordion */
.sidebar-subnav-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-5);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-left: 3px solid transparent;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  width: 100%;
  text-align: left;
}

.sidebar-subnav-toggle:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.sidebar-subnav-toggle .chevron {
  width: 14px;
  height: 14px;
  margin-left: auto;
  color: var(--text-faint);
  transition: transform var(--dur-base) var(--ease);
}

.sidebar-item.is-open .chevron {
  transform: rotate(90deg);
}

.sidebar-subnav {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-slow) var(--ease-out);
}

.sidebar-item.is-open .sidebar-subnav {
  max-height: 300px;
}

.sidebar-subnav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px var(--sp-5) 8px 52px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.sidebar-subnav-link:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.sidebar-subnav-link.active {
  color: var(--primary);
  font-weight: 600;
}

.sidebar-subnav-link::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: var(--r-full);
  background: currentColor;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-3) var(--sp-5);
}

.sidebar-upgrade {
  margin: var(--sp-4) var(--sp-4) 0;
  background: linear-gradient(135deg, var(--primary) 0%, #818cf8 100%);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  color: #fff;
  font-size: var(--text-sm);
}

.sidebar-upgrade-title {
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: var(--sp-1);
}

.sidebar-upgrade-desc {
  font-size: var(--text-xs);
  opacity: 0.85;
  margin-bottom: var(--sp-3);
}

.sidebar-upgrade-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--r-full);
  padding: 6px 16px;
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-display);
  transition: background var(--dur-fast) var(--ease);
  display: inline-block;
}

.sidebar-upgrade-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Sidebar backdrop (mobile) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 11, 20, 0.65);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease);
}

.sidebar-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* App main layout */
.app-layout {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
}

.hide-text-mobile {
  display: inline;
}

/* Messages route: single full-width column, no .app-main wrapper */
.app-layout.app-layout--messages {
  align-items: stretch;
  min-height: 100vh;
  /* width: 100%; */
  max-width: none;
  padding: 0;
  margin-top: 0;
}

/* Tribe viewer: full-width column under navbar (no .app-main) */
.app-layout.app-layout--tribe-show {
  align-items: stretch;
  min-height: 100vh;
  max-width: none;
  padding: 0;
  margin-top: 0;
}

.app-main {
  flex: 1;
  min-width: 0;
  max-width: 680px;
  padding: calc(var(--navbar-h) + var(--sp-6)) var(--sp-6) var(--sp-12);
}

.panel-right {
  width: var(--panel-right-w);
  flex-shrink: 0;
  padding: calc(var(--navbar-h) + var(--sp-6)) var(--sp-5) var(--sp-10);
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

.panel-right::-webkit-scrollbar {
  display: none;
}

/* Mobile bottom nav */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: var(--z-navbar);
  padding-bottom: env(safe-area-inset-bottom);
}

.mobile-bottom-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 100%;
  padding: 0 var(--sp-2);
}

.mobile-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-muted);
  border-radius: var(--r-md);
  transition: color var(--dur-fast) var(--ease);
  position: relative;
  text-decoration: none;
}

.mobile-nav-tab svg {
  width: 22px;
  height: 22px;
}

.mobile-nav-tab.active {
  color: var(--primary);
}

.mobile-nav-tab.active svg {
  stroke-width: 2.5;
}

.mobile-nav-fab {
  width: 50px;
  height: 50px;
  background: var(--primary);
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: var(--shadow-md);
  margin-top: -20px;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease-spring);
}

.mobile-nav-fab:hover {
  background: var(--primary-dark);
  transform: scale(1.05);
}

.mobile-nav-fab svg {
  width: 22px;
  height: 22px;
}

/* ============================================================
   4. Typography Utilities
   ============================================================ */

.font-display {
  font-family: var(--font-display);
}

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

.text-xs {
  font-size: var(--text-xs);
}

.text-sm {
  font-size: var(--text-sm);
}

.text-base {
  font-size: var(--text-base);
}

.text-lg {
  font-size: var(--text-lg);
}

.text-xl {
  font-size: var(--text-xl);
}

.text-2xl {
  font-size: var(--text-2xl);
}

.text-3xl {
  font-size: var(--text-3xl);
}

.font-normal {
  font-weight: 400;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.font-extrabold {
  font-weight: 800;
}

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

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

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

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

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

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

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

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

/* ============================================================
   5. Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 2px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease-spring);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Primary */
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

.btn-primary:focus-visible {
  box-shadow: var(--shadow-glow);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-muted);
  box-shadow: var(--shadow-sm);
}

/* Secondary */
.btn-secondary {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

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

/* Danger */
.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #b91c1c;
}

/* Success */
.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

/* Sizes */
.btn-xs {
  padding: 4px 12px;
  font-size: var(--text-xs);
}

.btn-sm {
  padding: 7px 16px;
  font-size: var(--text-xs);
}

.btn-lg {
  padding: 13px 28px;
  font-size: var(--text-base);
}

/* Icon-only */
.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--r-md);
  flex-shrink: 0;
}

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

.btn-icon-lg {
  width: 44px;
  height: 44px;
}

.btn-icon-circle {
  border-radius: var(--r-full);
}

/* Full width */
.btn-block {
  width: 100%;
}

/* Loading state */
.btn.is-loading {
  pointer-events: none;
}

.btn.is-loading .btn-text {
  opacity: 0;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after,
.btn-outline.is-loading::after {
  border-color: rgba(88, 80, 236, 0.25);
  border-top-color: var(--primary);
}

/* ============================================================
   6. Cards
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background var(--dur-slow) var(--ease), border-color var(--dur-slow) var(--ease);
}

.card-hover {
  transition: box-shadow var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
}

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

.card-body {
  padding: var(--sp-5);
}

.card-sm .card-body {
  padding: var(--sp-4);
}

.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.card-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
}

/* ============================================================
   7. Avatars
   ============================================================ */

.avatar {
  border-radius: var(--r-full);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-muted);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-2xs {
  width: 20px;
  height: 20px;
}

.avatar-xs {
  width: 26px;
  height: 26px;
}

.avatar-sm {
  width: 34px;
  height: 34px;
}

.avatar-md {
  width: 42px;
  height: 42px;
}

.avatar-lg {
  width: 54px;
  height: 54px;
}

.avatar-xl {
  width: 72px;
  height: 72px;
}

.avatar-2xl {
  width: 100px;
  height: 100px;
}

.avatar-3xl {
  width: 130px;
  height: 130px;
}

/* Initials fallback */
.avatar-initials {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  background: var(--primary-muted);
  font-size: 40%;
}

[data-theme="dark"] .avatar-initials {
  background: var(--primary-muted);
  color: var(--primary-light);
}

/* Online indicator */
.avatar-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.avatar-indicator {
  position: absolute;
  bottom: 1px;
  right: 1px;
  border: 2px solid var(--surface);
  border-radius: var(--r-full);
}

.avatar-sm+.avatar-indicator,
.avatar-wrap.avatar-sm .avatar-indicator {
  width: 9px;
  height: 9px;
}

.avatar-md+.avatar-indicator,
.avatar-wrap.avatar-md .avatar-indicator {
  width: 11px;
  height: 11px;
  bottom: 1px;
  right: 1px;
}

.avatar-lg+.avatar-indicator,
.avatar-wrap.avatar-lg .avatar-indicator {
  width: 13px;
  height: 13px;
}

.indicator-online {
  background: #22c55e;
}

.indicator-offline {
  background: var(--text-faint);
}

.indicator-away {
  background: var(--warning);
}

/* Avatar stack */
.avatar-stack {
  display: flex;
}

.avatar-stack .avatar-wrap {
  margin-right: -10px;
}

.avatar-stack .avatar-wrap:last-child {
  margin-right: 0;
}

.avatar-stack .avatar {
  border: 2px solid var(--surface);
}

.avatar-stack-overflow {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: var(--surface-alt);
  border: 2px solid var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-display);
  flex-shrink: 0;
}

/* ============================================================
   8. Badges & Pills
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
  line-height: 18px;
  white-space: nowrap;
}

.badge svg {
  width: 11px;
  height: 11px;
}

/* Role badges */
.badge-owner {
  background: #fef3c7;
  color: #92400e;
}

.badge-admin {
  background: var(--primary-muted);
  color: var(--primary-dark);
}

.badge-moderator {
  background: #e0f2fe;
  color: #0c4a6e;
}

.badge-peer {
  background: var(--success-bg);
  color: #15803d;
}

.badge-premium {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
}

.badge-tutor {
  background: var(--primary-muted);
  color: var(--primary);
}

/* Access type */
.badge-free {
  background: var(--success-bg);
  color: #15803d;
}

.badge-paid {
  background: #fce7f3;
  color: #9d174d;
}

.badge-tpt {
  background: var(--primary-muted);
  color: var(--primary);
}

/* Visibility */
.badge-public {
  background: var(--info-bg);
  color: #1e40af;
}

.badge-private-listed {
  background: var(--warning-bg);
  color: #92400e;
}

.badge-hidden {
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Material types */
.badge-text {
  background: #f0fdf4;
  color: #15803d;
}

.badge-video {
  background: #fce7f3;
  color: #9d174d;
}

.badge-document {
  background: var(--info-bg);
  color: #1e40af;
}

.badge-quiz {
  background: var(--warning-bg);
  color: #92400e;
}

.badge-assignment {
  background: var(--primary-muted);
  color: var(--primary-dark);
}

/* Status */
.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

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

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

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

.badge-neutral {
  background: var(--surface-alt);
  color: var(--text-muted);
}

[data-theme="dark"] .badge-owner {
  background: #451a03;
  color: #fbbf24;
}

[data-theme="dark"] .badge-peer {
  background: #052e16;
  color: #86efac;
}

[data-theme="dark"] .badge-free {
  background: #052e16;
  color: #86efac;
}

[data-theme="dark"] .badge-paid {
  background: #4a044e;
  color: #f0abfc;
}

/* Live indicator */
.badge-live {
  background: var(--danger);
  color: #fff;
  animation: pulse-badge 2s ease infinite;
}

@keyframes pulse-badge {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
  }

  50% {
    box-shadow: 0 0 0 5px rgba(220, 38, 38, 0);
  }
}

/* ============================================================
   9. Form Elements
   ============================================================ */

.form-group {
  margin-bottom: var(--sp-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease),
    background var(--dur-slow) var(--ease);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-faint);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
  background: var(--surface);
  outline: none;
}

.form-textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.6;
}

.form-input-icon-wrap {
  position: relative;
}

.form-input-icon-wrap .form-input {
  padding-left: 38px;
}

.form-input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.form-input-icon svg {
  width: 16px;
  height: 16px;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 5px;
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: 5px;
  display: none;
}

.form-group.has-error .form-error {
  display: block;
}

.form-group.has-error .form-input,
.form-group.has-error .form-textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-char-count {
  font-size: var(--text-xs);
  color: var(--text-faint);
  text-align: right;
  margin-top: 4px;
}

.form-char-count.near-limit {
  color: var(--warning);
}

.form-char-count.at-limit {
  color: var(--danger);
}

/* Radio pill group */
.radio-pills {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px 16px;
  border: 2px solid var(--border);
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--dur-base) var(--ease);
  user-select: none;
}

.radio-pill input {
  display: none;
}

.radio-pill:hover {
  border-color: var(--primary-light);
  background: var(--primary-faint);
}

.radio-pill:has(input:checked),
.radio-pill.checked {
  border-color: var(--primary);
  background: var(--primary-muted);
  color: var(--primary);
  font-weight: 700;
}

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.toggle-info {
  flex: 1;
}

.toggle-info-title {
  font-weight: 600;
  font-size: var(--text-sm);
}

.toggle-info-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: background var(--dur-base) var(--ease);
}

.toggle-track::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--dur-base) var(--ease-spring);
}

.toggle input:checked+.toggle-track {
  background: var(--primary);
}

.toggle input:checked+.toggle-track::before {
  transform: translateX(20px);
}

/* File upload zone */
.file-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}

.file-zone:hover,
.file-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-faint);
}

.file-zone-icon {
  color: var(--text-faint);
  margin: 0 auto var(--sp-3);
}

.file-zone-text {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.file-zone-link {
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   10. Progress Bar
   ============================================================ */

.progress {
  height: 6px;
  background: var(--surface-alt);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-sm {
  height: 4px;
}

.progress-md {
  height: 8px;
}

.progress-lg {
  height: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: var(--r-full);
  transition: width 0.6s var(--ease);
}

.progress-fill-success {
  background: linear-gradient(90deg, var(--success), #4ade80);
}

.progress-fill-warning {
  background: linear-gradient(90deg, var(--warning), #fbbf24);
}

/* ============================================================
   11. Table
   ============================================================ */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  white-space: nowrap;
}

.table th {
  background: var(--surface-alt);
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

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

.table .col-sticky {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: var(--z-base);
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);
}

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

.table-avatar-cell {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.table-avatar-cell .cell-name {
  font-weight: 600;
}

.table-avatar-cell .cell-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ============================================================
   12. Toasts
   ============================================================ */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  pointer-events: auto;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur-slow) var(--ease);
}

.toast.is-visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.toast-icon svg {
  width: 16px;
  height: 16px;
}

.toast-success .toast-icon {
  background: var(--success-bg);
  color: var(--success);
}

.toast-danger .toast-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.toast-warning .toast-icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.toast-info .toast-icon {
  background: var(--primary-muted);
  color: var(--primary);
}

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-danger {
  border-left: 3px solid var(--danger);
}

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-info {
  border-left: 3px solid var(--primary);
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  font-size: var(--text-sm);
  font-family: var(--font-display);
}

.toast-message {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 1px;
}

.toast-close {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.toast-close:hover {
  background: var(--surface-alt);
  color: var(--text);
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

/* ============================================================
   13. Modals
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 11, 20, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
  pointer-events: none;
}

.modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: scale(0.94) translateY(12px);
  transition: transform var(--dur-slow) var(--ease-spring);
  overflow: hidden;
}

.modal-overlay.is-open .modal {
  transform: scale(1) translateY(0);
}

.modal-lg {
  max-width: 680px;
}

.modal-sm {
  max-width: 380px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5) var(--sp-6);
}

.modal-body::-webkit-scrollbar {
  width: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--r-full);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Bottom sheet (mobile) */
@media (max-width: 600px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    max-height: 92vh;
    transform: translateY(100%);
  }

  .modal-overlay.is-open .modal {
    transform: translateY(0);
  }
}

/* ============================================================
   14. Notification Drawer
   ============================================================ */

.notif-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease);
}

.notif-drawer.is-open {
  transform: translateX(0);
}

.notif-drawer-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notif-drawer-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  flex: 1;
}

.notif-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-4);
  flex-shrink: 0;
  overflow-x: auto;
}

.notif-tab {
  padding: 11px 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.notif-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.notif-list {
  flex: 1;
  overflow-y: auto;
}

.notif-list::-webkit-scrollbar {
  width: 4px;
}

.notif-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--r-full);
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background var(--dur-fast) var(--ease);
}

.notif-item:hover {
  background: var(--surface-alt);
}

.notif-item.unread {
  background: var(--primary-faint);
}

[data-theme="dark"] .notif-item.unread {
  background: var(--primary-muted);
}

.notif-item.unread:hover {
  background: #ebe9fc;
}

[data-theme="dark"] .notif-item.unread:hover {
  background: #2a2870;
}

.notif-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notif-icon-wrap svg {
  width: 18px;
  height: 18px;
}

.notif-icon-tribe {
  background: var(--primary-muted);
  color: var(--primary);
}

.notif-icon-peer {
  background: var(--success-bg);
  color: var(--success);
}

.notif-icon-message {
  background: #e0f2fe;
  color: #0284c7;
}

.notif-icon-assessment {
  background: var(--warning-bg);
  color: var(--warning);
}

.notif-icon-system {
  background: var(--surface-alt);
  color: var(--text-muted);
}

.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-text {
  font-size: var(--text-sm);
  line-height: 1.45;
}

.notif-text strong {
  font-weight: 700;
}

.notif-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 3px;
}

.notif-unread-dot {
  width: 8px;
  height: 8px;
  background: var(--primary);
  border-radius: var(--r-full);
  flex-shrink: 0;
  margin-top: 5px;
}

/* ============================================================
   14b. Tribe preview drawer (discovery — details before enroll)
   ============================================================ */

.tribe-preview-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 11, 20, 0.55);
  z-index: calc(var(--z-drawer) - 1);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease);
}

.tribe-preview-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.tribe-preview-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100vw);
  max-width: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease);
}

.tribe-preview-drawer.is-open {
  transform: translateX(0);
}

.tribe-preview-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tribe-preview-header-label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  flex: 1;
}

.tribe-preview-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.tribe-preview-banner {
  position: relative;
  height: 180px;
  flex-shrink: 0;
}

.tribe-preview-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tribe-preview-banner-fallback {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-muted), var(--primary-light));
}

.tribe-preview-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(12, 11, 20, 0.55), transparent 55%);
  pointer-events: none;
}

.tribe-preview-badges-row {
  position: absolute;
  left: var(--sp-4);
  right: var(--sp-4);
  bottom: var(--sp-4);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-2);
  pointer-events: none;
}

.tribe-preview-inner {
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
}

.tribe-preview-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: var(--sp-2);
}

.tribe-preview-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-4);
}

.tribe-preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--sp-4);
}

.tribe-preview-section {
  margin-top: var(--sp-6);
}

.tribe-preview-h {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  margin-bottom: var(--sp-2);
}

.tribe-preview-prose {
  line-height: 1.55;
}

.tribe-preview-list {
  margin: 0;
  padding-left: 1.15rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.55;
}

.tribe-preview-list li {
  margin-bottom: var(--sp-2);
}

.tribe-preview-accordion {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
  background: var(--surface-alt);
  overflow: hidden;
}

.tribe-preview-accordion-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text);
  transition: background var(--dur-fast) var(--ease);
}

.tribe-preview-accordion-summary::-webkit-details-marker {
  display: none;
}

.tribe-preview-accordion summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  flex-shrink: 0;
  transition: transform var(--dur-base) var(--ease);
}

.tribe-preview-accordion[open] summary::after {
  transform: rotate(-135deg);
  margin-top: 4px;
}

.tribe-preview-accordion-summary:hover {
  background: var(--surface-hover);
}

.tribe-preview-mod-title {
  flex: 1;
  min-width: 0;
}

.tribe-preview-material-list {
  list-style: none;
  margin: 0;
  padding: 0 var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.tribe-preview-material {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.tribe-preview-material:last-child {
  border-bottom: none;
}

.tribe-preview-material-ic {
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
}

.tribe-preview-material-name {
  flex: 1;
  min-width: 0;
}

.tribe-preview-material-meta {
  font-size: var(--text-xs);
  color: var(--text-faint);
  flex-shrink: 0;
}

.tribe-preview-footer {
  flex-shrink: 0;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 -4px 24px rgba(88, 80, 236, 0.06);
}

[data-theme="dark"] .tribe-preview-footer {
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}

.app-main.app-main--wide {
  max-width: none;
}

/* ============================================================
   15. Empty & Loading States
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  gap: var(--sp-3);
}

.empty-icon {
  width: 72px;
  height: 72px;
  background: var(--primary-muted);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  margin-bottom: var(--sp-2);
}

.empty-icon svg {
  width: 32px;
  height: 32px;
}

.empty-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
}

.empty-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  max-width: 300px;
}

/* Skeletons */
@keyframes skeleton-shimmer {
  0% {
    background-position: -600px 0;
  }

  100% {
    background-position: 600px 0;
  }
}

.skeleton {
  background: linear-gradient(90deg,
      var(--surface-alt) 25%,
      var(--surface-hover) 50%,
      var(--surface-alt) 75%);
  background-size: 1200px 100%;
  animation: skeleton-shimmer 1.6s infinite linear;
  border-radius: var(--r-sm);
}

.skeleton-text {
  height: 14px;
  border-radius: var(--r-xs);
}

.skeleton-avatar {
  border-radius: var(--r-full);
}

.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}

/* Page loader */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-muted);
  z-index: var(--z-toast);
}

.page-loader-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: var(--r-full);
  animation: page-load 1.4s ease infinite;
}

@keyframes page-load {
  0% {
    width: 0%;
    margin-left: 0;
  }

  50% {
    width: 75%;
    margin-left: 10%;
  }

  100% {
    width: 0%;
    margin-left: 100%;
  }
}

/* ============================================================
   16. Dropdown / Context Menu
   ============================================================ */

.dropdown {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: var(--z-overlay);
  overflow: hidden;
  opacity: 0;
  transform: scale(0.95) translateY(-6px);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease-spring);
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--surface-alt);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-item.danger:hover {
  background: var(--danger-bg);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.dropdown-item.danger svg {
  color: var(--danger);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: var(--sp-1) 0;
}

/* ============================================================
   17. Step Indicator
   ============================================================ */

.steps {
  display: flex;
  align-items: center;
  margin-bottom: var(--sp-6);
}

.step {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  border: 2px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  flex-shrink: 0;
  transition: all var(--dur-base) var(--ease);
}

.step.active {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-glow-sm);
}

.step.done {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  transition: background var(--dur-base) var(--ease);
}

.step-connector.done {
  background: var(--success);
}

/* ============================================================
   18. Animations & Keyframes
   ============================================================ */

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

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes marquee {
  from {
    transform: translateX(100%);
  }

  to {
    transform: translateX(-100%);
  }
}

.animate-fade-in {
  animation: fade-in var(--dur-slow) var(--ease) both;
}

.animate-slide-up {
  animation: slide-up var(--dur-slow) var(--ease) both;
}

.animate-pop-in {
  animation: pop-in var(--dur-slow) var(--ease-spring) both;
}

/* Staggered children */
.stagger>* {
  animation: slide-up var(--dur-slow) var(--ease) both;
}

.stagger>*:nth-child(1) {
  animation-delay: 0ms;
}

.stagger>*:nth-child(2) {
  animation-delay: 60ms;
}

.stagger>*:nth-child(3) {
  animation-delay: 120ms;
}

.stagger>*:nth-child(4) {
  animation-delay: 180ms;
}

.stagger>*:nth-child(5) {
  animation-delay: 240ms;
}

.stagger>*:nth-child(6) {
  animation-delay: 300ms;
}

/* ============================================================
   19. Utility Classes
   ============================================================ */

.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

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

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

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

.justify-center {
  justify-content: center;
}

.justify-end {
  justify-content: flex-end;
}

.flex-1 {
  flex: 1;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.gap-1 {
  gap: var(--sp-1);
}

.gap-2 {
  gap: var(--sp-2);
}

.gap-3 {
  gap: var(--sp-3);
}

.gap-4 {
  gap: var(--sp-4);
}

.gap-5 {
  gap: var(--sp-5);
}

.gap-6 {
  gap: var(--sp-6);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}

.grid-auto {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-4);
}

.w-full {
  width: 100%;
}

.h-full {
  height: 100%;
}

.min-w-0 {
  min-width: 0;
}

.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.rounded-sm {
  border-radius: var(--r-sm);
}

.rounded-md {
  border-radius: var(--r-md);
}

.rounded-lg {
  border-radius: var(--r-lg);
}

.rounded-full {
  border-radius: var(--r-full);
}

.overflow-hidden {
  overflow: hidden;
}

.overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pointer {
  cursor: pointer;
}

.select-none {
  user-select: none;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mt-1 {
  margin-top: var(--sp-1);
}

.mt-2 {
  margin-top: var(--sp-2);
}

.mt-3 {
  margin-top: var(--sp-3);
}

.mt-4 {
  margin-top: var(--sp-4);
}

.mt-5 {
  margin-top: var(--sp-5);
}

.mt-6 {
  margin-top: var(--sp-6);
}

.mb-2 {
  margin-bottom: var(--sp-2);
}

.mb-3 {
  margin-bottom: var(--sp-3);
}

.mb-4 {
  margin-bottom: var(--sp-4);
}

.mb-5 {
  margin-bottom: var(--sp-5);
}

.mr-2 {
  margin-right: var(--sp-2);
}

.ml-auto {
  margin-left: auto;
}

.p-4 {
  padding: var(--sp-4);
}

.p-5 {
  padding: var(--sp-5);
}

.px-4 {
  padding-left: var(--sp-4);
  padding-right: var(--sp-4);
}

.py-2 {
  padding-top: var(--sp-2);
  padding-bottom: var(--sp-2);
}

.border-t {
  border-top: 1px solid var(--border);
}

.border-b {
  border-bottom: 1px solid var(--border);
}

.opacity-0 {
  opacity: 0;
}

.opacity-50 {
  opacity: 0.5;
}

/* ============================================================
   20. Responsive — Breakpoints
   ============================================================ */

/* Tablet — hide right panel */
@media (max-width: 1280px) {
  .panel-right {
    display: none;
  }

  .app-main {
    max-width: 100%;
  }
}

/* Mobile — sidebar becomes drawer */
@media (max-width: 1023px) {
  .hamburger {
    display: flex;
  }

  .sidebar {
    top: 0;
    width: 280px;
    z-index: var(--z-drawer);
    transform: translateX(-100%);
    padding-top: var(--sp-16);
    box-shadow: var(--shadow-xl);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .app-layout {
    margin-left: 0;
  }

  .app-main {
    padding: calc(var(--navbar-h) + var(--sp-5)) var(--sp-4) calc(var(--bottom-nav-h) + var(--sp-6));
    max-width: 100%;
  }

  .mobile-bottom-nav {
    display: block;
  }

  /* Messages: full-height chat — hide fixed bottom nav (body class toggled in messages script) */
  body.messages-mobile-chat-open .mobile-bottom-nav {
    display: none !important;
  }

  body.messages-mobile-chat-open #toast-container {
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .navbar-search {
    display: none;
  }
}

/* Small mobile */
@media (max-width: 600px) {
  .navbar {
    padding: 0 var(--sp-4);
  }

  #toast-container {
    bottom: calc(var(--bottom-nav-h) + 12px);
    right: var(--sp-3);
    left: var(--sp-3);
  }

  body.messages-mobile-chat-open #toast-container {
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .notif-drawer {
    width: 100%;
  }

  .tribe-preview-drawer {
    width: 100%;
    max-width: none;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .hide-text-mobile {
    display: none;
  }
}

/* ============================================================
   21. Dark mode — component overrides
   ============================================================ */

[data-theme="dark"] .table th {
  background: var(--surface-alt);
}

[data-theme="dark"] .table .col-sticky {
  background: var(--surface);
}

[data-theme="dark"] .table tbody tr:hover .col-sticky {
  background: var(--surface-alt);
}

[data-theme="dark"] .skeleton {
  background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface-hover) 50%, var(--surface-alt) 75%);
}

/* ============================================================
   Tribe dashboard (owner/admin) — TRIBEPEER_V2_PAGES_WIREFRAME §4
   MPA: one GET per tab; shared shell (banner + sticky subnav).
   Spec sizes: banner 180px; thumb 64×64; chart block 220px tall;
   content slide-in editor 400px (documented on content tab).
   ============================================================ */

.app-main.tribe-dashboard-main {
  max-width: none;
  padding: var(--navbar-h) 0 calc(var(--sp-12) + env(safe-area-inset-bottom, 0));
}

@media (max-width: 1023px) {
  .app-main.tribe-dashboard-main {
    padding-bottom: calc(var(--bottom-nav-h) + var(--sp-8) + env(safe-area-inset-bottom, 0));
  }
}

.tribe-dash-header {
  position: relative;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tribe-dash-banner {
  height: 180px;
  min-height: 180px;
  max-height: 180px;
  width: 100%;
  background-color: var(--surface-alt);
  background-image: linear-gradient(to top, rgba(12, 11, 20, 0.78) 0%, rgba(12, 11, 20, 0.2) 45%, transparent 100%),
    var(--tribe-dash-banner-img);
  background-size: cover;
  background-position: center;
}

.tribe-dash-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-6) var(--sp-5);
}

.tribe-dash-header-main {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-4);
  min-width: 0;
  flex: 1;
}

.tribe-dash-thumb-wrap {
  flex-shrink: 0;
  margin-top: -40px;
  position: relative;
  z-index: 1;
}

.tribe-dash-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--r-lg);
  object-fit: cover;
  display: block;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-md);
  background: var(--surface-alt);
}

.tribe-dash-thumb--placeholder {
  border: 3px solid var(--surface);
}

.tribe-dash-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 var(--sp-1);
}

.tribe-dash-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
}

.tribe-dash-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
}

.tribe-dash-header-actions .live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: var(--r-full);
  background: #ef4444;
  vertical-align: middle;
  animation: pulse-live 1.5s ease-in-out infinite;
}

@keyframes pulse-live {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.45;
  }
}

.dash-subnav {
  position: sticky;
  top: var(--navbar-h);
  z-index: var(--z-sticky);
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.dash-subnav::-webkit-scrollbar {
  display: none;
}

.dash-subnav-inner {
  display: flex;
  gap: 0;
  min-width: max-content;
  padding: 0 var(--sp-6);
}

.dash-nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 13px 18px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-display);
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.dash-nav-link:hover {
  color: var(--text);
}

.dash-nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-count-badge {
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--r-full);
  font-family: var(--font-display);
}

.dash-nav-link.active .tab-count-badge:not(.tab-count-badge--danger) {
  background: var(--primary-muted);
  color: var(--primary-dark);
}

[data-theme="dark"] .dash-nav-link.active .tab-count-badge:not(.tab-count-badge--danger) {
  color: var(--primary-light);
}

.tab-count-badge--danger {
  background: var(--danger);
  color: #fff;
}

.tribe-dash-body {
  padding: var(--sp-5) var(--sp-6) 0;
  max-width: 1200px;
}

.tribe-dash-demo-hint {
  margin-bottom: var(--sp-4);
}

.tribe-dash-section-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 800;
  margin: 0;
}

.tribe-dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

@media (max-width: 1023px) {
  .tribe-dash-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 479px) {
  .tribe-dash-stat-grid {
    grid-template-columns: 1fr;
  }
}

.tribe-dash-stat-card {
  padding: var(--sp-4) var(--sp-5);
}

.tribe-dash-stat-value {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.tribe-dash-stat-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 2px;
}

.tribe-dash-chart-card {
  margin-bottom: var(--sp-5);
}

.tribe-dash-chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5) 0;
}

.tribe-dash-chart-wrap {
  height: 220px;
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
}

.tribe-dash-chart-wrap--short {
  height: 200px;
}

.tribe-dash-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: stretch;
}

@media (max-width: 900px) {
  .tribe-dash-split {
    grid-template-columns: 1fr;
  }
}

.tribe-dash-pending-list {
  margin: 0;
  padding-left: 1.1rem;
}

.tribe-dash-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tribe-dash-activity-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}

.tribe-dash-activity-item:last-child {
  border-bottom: none;
}

.tribe-dash-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.tribe-dash-search {
  min-width: 200px;
  flex: 1;
  max-width: 320px;
}

.tribe-dash-module-card {
  overflow: hidden;
}

.tribe-dash-module-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.tribe-dash-drag {
  cursor: grab;
  color: var(--text-muted);
  user-select: none;
  font-size: 14px;
  line-height: 1;
}

.tribe-dash-material-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tribe-dash-material-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}

.tribe-dash-material-row:last-child {
  border-bottom: none;
}

.tribe-dash-module-footer {
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.tribe-dash-pending-banner {
  border-color: var(--primary);
  background: var(--primary-faint);
}

[data-theme="dark"] .tribe-dash-pending-banner {
  background: rgba(88, 80, 236, 0.12);
}

.tribe-dash-table {
  font-size: var(--text-sm);
}

.tribe-dash-inner-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.tribe-dash-inner-tab {
  padding: 8px 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-display);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.tribe-dash-inner-tab:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.tribe-dash-inner-tab.active {
  color: var(--primary-dark);
  border-color: var(--primary);
  background: var(--primary-muted);
}

[data-theme="dark"] .tribe-dash-inner-tab.active {
  color: var(--primary-light);
}