/* CSS Variables */
/* Slate Neutral Scale - Refined for Apple-like feel */
--rf-bg-dark: #000000;
/* True black for OLED feel */
--rf-bg-card: rgba(10, 14, 22, 0.55);
/* Dark Glass */
--rf-text-main: #ffffff;
/* Pure White */
--rf-text-dark: #e6faff;
/* Light Cyan Tint for Titles */
--rf-text-muted: rgba(255, 255, 255, 0.52);
/* Glass Muted */
--rf-border: rgba(0, 255, 255, 0.18);
--rf-border-light: rgba(0, 255, 255, 0.18);
/* Neon Border */

/* Accents - Vibrant but refined */
--rf-primary: #0071e3;
/* Apple Blue */
--rf-secondary: #5e5ce6;
/* Apple Indigo */
--rf-gradient: linear-gradient(135deg, #0071e3 0%, #5e5ce6 100%);
--rf-gradient-hover: linear-gradient(135deg, #0077ed 0%, #6461f2 100%);

/* Functional */
--rf-success: #34c759;
/* Apple Green */
--rf-warning: #ff9f0a;
/* Apple Orange */
--rf-error: #ff3b30;
/* Apple Red */

/* Shadows - Soft & Diffuse */
--shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
--shadow-glow: 0 0 20px rgba(0, 113, 227, 0.3);

/* Legacy Mappings */
--gradient-primary: var(--rf-gradient);
--gradient-primary-hover: var(--rf-gradient-hover);
--color-purple: var(--rf-primary);
--color-cyan: var(--rf-secondary);
--color-emerald: var(--rf-success);
--shadow-glow-purple: var(--shadow-glow);
--shadow-layered: var(--shadow-md);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  /* Critical for Apple look */
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background-color: var(--rf-bg);
  color: var(--rf-text-main);
  line-height: 1.5;
  letter-spacing: -0.022em;
  overflow-x: hidden;
}

/* App Shell Layout */
.rf-app-shell,
.app-shell {
  display: flex;
  flex-direction: column;
  /* FIX: Stack Header and Content vertically */
  min-height: 100vh;
  background: radial-gradient(circle at 0% -20%, rgba(34, 242, 194, 0.08), transparent 55%),
    radial-gradient(circle at 120% 120%, rgba(123, 92, 255, 0.12), transparent 60%),
    var(--rf-bg);
}

/* Sidebar - ALWAYS VISIBLE by default (auto-hide disabled) */
.sidebar {
  width: 260px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
  /* Visible by default */
  transform: translateX(0);
}

/* Main Content */
.main-content {
  margin-left: 16rem;
  /* FIX: Set default to 16rem (256px) to match Sidebar */
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 100vh;
  padding-top: 0;
  /* FIX: Remove legacy padding (Header is now relative) */
  padding-left: 32px;
  padding-right: 32px;
  padding-bottom: 32px;
  /* width: 100%; REMOVED to prevent overflow */
  box-sizing: border-box;
}

/* Collapsed state - only when manually toggled by user */
.sidebar.collapsed {
  transform: translateX(-260px);
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  font-size: 18px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

/* Sidebar Toggle - Neon FAB Style */
.sidebar-toggle {
  background: rgba(10, 14, 22, 0.8);
  border: 1px solid var(--rf-border-neon);
  font-size: 16px;
  cursor: pointer;
  color: var(--rf-accent-cyan);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(34, 242, 194, 0.1);
  backdrop-filter: blur(4px);
}

.sidebar-toggle:hover {
  background: rgba(34, 242, 194, 0.1);
  box-shadow: 0 0 15px rgba(34, 242, 194, 0.3);
  transform: scale(1.1);
  color: #fff;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-group {
  margin-bottom: 24px;
  padding: 8px;
  border-radius: 12px;
  transition: background 0.2s ease;
}

/* Color-coded sidebar sections - soft background differences */
.nav-group:first-of-type {
  background: rgba(139, 92, 246, 0.03);
}

.nav-group:nth-of-type(2) {
  background: rgba(6, 182, 212, 0.03);
}

.nav-group:last-of-type {
  background: rgba(148, 163, 184, 0.03);
}

.nav-group-title {
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
}

.nav-item {
  display: block;
  padding: 10px 16px;
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(139, 92, 246, 0.05);
  color: var(--color-purple);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
  color: var(--color-purple);
  border-left-color: var(--color-purple);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #e5e7eb;
  font-size: 12px;
  color: #94a3b8;
  text-align: center;
}

/* Top Bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 260px;
  right: 0;
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1001;
  transition: left 0.3s ease;
}

.sidebar.collapsed+.main-content .top-bar {
  left: 0;
}

/* Show toggle button when sidebar is collapsed */
.sidebar.collapsed~.main-content .top-bar .sidebar-toggle {
  display: block !important;
}

/* Hide toggle button on desktop when sidebar is visible */
@media (min-width: 769px) {
  .top-bar .sidebar-toggle {
    display: none;
  }

  .sidebar.collapsed~.main-content .top-bar .sidebar-toggle {
    display: block !important;
  }
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.website-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.website-selector select {
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
  min-width: 200px;
}

.website-selector select:hover {
  border-color: var(--color-purple);
}

.website-selector select:focus {
  outline: none;
  border-color: var(--color-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s;
  cursor: pointer;
  position: relative;
}

.user-profile:hover {
  background: #f8fafc;
}

.user-profile-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  z-index: 10000;
  display: none;
  overflow: hidden;
}

.user-profile-dropdown.show {
  display: block;
}

.user-profile-dropdown-item {
  display: block;
  padding: 12px 16px;
  color: #475569;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.user-profile-dropdown-item:hover {
  background: #f8fafc;
}

.user-profile-dropdown-item.logout {
  color: #ef4444;
  border-top: 1px solid #e5e7eb;
}

.user-profile-dropdown-item.logout:hover {
  background: #fef2f2;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-size: 14px;
  color: #475569;
  font-weight: 500;
}

.top-bar-quick-action {
  padding: 6px 16px;
  font-size: 13px;
}

.workspace-integration-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.workspace-integration-icon {
  width: 18px;
  height: 18px;
  color: #94a3b8;
  opacity: 0.35;
  transition: opacity 0.2s ease, color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.workspace-integration-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.workspace-integration-icon.integration-icon--active {
  color: #0ea5e9;
  opacity: 1;
}

.workspace-integration-icon:hover {
  opacity: 1;
  transform: scale(1.15);
}

.workspace-integration-icon.integration-icon--active:hover {
  color: #0284c7;
}

.workspace-integration-icon.integration-icon--inactive:hover {
  color: #64748b;
}

/* Main Content */
.main-content {
  margin-left: 260px;
  transition: margin-left 0.3s ease;
  min-height: 100vh;
  padding-top: 64px;
  padding-left: 32px;
  padding-right: 32px;
  padding-bottom: 32px;
  /* width: 100%; REMOVED to prevent overflow */
  box-sizing: border-box;
}

.sidebar.collapsed+.main-content {
  margin-left: 0;
  max-width: 100%;
}

/* When sidebar is not present (e.g., landing page) */
.app-shell.logged-out .main-content {
  margin-left: 0;
  padding-top: 0;
}

.content-wrapper {
  padding: 0;
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

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

/* Modern Gradient Color System - Global */
:root {
  /* Neon Glass Theme Tokens */
  --rf-bg: #05070b;
  /* app background */
  --rf-bg-elevated: #0b0f17;
  --rf-text-main: #f9fafb;
  --rf-text-muted: #9ca3af;

  --rf-accent-cyan: #22f2c2;
  --rf-accent-purple: #7b5cff;
  --rf-accent-pink: #ff2fbf;

  /* BORDERS - OPTION B (Transparent Glass) */
  --rf-border-soft: rgba(255, 255, 255, 0.08);
  --rf-border-strong: rgba(255, 255, 255, 0.15);
  --rf-border-neon: rgba(34, 242, 194, 0.3);

  --rf-glass-bg: rgba(255, 255, 255, 0.03);
  --rf-glass-bg-strong: rgba(255, 255, 255, 0.06);

  --rf-danger: #fb7185;
  --rf-warning: #fbbf24;
  --rf-success: #22c55e;

  --rf-radius-lg: 16px;
  --rf-radius-pill: 999px;
  --rf-blur-glass: 14px;

  --rf-shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --rf-shadow-glow-cyan: 0 0 20px rgba(34, 242, 194, 0.25);
  --rf-shadow-glow-purple: 0 0 20px rgba(123, 92, 255, 0.25);

  /* Legacy Compat */
  --rf-glass-bg2: var(--rf-glass-bg-strong);
  --rf-border-glass: var(--rf-border-soft);
  --rf-border-active: var(--rf-border-neon);
}

/* Base Components - Neon Glass */
.rf-glass-panel {
  position: relative;
  border-radius: var(--rf-radius-lg);
  background: var(--rf-glass-bg);
  border: 1px solid var(--rf-border-soft);
  box-shadow: var(--rf-shadow-soft);
  backdrop-filter: blur(var(--rf-blur-glass));
  -webkit-backdrop-filter: blur(var(--rf-blur-glass));
}

.rf-glass-card,
.rf-card {
  background: var(--rf-glass-bg);
  border: 1px solid var(--rf-border-soft);
  backdrop-filter: blur(var(--rf-blur-glass));
  -webkit-backdrop-filter: blur(var(--rf-blur-glass));
  border-radius: var(--rf-radius-lg);
  box-shadow: var(--rf-shadow-soft);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rf-glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Header Capsules */
.rf-chip-org {
  background: rgba(8, 12, 20, 0.6);
  border: 1px solid rgba(34, 242, 194, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 14px;
  box-shadow:
    0 0 15px rgba(34, 242, 194, 0.05),
    inset 0 0 20px rgba(34, 242, 194, 0.02);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: var(--rf-text-main);
  transition: all 0.2s ease;
}

.rf-chip-workspace {
  background: rgba(10, 16, 28, 0.6);
  border: 1px solid rgba(34, 242, 194, 0.3);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border-radius: 16px;
  box-shadow:
    0 0 20px rgba(34, 242, 194, 0.1),
    inset 0 0 20px rgba(34, 242, 194, 0.05);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  color: var(--rf-text-main);
  transition: all 0.2s ease;
}

/* Header Icons */
.workspace-integration-icon {
  height: 40px;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 20, 0.5);
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 255, 0.18);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--rf-text-muted);
  transition: all 0.2s ease;
  box-shadow: none;
  /* Reset default shadow */
}

.workspace-integration-icon:hover {
  border: 1.5px solid rgba(0, 255, 255, 0.38);
  box-shadow: 0 0 10px rgba(0, 255, 255, 0.25);
  color: var(--rf-accent-cyan);
  transform: translateY(-1px);
}

.workspace-integration-icon.integration-icon--active {
  border-color: var(--rf-accent-cyan);
  color: var(--rf-accent-cyan);
  box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
}

.rf-metric-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--rf-radius-pill);
  background: radial-gradient(circle at 0% 0%, rgba(34, 242, 194, 0.25), transparent),
    rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: var(--rf-shadow-glow-cyan);
  color: var(--rf-text-main);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rf-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--rf-radius-pill);
  border: 1px solid rgba(34, 242, 194, 0.7);
  background: linear-gradient(135deg, #22f2c2, #7b5cff);
  color: #020617;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.rf-btn-primary:hover {
  box-shadow: var(--rf-shadow-glow-cyan);
}

.rf-chip {
  padding: 4px 10px;
  border-radius: var(--rf-radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.8);
  color: var(--rf-text-muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Screenshot Mode Helper */
.rf-screenshot-mode .rf-app-shell {
  max-width: 1280px;
  margin: 0 auto;
  transform: scale(0.96);
  transform-origin: top center;
}

/* Buttons - Unified System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--rf-radius-pill, 999px);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  line-height: 1.5;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(1);
  pointer-events: none;
}

/* Primary - Neon Gradient Glass */
.btn-primary {
  background: linear-gradient(135deg, rgba(34, 242, 194, 0.9) 0%, rgba(123, 92, 255, 0.9) 100%);
  color: #020617; /* Dark text for contrast against neon */
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 15px rgba(34, 242, 194, 0.3);
  backdrop-filter: blur(4px);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(34, 242, 194, 0.5);
  background: linear-gradient(135deg, #22f2c2 0%, #886aff 100%);
  border-color: rgba(255, 255, 255, 0.4);
}

/* Secondary - Glass/Dark (Soft Border) */
.btn-secondary {
  background: rgba(255, 255, 255, 0.03);
  color: var(--rf-text-main);
  border: 1px solid var(--rf-border-soft);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Ghost - Text-only link style with hover glow */
.btn-ghost {
  background: transparent;
  color: var(--rf-text-muted);
  border-color: transparent;
  box-shadow: none;
  padding: 8px 16px; /* Slightly smaller padding for text links */
}

.btn-ghost:hover:not(:disabled) {
  color: var(--rf-accent-cyan);
  background: rgba(34, 242, 194, 0.05);
  text-shadow: 0 0 8px rgba(34, 242, 194, 0.4);
}

/* Danger - Red */
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
  transform: translateY(-1px);
}

/* Legacy mappings for compatibility */
.rf-btn-primary {
  @apply btn btn-primary;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.ready {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.not-ready {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.preview {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.draft {
  background: #e0e7ff;
  color: #3730a3;
}

.status-badge.approved {
  background: #dbeafe;
  color: #1e40af;
}

.status-badge.applied {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

/* Cards */
.card,
.panel,
.stats-box,
.block-bg-white,
.shadow-md.bg-white {
  background: rgba(10, 14, 22, 0.55) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0px 0px 12px rgba(0, 255, 255, 0.12),
    inset 0px 0px 24px rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(0, 255, 255, 0.18);
  color: var(--rf-text-main);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

tr:hover {
  background: #f8fafc;
}

/* Login Modal */
.login-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-modal-overlay.active {
  display: flex;
}

.login-modal-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.login-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: 1002;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.login-modal-overlay.active .login-modal {
  transform: scale(1);
}

.login-modal-header {
  padding: 24px 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.login-modal-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  color: #1e293b;
}

.login-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #64748b;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.2s;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-modal-close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.login-modal-body {
  padding: 24px;
}

.login-form-group {
  margin-bottom: 16px;
}

.login-form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.login-form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #1e293b;
  transition: all 0.2s;
  background: #fff;
}

.login-form-group input:focus {
  outline: none;
  border-color: var(--color-purple);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.login-form-group input.error {
  border-color: #ef4444;
}

.login-form-error {
  margin-top: 6px;
  font-size: 12px;
  color: #ef4444;
  display: none;
}

.login-form-error.show {
  display: block;
}

.login-forgot-password {
  text-align: right;
  margin-top: -8px;
  margin-bottom: 20px;
}

.login-forgot-password a {
  font-size: 13px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: all 0.2s;
}

.login-forgot-password a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.login-submit-btn {
  width: 100%;
  padding: 12px;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.25);
  position: relative;
  overflow: hidden;
}

.login-submit-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.login-submit-btn:hover {
  background: var(--gradient-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-purple);
}

.login-submit-btn:hover::before {
  left: 100%;
}

.login-submit-btn:active {
  transform: translateY(0) scale(0.98);
}

.login-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-divider {
  text-align: center;
  margin: 24px 0;
  color: #94a3b8;
  font-size: 14px;
  position: relative;
}

.login-divider::before,
.login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background: #e5e7eb;
}

.login-divider::before {
  left: 0;
}

.login-divider::after {
  right: 0;
}

.login-google-btn {
  width: 100%;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 16px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.login-google-btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-google-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.login-google-icon {
  width: 20px;
  height: 20px;
}

.login-modal-footer {
  padding: 0 24px 24px;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

.login-modal-footer a {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
}

.login-modal-footer a:hover {
  text-decoration: underline;
}

.login-form-message {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  display: none;
}

.login-form-message.show {
  display: block;
}

.login-form-message.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.login-form-message.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-260px);
  }

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

  .top-bar {
    left: 0;
  }

  .main-content {
    margin-left: 0;
    padding-left: 16px;
    padding-right: 16px;
    padding-bottom: 16px;
  }

  .sidebar-toggle {
    display: block;
  }

  .top-bar-left {
    gap: 8px;
  }

  .website-selector select {
    min-width: 150px;
    font-size: 12px;
  }

  .user-name {
    display: none;
  }

  .content-wrapper {
    padding: 0;
  }

  /* Chat Panel - Full Screen on Mobile */
  #chatPopup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    z-index: 10000 !important;
  }

  /* Tables - Stacked on Mobile */
  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  td {
    border: none;
    position: relative;
    padding: 8px 8px 8px 40% !important;
    text-align: left;
  }

  td:before {
    content: attr(data-label);
    position: absolute;
    left: 8px;
    width: 35%;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Login Modal - Mobile */
  .login-modal {
    max-width: 100%;
    margin: 0;
    border-radius: 12px 12px 0 0;
    max-height: 95vh;
  }

  .login-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .login-modal-header {
    padding: 20px 20px 0;
  }

  .login-modal-body {
    padding: 20px;
  }

  .login-modal-footer {
    padding: 0 20px 20px;
  }
}

/* Landing page animations */
.rf-fade-up {
  opacity: 0;
  transform: translateY(16px);
  transition: all .5s ease;
}

.rf-show {
  opacity: 1;
  transform: translateY(0);
}

/* Modern Toast Notification System */
#toastContainer {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  max-width: 420px;
  width: calc(100% - 40px);
}

.toast {
  position: relative;
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  border-left: 4px solid #0ea5e9;
  transform: translateX(100%);
  opacity: 0;
  transform-origin: top right;
  backdrop-filter: blur(10px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.show:hover {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  transform: translateX(-4px);
}

.toast.success {
  border-left-color: #10b981;
  background: linear-gradient(to right, #ffffff 0%, #f0fdf4 100%);
}

.toast.error {
  border-left-color: #ef4444;
  background: linear-gradient(to right, #ffffff 0%, #fef2f2 100%);
}

.toast.warning {
  border-left-color: #f59e0b;
  background: linear-gradient(to right, #ffffff 0%, #fffbeb 100%);
}

.toast.info {
  border-left-color: var(--color-purple);
  background: linear-gradient(to right, #ffffff 0%, rgba(139, 92, 246, 0.05) 100%);
}

.toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.toast.success .toast-icon {
  background: #10b981;
  color: white;
}

.toast.error .toast-icon {
  background: #ef4444;
  color: white;
}

.toast.warning .toast-icon {
  background: #f59e0b;
  color: white;
}

.toast.info .toast-icon {
  background: var(--color-purple);
  color: white;
}

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

.toast-title {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 4px 0;
  line-height: 1.4;
}

.toast-message {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
  word-wrap: break-word;
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  margin-top: -2px;
  margin-right: -4px;
}

.toast-close:hover {
  background: #f1f5f9;
  color: #475569;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0 0 12px 12px;
  /* Removed auto-progress animation - toasts now persist */
}

.toast.success .toast-progress {
  background: #10b981;
}

.toast.error .toast-progress {
  background: #ef4444;
}

.toast.warning .toast-progress {
  background: #f59e0b;
}

.toast.info .toast-progress {
  background: var(--color-purple);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%) scale(0.9);
    opacity: 0;
  }

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

@keyframes toastSlideOut {
  from {
    transform: translateX(0) scale(1);
    opacity: 1;
  }

  to {
    transform: translateX(100%) scale(0.9);
    opacity: 0;
  }
}

@keyframes toastProgress {
  from {
    width: 100%;
  }

  to {
    width: 0%;
  }
}

.toast.slide-out {
  animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Modern Modal Improvements */
.modern-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.2s ease-out;
}

.modern-modal {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modern-modal-header {
  padding: 24px 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.modern-modal-header h2,
.modern-modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
}

.modern-modal-close {
  background: #f1f5f9;
  border: none;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.modern-modal-close:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.modern-modal-body {
  padding: 24px;
}

.modern-modal-footer {
  padding: 0 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px) scale(0.95);
    opacity: 0;
  }

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

/* Mobile Responsive for Toasts */
@media (max-width: 768px) {
  #toastContainer {
    top: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
    width: auto;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }

  .modern-modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    margin-top: auto;
  }
}

/* ============================================
       SKELETON LOADING & TRANSITIONS (PACK E)
       ============================================ */

/* Skeleton Shimmer Animation */
@keyframes skeleton-shimmer {
  0% {
    background-position: -1000px 0;
  }

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

.skeleton-shimmer {
  background: linear-gradient(90deg,
      #f0f0f0 0%,
      #f8f8f8 50%,
      #f0f0f0 100%);
  background-size: 1000px 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
  height: 100%;
  width: 100%;
}

.skeleton-card {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 24px;
  min-height: 120px;
  position: relative;
  overflow: hidden;
}

.skeleton-section {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 24px;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.skeleton-chart {
  background: #f8f8f8;
  border-radius: 12px;
  padding: 24px;
  min-height: 300px;
  position: relative;
  overflow: hidden;
}

/* Fade-in Transitions */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.fade-in {
  animation: fadeIn 0.2s ease-out;
}

/* Page Transition */
@keyframes pageFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.main-content {
  animation: pageFadeIn 0.15s ease-out;
}

/* Deferred Hydration - Hide until JS loads */
.deferred-hydrate {
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

.deferred-hydrate.hydrated {
  opacity: 1;
}

/* Mobile Touch Improvements */
@media (max-width: 768px) {

  /* Larger tap targets */
  button,
  a,
  [role="button"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Better touch feedback */
  .panel-toggle-floating {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
}

  {
  % block extra_css %
}

  {
  % endblock %
}