/* ==========================================================================
   NusaMate Omnichannel Design System & Stylesheet
   Crafted for Maximum Performance, SEO, and Premium WhatsApp Web Aesthetics
   ========================================================================== */

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Brand Colors */
  --wa-green: #25D366;
  --wa-teal: #128C7E;
  --wa-dark-teal: #075E54;
  --wa-emerald: #00A884;
  --wa-light-green: #d9fdd3;
  --wa-outgoing-dark: #005c4b;
  --wa-incoming-dark: #202c33;
  --wa-incoming-light: #ffffff;

  /* Neutral Dark Theme (WhatsApp Web Dark Palette) */
  --bg-primary: #0b141a;
  --bg-secondary: #111b21;
  --bg-surface: #202c33;
  --bg-hover: #222e35;
  --bg-active: #2a3942;
  --border-color: #222e35;
  --border-light: rgba(255, 255, 255, 0.08);

  /* Typography */
  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --text-inverse: #111b21;

  /* Accents */
  --accent-blue: #53bdeb;
  --accent-amber: #f59e0b;
  --accent-purple: #8b5cf6;
  --accent-red: #ef4444;

  /* Shadows & Glassmorphism */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 24px rgba(37, 211, 102, 0.25);

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-full: 9999px;

  /* Chat Bubble Colors (Dark) */
  --wa-msg-incoming: #202c33;
  --wa-msg-outgoing: #005c4b;
  --wa-msg-outgoing-text: #e9edef;
  --wa-msg-meta: rgba(255, 255, 255, 0.6);

  --navbar-bg: rgba(11, 20, 26, 0.78);
  --callout-info-color: #bae6fd;
  --callout-tip-color: #a7f3d0;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-primary: #f0f2f5;
  --bg-secondary: #ffffff;
  --bg-surface: #ffffff;
  --bg-hover: #f5f6f6;
  --bg-active: #e9edef;
  --border-color: #e5e7eb;
  --border-light: rgba(0, 0, 0, 0.06);

  --navbar-bg: rgba(255, 255, 255, 0.82);
  --callout-info-color: #0369a1;
  --callout-tip-color: #047857;

  --text-primary: #111b21;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-inverse: #ffffff;

  /* Chat Bubble Colors (Light) */
  --wa-msg-incoming: #ffffff;
  --wa-msg-outgoing: #d9fdd3;
  --wa-msg-outgoing-text: #111b21;
  --wa-msg-meta: rgba(0, 0, 0, 0.45);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
  position: relative;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

input, textarea, select {
  font-family: inherit;
  outline: none;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  transition: border-color var(--transition-fast);
  max-width: 100%;
}
textarea {
  resize: vertical;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--wa-emerald);
}

/* Form Validation & State Hygiene */
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: #ef4444 !important;
  background-color: rgba(239, 68, 68, 0.06) !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

input.is-invalid:focus,
textarea.is-invalid:focus,
select.is-invalid:focus {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3) !important;
}

[data-theme="light"] input.is-invalid,
[data-theme="light"] textarea.is-invalid,
[data-theme="light"] select.is-invalid {
  border-color: #dc2626 !important;
  background-color: rgba(220, 38, 38, 0.04) !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}

input.is-valid,
textarea.is-valid,
select.is-valid {
  border-color: var(--wa-green) !important;
}

.form-error-feedback {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #f87171;
  margin-top: 5px;
  line-height: 1.35;
}

.form-error-feedback.visible {
  display: flex;
  animation: fieldFeedbackIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-error-feedback i {
  font-size: 13px;
  flex-shrink: 0;
}

[data-theme="light"] .form-error-feedback {
  color: #dc2626;
}

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

@keyframes shakeField {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.field-shake {
  animation: shakeField 0.35s ease-in-out;
}

/* -------------------------------------------------------------
   LANDING PAGE COMPONENTS
   ------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

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

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

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--border-light);
  height: 72px;
  display: flex;
  align-items: center;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

[data-theme="light"] .navbar {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .navbar.scrolled {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.07);
  border-bottom-color: rgba(0, 0, 0, 0.12);
}

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

.logo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--wa-green), var(--wa-teal));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  padding: 8px 4px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Mobile Nav Toggle & Drawer */
.mobile-nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-nav-toggle:hover {
  background: var(--bg-hover);
  color: var(--wa-emerald);
}

.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  width: 100%;
  height: 100%;
  height: 100vh;
  height: 100lvh;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100lvh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  touch-action: none;
  overscroll-behavior: contain;
}

.mobile-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(85vw, 320px);
  height: 100%;
  height: 100dvh;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  z-index: 1001;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s;
  display: flex;
  flex-direction: column;
  padding: 16px 16px max(20px, env(safe-area-inset-bottom, 20px)) 16px;
  box-shadow: var(--shadow-lg);
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.mobile-drawer.active {
  transform: translateX(0);
  visibility: visible;
}

html.drawer-open,
body.drawer-open {
  overflow: hidden !important;
  touch-action: none !important;
  overscroll-behavior: none !important;
}

.mobile-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 12px;
  flex-shrink: 0;
}

.mobile-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
}

.mobile-drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
  min-height: 42px;
  transition: all var(--transition-fast);
}

.mobile-drawer-link i {
  font-size: 19px;
  color: var(--wa-emerald);
}

.mobile-drawer-link:hover, .mobile-drawer-link.active {
  background: var(--bg-hover);
  color: var(--wa-emerald);
}

.mobile-drawer-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
}

.mobile-drawer-theme-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: background var(--transition-fast);
}

.mobile-drawer-theme-btn:hover {
  background: var(--bg-active);
}

.theme-switch-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--bg-primary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.mobile-drawer-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.drawer-card-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.drawer-card-text {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.drawer-card-text code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 4px;
  border-radius: 3px;
}

[data-theme="light"] .drawer-card-text code {
  background: rgba(0, 0, 0, 0.06);
}

.mobile-drawer-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition-normal);
  text-align: center;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  min-height: 32px;
  line-height: 1.25;
  border-radius: var(--radius-sm);
  gap: 6px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--wa-emerald), var(--wa-teal));
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 168, 132, 0.45);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--wa-emerald);
  color: var(--wa-emerald);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.2);
}

[data-theme="light"] .btn-secondary {
  background: #ffffff;
  color: #111b21;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .btn-secondary:hover {
  background: #ffffff;
  border-color: var(--wa-emerald);
  color: var(--wa-emerald);
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.2);
  transform: translateY(-2px);
}

.btn-secondary.active {
  background: rgba(0, 168, 132, 0.18);
  border-color: var(--wa-emerald);
  color: var(--wa-emerald);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.25);
}

[data-theme="light"] .btn-secondary.active {
  background: rgba(0, 168, 132, 0.12);
  border-color: var(--wa-emerald);
  color: #075e54;
  font-weight: 700;
}

