/* ==========================================================================
   Base Design System & Aesthetics (Ultra-Modern Glassmorphism & Translucency)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* Brand Palette */
  --bg-main: #0a1014;
  --bg-surface: #111b21;
  --bg-elevated: #1f2c34;
  --bg-hover: #23313a;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: #00a884;

  /* Preferred Glassmorphism & Translucency Tokens (Apple Obsidian Style) */
  --navbar-glass-bg: rgba(8, 12, 22, 0.1); /* 10% opacity / 90% transparent obsidian velvet tint */
  --navbar-glass-blur: 18px; /* Apple-style backdrop blur */
  --navbar-glass-saturate: 120%; /* subtle color enhancement of content sliding underneath */
  --navbar-border: rgba(255, 255, 255, 0.08); /* subtle hairline specular highlight */
  --navbar-shadow: 0 4px 30px rgba(0, 0, 0, 0.08); /* Ambient shadow */
  --navbar-backdrop-filter: blur(var(--navbar-glass-blur)) saturate(var(--navbar-glass-saturate));

  /* Glassmorphism & Translucency Tokens */
  --glass-bg: rgba(10, 16, 20, 0.72);
  --glass-surface: rgba(17, 27, 33, 0.75);
  --glass-elevated: rgba(31, 44, 52, 0.70);
  --glass-card: rgba(17, 27, 33, 0.62);
  --glass-input: rgba(31, 44, 52, 0.55);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --glass-border-light: 1px solid rgba(255, 255, 255, 0.13);
  --glass-border-glow: 1px solid rgba(0, 168, 132, 0.4);
  --glass-blur: blur(20px) saturate(180%);
  --glass-blur-sm: blur(12px) saturate(160%);
  --glass-blur-lg: blur(32px) saturate(200%);
  --glass-shadow: 0 10px 30px 0 rgba(0, 0, 0, 0.4);
  --glass-card-shadow: 0 16px 40px 0 rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --glass-inner-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.12);

  /* WhatsApp Emerald & Vibrant Accents */
  --emerald-primary: #00a884;
  --emerald-dark: #008069;
  --emerald-glow: rgba(0, 168, 132, 0.35);
  --emerald-light: #25d366;
  --neon-glow-emerald: 0 0 20px rgba(0, 168, 132, 0.4);
  --neon-glow-cyan: 0 0 20px rgba(56, 189, 248, 0.35);
  --gradient-emerald: linear-gradient(135deg, #00a884 0%, #059669 60%, #10b981 100%);
  --gradient-brand: linear-gradient(135deg, #00a884 0%, #25d366 100%);
  --gradient-header-glow: linear-gradient(90deg, rgba(0, 168, 132, 0.4) 0%, rgba(56, 189, 248, 0.3) 100%);

  /* Status Colors */
  --status-lead: #3b82f6;
  --status-vip: #a855f7;
  --status-warning: #f59e0b;
  --status-danger: #ef4444;
  --status-success: #10b981;

  /* Typography Colors */
  --text-primary: #f0f2f5;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0b141a;

  /* Chat Bubbles (Glassmorphic) */
  --bubble-inbound: rgba(31, 44, 52, 0.85);
  --bubble-outbound: linear-gradient(135deg, rgba(0, 92, 75, 0.92) 0%, rgba(0, 128, 105, 0.85) 100%);
  --bubble-admin: linear-gradient(135deg, rgba(13, 74, 62, 0.92) 0%, rgba(16, 94, 79, 0.85) 100%);

  /* Layout */
  --sidebar-width: 220px;
  --header-height: 52px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  /* Transitions & Shadows */
  --transition-fast: 0.16s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  --shadow-emerald: 0 0 24px rgba(0, 168, 132, 0.35);
}

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

svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 12%, rgba(0, 168, 132, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 90% 88%, rgba(56, 189, 248, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.025) 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

a {
  color: var(--emerald-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--emerald-light);
}

/* App Shell Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: transparent;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: rgba(17, 27, 33, 0.92);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border-right: var(--glass-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 120;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100vh;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  transition: width 0.26s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.26s ease;
}

/* Sidebar Dock Spacer in layout flow */
.sidebar-dock-spacer {
  width: 68px;
  min-width: 68px;
  height: 100%;
  flex-shrink: 0;
  transition: width 0.26s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

html.sidebar-is-pinned .sidebar-dock-spacer {
  width: 220px;
  min-width: 220px;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 0.75rem 0 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  border-bottom: 1px solid var(--navbar-border);
  background: var(--navbar-glass-bg);
  backdrop-filter: var(--navbar-backdrop-filter);
  -webkit-backdrop-filter: var(--navbar-backdrop-filter);
  box-shadow: var(--navbar-shadow);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 30%, #e2e8f0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  min-width: 0;
  overflow: hidden;
  flex: 1;
}

.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
  line-height: 1.2;
  transition: opacity var(--transition-fast);
}

.brand-logo svg {
  color: var(--emerald-primary);
  filter: drop-shadow(0 0 8px var(--emerald-primary));
  flex-shrink: 0;
}

.brand-logo-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background-color: var(--bg-hover);
  color: var(--emerald-primary);
}

.nav-menu {
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.045);
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(3px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(0, 168, 132, 0.22) 0%, rgba(0, 168, 132, 0.08) 100%);
  border: 1px solid rgba(0, 168, 132, 0.38);
  color: #25d366;
  font-weight: 600;
  box-shadow: 0 0 18px rgba(0, 168, 132, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 22%;
  height: 56%;
  width: 3.5px;
  border-radius: 0 4px 4px 0;
  background: var(--emerald-light);
  box-shadow: 0 0 10px var(--emerald-light);
}

.nav-item svg {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  stroke-width: 2;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.nav-item:hover svg {
  transform: scale(1.08);
}

.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: var(--glass-border);
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  gap: 0.65rem;
}

.sidebar-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.global-currency-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0 0.65rem;
  height: 28px;
  background: rgba(0, 168, 132, 0.15);
  border: 1px solid rgba(0, 168, 132, 0.4);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--emerald-light);
  white-space: nowrap;
  transition: all var(--transition-fast);
  box-sizing: border-box;
  line-height: 1;
}

