/* =============================================
   LinkBuild Design System
   SEO Link Exchange Marketplace
   ============================================= */

/* ---------- CSS Custom Properties ---------- */
:root {
  /* Primary */
  --primary-deep-blue: #0F4C81;
  --primary-purple: #6C4DF6;
  --primary-gradient: linear-gradient(135deg, #0F4C81 0%, #6C4DF6 100%);

  /* Secondary / Semantic */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;

  /* Neutral */
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Surfaces */
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;
  --text-inverse: #FFFFFF;
  --text-sidebar: #CBD5E1;
  --text-sidebar-active: #FFFFFF;

  /* Borders */
  --border-light: #E2E8F0;
  --border-medium: #CBD5E1;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.04);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 64px;
  --right-panel-width: 360px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;
}

/* =============================================
   RESET & BASE
   ============================================= */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* =============================================
   APP SHELL LAYOUT
   ============================================= */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-normal), min-width var(--transition-normal);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
  min-width: var(--sidebar-collapsed);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: var(--topbar-height);
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon svg { width: 22px; height: 22px; }

.sidebar-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-inverse);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

.sidebar-logo-text span { color: #818CF8; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
  padding: 8px 12px 4px;
  white-space: nowrap;
  opacity: 0.6;
}

.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .nav-badge {
  opacity: 0;
  visibility: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.nav-item.active {
  background: rgba(108, 77, 246, 0.2);
  color: var(--text-sidebar-active);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--primary-purple);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.nav-badge {
  margin-left: auto;
  background: var(--primary-purple);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

.nav-badge.warning { background: var(--warning); color: var(--gray-900); }
.nav-badge.danger { background: var(--danger); }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover { background: var(--bg-sidebar-hover); }

.sidebar-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-inverse);
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* ---------- Main Content Area ---------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ---------- Top Navigation Bar ---------- */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-hamburger {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.topbar-hamburger:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.topbar-breadcrumb {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

.topbar-center {
  flex: 1;
  max-width: 480px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.topbar-search:focus-within {
  border-color: var(--primary-purple);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(108,77,246,0.1);
}

.topbar-search svg { color: var(--gray-400); flex-shrink: 0; }

.topbar-search input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.topbar-search input::placeholder { color: var(--gray-400); }

.topbar-shortcut {
  font-size: 0.7rem;
  background: var(--gray-200);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gray-500);
  font-weight: 600;
  font-family: var(--font-mono);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* =============================================
   PROFILE DROPDOWN
   ============================================= */
.profile-dropdown-wrapper {
  position: relative;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0,0,0,0.12), 0 4px 12px rgba(0,0,0,0.08);
  z-index: 1000;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}

.profile-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header — user info */
.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(108,77,246,0.06) 0%, rgba(74,222,128,0.04) 100%);
}

.profile-dropdown-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(108,77,246,0.35);
}

.profile-dropdown-info {
  overflow: hidden;
  flex: 1;
}

.profile-dropdown-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown-email {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.profile-dropdown-badge {
  display: inline-block;
  margin-top: 5px;
  padding: 2px 8px;
  background: linear-gradient(135deg, #6C4DF6, #4ADE80);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 99px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Divider */
.profile-dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: 0;
}

/* Menu sections */
.profile-dropdown-menu {
  padding: 6px;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.13s ease, color 0.13s ease;
  text-align: left;
}

.profile-dropdown-item svg {
  color: var(--text-tertiary);
  flex-shrink: 0;
  transition: color 0.13s ease;
}

.profile-dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--primary-purple);
}

.profile-dropdown-item:hover svg {
  color: var(--primary-purple);
}

/* Logout button — red accent */
.profile-dropdown-logout {
  color: var(--danger) !important;
}

.profile-dropdown-logout svg {
  color: var(--danger) !important;
}

.profile-dropdown-logout:hover {
  background: rgba(239,68,68,0.08) !important;
  color: var(--danger) !important;
}

.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: all var(--transition-fast);
}

.topbar-icon-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.topbar-icon-btn .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-secondary);
}