/* Button click & focus hygiene: eliminate sticky hover/focus after clicks */
.btn:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

.header-icon-btn {
  transition: all var(--transition-fast) !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.header-icon-btn:active {
  transform: scale(0.92) !important;
}

.header-icon-btn:focus:not(:focus-visible) {
  outline: none !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  color: var(--text-primary) !important;
  background: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18) !important;
  transform: none !important;
}

[data-theme="light"] .header-icon-btn:focus:not(:focus-visible) {
  border-color: #cbd5e1 !important;
  color: #111b21 !important;
  background: #ffffff !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

@media (hover: none) {
  .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    transform: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  }
  [data-theme="light"] .btn-secondary:hover {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #111b21;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    transform: none;
  }
}

@keyframes spinRefresh {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.spin-anim {
  display: inline-block;
  animation: spinRefresh 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pricing Card Action Buttons */
.pricing-card .btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-sizing: border-box;
}

.pricing-card .btn-secondary {
  background: rgba(255, 255, 255, 0.09);
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.pricing-card .btn-secondary:hover {
  background: rgba(0, 168, 132, 0.15);
  border-color: var(--wa-emerald);
  color: var(--wa-emerald);
  box-shadow: 0 4px 16px rgba(0, 168, 132, 0.25);
  transform: translateY(-2px);
}

[data-theme="light"] .pricing-card .btn-secondary {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .pricing-card .btn-secondary:hover {
  background: #e6f7f3;
  border-color: var(--wa-emerald);
  color: var(--wa-emerald);
  box-shadow: 0 4px 12px rgba(0, 168, 132, 0.18);
  transform: translateY(-2px);
}

.hero-cta .btn-secondary {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .hero-cta .btn-secondary {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .hero-cta .btn-secondary:hover {
  background: #ffffff;
  border-color: var(--wa-emerald);
  color: var(--wa-emerald);
  box-shadow: 0 6px 16px rgba(0, 168, 132, 0.22);
}

.btn-outline {
  border: 1.5px solid var(--wa-emerald);
  color: var(--wa-emerald);
  background: transparent;
  font-weight: 700;
}

.btn-outline:hover {
  background: var(--wa-emerald);
  color: #ffffff;
}

/* Hero Section */
.hero {
  position: relative;
  padding: 100px 0 80px;
  overflow: hidden;
  text-align: center;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(circle, rgba(0, 168, 132, 0.15) 0%, rgba(11, 20, 26, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  background: rgba(0, 168, 132, 0.12);
  border: 1px solid rgba(0, 168, 132, 0.3);
  color: var(--wa-emerald);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 24px;
}

.hero-badge .pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wa-green);
  box-shadow: 0 0 8px var(--wa-green);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.hero-title {
  font-size: 52px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1.5px;
  margin-bottom: 20px;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, #25D366 0%, #00A884 50%, #53bdeb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 36px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 60px;
}

/* Mockup Showcase */
.mockup-preview {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 168, 132, 0.15);
  overflow: hidden;
  background: var(--bg-secondary);
  transition: all var(--transition-normal);
}

[data-theme="light"] .mockup-preview {
  border-color: var(--border-color);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08);
}

.mockup-header {
  background: var(--bg-hover);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.mockup-url {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-surface);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  max-width: 340px;
  margin: 0 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mockup-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  padding: 24px;
  background: #111b21;
  text-align: left;
  min-height: 380px;
}

[data-theme="light"] .mockup-grid {
  background: #edf1f5;
}

/* Feature Grid */
.features-section {
  padding: 80px 0;
  border-top: 1px solid var(--border-color);
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 56px;
}

.section-tag {
  color: var(--wa-emerald);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.section-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.section-desc {
  font-size: 16px;
  color: var(--text-secondary);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 24px;
}

.grid-4,
.features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

@media (max-width: 1024px) {
  .grid-4,
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .grid-4,
  .features-grid {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 168, 132, 0.4);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.feature-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: rgba(0, 168, 132, 0.12);
  color: var(--wa-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 20px;
}

.feature-card h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

/* Pricing Section */
.pricing-section {
  padding: 80px 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.pricing-switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 48px;
  flex-wrap: nowrap;
}

.switch-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

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

.save-badge {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-block;
  line-height: 1.4;
  vertical-align: middle;
}

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: stretch;
}

.pricing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 30px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

.pricing-card.featured {
  border: 2px solid var(--wa-emerald);
  box-shadow: 0 12px 36px rgba(0, 168, 132, 0.16);
  background: var(--bg-surface);
  transform: translateY(-4px);
}

.pricing-card.featured:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 48px rgba(0, 168, 132, 0.24);
}

[data-theme="dark"] .pricing-card.featured {
  background: linear-gradient(180deg, #1b2f2b 0%, #16242a 100%);
  border: 2px solid var(--wa-emerald);
  box-shadow: 0 12px 36px rgba(0, 168, 132, 0.22);
}

[data-theme="light"] .pricing-card.featured {
  background: #ffffff;
  border: 2px solid var(--wa-emerald);
  box-shadow: 0 14px 40px rgba(0, 168, 132, 0.15), 0 2px 8px rgba(0, 0, 0, 0.04);
}

.popular-tag {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--wa-emerald), var(--wa-teal));
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 16px;
  border-radius: 99px;
  letter-spacing: 0.6px;
  box-shadow: 0 4px 12px rgba(0, 168, 132, 0.35);
  white-space: nowrap;
}

.plan-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.plan-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  min-height: 42px;
  line-height: 1.5;
}

.price-box {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.price-main {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--text-primary);
}

.price-period {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.price-sub,
.price-kwd-sub {
  font-size: 13px;
  color: var(--wa-emerald);
  font-weight: 700;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.plan-features {
  list-style: none;
  margin-bottom: 32px;
  flex: 1;
}

.plan-features li {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.5;
}

.plan-features li strong {
  color: var(--text-primary);
  font-weight: 700;
}

.plan-features li i {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.plan-features li .check-icon {
  color: var(--wa-emerald);
  font-weight: bold;
}

/* -------------------------------------------------------------
   WEB.WHATSAPP.COM REPLICA OMNICHANNEL STYLES (/portal)
   ------------------------------------------------------------- */
.portal-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

/* Custom Scrollbar for Anti-slop clean look */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(134, 150, 160, 0.2);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(134, 150, 160, 0.4);
}
.filter-pills::-webkit-scrollbar {
  height: 4px;
}

/* Left Navigation Rail (Menu Sidebar) */
.portal-nav-rail {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 14px 8px;
  gap: 4px;
  z-index: 20;
  transition: width 0.28s cubic-bezier(0.2, 0, 0, 1);
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
  contain: layout style;
  user-select: none;
}

.portal-nav-rail.collapsed {
  width: 68px;
}

/* Strict No-Wrap Protection across rail during animation */
.portal-nav-rail,
.portal-nav-rail *,
.portal-nav-rail .rail-text,
.portal-nav-rail .rail-btn,
.portal-nav-rail .theme-label,
.portal-nav-rail .sidebar-group-title,
.portal-nav-rail .rail-user-details,
.portal-nav-rail #admin-presence-text {
  white-space: nowrap !important;
}

/* Smooth Fade & Slide Choreography for All Rail Text */
.portal-nav-rail .rail-text,
.portal-nav-rail .theme-label,
.portal-nav-rail .sidebar-logo span {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
  display: inline-block;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  /* Delayed fade-in on expand: text only reveals after sidebar expands comfortably */
  transition: opacity 0.16s cubic-bezier(0.2, 0, 0, 1) 0.1s, transform 0.16s cubic-bezier(0.2, 0, 0, 1) 0.1s, visibility 0s linear 0s;
}

.portal-nav-rail .theme-mini-switch {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
  pointer-events: auto;
  overflow: visible !important;
  text-overflow: clip !important;
  transition: opacity 0.16s cubic-bezier(0.2, 0, 0, 1) 0.1s, transform 0.16s cubic-bezier(0.2, 0, 0, 1) 0.1s, visibility 0s linear 0s;
}

.portal-nav-rail.collapsed .rail-text,
.portal-nav-rail.collapsed .theme-label,
.portal-nav-rail.collapsed .sidebar-logo span {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateX(-6px) !important;
  pointer-events: none !important;
  /* Instant fade-out on collapse: text disappears in first 70ms before width shrinks noticeably */
  transition: opacity 0.07s ease 0s, transform 0.07s ease 0s, visibility 0s linear 0.08s !important;
}

.portal-nav-rail.collapsed .theme-mini-switch {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: translateX(-6px) !important;
  pointer-events: none !important;
  transition: opacity 0.07s ease 0s, transform 0.07s ease 0s, visibility 0s linear 0.08s !important;
}

/* Sidebar Header (Brand + Collapse Toggle) */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  width: 100%;
  padding: 0 8px;
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
}

.sidebar-header a,
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap !important;
  overflow: hidden;
  text-decoration: none;
  font-size: 20px;
  font-weight: 800;
  color: var(--wa-green);
  opacity: 1;
  visibility: visible;
  flex-shrink: 0;
  transition: opacity 0.16s cubic-bezier(0.2, 0, 0, 1) 0.1s, visibility 0s linear 0s;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 20px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background-color 0.2s;
  flex-shrink: 0;
  margin-left: auto;
}

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

.sidebar-desktop-icon {
  display: inline-flex;
}

.sidebar-mobile-close-icon {
  display: none !important;
}

.portal-nav-rail.collapsed .sidebar-header {
  padding: 0 8px;
  justify-content: flex-start;
}

.portal-nav-rail.collapsed .sidebar-header a,
.portal-nav-rail.collapsed .sidebar-logo {
  opacity: 0 !important;
  visibility: hidden !important;
  width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.07s ease 0s, width 0.28s cubic-bezier(0.2, 0, 0, 1) 0s, visibility 0s linear 0.08s !important;
}

.portal-nav-rail.collapsed .sidebar-toggle-btn {
  margin: 0;
}

/* Sidebar Group Titles */
.sidebar-group-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-left: 12px;
  margin-top: 8px;
  margin-bottom: 2px;
  height: 18px;
  line-height: 18px;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  white-space: nowrap !important;
  transition: opacity 0.16s cubic-bezier(0.2, 0, 0, 1) 0.1s, height 0.26s cubic-bezier(0.2, 0, 0, 1), margin 0.26s cubic-bezier(0.2, 0, 0, 1), visibility 0s linear 0s;
}