.global-currency-pill-btn:hover {
  background: rgba(0, 168, 132, 0.28);
  border-color: var(--emerald-light);
  box-shadow: 0 0 10px rgba(0, 168, 132, 0.3);
}

.currency-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  line-height: 1;
  transform: translateY(-0.5px);
}

#global-currency-pill {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 0.88rem;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(0, 168, 132, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 0.7rem;
  color: var(--emerald-primary);
  text-transform: capitalize;
}

.logout-btn {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: #f87171;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  color: #ffffff;
  background-color: rgba(239, 68, 68, 0.32);
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
  transform: scale(1.06);
}

/* ==========================================================================
   Sidebar States: Collapsed, Hover-Expanded, and Pinned
   ========================================================================== */

/* Pin Button Styling */
.sidebar-pin-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-pin-btn:hover {
  background-color: rgba(0, 168, 132, 0.18);
  border-color: rgba(0, 168, 132, 0.4);
  color: var(--emerald-light);
  transform: scale(1.08);
}

.sidebar-pin-btn.pinned,
.sidebar.pinned .sidebar-pin-btn {
  background: rgba(0, 168, 132, 0.22);
  border-color: rgba(0, 168, 132, 0.55);
  color: var(--emerald-light);
  box-shadow: 0 0 12px rgba(0, 168, 132, 0.35);
}

.sidebar-pin-btn.pinned .pin-icon path,
.sidebar.pinned .sidebar-pin-btn .pin-icon path {
  fill: currentColor;
}

/* 1. Collapsed State (Default when unpinned and not hover-expanded) */
.sidebar.collapsed:not(.hover-expanded),
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) {
  width: 68px;
  box-shadow: 2px 0 14px rgba(0, 0, 0, 0.25);
}

.sidebar.collapsed:not(.hover-expanded) .brand-name,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .brand-name {
  display: none !important;
}

.sidebar.collapsed:not(.hover-expanded) .sidebar-pin-btn,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .sidebar-pin-btn {
  display: none !important;
}

.sidebar.collapsed:not(.hover-expanded) .brand-logo,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .brand-logo {
  justify-content: center !important;
  width: 100% !important;
}

.sidebar.collapsed:not(.hover-expanded) .sidebar-header,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .sidebar-header {
  padding: 0 !important;
  justify-content: center !important;
}

.sidebar.collapsed:not(.hover-expanded) .nav-menu,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .nav-menu {
  padding: 1rem 0.5rem !important;
  align-items: center !important;
}

.sidebar.collapsed:not(.hover-expanded) .nav-item,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .nav-item {
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  justify-content: center !important;
  position: relative !important;
}

