:root {
  /* Color Palette (Slate & Emerald Theme) */
  --primary: #0d9488;
  --primary-hover: #0f766e;
  --primary-light: #f0fdfa;
  --primary-rgb: 13, 148, 136;
  
  --bg-gradient: radial-gradient(circle at 5% 5%, rgba(20, 184, 166, 0.06) 0%, transparent 35%), 
                 radial-gradient(circle at 95% 95%, rgba(13, 148, 136, 0.06) 0%, transparent 35%),
                 #f8fafc;
  
  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(15, 118, 110, 0.08);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #f8fafc;
  
  --border-color: #e2e8f0;
  
  /* Status Colors */
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fee2e2;
  --danger-text: #b91c1c;
  
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fef3c7;
  --warning-text: #b45309;
  
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #d1fae5;
  --success-text: #065f46;
  
  /* UI Tokens */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 118, 110, 0.05), 0 4px 6px -4px rgba(15, 118, 110, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(15, 118, 110, 0.08), 0 8px 10px -6px rgba(15, 118, 110, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.hidden {
  display: none !important;
}

/* Shell Layout */
.shell {
  width: 100%;
  max-width: 1600px;
  padding: 24px 24px 60px;
  margin: 0 auto;
}

/* Header & Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 12px 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.brand h1 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.brand small {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.userbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

#workspaceSelect {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: var(--transition-fast);
}

#workspaceSelect:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* App Main Layout Grid */
.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
  position: relative;
}

/* Sidebar & Navigation */
.sidebar {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px 14px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 24px;
  height: max-content;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav button {
  width: 100%;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  transition: var(--transition-fast);
}

.nav button svg, .nav button i {
  width: 18px;
  height: 18px;
  transition: var(--transition-fast);
}

.nav button:hover {
  background: rgba(13, 148, 136, 0.04);
  color: var(--primary);
}

.nav button.active {
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding-left: 20px;
}

/* Content Area */
.content {
  display: grid;
  gap: 24px;
  animation: fadeIn var(--transition-normal);
  min-width: 0;
}

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

/* Panels */
.panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.panel h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.panel h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
}

.panel p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Stats Cards Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  min-width: 0;
}

.stat {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  min-width: 0;
}

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

.stat span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.stat strong {
  font-size: clamp(16px, 4.5vw, 24px);
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
  word-break: break-all;
  overflow-wrap: break-word;
  display: block;
}

/* Visual Chart Container */
.chart-container {
  width: 100%;
  height: 280px;
  position: relative;
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.chart-container canvas {
  max-width: 100% !important;
  max-height: 100% !important;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  font-size: 12px;
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: 0.3px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  background-color: white;
  font-size: 14px;
  outline: none;
  transition: var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.12);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

/* Buttons */
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.actions.full {
  grid-column: 1 / -1;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.btn svg, .btn i {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-hover), var(--primary));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(13, 148, 136, 0.25);
}

.btn-ghost {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

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

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.btn-danger:hover {
  background: var(--danger-text);
  color: white;
}

/* Tables & Wrappers */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: white;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

th, td {
  padding: 14px 18px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

th {
  color: var(--text-muted);
  background: #f8fafc;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
}

tr:last-child td {
  border-bottom: 0;
}

tr:hover td {
  background-color: #fafbfd;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(13, 148, 136, 0.15);
}

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

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

#userEmailBadge {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Auth Cards */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 40px;
  backdrop-filter: blur(16px);
  animation: fadeIn var(--transition-normal);
}

.auth-card h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.75px;
}

.auth-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* Toast Notification Wrap */
.toast-wrap {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 999999;
  display: grid;
  gap: 12px;
}

.toast {
  width: min(350px, calc(100vw - 48px));
  background: white;
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--primary);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-md);
  padding: 16px;
  animation: slideIn var(--transition-normal) forwards;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast strong {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 700;
}

.toast p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

/* Plan Limits Progress Bar Row */
.limit-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 16px;
  align-items: center;
  margin: 16px 0;
}

.bar {
  height: 8px;
  background: var(--border-color);
  border-radius: 999px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #14b8a6);
  width: 0;
  transition: width 0.6s ease;
}

.limit-row span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  min-width: 0;
}