.portal-nav-rail.collapsed .sidebar-group-title {
  opacity: 0 !important;
  visibility: hidden !important;
  height: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.07s ease 0s, height 0.26s cubic-bezier(0.2, 0, 0, 1), margin 0.26s cubic-bezier(0.2, 0, 0, 1), visibility 0s linear 0.08s !important;
}

/* Standard Rail Button */
.rail-btn {
  width: 100%;
  height: 44px;
  min-height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 8px;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  position: relative;
  text-align: left;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap !important;
  border: none;
  background: transparent;
  cursor: pointer;
}

.rail-btn i,
.rail-btn .ph {
  font-size: 20px;
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-align: center;
  border-radius: var(--radius-sm);
}

.portal-nav-rail.collapsed .rail-btn {
  justify-content: flex-start;
  padding: 0 8px;
}

.rail-btn:hover, .rail-btn.active {
  color: var(--wa-emerald);
  background: var(--bg-hover);
}

.rail-btn .rail-badge-count {
  position: absolute;
  right: 12px;
  background: var(--wa-green);
  color: #111b21;
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: right 0.28s cubic-bezier(0.2, 0, 0, 1), top 0.28s cubic-bezier(0.2, 0, 0, 1);
}

.portal-nav-rail.collapsed .rail-badge-count {
  right: 6px;
  top: 6px;
  min-width: 14px;
  height: 14px;
  font-size: 9px;
  padding: 0 3px;
}

/* Quick Theme Switcher in Sidebar (Between Brand & Utama) */
.rail-btn.theme-toggle-rail,
.theme-toggle-rail {
  height: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1.5px solid rgba(0, 168, 132, 0.45);
  background: linear-gradient(135deg, rgba(32, 44, 51, 0.95) 0%, rgba(17, 27, 33, 0.98) 100%);
  color: #f8fafc;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 8px;
  width: 100%;
  cursor: pointer;
  margin: 3px 0 10px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  text-align: left;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap !important;
}

.rail-btn.theme-toggle-rail:hover,
.theme-toggle-rail:hover {
  background: linear-gradient(135deg, rgba(38, 52, 60, 1) 0%, rgba(20, 31, 38, 1) 100%);
  border-color: var(--wa-emerald);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.rail-btn.theme-toggle-rail:active,
.theme-toggle-rail:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* Light theme overrides for theme-toggle-rail */
[data-theme="light"] .rail-btn.theme-toggle-rail,
[data-theme="light"] .theme-toggle-rail {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border: 1.5px solid rgba(0, 168, 132, 0.55);
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.15), inset 0 1px 0 #ffffff;
}

[data-theme="light"] .rail-btn.theme-toggle-rail:hover,
[data-theme="light"] .theme-toggle-rail:hover {
  background: linear-gradient(135deg, #ffffff 0%, #e6fbf3 100%);
  border-color: #00A884;
  color: #000000;
  box-shadow: 0 4px 14px rgba(0, 168, 132, 0.24);
}

/* Theme Icon Badge */
.theme-icon-badge {
  width: 36px;
  min-width: 36px;
  height: 36px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.45);
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.18);
  font-size: 18px;
  transition: all 0.2s ease;
}