.sidebar.collapsed:not(.hover-expanded) .nav-label,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .nav-label,
.sidebar.collapsed:not(.hover-expanded) .nav-section-title,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .nav-section-title {
  display: none !important;
}

.sidebar.collapsed:not(.hover-expanded) .sidebar-footer,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .sidebar-footer {
  padding: 0.75rem 0.35rem !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
}

.sidebar.collapsed:not(.hover-expanded) .sidebar-user-row,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .sidebar-user-row {
  flex-direction: column !important;
  align-items: center !important;
  gap: 0.65rem !important;
  width: auto !important;
}

.sidebar.collapsed:not(.hover-expanded) .user-details,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .user-details,
.sidebar.collapsed:not(.hover-expanded) .lang-switcher-container,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .lang-switcher-container,
.sidebar.collapsed:not(.hover-expanded) .sidebar-footer-meta,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .sidebar-footer-meta,
.sidebar.collapsed:not(.hover-expanded) #global-currency-link,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) #global-currency-link,
.sidebar.collapsed:not(.hover-expanded) .logout-text,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .logout-text {
  display: none !important;
}

.sidebar.collapsed:not(.hover-expanded) .logout-btn,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .logout-btn {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  justify-content: center !important;
  border-radius: 10px !important;
  position: relative !important;
}

.sidebar.collapsed:not(.hover-expanded) .logout-btn:hover::after,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .logout-btn:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-elevated);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fca5a5;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  z-index: 1000;
  pointer-events: none;
}

/* Tooltip on hover when strictly collapsed */
.sidebar.collapsed:not(.hover-expanded) .nav-item:hover::after,
html.sidebar-is-collapsed .sidebar:not(.hover-expanded):not(.pinned) .nav-item:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-elevated);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-subtle);
  z-index: 999;
  pointer-events: none;
  animation: fadeInTooltip 0.15s ease-out;
}

/* 2. Hover-Expanded State (Floating Overlay Drawer) */
.sidebar.hover-expanded {
  width: 220px !important;
  box-shadow: 14px 0 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(0, 168, 132, 0.18) !important;
}

/* 3. Pinned State (Permanently Docked) */
.sidebar.pinned,
html.sidebar-is-pinned .sidebar {
  width: 220px !important;
}

.sidebar.hover-expanded .sidebar-footer-meta,
.sidebar.pinned .sidebar-footer-meta,
html.sidebar-is-pinned .sidebar .sidebar-footer-meta {
  display: flex !important;
}

.sidebar.hover-expanded .sidebar-user-row,
.sidebar.pinned .sidebar-user-row,
html.sidebar-is-pinned .sidebar .sidebar-user-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
}

@keyframes fadeInTooltip {
  from { opacity: 0; transform: translate(-4px, -50%); }
  to { opacity: 1; transform: translate(0, -50%); }
}

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

.main-viewport {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-main);
  position: relative;
  min-width: 0;
}

.top-bar {
  height: var(--header-height);
  background-color: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.top-bar-title {
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Glass Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--gradient-emerald);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #00b890 0%, #059669 60%, #10b981 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(0, 168, 132, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-secondary {
  background-color: rgba(31, 44, 52, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.btn-secondary:hover {
  background-color: rgba(42, 57, 66, 0.85);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.btn-danger {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22) 0%, rgba(220, 38, 38, 0.12) 100%);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.85);
  color: #fff;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.38rem 0.8rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

/* Forms & Inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 1.15rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.7rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.09);
  background-color: var(--glass-input);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  background-color: rgba(31, 44, 52, 0.85);
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.25);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.badge-emerald {
  background-color: rgba(0, 168, 132, 0.18);
  color: var(--emerald-light);
  border: 1px solid rgba(0, 168, 132, 0.35);
  box-shadow: 0 0 10px rgba(0, 168, 132, 0.15);
}

.badge-lead {
  background-color: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.badge-vip {
  background-color: rgba(168, 85, 247, 0.18);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.badge-danger {
  background-color: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.15);
}

.badge-secondary {
  background-color: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Glass Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(4, 8, 12, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.modal-box {
  background: rgba(17, 27, 33, 0.88);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-box form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-backdrop.active .modal-box {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  flex-shrink: 0;
}

.modal-body {
  padding: 1.6rem;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-footer {
  padding: 1.1rem 1.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
}

/* Glass Cards & Containers */
.content-card, .card {
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-card-shadow);
  position: relative;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 200;
}