.theme-toggle {
  cursor: pointer;
}

/* ---------- Page Content ---------- */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* ---------- Right Panel ---------- */
.right-panel {
  width: var(--right-panel-width);
  min-width: var(--right-panel-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-light);
  overflow-y: auto;
  display: none;
}

.right-panel.visible { display: block; }

/* =============================================
   COMPONENTS
   ============================================= */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn svg { width: 16px; height: 16px; }

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 2px 8px rgba(108,77,246,0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(108,77,246,0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--gray-400);
}

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

.btn-ghost:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-success { background: var(--success); color: white; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-warning { background: var(--warning); color: var(--gray-900); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-light);
}

.card-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card-body { padding: 20px; }

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- KPI Cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

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

.kpi-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-card-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-card-icon.blue { background: var(--info-light); color: var(--info); }
.kpi-card-icon.purple { background: rgba(108,77,246,0.1); color: var(--primary-purple); }
.kpi-card-icon.green { background: var(--success-light); color: var(--success); }
.kpi-card-icon.orange { background: var(--warning-light); color: var(--warning); }
.kpi-card-icon.red { background: var(--danger-light); color: var(--danger); }

.kpi-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.kpi-card-change {
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-card-change.up { color: var(--success); }
.kpi-card-change.down { color: var(--danger); }

/* ---------- Tables ---------- */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: var(--bg-tertiary);
}

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-light);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  white-space: nowrap;
}

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: var(--gray-50);
}

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

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: #065F46; }
.badge-warning { background: var(--warning-light); color: #92400E; }
.badge-danger { background: var(--danger-light); color: #991B1B; }
.badge-info { background: var(--info-light); color: #1E40AF; }
.badge-purple { background: rgba(108,77,246,0.1); color: var(--primary-purple); }
.badge-neutral { background: var(--gray-100); color: var(--gray-600); }

/* ---------- Status Dots ---------- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  margin-right: 6px;
}

.status-dot.green { background: var(--success); }
.status-dot.orange { background: var(--warning); }
.status-dot.red { background: var(--danger); }
.status-dot.blue { background: var(--info); }

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-item:hover { color: var(--text-primary); }
.tab-item.active {
  color: var(--primary-purple);
  border-bottom-color: var(--primary-purple);
  font-weight: 600;
}

/* ---------- Inputs ---------- */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}

.input:focus {
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 3px rgba(108,77,246,0.1);
}

.input::placeholder { color: var(--gray-400); }

.select {
  padding: 10px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  min-width: 120px;
}

.select:focus {
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 3px rgba(108,77,246,0.1);
}

/* ---------- Filter Bar ---------- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 0;
}

.filter-bar .select { min-width: 140px; }

.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--info-light);
  color: var(--info);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
}

.filter-tag button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
}

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal,
.modal-box {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal,
.modal-overlay.active .modal-box {
  transform: translateY(0);
}

.auth-modal {
  max-width: 420px;
  /* Force light theme on auth modal regardless of parent page theme */
  background: #FFFFFF !important;
  color: #0F172A !important;
}

/* All text inside auth modal must be dark */
.auth-modal h2,
.auth-modal label,
.auth-modal p,
.auth-modal .modal-header {
  color: #0F172A !important;
}

.auth-modal .modal-header {
  border-bottom-color: #E2E8F0 !important;
  background: #FFFFFF !important;
}

.auth-modal .modal-body {
  background: #FFFFFF !important;
}

/* Input fields inside auth modal */
.auth-modal .input {
  background: #F8FAFC !important;
  border-color: #CBD5E1 !important;
  color: #0F172A !important;
}

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

.auth-modal .input:focus {
  border-color: #6C4DF6 !important;
  background: #FFFFFF !important;
}

/* Secondary text (eg. "Don't have an account?") */
.auth-modal p {
  color: #475569 !important;
}

/* Close button — clearly visible on auth modal */
.auth-modal .modal-close {
  background: #E2E8F0 !important;
  color: #1E293B !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  border: none !important;
  transition: background 0.15s ease !important;
  flex-shrink: 0;
}

.auth-modal .modal-close:hover {
  background: #CBD5E1 !important;
  color: #0F172A !important;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---------- Charts Area ---------- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.chart-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  padding: 20px;
  min-height: 320px;
  position: relative;
  overflow: hidden;
}

.chart-card canvas {
  width: 100% !important;
  height: 260px !important;
  display: block;
  max-width: 100%;
}

.chart-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

/* ---------- Kanban ---------- */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: 65vh;
}