[data-theme="light"] .theme-icon-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.18);
}

.theme-toggle-rail .theme-label {
  flex: 1;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap !important;
  letter-spacing: 0.1px;
}

/* Mini switch indicator inside theme button */
.theme-mini-switch {
  width: 34px !important;
  height: 20px !important;
  min-width: 34px !important;
  min-height: 20px !important;
  border-radius: 99px !important;
  position: relative !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
  box-sizing: border-box !important;
  transition: all 0.25s ease !important;
  background: rgba(96, 165, 250, 0.22) !important;
  border: 1.5px solid rgba(96, 165, 250, 0.6) !important;
  margin-left: auto !important;
  overflow: visible !important;
  text-overflow: clip !important;
  vertical-align: middle !important;
  padding: 0 !important;
}

.theme-mini-switch .theme-switch-slider,
.theme-mini-switch:empty::before {
  content: "" !important;
  display: block !important;
  position: absolute !important;
  top: 2px !important;
  left: 2px !important;
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  min-height: 12px !important;
  border-radius: 50% !important;
  background: #60a5fa !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 0 6px rgba(96, 165, 250, 0.6) !important;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease !important;
  transform: translateX(0) !important;
  pointer-events: none !important;
}

.theme-mini-switch.is-light,
[data-theme="light"] .theme-mini-switch {
  background: rgba(0, 168, 132, 0.25) !important;
  border-color: rgba(0, 168, 132, 0.7) !important;
}

.theme-mini-switch.is-light .theme-switch-slider,
[data-theme="light"] .theme-mini-switch .theme-switch-slider,
.theme-mini-switch.is-light:empty::before,
[data-theme="light"] .theme-mini-switch:empty::before {
  background: #00A884 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 6px rgba(0, 168, 132, 0.5) !important;
  transform: translateX(15px) !important;
}

/* Collapsed rail adjustments for theme toggle */
.portal-nav-rail.collapsed .theme-toggle-rail {
  margin: 4px auto 10px auto;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1.5px solid rgba(0, 168, 132, 0.45);
  background: linear-gradient(135deg, rgba(32, 44, 51, 0.95) 0%, rgba(17, 27, 33, 0.98) 100%);
  box-sizing: border-box;
  overflow: hidden;
  gap: 0;
}

.portal-nav-rail.collapsed .theme-toggle-rail:hover {
  border-color: var(--wa-emerald);
  box-shadow: 0 0 10px rgba(0, 168, 132, 0.35);
  transform: scale(1.05);
}

.portal-nav-rail.collapsed .theme-toggle-rail .theme-icon-badge {
  width: 100%;
  height: 100%;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #60a5fa;
  margin: 0;
  padding: 0;
}

[data-theme="light"] .portal-nav-rail.collapsed .theme-toggle-rail {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
  border: 1.5px solid rgba(0, 168, 132, 0.55);
}

[data-theme="light"] .portal-nav-rail.collapsed .theme-toggle-rail .theme-icon-badge {
  color: #d97706;
}

.portal-nav-rail.collapsed .theme-toggle-rail .theme-label,
.portal-nav-rail.collapsed .theme-toggle-rail .theme-mini-switch {
  display: none !important;
}

/* Presence Pill */
.presence-pill {
  width: 100%;
  height: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 8px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  cursor: pointer;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap !important;
}

.presence-dot-wrap {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.presence-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  transition: background var(--transition-fast);
}
.presence-status-dot.online { background: #25D366; box-shadow: 0 0 8px #25D366; }
.presence-status-dot.offline { background: #8696a0; }

.portal-nav-rail.collapsed .presence-pill {
  width: 100%;
  padding: 0 8px;
  justify-content: flex-start;
}

/* Logout Button in Rail */
.rail-btn.rail-btn-logout,
#rail-btn-logout {
  color: #ef4444;
  border-top: 1px solid var(--border-color);
  margin-top: 4px;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* WhatsApp Main Workspace */
.wa-workspace {
  display: flex;
  flex: 1;
  height: 100%;
  overflow: hidden;
}

/* Left Sidebar (Chats & Devices) */
.wa-sidebar {
  width: 380px;
  min-width: 320px;
  max-width: 440px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.wa-sidebar-header {
  padding: 12px 14px;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
}

/* Custom Device Picker Dropdown */
.custom-device-picker {
  position: relative;
  flex: 1;
  min-width: 0;
}

.device-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.device-picker-btn:hover {
  background: var(--bg-card);
  border-color: rgba(0, 168, 132, 0.4);
}

/* Centered Dropdown Options Box ("Kotak Pilihan") */
.device-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% + 36px);
  max-width: 340px;
  min-width: 260px;
  max-height: 440px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
  z-index: 1000;
  padding: 8px;
  box-sizing: border-box;
}

.device-dropdown-menu.show {
  display: flex !important;
  flex-direction: column;
  gap: 3px;
  animation: fadeInDown 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.device-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  gap: 10px;
  transition: background 0.15s;
  text-align: left;
  user-select: none;
}

.device-option-item:hover {
  background: var(--bg-hover);
}

.device-option-item.active {
  background: rgba(0, 168, 132, 0.12);
}

.device-option-item.active .device-check {
  display: inline-block !important;
}

.btn-solo-device {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-solo-device:hover {
  background: var(--wa-emerald);
  color: #fff;
  border-color: var(--wa-emerald);
}

/* Chat device badge tag */
.chat-device-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 168, 132, 0.12);
  color: var(--wa-emerald);
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

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

.device-picker {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  transition: background var(--transition-fast);
}

.device-picker:hover {
  background: var(--bg-card);
}

.device-picker select {
  background: transparent;
  border: none;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  text-align-last: left;
  width: 100%;
  flex: 1;
  min-width: 0;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.device-picker select option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  text-align: left;
}

.filter-pills {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  overflow-x: auto;
  border-bottom: 1px solid var(--border-light);
}

.filter-pill {
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-secondary);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill.active {
  background: var(--wa-emerald);
  color: #fff;
}

/* Chat Item */
.chat-list {
  flex: 1;
  overflow-y: auto;
}

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

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

.chat-item.active {
  background: var(--bg-active);
}

.chat-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--wa-emerald);
  font-size: 18px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

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

.chat-top-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.chat-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-time {
  font-size: 12px;
  color: var(--text-muted);
}

.chat-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-snippet {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.unread-badge {
  background: var(--wa-green);
  color: #111b21;
  font-size: 11px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat Main View (web.whatsapp.com replica) */
.wa-chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--bg-primary);
  background-image: radial-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 0);
  background-size: 24px 24px;
  position: relative;
}

.chat-header {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 10;
  box-sizing: border-box;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.btn-mobile-back {
  display: none;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}

.btn-mobile-back:hover,
.btn-mobile-back:active {
  background: var(--bg-hover);
}

.chat-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

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

.chat-header-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  overflow: hidden;
  justify-content: center;
}