.toast {
  background: rgba(17, 27, 33, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  min-width: 320px;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast.toast-success {
  border-left: 4px solid var(--emerald-primary);
}
.toast.toast-error {
  border-left: 4px solid var(--status-danger);
}
.toast.toast-warning {
  border-left: 4px solid var(--status-warning);
}

@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Custom Sleek Glass Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.13);
  border-radius: 9999px;
  transition: background var(--transition-fast);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 168, 132, 0.5);
}

/* Micro-animations */
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 10px rgba(0, 168, 132, 0.25); }
  50% { box-shadow: 0 0 24px rgba(0, 168, 132, 0.55); }
}

.pulse-emerald {
  animation: pulseGlow 2.5s infinite ease-in-out;
}

.ripple-hover {
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.ripple-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Language Switcher */
.lang-switcher-container {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin: 0;
  height: 28px;
  box-sizing: border-box;
}
.btn-lang {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 0.5rem;
  height: 100%;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
}
.btn-lang:hover {
  color: var(--text-primary);
}
.btn-lang.active {
  background: var(--emerald-primary);
  color: #fff;
  box-shadow: 0 1px 4px var(--emerald-glow);
}

/* AI Generator & Presets Chips */
.ai-preset-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.775rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.ai-preset-chip:hover {
  background: rgba(0, 168, 132, 0.15);
  border-color: var(--emerald-primary);
  color: var(--emerald-light);
  transform: translateY(-1px);
}

/* ==========================================================================
   Mobile Companion App Shell & Responsive Layout
   ========================================================================== */

/* 1. Mobile Desktop Advisory Banner */
.mobile-desktop-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--navbar-glass-bg, rgba(8, 12, 22, 0.9));
  backdrop-filter: blur(18px) saturate(120%);
  -webkit-backdrop-filter: blur(18px) saturate(120%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  color: #e2e8f0;
  font-size: 0.82rem;
  line-height: 1.45;
  z-index: 100;
  flex-shrink: 0;
}

.mobile-banner-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
}

.mobile-banner-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
}

.mobile-banner-text strong {
  color: #25d366;
}

.mobile-banner-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 0.85rem;
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.mobile-banner-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* Diminished State: Yellow Triangle Pill Indicator */
.mobile-banner-diminished {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.75rem;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  z-index: 99;
  animation: fadeInDown 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.diminished-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.32);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  color: #fde68a;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.diminished-pill:hover,
.diminished-pill:active {
  background: rgba(245, 158, 11, 0.24);
  border-color: rgba(245, 158, 11, 0.6);
  color: #ffffff;
  transform: scale(1.02);
}

.diminished-triangle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: softAmberPulse 2.8s infinite ease-in-out;
}

.diminished-label {
  white-space: nowrap;
  letter-spacing: 0.01em;
}

@keyframes softAmberPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
    filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4));
  }
  50% {
    transform: scale(1.12);
    opacity: 0.82;
    filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.85));
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 769px) {
  .mobile-desktop-banner,
  .mobile-banner-diminished {
    display: none !important;
  }
}

/* 2. Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(8, 12, 22, 0.94);
  backdrop-filter: blur(20px) saturate(120%);
  -webkit-backdrop-filter: blur(20px) saturate(120%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: space-around;
  padding: 0 0.5rem;
}

.mobile-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #8696a0;
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.35rem 0.6rem;
  border-radius: 12px;
  transition: all 0.2s ease;
  flex: 1;
  max-width: 80px;
}

.mobile-nav-tab svg {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
}

.mobile-nav-tab.active {
  color: #25d366;
}

.mobile-nav-tab.active svg {
  stroke: #25d366;
  transform: scale(1.08);
}

.mobile-nav-tab.logout-tab {
  color: #f87171;
}

.mobile-nav-tab.logout-tab svg {
  stroke: #f87171;
}

.mobile-nav-tab.logout-tab:active,
.mobile-nav-tab.logout-tab:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

/* 3. Base Mobile Media Queries (<= 768px) */
@media (max-width: 768px) {
  /* Hide desktop hover/pinned sidebar & spacer completely */
  .sidebar,
  .sidebar-dock-spacer {
    display: none !important;
  }

  /* Full screen viewport with bottom clearance for navigation */
  .app-container {
    flex-direction: column;
    height: 100vh;
    width: 100vw;
  }

  .main-viewport {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 64px; /* Room for bottom bar */
  }

  /* Show mobile bottom nav */
  .mobile-bottom-nav {
    display: flex;
  }

  /* Page Container mobile padding */
  .page-container {
    padding: 1rem 0.85rem 5rem 0.85rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
}