.kanban-column {
  min-width: 300px;
  max-width: 320px;
  flex: 1;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.kanban-column-title {
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-column-count {
  background: var(--gray-300);
  color: var(--gray-600);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.kanban-cards {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}

.kanban-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 14px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.kanban-card-domain {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.kanban-card-partner {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ---------- Messages Layout ---------- */
.messages-layout {
  display: flex;
  height: calc(100vh - var(--topbar-height) - 56px);
  margin: -28px -32px;
}

.conversations-list {
  width: 320px;
  min-width: 320px;
  border-right: 1px solid var(--border-light);
  background: var(--bg-secondary);
  overflow-y: auto;
}

.conversations-search {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.conversation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border-light);
}

.conversation-item:hover { background: var(--bg-tertiary); }
.conversation-item.active { background: rgba(108,77,246,0.05); border-left: 3px solid var(--primary-purple); }

.conversation-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
}

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

.conversation-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.conversation-preview {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-time {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.5;
}

.chat-bubble.sent {
  align-self: flex-end;
  background: var(--primary-gradient);
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-bubble.received {
  align-self: flex-start;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  outline: none;
  font-size: 0.9rem;
}

.chat-input-area input:focus {
  border-color: var(--primary-purple);
}

.chat-detail-panel {
  width: 300px;
  min-width: 300px;
  border-left: 1px solid var(--border-light);
  background: var(--bg-secondary);
  overflow-y: auto;
  padding: 20px;
}

/* ---------- Pricing Cards ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  max-width: 1000px;
}

.pricing-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

.pricing-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.pricing-card.featured {
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 1px var(--primary-purple), var(--shadow-lg);
  position: relative;
}

.pricing-card.featured::before {
  content: 'Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary-gradient);
  color: white;
  padding: 4px 16px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.pricing-plan-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.pricing-price {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
}

.pricing-price span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-tertiary);
}

.pricing-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-features li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.pricing-features li svg { color: var(--success); flex-shrink: 0; }

/* ---------- Health Score ---------- */
.health-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.health-bar {
  width: 60px;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.health-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.health-bar-fill.good { background: var(--success); }
.health-bar-fill.warning { background: var(--warning); }
.health-bar-fill.danger { background: var(--danger); }

/* ---------- Reputation Score ---------- */
.reputation-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.reputation-ring svg {
  transform: rotate(-90deg);
}

.reputation-ring .bg-circle {
  fill: none;
  stroke: var(--gray-200);
}

.reputation-ring .progress-circle {
  fill: none;
  stroke: var(--primary-purple);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.reputation-score-text {
  position: absolute;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text-primary);
}

/* ---------- Empty States ---------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--gray-400);
}

.empty-state-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.empty-state-text {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  margin-bottom: 20px;
}

/* ---------- Notifications Feed ---------- */
.notification-item {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.notification-item:hover { background: var(--bg-tertiary); }
.notification-item.unread { background: rgba(108,77,246,0.03); }

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

.notification-content { flex: 1; }
.notification-title { font-weight: 600; font-size: 0.875rem; }
.notification-text { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.notification-time { font-size: 0.7rem; color: var(--text-tertiary); margin-top: 4px; }

/* ---------- Page Title ---------- */
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  margin-bottom: 24px;
}

/* ---------- Two Column Layout ---------- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ---------- Widgets Grid ---------- */
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

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

.avatar-stack img,
.avatar-stack .avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-secondary);
  margin-left: -8px;
}

.avatar-stack img:first-child,
.avatar-stack .avatar-placeholder:first-child {
  margin-left: 0;
}

/* ---------- Progress ---------- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ---------- Page Sections (hide/show) ---------- */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* =============================================
   MOBILE BOTTOM NAVIGATION
   ============================================= */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  z-index: 150;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  justify-content: space-around;
  align-items: center;
}

/* Force mobile class for testing */
html.force-mobile .mobile-bottom-nav {
  display: flex;
}

html.force-mobile .sidebar {
  position: fixed;
  left: -280px;
  top: 0;
  bottom: 0;
  height: 100vh;
  width: 280px;
  min-width: 280px;
  z-index: 200;
  transition: left var(--transition-normal);
  box-shadow: var(--shadow-xl);
}

html.force-mobile .sidebar .sidebar-logo-text,
html.force-mobile .sidebar .sidebar-section-label,
html.force-mobile .sidebar .sidebar-user-info,
html.force-mobile .sidebar .nav-badge {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

html.force-mobile .sidebar.mobile-open {
  left: 0;
}

html.force-mobile .topbar-search {
  display: none;
}

html.force-mobile .topbar-breadcrumb {
  display: none;
}

html.force-mobile .page-content {
  padding: 10px;
  padding-bottom: 80px;
}

html.force-mobile .kpi-grid {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

html.force-mobile .kpi-card {
  padding: 12px;
  gap: 4px;
}

html.force-mobile .kpi-card-value {
  font-size: 1.3rem;
}

html.force-mobile .kpi-card-label {
  font-size: 0.65rem;
}

html.force-mobile .charts-grid {
  grid-template-columns: 1fr;
}

html.force-mobile .widgets-grid {
  grid-template-columns: 1fr;
}

html.force-mobile .pricing-grid {
  grid-template-columns: 1fr;
  max-width: 400px;
}

html.force-mobile .kanban-board {
  flex-direction: row;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

html.force-mobile .kanban-column {
  min-width: 280px;
  max-width: 320px;
  scroll-snap-align: start;
}

html.force-mobile .messages-layout {
  flex-direction: column;
}

html.force-mobile .conversations-list {
  width: 100%;
  min-width: 100%;
  border-right: none;
}

html.force-mobile .chat-detail-panel {
  display: none;
}

html.force-mobile .two-col {
  grid-template-columns: 1fr;
}

html.force-mobile .table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

html.force-mobile .data-table {
  min-width: 550px;
  font-size: 0.75rem;
}

html.force-mobile .btn {
  padding: 8px 14px;
  font-size: 0.8rem;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 4px;
  min-width: 48px;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  border: none;
  background: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
}

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

.mobile-nav-item .mobile-nav-badge {
  position: absolute;
  top: 2px;
  right: 50%;
  transform: translateX(18px);
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
}

/* =============================================
   RESPONSIVE — TABLET LANDSCAPE (≤1200px)
   ============================================= */
@media (max-width: 1200px) {
  :root {
    --sidebar-width: 220px;
    --topbar-height: 56px;
    font-size: 13px;
  }

  .sidebar {
    width: var(--sidebar-collapsed);
    min-width: var(--sidebar-collapsed);
  }

  .sidebar .sidebar-logo-text,
  .sidebar .sidebar-section-label,
  .sidebar .sidebar-user-info,
  .sidebar .nav-badge {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .sidebar.expanded {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
  }

  .sidebar.expanded .sidebar-logo-text,
  .sidebar.expanded .sidebar-section-label,
  .sidebar.expanded .sidebar-user-info,
  .sidebar.expanded .nav-badge {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .pricing-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .pricing-card {
    padding: 20px;
  }

  .pricing-price {
    font-size: 2rem;
  }

  .right-panel {
    display: none !important;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }

  .kpi-card {
    padding: 16px;
  }

  .kpi-card-value {
    font-size: 1.5rem;
  }

  .page-content {
    padding: 20px;
  }

  .charts-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .widgets-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .kanban-board {
    gap: 12px;
  }

  .kanban-column {
    min-width: 250px;
    max-width: 280px;
  }

  .topbar-search {
    max-width: 300px;
  }

  .conversations-list {
    width: 260px;
    min-width: 260px;
  }

  .chat-detail-panel {
    width: 240px;
    min-width: 240px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
    font-size: 0.8rem;
  }
}

/* =============================================
   RESPONSIVE — TABLET PORTRAIT (≤900px)
   ============================================= */
@media (max-width: 900px) {
  :root {
    font-size: 12px;
    --topbar-height: 52px;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    height: 100vh;
    width: 280px;
    min-width: 280px;
    z-index: 200;
    transition: left var(--transition-normal);
    box-shadow: var(--shadow-xl);
  }

  .sidebar .sidebar-logo-text,
  .sidebar .sidebar-section-label,
  .sidebar .sidebar-user-info,
  .sidebar .nav-badge {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar.mobile-open {
    left: 0;
  }

  .topbar {
    padding: 0 12px;
    gap: 8px;
  }

  .topbar-search {
    display: none;
  }

  .topbar-breadcrumb {
    display: none;
  }

  .topbar-center {
    flex: 0;
    max-width: none;
  }

  .page-content {
    padding: 14px;
    padding-bottom: 80px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .kpi-card {
    padding: 14px;
  }

  .kpi-card-value {
    font-size: 1.4rem;
  }

  .kpi-card-label {
    font-size: 0.7rem;
  }

  .charts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .widgets-grid {
    grid-template-columns: 1fr;
  }

  .page-title {
    font-size: 1.3rem;
  }

  .page-subtitle {
    font-size: 0.8rem;
    margin-bottom: 16px;
  }

  /* Pricing */
  .pricing-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
  }

  /* Kanban — horizontal scroll */
  .kanban-board {
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 12px;
  }

  .kanban-column {
    min-width: 280px;
    max-width: 320px;
    scroll-snap-align: start;
  }

  /* Messages — full screen layered */
  .messages-layout {
    flex-direction: column;
    margin: -14px;
    height: calc(100vh - var(--topbar-height) - 20px);
  }

  .conversations-list {
    width: 100%;
    min-width: 100%;
    max-height: none;
    flex: 1;
    border-right: none;
  }

  .chat-area {
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    z-index: 100;
    display: none;
  }

  .chat-area.mobile-active {
    display: flex;
  }

  .chat-detail-panel {
    display: none;
  }

  /* Tables — scrollable on tablet portrait */
  .table-container {
    border-radius: var(--radius-lg);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .data-table {
    min-width: 600px;
    font-size: 0.8rem;
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px;
    white-space: nowrap;
  }

  /* Two column to single */
  .two-col {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Filter bar — wrap nicely */
  .filter-bar {
    gap: 8px;
  }

  .filter-bar .select {
    min-width: 0;
    flex: 1;
    font-size: 0.8rem;
    padding: 8px 10px;
  }

  /* Tabs — scroll horizontally */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0;
  }

  .tab-item {
    padding: 10px 16px;
    font-size: 0.8rem;
    flex-shrink: 0;
  }

  /* Buttons — full width on mobile */
  .btn-lg {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  /* Top bar icon buttons */
  .topbar-icon-btn {
    width: 34px;
    height: 34px;
  }

  .topbar-hamburger {
    width: 34px;
    height: 34px;
  }

  /* Notifications */
  .notification-item {
    padding: 12px;
  }

  /* Website detail */
  .card-body[style] {
    padding: 16px !important;
  }

  /* Admin */
  .progress-bar {
    height: 5px;
  }
}

/* =============================================
   RESPONSIVE — MOBILE (≤480px)
   ============================================= */
@media (max-width: 480px) {
  :root {
    font-size: 11px;
    --topbar-height: 48px;
  }

  /* Show mobile bottom nav, hide sidebar completely */
  .mobile-bottom-nav {
    display: flex;
  }

  .sidebar {
    display: none;
  }

  .sidebar.mobile-open {
    display: flex;
    left: 0;
    width: 100%;
    min-width: 100%;
    z-index: 250;
  }

  .topbar {
    padding: 0 10px;
    gap: 6px;
  }

  .topbar-hamburger {
    display: flex;
  }

  .page-content {
    padding: 10px;
    padding-bottom: 80px;
  }

  /* KPI — single column */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .kpi-card {
    padding: 12px;
    gap: 4px;
  }

  .kpi-card-value {
    font-size: 1.3rem;
  }

  .kpi-card-label {
    font-size: 0.65rem;
  }

  .kpi-card-icon {
    width: 28px;
    height: 28px;
  }

  .kpi-card-change {
    font-size: 0.7rem;
  }

  .page-title {
    font-size: 1.2rem;
    margin-bottom: 2px;
  }

  .page-subtitle {
    font-size: 0.75rem;
    margin-bottom: 12px;
  }

  /* Charts */
  .chart-card {
    padding: 14px;
  }

  .chart-card h3 {
    font-size: 0.85rem;
    margin-bottom: 10px;
  }

  /* Marketplace card */
  .card-body {
    padding: 12px;
  }

  .filter-bar {
    padding: 10px 0;
    gap: 6px;
  }

  .filter-bar .select {
    flex: 1 1 45%;
    min-width: 0;
  }

  /* Kanban — swipe cards */
  .kanban-column {
    min-width: 260px;
    max-width: 300px;
  }

  .kanban-card {
    padding: 10px;
  }

  .kanban-card-domain {
    font-size: 0.8rem;
  }

  /* Messages */
  .conversation-item {
    padding: 10px 12px;
    gap: 8px;
  }

  .conversation-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.75rem;
  }

  .chat-messages {
    padding: 12px;
    gap: 10px;
  }

  .chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    font-size: 0.8rem;
  }

  .chat-input-area {
    padding: 10px;
    gap: 6px;
  }

  .chat-input-area input {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  /* Back button for mobile chat */
  .mobile-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--primary-purple);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-family: inherit;
  }

  /* Scrollable data tables on mobile */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  .data-table {
    min-width: 550px;
    font-size: 0.75rem;
  }

  .data-table th,
  .data-table td {
    padding: 8px 10px;
  }

  /* Billing */
  .pricing-grid {
    max-width: none;
  }

  .pricing-card {
    padding: 20px 16px;
  }

  .pricing-price {
    font-size: 1.8rem;
  }

  /* Buttons */
  .btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .btn-lg {
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .btn-icon {
    width: 32px;
    height: 32px;
  }

  /* Notifications */
  .notification-icon {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
  }

  /* Badges */
  .badge {
    padding: 2px 8px;
    font-size: 0.7rem;
  }

  /* Website detail hero */
  .card-body[style*="padding:28px"] {
    padding: 16px !important;
  }

  /* Settings */
  .input {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  /* Admin */
  .notification-item {
    padding: 10px;
  }
}

/* =============================================
   MOBILE OVERLAY
   ============================================= */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  z-index: 199;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.mobile-overlay.active {
  display: block;
}

/* =============================================
   RESPONSIVE UTILITY CLASSES
   ============================================= */
.hide-mobile {
  /* shown by default, hidden on mobile in media queries */
}

.hide-desktop {
  display: none;
}

@media (max-width: 480px) {
  .hide-mobile {
    display: none !important;
  }

  .hide-desktop {
    display: flex;
  }
}

/* Improved touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
  .nav-item,
  .btn,
  .tab-item,
  .conversation-item,
  .notification-item,
  .kanban-card,
  .mobile-nav-item {
    min-height: 44px;
  }

  .nav-item {
    padding: 12px;
  }

  .topbar-icon-btn,
  .topbar-hamburger {
    min-width: 44px;
    min-height: 44px;
  }
}

/* Smooth scroll for the page content */
.page-content {
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

/* Prevent text zoom on mobile inputs */
@media (max-width: 480px) {
  input[type="text"],
  input[type="email"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}