.chat-header-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.25;
}

.chat-header-status {
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.25;
  margin-top: 2px;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 99px;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.2px;
}

.badge-tag.badge-ai {
  background: rgba(0, 168, 132, 0.12);
  color: var(--wa-emerald);
  border: 1px solid rgba(0, 168, 132, 0.3);
}

.badge-tag.badge-admin {
  background: rgba(83, 189, 235, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(83, 189, 235, 0.3);
}

.btn-header-ai {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-primary);
  cursor: pointer;
  white-space: nowrap;
  min-height: 32px;
  transition: all var(--transition-fast);
}

.btn-header-ai:hover {
  background: var(--bg-active);
  border-color: var(--wa-emerald);
}

.btn-header-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

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

/* Message Bubbles Area */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background-color: var(--bg-primary);
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 20px 20px;
}

[data-theme="light"] .messages-container {
  background-color: #efeae2;
  background-image: radial-gradient(rgba(0, 0, 0, 0.045) 1px, transparent 1px);
}

.msg-row {
  display: flex;
  width: 100%;
}

.msg-row.incoming {
  justify-content: flex-start;
}

.msg-row.outgoing {
  justify-content: flex-end;
}

.msg-bubble {
  max-width: 65%;
  padding: 8px 12px 6px;
  border-radius: 8px;
  position: relative;
  font-size: 14.2px;
  line-height: 1.45;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  word-break: break-word;
}

.msg-row.incoming .msg-bubble {
  background: var(--wa-msg-incoming);
  color: var(--text-primary);
  border-top-left-radius: 0;
}

.msg-row.outgoing .msg-bubble {
  background: var(--wa-msg-outgoing);
  color: var(--wa-msg-outgoing-text);
  border-top-right-radius: 0;
}

.msg-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--wa-msg-meta);
  margin-top: 4px;
  float: right;
  margin-left: 12px;
}

.tick-read {
  color: var(--accent-blue);
}

/* Typing Simulator Indicator */
.typing-indicator-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--wa-emerald);
  background: rgba(0, 168, 132, 0.08);
  border-radius: 4px;
  width: fit-content;
  margin-bottom: 8px;
}

/* Chat Input Bar */
.chat-input-bar {
  min-height: 62px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.chat-input-field {
  flex: 1;
  background: var(--bg-hover);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14.5px;
}

/* Quick Reply Popover */
.quick-reply-popover {
  position: absolute;
  bottom: 72px;
  left: 64px;
  width: 360px;
  max-height: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.quick-reply-popover.active {
  display: block;
}

.qr-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--transition-fast);
}

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

.qr-code-pill {
  font-weight: 700;
  color: var(--wa-emerald);
  font-size: 12px;
  margin-bottom: 2px;
}

.qr-text-preview {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Right Detail Sidebar */
.wa-details-sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

/* Modal Popup */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  overflow-y: auto;
  padding: 40px 16px;
}

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

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  margin: auto;
  padding: clamp(18px, 4vw, 28px);
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}

/* Stable Dimensions for Quick Tour Onboarding Modal */
.tour-modal-card {
  width: 580px;
  max-width: min(580px, 94vw);
  min-height: 520px;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.tour-steps-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 310px;
}

.tour-step-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

footer a {
  transition: color var(--transition-fast);
}

footer a:hover {
  color: var(--wa-emerald);
}

/* ==========================================================================
   Responsive Grid Utilities
   ========================================================================== */
.portal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.portal-grid-broadcast {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
}

.portal-grid-analytics {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.portal-grid-devices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}

.portal-stats-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.portal-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

/* Portal Mobile Header */
.portal-mobile-header {
  display: none;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 14px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 120;
  width: 100%;
}

/* Portal Mobile Bottom Navigation Bar */
.portal-mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  z-index: 150;
  align-items: center;
  justify-content: space-around;
  padding: 4px 6px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2);
}

.portal-bottom-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  min-width: 52px;
  min-height: 44px;
  transition: all var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
}

.portal-bottom-btn i {
  font-size: 20px;
}

.portal-bottom-btn:hover, .portal-bottom-btn.active {
  color: var(--wa-green);
}

.portal-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 290;
  display: none;
}

.portal-drawer-backdrop.active {
  display: block;
}

/* ==========================================================================
   Responsive Adjustments & Breakpoints
   ========================================================================== */