/* Mobile Menu Toggle Styling */
.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
}

/* Responsive Styles for Screens <= 900px */
@media (max-width: 900px) {
  .shell {
    padding: 16px 16px 40px;
  }

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

  .menu-toggle {
    display: inline-flex !important;
    position: absolute;
    top: 16px;
    right: 16px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    z-index: 1000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    box-shadow: var(--shadow-xl);
    display: block;
    background: white;
  }

  .sidebar.open {
    left: 0;
  }

  /* Overlay Background when Sidebar is Opened */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    border-radius: var(--radius-md);
    padding: 16px;
  }

  .userbar {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Hide workspace text labels on narrow buttons to save space */
  #newWorkspaceBtn span, #logoutBtn span {
    display: none;
  }

  #newWorkspaceBtn, #logoutBtn {
    padding: 8px 10px;
  }

  .toast-wrap {
    right: 16px;
    top: 16px;
  }

  .toast {
    width: min(320px, calc(100vw - 32px));
  }

  .grid, .form-grid, .split {
    grid-template-columns: 1fr;
  }
}

/* ==========================================
   FLOATING CHAT WIDGET STYLING (PREMIUM UX)
   ========================================== */
.floating-chat {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
}

/* FAB Button */
.chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #0d9488);
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(13, 148, 136, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
  position: relative;
}

.chat-fab:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.45);
}

.chat-fab svg {
  width: 24px;
  height: 24px;
  transition: transform 0.3s ease;
}

.chat-fab.open svg {
  transform: rotate(90deg);
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 380px;
  height: 520px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10001;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.chat-window.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.chat-window.hidden {
  display: none !important;
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-sm);
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.3);
}

.chat-header h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  color: white;
}

.chat-status {
  font-size: 11px;
  color: #a1a1aa;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #22c55e;
  display: inline-block;
  box-shadow: 0 0 8px #22c55e;
}

.chat-close {
  background: transparent;
  border: none;
  color: #a1a1aa;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.chat-close:hover {
  color: white;
}

/* Chat Messages */
.chat-messages {
  flex-grow: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: var(--bg-gradient);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 99px;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  box-shadow: var(--shadow-sm);
  animation: msgFadeIn 0.25s ease forwards;
}

.chat-msg:has(.chat-preview-card),
.chat-msg.card-msg {
  max-width: 100%;
  width: 100%;
  padding: 12px;
  align-self: stretch !important;
}

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

.chat-msg.bot {
  background-color: white;
  color: var(--text-main);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border-color);
}