@media (max-width: 992px) {
  .pricing-cards {
    grid-template-columns: 1fr;
    max-width: 540px;
    margin: 0 auto;
  }
  .wa-details-sidebar {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    width: min(85vw, 360px);
    height: 100vh;
    z-index: 250;
    box-shadow: var(--shadow-lg);
    border-left: 1px solid var(--border-color);
    background: var(--bg-surface);
  }
  .portal-grid-2,
  .portal-grid-broadcast,
  .portal-grid-analytics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  .logo-brand {
    font-size: 18px;
    gap: 8px;
  }
  .logo-icon {
    width: 34px;
    height: 34px;
    font-size: 17px;
    border-radius: 8px;
  }
  .nav-links {
    display: none;
  }
  .nav-btn-desktop {
    display: none !important;
  }
  .mobile-nav-toggle {
    display: flex;
  }
  .hero-title {
    font-size: clamp(26px, 6vw, 36px);
  }
  .hero-desc {
    font-size: 15px;
    padding: 0 4px;
  }
  .hero-cta {
    flex-direction: column;
    width: 100%;
    align-items: center;
  }
  .hero-cta .btn {
    width: 100%;
    max-width: 320px;
    min-height: 44px;
  }
  .mockup-grid {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 10px;
    min-height: auto;
  }
  .mockup-chat-sidebar {
    display: none;
  }
  .mockup-chat-conv {
    width: 100%;
  }

  /* Portal Mobile Layout */
  .portal-mobile-header {
    display: flex;
  }
  .portal-mobile-bottom-nav {
    display: flex;
  }
  .portal-container {
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  .portal-nav-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px !important;
    height: 100vh;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
    background: var(--bg-surface);
    overflow-y: auto;
  }
  .portal-nav-rail.mobile-open {
    transform: translateX(0);
  }
  /* On mobile: all text, labels, and category titles are always 100% visible in drawer */
  .portal-nav-rail .rail-text,
  .portal-nav-rail .theme-label,
  .portal-nav-rail .sidebar-logo span,
  .portal-nav-rail.collapsed .rail-text,
  .portal-nav-rail.collapsed .theme-label,
  .portal-nav-rail.collapsed .sidebar-logo span,
  .portal-nav-rail.mobile-open .rail-text,
  .portal-nav-rail.mobile-open .theme-label,
  .portal-nav-rail.mobile-open .sidebar-logo span {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    display: inline-block !important;
    pointer-events: auto !important;
  }

  .portal-nav-rail .theme-mini-switch,
  .portal-nav-rail.collapsed .theme-mini-switch,
  .portal-nav-rail.mobile-open .theme-mini-switch {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    display: inline-block !important;
    pointer-events: auto !important;
    overflow: visible !important;
  }

  .portal-nav-rail .sidebar-group-title,
  .portal-nav-rail.collapsed .sidebar-group-title,
  .portal-nav-rail.mobile-open .sidebar-group-title {
    opacity: 1 !important;
    visibility: visible !important;
    height: 18px !important;
    line-height: 18px !important;
    margin-top: 10px !important;
    margin-bottom: 2px !important;
    padding-left: 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--text-muted) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: block !important;
    pointer-events: auto !important;
  }

  .portal-nav-rail .sidebar-header,
  .portal-nav-rail.collapsed .sidebar-header,
  .portal-nav-rail.mobile-open .sidebar-header {
    justify-content: space-between !important;
    padding: 0 8px !important;
  }

  .portal-nav-rail .sidebar-header a,
  .portal-nav-rail.collapsed .sidebar-header a,
  .portal-nav-rail .sidebar-logo,
  .portal-nav-rail.collapsed .sidebar-logo,
  .portal-nav-rail.mobile-open .sidebar-header a,
  .portal-nav-rail.mobile-open .sidebar-logo {
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
    display: flex !important;
    pointer-events: auto !important;
  }

  /* Desktop hamburger hidden on mobile; Close (✕) icon displayed on mobile drawer */
  .sidebar-desktop-icon {
    display: none !important;
  }
  .sidebar-mobile-close-icon {
    display: inline-flex !important;
    font-size: 22px !important;
    color: var(--text-secondary);
  }
  .sidebar-mobile-close-icon:hover {
    color: var(--wa-emerald);
  }

  .portal-nav-rail .rail-btn,
  .portal-nav-rail.mobile-open .rail-btn {
    justify-content: flex-start;
    padding: 0 12px;
    width: 100%;
  }
  .portal-nav-rail #admin-presence-text,
  .portal-nav-rail.mobile-open #admin-presence-text {
    opacity: 1 !important;
    visibility: visible !important;
    display: inline !important;
  }
  .portal-nav-rail .presence-pill,
  .portal-nav-rail.mobile-open .presence-pill {
    justify-content: flex-start;
    padding: 0 12px;
  }
  .portal-nav-rail .rail-user-info,
  .portal-nav-rail.mobile-open .rail-user-info {
    justify-content: flex-start !important;
    padding: 0 12px !important;
  }
  .portal-nav-rail .rail-user-details,
  .portal-nav-rail.mobile-open .rail-user-details {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
  }

  .portal-view-section {
    padding: 16px 14px 76px 14px !important;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
  }
  #view-chat.active {
    padding: 0 !important;
  }
  .wa-workspace {
    flex: 1;
    height: calc(100vh - 56px - 60px);
    overflow: hidden;
  }
  .wa-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .wa-chat-view {
    display: none;
    width: 100% !important;
    min-width: 0 !important;
  }
  .wa-workspace.mobile-chat-active .wa-sidebar {
    display: none !important;
  }
  .wa-workspace.mobile-chat-active .wa-chat-view {
    display: flex !important;
    width: 100% !important;
  }

  /* When a chat conversation is open on mobile: hide duplicate headers & bottom nav */
  body.mobile-chat-open .portal-mobile-header,
  body.mobile-chat-open .portal-mobile-bottom-nav,
  .wa-workspace.mobile-chat-active ~ .portal-mobile-bottom-nav {
    display: none !important;
  }

  body.mobile-chat-open .portal-view-section {
    padding: 0 !important;
  }

  body.mobile-chat-open .wa-workspace,
  body.mobile-chat-open .wa-chat-view {
    height: 100vh !important;
    height: 100dvh !important;
  }

  .chat-header {
    height: 58px;
    padding: 0 10px;
    gap: 8px;
  }

  .btn-mobile-back {
    display: inline-flex !important;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    font-size: 20px;
  }

  .chat-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    font-size: 15px;
  }

  .chat-header-actions {
    gap: 6px;
  }

  .chat-header-actions .badge-tag {
    font-size: 10px;
    padding: 3px 7px;
  }

  .chat-header-actions .btn-header-ai {
    font-size: 11px;
    padding: 5px 8px;
    min-height: 30px;
  }
  .modal-overlay {
    padding: 16px;
    align-items: center;
  }
  .modal-card {
    padding: clamp(16px, 4vw, 24px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    width: 100%;
  }
  .section-header-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .section-header-box > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .pricing-switch-wrapper {
    gap: 8px;
    margin-bottom: 32px;
  }
  .switch-label .label-prefix {
    display: none;
  }
  .switch-label {
    font-size: 13.5px;
  }
  .save-badge {
    font-size: 10px;
    padding: 2px 6px;
  }
}

@media (max-width: 480px) {
  .portal-stats-3 {
    grid-template-columns: 1fr;
  }
  .contacts-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .contacts-filter-bar > div {
    width: 100%;
  }
  .chat-input-bar {
    padding: 8px 8px;
    gap: 4px;
  }
  .chat-input-bar .btn-primary {
    padding: 8px 12px;
  }
  .chat-input-bar .send-btn-text {
    display: none;
  }
}

/* ==========================================================================
   Contacts & Automation Exclusion Components
   ========================================================================== */
.contacts-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.contacts-stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}
.contacts-stat-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}
.contacts-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.contacts-stat-val {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}
.contacts-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.contacts-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.contacts-table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.contacts-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
.contacts-table th {
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.contacts-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}
.contacts-table tbody tr {
  transition: background-color var(--transition-fast);
}
.contacts-table tbody tr:hover {
  background-color: var(--bg-hover);
}
.contacts-table tbody tr.is-excluded-row {
  background-color: rgba(239, 68, 68, 0.04);
}
.contacts-table tbody tr.is-excluded-row:hover {
  background-color: rgba(239, 68, 68, 0.08);
}

/* Exclusion Toggle Switch */
.switch-ui {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch-ui input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--bg-hover);
  border: 1px solid var(--border-color);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 24px;
}
.switch-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
input:checked + .switch-slider {
  background-color: var(--accent-red);
  border-color: var(--accent-red);
}
input:checked + .switch-slider:before {
  transform: translateX(20px);
}

/* Exclusion Chip Badges */
.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.28);
  animation: fadeIn 0.2s ease;
  vertical-align: middle;
}

.contact-chip i.ph-user {
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.contact-chip span {
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
}

.contact-chip button,
.contact-chip .contact-chip-remove {
  background: rgba(239, 68, 68, 0.18);
  border: none;
  color: #f87171;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  padding: 0;
  margin: 0;
  margin-left: 2px;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.contact-chip button i,
.contact-chip .contact-chip-remove i {
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.contact-chip button:hover,
.contact-chip .contact-chip-remove:hover {
  background: #ef4444;
  color: #ffffff;
  transform: scale(1.1);
}

/* ==========================================================================
   Broadcast Campaigns & Smart Recipients System
   ========================================================================== */
.recipient-mode-tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 14px;
}
.recipient-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all var(--transition-fast);
}
.recipient-tab-btn.active {
  background: var(--bg-hover);
  color: var(--wa-green);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.broadcast-progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid var(--border-color);
}
.broadcast-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--wa-emerald), var(--wa-green));
  border-radius: 4px;
  transition: width 0.4s ease;
}
.campaign-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color var(--transition-fast);
}
.campaign-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}
.pulse-badge {
  animation: pulse-glow 2s infinite ease-in-out;
}
@keyframes pulse-glow {
  0% { opacity: 0.8; }
  50% { opacity: 1; filter: drop-shadow(0 0 6px rgba(0, 168, 132, 0.6)); }
  100% { opacity: 0.8; }
}

/* Floating Back to Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--wa-emerald);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 16px rgba(0, 168, 132, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.2s ease,
              box-shadow 0.2s ease;
}

.back-to-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.back-to-top-btn:hover {
  background: var(--wa-teal);
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 6px 22px rgba(0, 168, 132, 0.55);
}

.back-to-top-btn:active {
  transform: translateY(0) scale(0.94);
}

@media (max-width: 768px) {
  .back-to-top-btn {
    bottom: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    font-size: 18px;
  }
}

/* ==========================================================================
   Custom Confirmation Modal & Toast Notification System
   ========================================================================== */
.confirm-modal-card {
  max-width: 440px !important;
  width: min(440px, 92vw) !important;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 48px -8px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 24px !important;
  margin: auto;
  box-sizing: border-box;
  animation: confirmModalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .confirm-modal-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

@keyframes confirmModalScale {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.confirm-modal-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.confirm-modal-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  border: 1px solid transparent;
  transition: all 0.2s ease;
}

.confirm-modal-icon-wrap.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.24);
}

.confirm-modal-icon-wrap.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.24);
}

.confirm-modal-icon-wrap.primary {
  background: rgba(0, 168, 132, 0.12);
  color: var(--wa-emerald);
  border-color: rgba(0, 168, 132, 0.24);
}

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

.confirm-modal-content h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 6px 0;
  line-height: 1.35;
}

.confirm-modal-content p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
  word-break: break-word;
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.confirm-btn-cancel {
  min-width: 88px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.btn-danger-action {
  background: #ef4444 !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: var(--radius-md) !important;
  padding: 9px 20px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35) !important;
  transition: background 0.15s ease, transform 0.1s ease !important;
}

.btn-danger-action:hover {
  background: #dc2626 !important;
}

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

.btn-warning-action {
  background: #f59e0b !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: var(--radius-md) !important;
  padding: 9px 20px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35) !important;
  transition: background 0.15s ease, transform 0.1s ease !important;
}

.btn-warning-action:hover {
  background: #d97706 !important;
}

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

/* Toast Container & Cards */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  pointer-events: none;
}

@media (max-width: 768px) {
  .toast-container {
    bottom: 74px; /* above mobile bottom nav */
    right: 16px;
    left: 16px;
    max-width: calc(100vw - 32px);
  }
}

.toast-item {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

[data-theme="light"] .toast-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.toast-item.toast-success {
  border-left: 4px solid var(--wa-green);
}

.toast-item.toast-error {
  border-left: 4px solid #ef4444;
}

.toast-item.toast-info {
  border-left: 4px solid var(--accent-blue);
}

.toast-item.toast-warning {
  border-left: 4px solid #f59e0b;
}

.toast-item .toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast-item.toast-success .toast-icon { color: var(--wa-green); }
.toast-item.toast-error .toast-icon { color: #ef4444; }
.toast-item.toast-info .toast-icon { color: var(--accent-blue); }
.toast-item.toast-warning .toast-icon { color: #f59e0b; }

.toast-item .toast-msg {
  flex: 1;
  line-height: 1.4;
  word-break: break-word;
}

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

/* -------------------------------------------------------------
 * INTERACTIVE UPLOAD PROGRESS BAR & MEDIA LIBRARY STYLES
 * ------------------------------------------------------------- */
.upload-progress-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-top: 8px;
  animation: toastSlideIn 0.2s ease;
}

.upload-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(120, 120, 120, 0.2);
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}

.upload-progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #25D366, #128C7E);
  border-radius: 999px;
  transition: width 0.15s ease-out;
}

.upload-progress-fill.error {
  background: #ef4444 !important;
}

/* Media Storage Meter */
.storage-meter-track {
  width: 100%;
  height: 10px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  margin: 10px 0;
}

.storage-meter-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #25D366, #10b981);
  transition: width 0.3s ease;
}

.storage-meter-bar.warning {
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.storage-meter-bar.danger {
  background: linear-gradient(90deg, #ef4444, #b91c1c);
}

/* Media Dropzone */
.media-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  background: var(--bg-surface);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.media-dropzone:hover,
.media-dropzone.drag-over {
  border-color: var(--wa-green);
  background: var(--bg-hover);
  transform: scale(0.998);
}

/* Media Library Grid & Cards */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.media-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  position: relative;
}

.media-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--wa-green);
}

.media-card-preview {
  width: 100%;
  height: 130px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.media-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.media-card:hover .media-card-preview img {
  transform: scale(1.04);
}

.media-card-doc-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
}

.media-card-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.media-card-name,
.media-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 6px;
}

.media-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  width: 100%;
  box-sizing: border-box;
}

.media-card-actions .media-btn-copy {
  flex: 1;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(0, 168, 132, 0.12);
  color: var(--wa-emerald);
  border: 1px solid rgba(0, 168, 132, 0.35);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  box-sizing: border-box;
}

.media-card-actions .media-btn-copy:hover {
  background: var(--wa-green);
  color: #111b21;
  border-color: var(--wa-green);
  box-shadow: 0 2px 8px rgba(0, 168, 132, 0.3);
  transform: translateY(-1px);
}