.chat-msg.user {
  background: linear-gradient(135deg, var(--primary), #0d9488);
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg.system {
  align-self: center;
  background-color: rgba(244, 244, 245, 0.85);
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: none;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.chat-msg.typing {
  align-self: flex-start;
  background-color: white;
  color: var(--text-muted);
  padding: 10px 14px;
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-msg.typing .dots {
  display: inline-flex;
  gap: 3px;
}

.chat-msg.typing .dots span {
  width: 5px;
  height: 5px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingDot 1s infinite alternate;
}

.chat-msg.typing .dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-msg.typing .dots span:nth-child(3) { animation-delay: 0.4s; }

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

/* Preview Card inside Chat Bubble */
.chat-preview-card {
  margin-top: 8px;
  background: var(--bg-gradient);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  font-size: 12px;
  display: grid;
  gap: 6px;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.chat-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  background: white;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.chat-preview-item span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.chat-preview-item strong {
  color: var(--text-main);
  font-size: 12px;
}

.chat-preview-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.chat-preview-actions .btn {
  padding: 8px 12px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  flex: 1;
}

/* Chat Input Area */
.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background-color: white;
  border-top: 1px solid var(--border-color);
  align-items: center;
}

.chat-input-area input {
  flex-grow: 1;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13.5px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-gradient);
}

.chat-input-area input:focus {
  background-color: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
}

.chat-send-btn svg {
  width: 16px;
  height: 16px;
  margin: 0;
}

/* Responsive Mobile & Tablet Chat Widget (Premium UX) */
@media (max-width: 900px) {
  .chat-window {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    transform: translateY(100%);
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background-color: #f8fafc !important;
    overscroll-behavior: contain !important;
  }
  .chat-window.show {
    transform: translateY(0) !important;
  }
  .chat-header {
    flex-shrink: 0 !important;
  }
  .chat-messages {
    flex-grow: 1 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background-color: #f8fafc !important;
    overscroll-behavior: contain !important;
  }
  .chat-input-area {
    flex-shrink: 0 !important;
    padding: 12px 16px !important;
    background-color: white !important;
  }
}

/* Reusable Modal Dialog Styling */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}
.modal-backdrop.show {
  opacity: 1;
}
.modal-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform 0.2s ease-out;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-backdrop.show .modal-card {
  transform: scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header i {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.modal-header i.info { color: var(--primary); }
.modal-header i.danger { color: var(--danger); }
.modal-header i.warning { color: var(--warning); }
.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}
.modal-body {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
}
.modal-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.modal-field label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.modal-field input, .modal-field select {
  padding: 8px 12px;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #f8fafc;
  width: 100%;
}
.modal-field input:focus, .modal-field select:focus {
  border-color: var(--primary);
  background: white;
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* Pagination Styling */
.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}
.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
}
.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pagination-btn {
  background: var(--bg-surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pagination-btn:hover:not(:disabled) {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.pagination-current {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

/* Workspace Lockout Overlay */
.workspace-lockout-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.96);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #f8fafc;
  font-family: 'Plus Jakarta Sans', sans-serif;
  backdrop-filter: blur(10px);
}

.workspace-lockout-card {
  text-align: center;
  max-width: 480px;
  padding: 30px;
  background: var(--bg-panel, #1e293b);
  border-radius: 12px;
  border: 1px solid var(--danger, #ef4444);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

.workspace-lockout-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.workspace-lockout-card h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--danger, #ef4444);
}

.workspace-lockout-card p {
  font-size: 15px;
  color: var(--text-muted, #94a3b8);
  line-height: 1.6;
  margin-bottom: 24px;
}

/* PWA Installation Components */
.pwa-install-banner {
  margin-top: 24px;
  padding: 16px;
  border: 1.5px dashed var(--primary);
  border-radius: var(--radius-md);
  background: var(--primary-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
  animation: fadeIn var(--transition-normal);
}

.pwa-install-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-weight: 700;
}

.pwa-install-banner-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 !important;
  line-height: 1.4;
}

.pwa-install-banner-actions {
  display: flex;
  gap: 8px;
  width: 100%;
}

.pwa-install-banner-actions button {
  flex: 1;
  padding: 8px 12px;
  font-size: 12.5px;
}

#pwaInstallBtn {
  background: var(--primary-light);
  color: var(--primary);
  border: 1.5px dashed var(--primary);
  margin-top: 12px;
  font-weight: 700;
}

#pwaInstallBtn:hover {
  background: var(--primary);
  color: white;
}

/* Responsive adjustments for HP (max-width: 600px) */
@media (max-width: 600px) {
  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .panel-head .btn {
    align-self: flex-start;
  }
  #userEmailBadge {
    max-width: 170px !important;
  }
}

/* ==========================================
   FAQ ACCORDION COMPONENT STYLING
   ========================================== */
.faq-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  width: 100%;
}
.faq-item {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  width: 100%;
}
.faq-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}
.faq-toggle {
  width: 100%;
  background: transparent;
  border: none;
  padding: 16px 20px;
  text-align: left;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  outline: none;
  transition: color var(--transition-fast);
}
.faq-toggle:hover {
  color: var(--primary);
}
.faq-toggle i, .faq-toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: transform var(--transition-normal), color var(--transition-fast);
  color: var(--text-muted);
}
.faq-item.open {
  border-color: var(--primary);
}
.faq-item.open .faq-toggle {
  border-bottom: 1px solid var(--border-color);
  background: var(--primary-light);
  color: var(--primary);
}
.faq-item.open .faq-toggle i, .faq-item.open .faq-toggle svg {
  transform: rotate(180deg);
  color: var(--primary);
}
.faq-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.faq-content-inner {
  padding: 20px;
  line-height: 1.7;
  font-size: 13.5px;
  color: var(--text-muted);
}
.faq-content-inner li {
  margin-left: 20px;
  margin-bottom: 6px;
}