.media-card-actions .media-btn-view {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  min-height: 32px;
  max-height: 32px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.media-card-actions .media-btn-view:hover {
  background: var(--bg-hover);
  border-color: var(--text-secondary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.media-card-actions .media-btn-delete {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  min-height: 32px;
  max-height: 32px;
  padding: 0;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #ef4444;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.media-card-actions .media-btn-delete:hover {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

/* Light Theme overrides for media-card-actions */
[data-theme="light"] .media-card-actions .media-btn-copy {
  background: rgba(0, 168, 132, 0.1);
  color: #075e54;
  border-color: rgba(0, 168, 132, 0.4);
}
[data-theme="light"] .media-card-actions .media-btn-copy:hover {
  background: var(--wa-green);
  color: #ffffff;
}
[data-theme="light"] .media-card-actions .media-btn-view {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}
[data-theme="light"] .media-card-actions .media-btn-view:hover {
  background: #e2e8f0;
  color: #0f172a;
}
[data-theme="light"] .media-card-actions .media-btn-delete {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #dc2626;
}
[data-theme="light"] .media-card-actions .media-btn-delete:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Media Picker Modal Specifics */
.media-picker-modal-card {
  max-width: 820px;
  width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.media-picker-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.media-picker-item {
  cursor: pointer;
  border: 2px solid transparent;
}

.media-picker-item:hover {
  border-color: var(--wa-green);
}

.media-picker-item.selected {
  border-color: var(--wa-green);
  box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.3);
}

.media-picker-item.selected::after {
  content: '✓ Terpilih';
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--wa-green);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Chat Attachment Popover Menu */
.chat-attachment-popover {
  animation: fadeInPopover 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.attachment-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.15s ease;
}

.attachment-menu-item:hover {
  background: var(--bg-hover);
}

/* ==========================================================================
   Support Center, Web Chat Admin & Trouble Tickets
   ========================================================================== */
.support-subtab-group .support-tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.support-subtab-group .support-tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.support-subtab-group .support-tab-btn.active {
  background: var(--wa-emerald);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 168, 132, 0.3);
}

.support-quick-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.support-quick-pill:hover {
  background: var(--wa-emerald);
  color: #ffffff;
  border-color: var(--wa-emerald);
  transform: translateY(-1px);
}

/* Chat Message Bubbles in Support Center */
.support-msg-item {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  animation: fadeInMsg 0.2s ease-out forwards;
}

@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.support-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}

.support-msg-admin {
  align-self: flex-start;
  align-items: flex-start;
}

.support-msg-system {
  align-self: center;
  align-items: center;
  max-width: 90%;
  text-align: center;
}

.support-bubble {
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  position: relative;
  word-break: break-word;
}

.support-msg-user .support-bubble {
  background: var(--wa-msg-outgoing);
  color: var(--wa-msg-outgoing-text);
  border-bottom-right-radius: 3px;
}

.support-msg-admin .support-bubble {
  background: var(--wa-msg-incoming);
  color: var(--text-primary);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--border-color);
}

.support-msg-system .support-bubble {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 14px;
}

.support-bubble-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
}

.support-msg-admin .support-bubble-header {
  color: var(--wa-emerald);
}

.support-msg-user .support-bubble-header {
  color: rgba(255, 255, 255, 0.85);
}

.support-meta {
  font-size: 11px;
  margin-top: 4px;
  opacity: 0.75;
  display: flex;
  align-items: center;
  gap: 4px;
}

.support-msg-user .support-meta {
  justify-content: flex-end;
  color: rgba(255, 255, 255, 0.7);
}

.support-msg-admin .support-meta {
  justify-content: flex-start;
  color: var(--text-muted);
}

/* Trouble Ticket Badges */
.ticket-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.3px;
}

.ticket-badge-open {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.ticket-badge-in_progress {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.ticket-badge-resolved {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.ticket-badge-closed {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Priority Badges */
.ticket-badge-low {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.ticket-badge-medium {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.ticket-badge-high {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.ticket-badge-urgent {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.4);
  animation: pulseUrgent 2s infinite;
}

@keyframes pulseUrgent {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Floating Support Button (FAB) */
.floating-support-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #00A884 0%, #075E54 100%);
  color: #ffffff;
  border: none;
  border-radius: 30px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 168, 132, 0.4);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.floating-support-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 22px rgba(0, 168, 132, 0.55);
}

.floating-support-btn i {
  font-size: 20px;
}

.floating-support-badge {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  border: 2px solid #fff;
  margin-left: 2px;
}

@media (max-width: 768px) {
  .floating-support-btn {
    bottom: 74px; /* Above mobile bottom nav */
    right: 16px;
    padding: 10px;
    border-radius: 50%;
  }
  .floating-support-text {
    display: none;
  }
}

/* User Profile and Rail Info */
.rail-user-info {
  width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
  user-select: none;
  box-sizing: border-box;
  overflow: hidden;
  white-space: nowrap !important;
}

.rail-user-info:hover {
  background-color: var(--bg-hover) !important;
}

.user-avatar-badge {
  width: 36px;
  min-width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 168, 132, 0.15);
  color: var(--wa-emerald);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.rail-user-info:hover .user-avatar-badge {
  transform: scale(1.06);
}

.rail-user-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
  flex: 1;
  white-space: nowrap !important;
  flex-shrink: 0;
}

.rail-user-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.rail-user-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.portal-nav-rail.collapsed .rail-user-info {
  width: 100%;
  padding: 0 8px;
  justify-content: flex-start;
}

/* Superadmin Support Threads Sidebar */
.support-threads-sidebar {
  transition: width 0.2s ease;
}
.support-thread-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.15s ease;
  user-select: none;
}
.support-thread-item:hover {
  background-color: var(--bg-hover);
}
.support-thread-item.active {
  background-color: rgba(0, 168, 132, 0.12);
  border-left: 3px solid var(--wa-emerald);
}
.support-thread-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00A884, #075E54);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.support-thread-unread-badge {
  background: var(--wa-green);
  color: #111b21;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
}

/* Payment Method & Cycle Selectors */
.payment-method-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}
.payment-method-pill:hover {
  background: var(--bg-hover);
  border-color: var(--wa-emerald);
}
.payment-method-pill.active {
  background: rgba(0, 168, 132, 0.08);
  border: 2px solid var(--wa-emerald);
}
.billing-cycle-option {
  transition: all 0.2s ease;
}
.billing-cycle-option:hover {
  border-color: var(--wa-emerald);
}

@media (max-width: 992px) {
  .support-chat-container {
    flex-direction: column !important;
  }
  .support-threads-sidebar {
    width: 100% !important;
    max-height: 190px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-color);
  }
}

/* Homepage Floating Support Widget */
.home-support-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  height: 48px;
  padding: 0 18px 0 12px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--wa-green), #059669);
  color: #111b21;
  font-weight: 700;
  font-size: 13.5px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 168, 132, 0.4);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}
.home-support-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 28px rgba(0, 168, 132, 0.55);
}
.home-support-btn:active {
  transform: translateY(0) scale(0.97);
}
.support-avatar-badge {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(17, 27, 33, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #111b21;
}
.support-avatar-badge .support-status-dot.online {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #fff;
}
.back-to-top-btn {
  bottom: 82px !important;
}
@media (max-width: 768px) {
  .back-to-top-btn {
    bottom: 76px !important;
  }
}

.home-support-drawer {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 110px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
  animation: supportSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.home-support-drawer.active {
  display: flex;
}
@keyframes supportSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}




