/* styles.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Colors - Calm/Serene Theme (Slate Palette) */
  --bg-primary: #0f172a;
  /* Slate 900 */
  --bg-secondary: #1e293b;
  /* Slate 800 */
  --bg-tertiary: #334155;
  /* Slate 700 */
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-card-hover: rgba(51, 65, 85, 0.8);

  --accent-primary: #38bdf8;
  /* Sky 400 */
  --accent-secondary: #818cf8;
  /* Indigo 400 */
  --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);

  --text-primary: #f1f5f9;
  /* Slate 100 */
  --text-secondary: #94a3b8;
  /* Slate 400 */
  --text-muted: #64748b;
  /* Slate 500 */

  --border-color: rgba(148, 163, 184, 0.1);
  --border-hover: rgba(148, 163, 184, 0.2);

  --success: #34d399;
  /* Emerald 400 */
  --warning: #fbbf24;
  /* Amber 400 */
  --danger: #f87171;
  /* Red 400 */
  --info: #60a5fa;
  /* Blue 400 */

  /* Shadows - Softer & Diffused */
  --shadow-sm: 0 4px 6px -1px rgba(15, 23, 42, 0.3);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.4);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.5);
  --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);

  /* Animation */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);

  /* Safe Area Insets (for notched devices) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  /* iOS/Touch Optimizations */
  -webkit-tap-highlight-color: transparent;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Custom Scrollbar (Mac/iOS/Windows modern look) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

/* Background Effects */
.bg-fixed {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08), transparent 25%);
  pointer-events: none;
}

.grid-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  z-index: -1;
  pointer-events: none;
  mask-image: radial-gradient(circle at center, black, transparent 80%);
}

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

/* Layout Utilities */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.hidden {
  display: none !important;
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition-normal);
  padding-top: var(--safe-top);
  height: calc(80px + var(--safe-top));
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
}

.brand svg {
  width: 32px;
  height: 32px;
  color: var(--accent-primary);
}

.nav-links {
  display: flex;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition-fast);
  cursor: pointer;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.nav-link.auth-locked {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-normal);
  border: none;
  outline: none;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  transform: translateY(-2px);
}

/* Page Sections */
.main-content {
  padding-top: calc(100px + var(--safe-top));
  padding-bottom: calc(60px + var(--safe-bottom));
  min-height: 100vh;
}

.page-section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

/* Header Section */
.section-header {
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 20px;
}

.header-title h1 {
  font-size: 2.5rem;
  margin-bottom: 8px;
  background: linear-gradient(to right, #fff, #a1a1aa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-title p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(8px);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-content .value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
}

.stat-content .label {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 2px;
}

/* Tool Cards */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}

.tool-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.tool-badge {
  padding: 6px 12px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.tool-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  flex-grow: 1;
  position: relative;
  z-index: 1;
}

.tool-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.tag {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
}

/* Tool type badge - same as tool-badge */
.tool-type {
  padding: 6px 12px;
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid rgba(139, 92, 246, 0.25);
  white-space: nowrap;
}

/* Tool tag - individual tag item */
.tool-tag {
  font-size: 0.7rem;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tool actions (Edit/Delete buttons) */
.tool-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.tool-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.tool-footer .btn {
  flex: 1;
  font-size: 0.9rem;
}

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

.hero h1 {
  font-size: 4rem;
  background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 20px;
  line-height: 1.1;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 80px;
}

.feature-item {
  text-align: center;
  padding: 32px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.feature-item h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.feature-item p {
  color: var(--text-secondary);
}

/* Form Styles (Suggestions/Bugs) */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
}

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

.account-identity-card {
  margin-bottom: 24px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.38);
  padding: 14px 16px;
}

.account-identity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.account-identity-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.account-identity-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: right;
  word-break: break-word;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 16px;
  /* Prevent iOS zoom on focus */
  transition: var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: rgba(0, 0, 0, 0.4);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

textarea.form-textarea {
  resize: vertical;
  min-height: 120px;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  display: flex;
  opacity: 1;
}

#loginModal.auth-modal-locked .close-btn {
  display: none !important;
}

.modal-content {
  background: #121212;
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 600px;
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  transition: transform 0.3s ease;
  position: relative;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 1.8rem;
}

.close-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1024px) {
  .hero h1 {
    font-size: 3rem;
  }

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

/* Tablet */
@media (max-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .hero h1 {
    font-size: 3rem;
  }

  .section-header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .header-title {
    text-align: center;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .navbar-content {
    height: auto;
    padding: 16px 0;
    flex-direction: column;
    gap: 16px;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 12px;
    justify-content: flex-start;
    flex-wrap: nowrap;
  }

  .nav-link {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  .branding {
    width: 100%;
    justify-content: center;
  }

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

  .main-content {
    padding-top: 160px;
  }

  .hero {
    padding: 40px 0;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

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

  .tool-card {
    padding: 20px;
  }

  .tool-header {
    flex-direction: column;
    gap: 12px;
  }

  .tool-actions {
    flex-direction: column;
  }

  .admin-card {
    padding: 16px;
  }

  .admin-header-row {
    flex-direction: column;
    gap: 12px;
  }

  .modal-content {
    margin: 16px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
  }

  .container {
    padding: 0 16px;
  }

  .header-title h1 {
    font-size: 1.75rem;
  }

  .btn {
    padding: 10px 16px;
    font-size: 0.9rem;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .nav-links {
    gap: 4px;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 0.8rem;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .header-title h1 {
    font-size: 1.5rem;
  }

  .tool-name {
    font-size: 1.1rem;
  }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Admin Cards */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
  transition: var(--transition-normal);
}

.admin-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.admin-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.admin-info {
  flex: 1;
}

.admin-username {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.admin-email {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.admin-discord,
.admin-id {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.admin-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Role Badges */
.role-badge {
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: capitalize;
}

.role-owner {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.role-developer {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.role-admin {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.role-head-moderator,
.role-senior-moderator {
  background: rgba(234, 179, 8, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.role-moderator,
.role-trial-moderator {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.role-member {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.95rem;
}

/* styles-chat.css */

/* Layout */
.chat-wrapper {
  display: flex;
  height: calc(100vh - 80px);
  /* Minus navbar */
  margin-top: 80px;
  background: var(--bg-primary);
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 350px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.sidebar-header h2 {
  font-size: 1.2rem;
}

.search-bar {
  padding: 16px;
}

.search-bar input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
}

.search-bar input:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.filters {
  display: flex;
  padding: 0 16px 16px;
  gap: 8px;
  overflow-x: auto;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.filter-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.ticket-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}

.ticket-item {
  padding: 16px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  /* var(--border-color) */
  margin-bottom: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.ticket-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ticket-item.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.3);
}

.ticket-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ticket-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.ticket-preview {
  color: var(--text-secondary);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 10px;
}

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

.status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
}

/* Chat Area */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}

.chat-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
}

.empty-content svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.chat-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(10, 10, 10, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.header-info h2 {
  margin-bottom: 8px;
  font-size: 1.4rem;
}

.meta-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.badge {
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ticket-details {
  padding: 20px 30px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.detail-box h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.detail-box p {
  color: var(--text-secondary);
  line-height: 1.5;
  font-size: 0.95rem;
}

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

.message {
  display: flex;
  flex-direction: column;
  max-width: 70%;
  align-self: flex-start;
}

.message.own {
  align-self: flex-end;
  align-items: flex-end;
}

.message-header {
  margin-bottom: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}

.staff-badge {
  background: var(--accent-primary);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
}

.message-bubble {
  padding: 12px 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 12px;
  border-top-left-radius: 2px;
  line-height: 1.5;
  border: 1px solid var(--border-color);
}

.message.own .message-bubble {
  background: var(--accent-primary);
  color: white;
  border-radius: 12px;
  border-top-right-radius: 2px;
  border: none;
}

.message.staff .message-bubble {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
}

.chat-input-area {
  padding: 20px 30px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input-area textarea {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  max-height: 150px;
}

.chat-input-area textarea:focus {
  border-color: var(--accent-primary);
  outline: none;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--accent-primary);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.send-btn:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

.send-btn svg {
  width: 20px;
  height: 20px;
}

/* Modals */
.ticket-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}

.type-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-normal);
}

.type-card:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-3px);
}

.type-card .icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.type-card h3 {
  margin-bottom: 6px;
  color: var(--text-primary);
}

.type-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
  .chat-wrapper {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .chat-area {
    width: 100%;
  }

  .back-btn {
    display: block;
    margin-right: 12px;
    padding: 8px;
    font-size: 1.2rem;
    background: transparent;
    border: none;
    color: var(--text-primary);
  }
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  backdrop-filter: blur(2px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Enhanced Mobile & Tablet Styles - Append to existing styles.css */

/* ===================================
   IMPROVED MOBILE RESPONSIVENESS
   =================================== */

/* iPad & Tablet Landscape (max-width: 1024px) */
@media (max-width: 1024px) {
  .hero-title {
    font-size: 3em;
  }

  .hero-subtitle {
    font-size: 1.1em;
  }

  .navbar-menu {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
  }

  .navbar-menu::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari */
  }
}

/* iPad Portrait & Smaller Tablets (max-width: 768px) */
@media (max-width: 768px) {

  /* Improved Touch Targets */
  button,
  .btn,
  .navbar-link,
  select,
  input[type="checkbox"] {
    min-height: 44px;
    touch-action: manipulation;
  }

  /* Better Hero Section */
  .hero-section {
    padding: 50px 16px;
    margin-bottom: 40px;
  }

  .hero-title {
    font-size: 2.5em;
    letter-spacing: -1.5px;
  }

  .hero-subtitle {
    font-size: 1em;
    max-width: 100%;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
  }

  /* Improved Features Grid */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .feature-card h3 {
    font-size: 1.3em;
  }

  /* Better Form Inputs */
  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
  }

  /* Improved Modal Scrolling */
  .modal-content {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }

  /* Better Chat UI */
  .chat-messages {
    max-height: 300px;
  }

  .chat-empty-state {
    padding: 30px 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
  }

  /* Improved Executor Cards */
  .exec-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .exec-group-header {
    font-size: 1.1em;
    margin: 24px 0 12px;
  }

  /* Better Loading Overlay */
  .spinner {
    width: 50px;
    height: 50px;
  }
}

/* iPhone & Small Android (max-width: 480px) */
@media (max-width: 480px) {

  /* Optimized Text Sizes */
  body {
    font-size: 14px;
    line-height: 1.6;
  }

  /* Better Hero */
  .hero-title {
    font-size: 2em;
    line-height: 1.2;
  }

  .hero-subtitle {
    font-size: 0.9em;
    line-height: 1.5;
  }

  .btn-large {
    padding: 14px 28px;
    font-size: 16px;
  }

  /* Improved Stats */
  .home-stats {
    gap: 12px;
  }

  .home-stat-value {
    font-size: 2.2em;
  }

  .home-stat-label {
    font-size: 0.8em;
  }

  /* Better Section Titles */
  .section-title {
    font-size: 1.8em;
  }

  /* Optimized Chat */
  .chat-message {
    margin-bottom: 12px;
  }

  .chat-message-author {
    font-size: 13px;
  }

  .chat-message-time {
    font-size: 11px;
  }

  .chat-message-text {
    padding: 10px 14px;
    font-size: 14px;
  }

  /* Better Input Areas */
  .chat-input {
    font-size: 14px;
    padding: 10px 14px;
  }

  .chat-send-btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  /* Optimized Badges */
  .category-badge,
  .status-badge,
  .exec-badge,
  .role-badge {
    font-size: 9px;
    padding: 4px 10px;
  }
}

/* ===================================
   IMPROVED ANIMATIONS
   =================================== */

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

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

/* Scale In Animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

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

/* Slide In Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }

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

/* Slide In Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

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

/* Bounce Animation */
@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Pulse Animation */
@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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

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

/* Rotate Animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Apply Animations */
.page-section.active {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-card,
.feature-card,
.home-stat-card,
.exec-card,
.admin-card {
  animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both;
}

/* Staggered Animation for Cards */
.tool-card:nth-child(1),
.feature-card:nth-child(1),
.home-stat-card:nth-child(1) {
  animation-delay: 0.1s;
}

.tool-card:nth-child(2),
.feature-card:nth-child(2),
.home-stat-card:nth-child(2) {
  animation-delay: 0.15s;
}

.tool-card:nth-child(3),
.feature-card:nth-child(3),
.home-stat-card:nth-child(3) {
  animation-delay: 0.2s;
}

.tool-card:nth-child(4),
.feature-card:nth-child(4),
.home-stat-card:nth-child(4) {
  animation-delay: 0.25s;
}

.tool-card:nth-child(5),
.feature-card:nth-child(5) {
  animation-delay: 0.3s;
}

.tool-card:nth-child(6),
.feature-card:nth-child(6) {
  animation-delay: 0.35s;
}

/* Navbar Animation */
.navbar {
  animation: slideInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hero Animations */
.hero-title {
  animation: fadeIn 0.8s ease-out;
}

.hero-subtitle {
  animation: fadeIn 1s ease-out 0.2s;
  animation-fill-mode: both;
}

.hero-buttons {
  animation: fadeIn 1.2s ease-out 0.4s;
  animation-fill-mode: both;
}

/* Button Hover Animations */
button,
.btn {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:hover,
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.15);
}

button:active,
.btn:active {
  transform: translateY(0);
}

/* Card Hover Animations */
.tool-card,
.feature-card,
.home-stat-card,
.exec-card,
.admin-card {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-card:hover,
.feature-card:hover,
.home-stat-card:hover,
.exec-card:hover,
.admin-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

/* Modal Animations */
.modal.active .modal-content {
  animation: scaleIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Message Animations */
.success-msg.active,
.error-msg.active {
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Loading Spinner Animation */
.spinner {
  animation: rotate 1s linear infinite;
}

/* Stat Icon Animations */
.stat-icon,
.home-stat-icon,
.page-icon {
  transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon,
.home-stat-card:hover .home-stat-icon,
.page-title:hover .page-icon {
  transform: scale(1.1) rotate(5deg);
}

/* Badge Animations */
.category-badge,
.status-badge,
.exec-badge,
.role-badge {
  transition: all 0.3s ease;
}

.category-badge:hover,
.status-badge:hover,
.exec-badge:hover,
.role-badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Chat Message Animations */
.chat-message {
  animation: slideInLeft 0.4s ease-out;
}

.chat-message.staff {
  animation: slideInRight 0.4s ease-out;
}

/* ===================================
   ACCESSIBILITY IMPROVEMENTS
   =================================== */

/* Focus Visible Styles */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .bg-sphere {
    animation: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
    --border-color: #ffffff;
  }
}

/* ===================================
   PERFORMANCE OPTIMIZATIONS
   =================================== */

/* GPU Acceleration */
.tool-card,
.feature-card,
.home-stat-card,
.exec-card,
.admin-card,
button,
.btn {
  will-change: transform;
}

/* Contain Layout Shifts */
.tool-card,
.feature-card,
.suggestion-item {
  contain: layout style paint;
}

/* Better Scrolling */
.chat-messages,
.suggestions-list,
.modal-content {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ===================================
   TOUCH DEVICE OPTIMIZATIONS
   =================================== */

@media (hover: none) and (pointer: coarse) {

  /* Larger Touch Targets */
  button,
  .btn,
  .navbar-link,
  .close-btn,
  .chat-send-btn,
  select,
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 48px;
    min-width: 48px;
    touch-action: manipulation;
  }

  /* Remove Hover Effects */
  .tool-card:hover,
  .suggestion-item:hover,
  .stat-card:hover,
  .feature-card:hover {
    transform: none;
    box-shadow: var(--shadow-md);
  }

  /* Better Tap Feedback */
  button:active,
  .btn:active,
  .navbar-link:active,
  .tool-card:active {
    transform: scale(0.98);
    opacity: 0.9;
    transition: all 0.1s ease;
  }

  /* Disable Hover Animations */
  * {
    --hover-transition: none;
  }
}

/* ===================================
   DARK MODE ENHANCEMENTS
   =================================== */

/* Already Dark by Default */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --text-primary: #ffffff;
  }
}

/* Optional Light Mode Support */
@media (prefers-color-scheme: light) {
  :root {
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #fafafa;
    --border-color: #e0e0e0;
    --text-primary: #1a1a1a;
    --text-secondary: #333333;
    --text-muted: #666666;
    --accent: #1a1a1a;
  }

  .bg-animation::before {
    background:
      linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
      linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  }

  .sphere-1,
  .sphere-2,
  .sphere-3 {
    background: radial-gradient(circle,
        rgba(0, 0, 0, 0.05) 0%,
        transparent 70%);
  }
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {

  .navbar,
  .navbar-actions,
  .btn,
  button,
  .modal,
  .bg-animation {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .card,
  .tool-card,
  .suggestion-item {
    page-break-inside: avoid;
    border: 1px solid #000;
  }
}

/* ===================================
   GLOBAL GENERIC STYLES (Fix for unstyled elements)
   =================================== */

/* Ensure all buttons have a base style if not class-specified */
button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: var(--accent-primary, #3b82f6);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

/* Ensure all inputs/textareas have base style */
input,
textarea,
select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  color: var(--text-primary, #fff);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent-primary, #3b82f6);
  background: rgba(255, 255, 255, 0.08);
}

/* Ensure divs have correct box sizing model */
div {
  box-sizing: border-box;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}


/* ===================================
   PATCHES FOR UNSTYLED ELEMENTS
   =================================== */

/* Custom Select Styling */
select,
.form-select,
.status-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px;
  padding-right: 32px !important;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

select:focus,
.form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
  outline: none;
}

/* Chat Message Bubbles Fix */
.message-bubble {
  padding: 12px 16px;
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 12px;
  border-top-left-radius: 2px;
  line-height: 1.5;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  word-wrap: break-word;
  /* Ensure long words break */
}

/* Own Message Bubble */
.message.own .message-bubble {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
  border-radius: 12px;
  border-top-right-radius: 2px;
  border-top-left-radius: 12px;
}

/* Ticket List Item Hover Fix */
.ticket-item {
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.ticket-item:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.ticket-item.active {
  background: rgba(59, 130, 246, 0.1);
  border-color: var(--accent-primary);
}

/* Chat Input Area Fix */
.chat-input-area textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  min-height: 44px;
}

.chat-input-area textarea:focus {
  border-color: var(--accent-primary);
  background: var(--bg-primary);
}

/* Back Button Fix (Mobile) */
.back-btn {
  background: transparent;
  color: var(--text-primary);
  border: none;
  font-size: 1.5rem;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Ticket Type Card Hover */
.type-card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-color);
}

.type-card:hover {
  border-color: var(--accent-primary);
  background: rgba(59, 130, 246, 0.05);
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Status Select Specific */
.status-select {
  padding: 6px 30px 6px 12px;
  font-size: 0.85rem;
  min-width: 120px;
  height: 32px;
}

/* Admin Card Actions */
.status-actions button {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.status-actions .delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-actions .delete-btn:hover {
  background: var(--danger);
  color: white;
}


/* ===================================
   MISSING DESKTOP STYLES
   =================================== */

/* Executor Grid Layout (Missing in Desktop) */
.exec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* Force 3 columns */
  gap: 20px;
  margin-bottom: 40px;
}

/* Tablet Responsiveness */
@media (max-width: 1024px) {
  .exec-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Responsiveness defined in media query below */

/* Executor Card Base Style */
.exec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.exec-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-primary);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.exec-card h2 {
  font-size: 1.2rem;
  margin-bottom: 5px;
  color: var(--text-primary);
}

.exec-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.exec-card-badges {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.exec-badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
}

.exec-badge.working {
  background: rgba(6, 182, 212, 0.1);
  color: #22d3ee;
  border: 1px solid rgba(6, 182, 212, 0.3);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

.exec-badge.patched {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.exec-badge.bypassed {
  background: rgba(168, 85, 247, 0.1);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.exec-badge.detected-warn {
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.exec-badge.maintenance {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.exec-badge.free {
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.exec-badge.paid {
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
}

.exec-group-header {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 30px 0 15px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}


/* ===================================
   SUGGESTIONS & BUG LIST STYLES
   =================================== */

/* Suggestion Card */
.suggestion-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.suggestion-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.suggestion-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.suggestion-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.suggestion-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
}

.suggestion-email {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Badges */
.category-badge,
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 8px;
  margin-top: 8px;
}

.category-badge {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.status-badge.status-pending {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.status-badge.status-read {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.status-badge.status-approved,
.status-badge.status-fixed {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.status-badge.status-rejected,
.status-badge.status-closed {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.status-badge.severity-low {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.status-badge.severity-medium {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.status-badge.severity-high {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.status-badge.severity-critical {
  background: rgba(220, 38, 38, 0.2);
  color: #ef4444;
  border: 1px solid rgba(220, 38, 38, 0.5);
}

/* Actions */
.status-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-btn {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
}

.delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.delete-btn:hover {
  background: #ef4444;
  color: white;
}

.chat-toggle-btn {
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent-primary);
  border: 1px solid rgba(59, 130, 246, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.chat-toggle-btn:hover {
  background: var(--accent-primary);
  color: white;
}

/* Content */
.suggestion-message {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.2);
  padding: 16px;
  border-radius: 8px;
}

.suggestion-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
}

/* Inline Chat Section */
.chat-section {
  display: none;
  /* Hidden by default, toggled via JS */
  margin-top: 16px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 16px;
}

.chat-section.active {
  display: flex;
  flex-direction: column;
}

.chat-messages {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===================================
   CUSTOM UI COMPONENTS (TOAST & MODAL)
   =================================== */

/* Toast Container */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
  /* Allow clicks to pass through container */
}

/* Toast Element */
.toast {
  background: rgba(18, 18, 18, 0.95);
  backdrop-filter: blur(10px);
  color: #fff;
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  pointer-events: auto;
  /* Enable clicks on toast */
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top right;
}

.toast.hiding {
  animation: fadeOutRight 0.3s forwards;
}

.toast-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.toast-info .toast-icon {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.toast-warning .toast-icon {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.toast-content {
  flex-grow: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
  color: var(--text-primary);
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Custom Confirm Modal */
.custom-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.custom-modal {
  background: #18181b;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 90%;
  max-width: 400px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 24px;
}

.modal-icon.warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.modal-icon.danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.modal-icon.info {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.modal-title-custom {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.modal-desc-custom {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.modal-actions-custom {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.btn-modal {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.btn-modal.cancel {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-modal.cancel:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-modal.confirm {
  background: var(--accent-primary);
  color: white;
}

.btn-modal.confirm:hover {
  filter: brightness(1.1);
}

.btn-modal.confirm.danger {
  background: var(--danger);
}

@keyframes fadeOutRight {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}


/* ===================================
   CHAT UI REWRITE (PREMIUM)
   =================================== */

/* Chat Wrapper */
.chat-wrapper {
  background: var(--bg-primary);
  height: calc(100vh - 80px);
  /* Height minus navbar */
  display: flex;
  overflow: hidden;
  border-top: 1px solid var(--border-color);
}

/* Sidebar Redesign */
.sidebar {
  width: 320px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

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

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.search-bar {
  padding: 16px 20px;
}

.search-bar input {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text-primary);
  width: 100%;
  transition: all 0.2s;
}

.search-bar input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.filters {
  padding: 0 20px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

.ticket-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0 10px 20px;
}

/* Ticket Item Redesign */
.ticket-item {
  padding: 16px;
  margin-bottom: 8px;
  border-radius: 12px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.ticket-item:hover {
  background: rgba(255, 255, 255, 0.03);
  transform: translateX(2px);
}

.ticket-item.active {
  background: rgba(59, 130, 246, 0.08);
  /* Light Blue Tint */
  border-color: rgba(59, 130, 246, 0.2);
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ticket-title {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95rem;
  max-width: 70%;
}

.ticket-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ticket-preview {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.ticket-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Chat Area Redesign */
.chat-area {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  position: relative;
}

.chat-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

.chat-empty svg {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
  opacity: 0.5;
  color: var(--accent-primary);
}

.chat-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 16px 24px;
  background: rgba(18, 18, 18, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.messages-container {
  flex-grow: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message Bubble Redesign */
.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  align-self: flex-start;
  animation: fadeIn 0.3s ease;
}

.message.own {
  align-self: flex-end;
  align-items: flex-end;
}

.message-info {
  margin-bottom: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 8px;
}

.message-bubble {
  padding: 12px 18px;
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 18px;
  border-top-left-radius: 4px;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  font-size: 0.95rem;
  position: relative;
}

.message.own .message-bubble {
  background: var(--accent-primary);
  /* Blue */
  color: white;
  border-radius: 18px;
  border-top-right-radius: 4px;
  border-top-left-radius: 18px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.message.staff:not(.own) .message-bubble {
  background: rgba(16, 185, 129, 0.1);
  /* Green tint for staff */
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

/* Input Area Redesign */
.chat-input-area {
  padding: 20px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.chat-input-area textarea {
  flex-grow: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 24px;
  color: var(--text-primary);
  resize: none;
  max-height: 120px;
  transition: all 0.2s;
  line-height: 1.4;
}

.chat-input-area textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
  outline: none;
}

.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.send-btn:hover {
  transform: scale(1.05);
  background: #2563eb;
}

.send-btn svg {
  width: 20px;
  height: 20px;
  margin-left: 2px;
  /* Visual alignment */
}


/* ===================================
   ADVANCED EXECUTOR STATUS STYLES (CALM THEME)
   =================================== */

/* Status Colors & Glows - Softened */
.border-yellow {
  border-color: rgba(251, 191, 36, 0.4) !important;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.05);
  background: linear-gradient(to bottom, rgba(251, 191, 36, 0.02), transparent);
}

.border-purple {
  border-color: rgba(168, 85, 247, 0.4) !important;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.05);
  background: linear-gradient(to bottom, rgba(168, 85, 247, 0.02), transparent);
}

.border-orange {
  border-color: rgba(251, 146, 60, 0.4) !important;
  box-shadow: 0 4px 20px rgba(251, 146, 60, 0.05);
  background: linear-gradient(to bottom, rgba(251, 146, 60, 0.02), transparent);
}

.border-red {
  border-color: rgba(248, 113, 113, 0.4) !important;
  box-shadow: 0 4px 20px rgba(248, 113, 113, 0.05);
  background: linear-gradient(to bottom, rgba(248, 113, 113, 0.02), transparent);
}

/* Hologram Effect -> Serene Glow (Cyan/Sky) */
.border-hologram {
  border-color: rgba(56, 189, 248, 0.4) !important;
  /* Sky 400 */
  box-shadow: 0 4px 25px rgba(56, 189, 248, 0.1);
  background: linear-gradient(to bottom, rgba(56, 189, 248, 0.03), transparent);
  position: relative;
  overflow: hidden;
}

/* Removing the aggressive rotating hologram animation */
.border-hologram::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.5), transparent);
  opacity: 0.5;
}

/* Status Message Text - Softer Colors */
.status-msg {
  font-size: 0.8rem;
  margin-top: 10px;
  margin-bottom: 16px;
  line-height: 1.5;
  font-weight: 400;
  /* Regular weight for calm look */
  display: flex;
  align-items: flex-start;
  gap: 8px;
  opacity: 0.9;
}

.text-yellow {
  color: #fcd34d;
}

/* Amber 300 */
.text-purple {
  color: #d8b4fe;
}

/* Purple 300 */
.text-orange {
  color: #fdba74;
}

/* Orange 300 */
.text-red {
  color: #fca5a5;
}

/* Red 300 */
.text-hologram {
  color: #7dd3fc;
  text-shadow: none;
}

/* Sky 300, no shadow */

/* Update Badges for Calm Look */
.exec-badge {
  font-weight: 500;
  letter-spacing: 0.02em;
  border-width: 1px;
  padding: 4px 12px;
}

.exec-badge.working {
  background: rgba(56, 189, 248, 0.08);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.2);
  box-shadow: none;
  /* Remove glow */
}

.exec-badge.bypassed {
  background: rgba(168, 85, 247, 0.08);
  color: #c084fc;
  border-color: rgba(168, 85, 247, 0.2);
}

.exec-badge.detected-warn {
  background: rgba(251, 191, 36, 0.08);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.2);
}

.exec-badge.patched {
  background: rgba(248, 113, 113, 0.08);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.2);
}

/* ===================================
   UI REFRESH OVERRIDES (2026)
   =================================== */

:root {
  --bg-primary: #050812;
  --bg-secondary: #0b1220;
  --bg-tertiary: #111b2f;
  --bg-card: rgba(15, 23, 42, 0.92);
  --bg-card-hover: rgba(30, 41, 59, 0.96);

  --accent-primary: #38bdf8;
  --accent-secondary: #7c82ff;
  --accent-gradient: linear-gradient(120deg, #38bdf8, #7c82ff);

  --text-primary: #e8eef9;
  --text-secondary: #a9b8d1;
  --text-muted: #7b8aa6;

  --border-color: rgba(148, 163, 184, 0.2);
  --border-hover: rgba(148, 163, 184, 0.35);

  --success: #34d399;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
}

* {
  box-sizing: border-box;
}

body {
  color: var(--text-primary);
  background: radial-gradient(1200px 700px at 15% 0%, rgba(56, 189, 248, 0.09), transparent 55%),
    radial-gradient(900px 600px at 100% 10%, rgba(124, 130, 255, 0.12), transparent 50%),
    var(--bg-primary);
}

.bg-fixed {
  background:
    radial-gradient(circle at 20% 18%, rgba(56, 189, 248, 0.12), transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(124, 130, 255, 0.14), transparent 22%);
}

.grid-overlay {
  opacity: 0.4;
  mask-image: radial-gradient(circle at center, black 35%, transparent 90%);
}

.navbar {
  background: rgba(6, 10, 18, 0.88);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border-color);
}

.navbar-content {
  min-height: 78px;
}

.brand {
  font-size: 1.85rem;
}

.nav-links {
  background: rgba(148, 163, 184, 0.07);
}

.nav-link {
  color: var(--text-secondary);
}

.nav-link.active {
  background: rgba(56, 189, 248, 0.16);
  color: #eaf8ff;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.main-content {
  padding-top: 110px;
}

.page-section {
  display: none;
}

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

.section-header {
  margin-bottom: 26px;
  align-items: flex-end;
}

.section-header.centered-header {
  justify-content: center;
  text-align: center;
  align-items: center;
  position: relative;
}

@media (min-width: 1025px) {
  .section-header.centered-header .btn {
    position: absolute;
    right: 0;
    bottom: 20px;
    /* Aligns with padding-bottom of section-header */
  }
}


.section-header.centered-header .header-title {
  text-align: center;
}

.header-title h1 {
  background: linear-gradient(90deg, #f4f8ff, #b8d7ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-title p {
  color: var(--text-secondary);
}

.compact-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.stat-card {
  background: linear-gradient(155deg, rgba(17, 27, 47, 0.92), rgba(10, 16, 30, 0.92));
  border: 1px solid var(--border-color);
  border-radius: 14px;
  backdrop-filter: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.stat-icon {
  display: none;
}

.stat-content .value {
  color: #f7fbff;
  font-size: 1.75rem;
}

.stat-content .label {
  color: var(--text-secondary);
}

.hero {
  text-align: center;
  padding: 36px 0 10px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.7rem);
  margin-bottom: 14px;
}

.hero p {
  max-width: 720px;
  margin: 0 auto 26px;
  color: var(--text-secondary);
}

.feature-grid {
  gap: 18px;
}

.feature-item {
  background: rgba(17, 27, 47, 0.75);
  border: 1px solid var(--border-color);
}

.feature-item p {
  color: var(--text-secondary);
}

.tools-grid {
  gap: 16px;
}

.tool-card {
  border-radius: 14px;
  padding: 20px;
  background: linear-gradient(160deg, rgba(17, 27, 47, 0.95), rgba(8, 13, 25, 0.98));
  border: 1px solid var(--border-color);
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 14px 30px rgba(3, 8, 18, 0.6);
}

.tool-name {
  color: #f3f8ff;
}

.tool-description,
.tool-tag {
  color: var(--text-secondary);
}

.btn,
button.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #06101b;
  border-color: rgba(127, 201, 255, 0.28);
  box-shadow: 0 8px 22px rgba(56, 189, 248, 0.24);
}

.btn-primary:hover {
  color: #06101b;
  box-shadow: 0 10px 26px rgba(56, 189, 248, 0.34);
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.12);
  color: #dce8fb;
  border-color: rgba(148, 163, 184, 0.32);
}

.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.2);
}

.btn-danger {
  background: rgba(248, 113, 113, 0.14);
  color: #ffb4b4;
  border-color: rgba(248, 113, 113, 0.35);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.24);
}

.form-card {
  max-width: 860px;
  margin: 0 auto;
  background: linear-gradient(165deg, rgba(17, 27, 47, 0.95), rgba(8, 13, 25, 0.98));
  border-radius: 14px;
  border: 1px solid var(--border-color);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.form-card h3 {
  margin-bottom: 20px;
  text-align: center;
}

.form-row {
  gap: 14px;
}

.form-label {
  color: #d9e5f8;
  font-weight: 600;
}

.form-input,
.form-select,
.form-textarea,
input,
select,
textarea {
  background: rgba(5, 11, 21, 0.88);
  color: #eaf3ff;
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 10px;
  min-height: 44px;
}

.form-textarea {
  min-height: 128px;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #7a8aa8;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(56, 189, 248, 0.7);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.18);
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0 auto 18px;
  max-width: 860px;
}

.filter-row.filter-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-section-title {
  text-align: center;
  margin-bottom: 6px;
}

.suggestions-list {
  display: grid;
  gap: 14px;
}

.suggestion-item {
  margin-bottom: 0;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: linear-gradient(150deg, rgba(17, 27, 47, 0.95), rgba(7, 12, 23, 0.98));
}

.suggestion-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.suggestion-name {
  color: #eaf3ff;
}

.suggestion-email,
.suggestion-time {
  color: var(--text-secondary);
}

.suggestion-message {
  background: rgba(3, 8, 17, 0.55);
  color: #dce9ff;
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.status-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.status-btn {
  min-height: 36px;
  background: rgba(8, 14, 26, 0.95);
  color: #e7f1ff;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.chat-toggle-btn {
  min-height: 36px;
  background: rgba(56, 189, 248, 0.16);
  color: #bfe9ff;
  border: 1px solid rgba(56, 189, 248, 0.34);
}

.chat-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.26);
  color: #ecf8ff;
}

.delete-btn {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(248, 113, 113, 0.14);
  color: #ffb7b7;
  border: 1px solid rgba(248, 113, 113, 0.36);
  font-weight: 600;
}

.delete-btn:hover {
  background: rgba(248, 113, 113, 0.25);
  color: #ffe3e3;
}

.category-badge,
.status-badge {
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid transparent;
}

.category-badge {
  background: rgba(148, 163, 184, 0.16);
  border-color: rgba(148, 163, 184, 0.28);
  color: #d2def2;
}

.status-badge.status-pending,
.status-badge.pending {
  background: rgba(250, 204, 21, 0.14);
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.35);
}

.status-badge.status-read {
  background: rgba(96, 165, 250, 0.16);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.35);
}

.status-badge.status-approved,
.status-badge.status-fixed,
.status-badge.status-resolved {
  background: rgba(52, 211, 153, 0.16);
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, 0.35);
}

.status-badge.status-rejected,
.status-badge.status-closed,
.status-badge.status-patched {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
}

.status-badge.status-open,
.status-badge.status-in-progress,
.status-badge.in-progress {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.35);
}

.status-badge.severity-low {
  background: rgba(96, 165, 250, 0.16);
  color: #bfdbfe;
}

.status-badge.severity-medium {
  background: rgba(251, 191, 36, 0.16);
  color: #fde68a;
}

.status-badge.severity-high {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

.status-badge.severity-critical {
  background: rgba(239, 68, 68, 0.22);
  color: #fee2e2;
  border-color: rgba(248, 113, 113, 0.45);
}

.chat-section {
  background: rgba(6, 11, 22, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.chat-input-area {
  background: transparent;
  border-top: none;
  padding: 0;
}

.chat-input {
  min-height: 38px;
  border-radius: 8px;
}

.chat-send-btn {
  min-height: 38px;
  border-radius: 8px;
  background: var(--accent-gradient);
  color: #06101b;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.admin-card {
  border-radius: 12px;
  background: linear-gradient(150deg, rgba(17, 27, 47, 0.96), rgba(8, 13, 25, 0.98));
  border: 1px solid var(--border-color);
}

.admin-tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  justify-content: center;
}

.admin-tab-btn {
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.74);
  color: #dce8fb;
  font-weight: 600;
}

.admin-tab-btn.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.5);
  color: #eff8ff;
}

.moderation-card {
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: linear-gradient(160deg, rgba(17, 27, 47, 0.95), rgba(8, 13, 25, 0.98));
  padding: 14px;
}

.moderation-card h4 {
  margin-bottom: 8px;
}

.moderation-meta {
  display: grid;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.moderation-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-username {
  color: #f2f7ff;
}

.admin-email,
.admin-discord,
.admin-id {
  color: var(--text-secondary);
}

.role-badge {
  border-radius: 999px;
}

.role-owner {
  background: rgba(250, 204, 21, 0.16);
  color: #fde68a;
}

.role-developer {
  background: rgba(167, 139, 250, 0.18);
  color: #ddd6fe;
}

.role-admin {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}

.role-head-moderator,
.role-senior-moderator,
.role-moderator,
.role-trial-moderator {
  background: rgba(52, 211, 153, 0.16);
  color: #bbf7d0;
}

.role-member {
  background: rgba(148, 163, 184, 0.18);
  color: #d0d9ea;
}

.exec-filter-group {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.exec-filter-btn {
  min-height: 42px;
  border-radius: 10px;
  padding: 0 14px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.8);
  color: #d5e3fb;
}

.exec-filter-btn.active {
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.2);
  color: #ebf8ff;
}

.exec-group-header {
  color: #d8e6ff;
  border-bottom: 1px solid var(--border-color);
}

.exec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.exec-card {
  border-radius: 12px;
  background: linear-gradient(155deg, rgba(17, 27, 47, 0.96), rgba(7, 12, 22, 0.98));
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.exec-card:hover {
  transform: translateY(-2px);
}

.exec-card h2 {
  color: #eaf3ff;
}

.status-msg {
  color: var(--text-secondary);
}

.exec-warning-box {
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #d7e4fb;
}

.exec-warning-box.yellow {
  background: rgba(251, 191, 36, 0.14);
  color: #fde68a;
}

.exec-warning-box.purple {
  background: rgba(167, 139, 250, 0.16);
  color: #ddd6fe;
}

.exec-warning-box.orange {
  background: rgba(251, 146, 60, 0.16);
  color: #fed7aa;
}

.exec-warning-box.red {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
}

.exec-warning-box.blue-hologram {
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
}

.modal {
  background: rgba(1, 4, 9, 0.78);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: linear-gradient(165deg, rgba(14, 23, 41, 0.96), rgba(7, 12, 22, 0.98));
  border: 1px solid var(--border-color);
  border-radius: 14px;
  width: min(100%, 900px);
  max-width: 620px;
  max-height: min(88vh, 900px);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
}

.modal-content.modal-wide {
  max-width: 900px;
}

.modal-header h2 {
  color: #edf5ff;
}

.close-btn {
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: transparent;
  font-size: 0;
  background: rgba(15, 23, 42, 0.8);
  position: relative;
}

.close-btn::before {
  content: "×";
  color: #d3e2fa;
  font-size: 1.5rem;
  line-height: 1;
}

.close-btn:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.4);
  color: transparent;
}

.close-btn {
  color: #d3e2fa;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.close-btn::before {
  content: none !important;
}

.close-btn:hover {
  color: #ffffff;
}

.meta-line {
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.executor-modal-top {
  display: block;
  margin-bottom: 14px;
}

.executor-modal-info-main {
  display: grid;
  gap: 8px;
}

.executor-modal-info-main p {
  margin: 0;
  color: #dce9ff;
}

.executor-modal-section {
  margin-top: 12px;
}

.executor-modal-section h3 {
  font-size: 0.9rem;
  color: #d9e7ff;
  margin: 0 0 8px;
}

.executor-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-item {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(3, 8, 17, 0.55);
}

.info-item label {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.info-item span {
  color: #dce9ff;
  font-weight: 600;
  word-break: break-word;
}

.executor-modal-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.metric-card {
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: rgba(3, 8, 17, 0.55);
  padding: 10px;
  text-align: center;
}

.metric-card .val {
  display: block;
  color: #f1f6ff;
  font-size: 1.2rem;
  font-weight: 700;
}

.metric-card .lbl {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.executor-modal-act.filter-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

.executor-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.executor-modal-actions .btn.disabled-link {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
}

@media (max-width: 760px) {
  .modal {
    align-items: flex-start;
    padding: 10px;
  }

  .modal-content,
  .modal-content.modal-wide {
    max-width: 100%;
    max-height: calc(100vh - 20px);
    padding: 16px;
    border-radius: 12px;
  }

  .executor-modal-grid {
    grid-template-columns: 1fr;
  }

  .executor-modal-metrics {
    grid-template-columns: 1fr;
  }

  .executor-modal-actions {
    justify-content: stretch;
  }

  .executor-modal-actions .btn {
    flex: 1 1 calc(50% - 5px);
  }
}

@media (max-width: 520px) {
  .executor-modal-actions .btn {
    flex: 1 1 100%;
  }
}

.chat-modal-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.chat-modal-messages {
  min-height: 220px;
  max-height: 320px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 12px;
  background: rgba(3, 8, 17, 0.55);
}

.modal .chat-input-area {
  margin-top: 10px;
  padding: 0;
  background: transparent;
  border-top: none;
}

.modal .chat-input-area textarea {
  border-radius: 10px;
}

.loading-overlay {
  background: rgba(3, 7, 14, 0.65);
}

.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(2, 6, 12, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lock-card {
  width: min(100%, 680px);
  border-radius: 16px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: linear-gradient(165deg, rgba(49, 12, 16, 0.92), rgba(18, 9, 12, 0.96));
  padding: 24px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

.lock-card h2 {
  margin-bottom: 8px;
  color: #fecaca;
}

.lock-card p {
  color: #f7d4d4;
}

.lock-meta {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(248, 113, 113, 0.25);
  background: rgba(69, 10, 10, 0.35);
  display: grid;
  gap: 8px;
}

.lock-note {
  margin-top: 12px;
  color: #fecaca;
  font-size: 0.88rem;
}

.spinner {
  border-top-color: #7dd3fc;
  border-right-color: rgba(125, 211, 252, 0.24);
}

.toast-container {
  z-index: 3200;
}

.toast {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.96), rgba(7, 12, 22, 0.98));
}

.toast-success {
  border-color: rgba(52, 211, 153, 0.45);
}

.toast-error {
  border-color: rgba(248, 113, 113, 0.45);
}

.custom-modal-overlay {
  background: rgba(1, 4, 9, 0.72);
}

.custom-modal {
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: linear-gradient(160deg, rgba(14, 23, 41, 0.97), rgba(8, 13, 24, 0.98));
}

.modal-icon {
  font-size: 2rem;
}

.btn-modal.cancel {
  background: rgba(148, 163, 184, 0.15);
  color: #d8e3f7;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.btn-modal.confirm {
  background: var(--accent-gradient);
  color: #06101b;
}

.chat-wrapper {
  margin-top: 80px;
  height: calc(100vh - 80px);
  border-top: 1px solid var(--border-color);
}

.sidebar {
  background: linear-gradient(170deg, rgba(12, 20, 37, 0.96), rgba(8, 13, 23, 0.98));
  border-right: 1px solid var(--border-color);
}

.sidebar-header {
  border-bottom: 1px solid var(--border-color);
}

.search-bar input {
  background: rgba(3, 8, 17, 0.75);
}

.filters {
  gap: 8px;
}

.filter-btn {
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #d7e5fb;
}

.filter-btn.active {
  background: rgba(56, 189, 248, 0.24);
  border-color: rgba(56, 189, 248, 0.45);
  color: #edfbff;
}

.ticket-item {
  border: 1px solid transparent;
  border-radius: 12px;
}

.ticket-item:hover {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.2);
}

.ticket-item.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.34);
}

.ticket-title {
  color: #eaf3ff;
}

.ticket-preview,
.ticket-meta {
  color: var(--text-secondary);
}

.chat-area {
  background: rgba(3, 7, 14, 0.85);
}

.chat-header {
  background: rgba(8, 14, 26, 0.92);
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(4px);
}

.back-btn {
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.7);
  color: transparent;
  position: relative;
}

.back-btn::before {
  content: "←";
  color: #d8e5fb;
  font-size: 1.25rem;
}

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

.btn-icon {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(148, 163, 184, 0.1);
  color: #d8e4fa;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.btn-icon svg {
  width: 15px;
  height: 15px;
}

.btn-icon span {
  font-size: 0.8rem;
  font-weight: 600;
}

.btn-icon.danger {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.16);
  color: #ffc4c4;
}

.btn-icon.danger:hover {
  background: rgba(248, 113, 113, 0.25);
}

.status-select {
  min-height: 34px;
  border-radius: 8px;
}

.ticket-details {
  border-bottom: 1px solid var(--border-color);
}

.detail-box {
  background: rgba(12, 20, 37, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 10px;
}

.messages-container {
  background: rgba(2, 6, 13, 0.45);
}

.message {
  max-width: 76%;
}

.message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.message-bubble {
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.message.own .message-bubble {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.36);
  color: #eaf9ff;
}

.message.staff:not(.own) .message-bubble {
  background: rgba(52, 211, 153, 0.18);
  border-color: rgba(52, 211, 153, 0.35);
  color: #d1fae5;
}

.staff-badge {
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.38);
  color: #c9f0ff;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.send-btn {
  background: var(--accent-gradient);
  color: #06101b;
  box-shadow: 0 8px 18px rgba(56, 189, 248, 0.3);
}

.send-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.ticket-type-grid {
  gap: 10px;
}

.type-card {
  background: rgba(12, 20, 37, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  color: var(--text-primary);
}

.type-card .icon {
  font-size: 1.7rem;
}

.type-card p {
  color: var(--text-secondary);
}

.empty-state,
.chat-empty {
  color: var(--text-secondary);
}

@media (max-width: 980px) {

  .filter-row,
  .filter-row.filter-row-3 {
    grid-template-columns: 1fr;
  }

  .form-actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .exec-filter-group {
    align-items: stretch;
  }

  .chat-wrapper {
    margin-top: 76px;
    height: calc(100vh - 76px);
  }
}

@media (max-width: 700px) {
  .navbar-content {
    gap: 12px;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  .sidebar {
    width: 100%;
    max-width: none;
  }

  .header-actions #staffControls {
    width: 100%;
    justify-content: flex-end;
  }

  .btn-icon span {
    display: none;
  }
}

/* ===================================
   CHAT PAGE SCOPED FIXES
   =================================== */

body.chat-page {
  overflow: hidden;
}

body.chat-page .container {
  max-width: 100%;
  padding: 0 18px;
}

body.chat-page .navbar {
  height: 80px;
}

body.chat-page .navbar-content {
  height: 80px;
}

body.chat-page .brand {
  font-size: 2rem;
}

body.chat-page .chat-wrapper {
  margin-top: 80px;
  height: calc(100vh - 80px);
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

body.chat-page .sidebar {
  width: 100%;
  min-width: 0;
  border-right: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(170deg, rgba(11, 19, 34, 0.98), rgba(7, 12, 22, 0.98));
}

body.chat-page .sidebar-header {
  padding: 16px;
  gap: 10px;
}

body.chat-page .sidebar-header h2 {
  font-size: 2rem;
  line-height: 1.1;
}

body.chat-page .ticket-scope-tabs {
  display: flex;
  gap: 8px;
  padding: 0 16px 10px;
}

body.chat-page .scope-tab {
  flex: 1;
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.75);
  color: #dce8fb;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

body.chat-page .scope-tab:hover {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.35);
}

body.chat-page .scope-tab.active {
  background: rgba(56, 189, 248, 0.22);
  border-color: rgba(56, 189, 248, 0.5);
  color: #f0f9ff;
}

body.chat-page .ticket-scope-hint {
  padding: 0 16px 10px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

body.chat-page .btn-sm {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  font-size: 0.88rem;
}

body.chat-page .search-bar {
  padding: 12px 16px;
}

body.chat-page .search-bar input {
  min-height: 40px;
  border-radius: 10px;
  font-size: 0.92rem;
}

body.chat-page .filters {
  padding: 0 16px 12px;
  gap: 8px;
}

body.chat-page .filter-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 0.82rem;
}

body.chat-page .ticket-list {
  padding: 0 10px 14px;
}

body.chat-page .ticket-item {
  padding: 14px 12px;
  border-radius: 12px;
}

body.chat-page .ticket-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

body.chat-page .ticket-title {
  font-size: 1.05rem;
  line-height: 1.35;
}

body.chat-page .ticket-preview {
  margin: 7px 0;
  line-height: 1.4;
}

body.chat-page .ticket-kind {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

body.chat-page .ticket-kind-suggestion {
  background: rgba(56, 189, 248, 0.16);
  color: #bae6fd;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

body.chat-page .ticket-kind-bug {
  background: rgba(248, 113, 113, 0.16);
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

body.chat-page .ticket-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
}

body.chat-page .chat-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(7, 12, 22, 0.94), rgba(4, 8, 16, 0.96));
}

body.chat-page .chat-header {
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

body.chat-page .header-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

body.chat-page .header-info h2 {
  font-size: 2rem;
  margin-bottom: 6px;
  line-height: 1.2;
}

body.chat-page .meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

body.chat-page .date {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

body.chat-page .back-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(15, 23, 42, 0.6);
  color: #dbe7fb !important;
  font-size: 1rem;
  line-height: 1;
}

body.chat-page .back-btn::before {
  content: none;
}

body.chat-page .header-actions {
  min-width: 260px;
}

body.chat-page #staffControls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

body.chat-page #staffControls.hidden {
  display: none !important;
}

body.chat-page .status-select {
  min-height: 36px;
  min-width: 150px;
  border-radius: 10px;
  font-size: 0.86rem;
}

body.chat-page .btn-icon {
  min-height: 36px;
  border-radius: 10px;
}

body.chat-page .btn-icon span {
  display: inline;
}

body.chat-page .ticket-details {
  padding: 14px 18px 10px;
  display: grid;
  gap: 8px;
}

body.chat-page .detail-box {
  padding: 10px 12px;
}

body.chat-page .detail-box h4 {
  margin-bottom: 4px;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.chat-page .detail-box p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.45;
}

body.chat-page .messages-container {
  flex: 1;
  min-height: 0;
  padding: 16px 18px;
  overflow-y: auto;
}

body.chat-page .message {
  margin-bottom: 12px;
}

body.chat-page .message-header {
  margin-bottom: 5px;
}

body.chat-page .message-bubble {
  border-radius: 12px;
  padding: 10px 12px;
}

body.chat-page .chat-input-area {
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  padding: 12px 16px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

body.chat-page .chat-input-area textarea {
  min-height: 44px;
  max-height: 120px;
  border-radius: 10px;
  padding: 10px 12px;
  line-height: 1.35;
}

body.chat-page .send-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 12px;
}

body.chat-page .send-btn svg {
  width: 17px;
  height: 17px;
  margin-left: 0;
}

body.chat-page .status-badge {
  font-size: 0.72rem;
  line-height: 1;
}

body.chat-page .status-badge.pending,
body.chat-page .status-badge.status-pending {
  background: rgba(250, 204, 21, 0.18);
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.4);
}

body.chat-page .status-badge.in-progress,
body.chat-page .status-badge.status-in-progress {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
  border-color: rgba(96, 165, 250, 0.4);
}

body.chat-page .status-badge.resolved,
body.chat-page .status-badge.status-resolved {
  background: rgba(52, 211, 153, 0.18);
  color: #bbf7d0;
  border-color: rgba(52, 211, 153, 0.4);
}

body.chat-page .status-badge.closed,
body.chat-page .status-badge.status-closed,
body.chat-page .status-badge.rejected,
body.chat-page .status-badge.status-rejected {
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.4);
}

@media (max-width: 1100px) {
  body.chat-page .chat-wrapper {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  body.chat-page .header-actions {
    min-width: 210px;
  }
}

@media (max-width: 860px) {
  body.chat-page {
    overflow-y: auto;
  }

  body.chat-page .chat-wrapper {
    grid-template-columns: 1fr;
    height: auto;
    min-height: calc(100vh - 80px);
  }

  body.chat-page .sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  }

  body.chat-page .chat-area {
    min-height: 62vh;
  }

  body.chat-page .chat-header {
    flex-direction: column;
    align-items: stretch;
  }

  body.chat-page .header-actions {
    min-width: 0;
  }

  body.chat-page #staffControls {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  body.chat-page.chat-mobile-detail .sidebar {
    display: none;
  }

  body.chat-page.chat-mobile-detail .chat-area {
    min-height: calc(100vh - 80px);
  }

  body.chat-page .header-info {
    min-width: 0;
  }

  body.chat-page .header-info h2 {
    font-size: 1.25rem;
    word-break: break-word;
  }

  body.chat-page .header-actions {
    width: 100%;
  }

  body.chat-page #staffControls {
    width: 100%;
  }

  body.chat-page .status-select {
    min-width: 0;
    flex: 1 1 170px;
  }

  body.chat-page .messages-container {
    padding: 12px;
  }

  body.chat-page .chat-input-area {
    position: sticky;
    bottom: 0;
    background: rgba(5, 10, 18, 0.96);
    backdrop-filter: blur(6px);
  }
}

@media (max-width: 620px) {
  body.chat-page .navbar {
    height: auto;
  }

  body.chat-page .navbar-content {
    min-height: 72px;
    gap: 8px;
    padding: 10px 0;
    flex-wrap: wrap;
  }

  body.chat-page .brand {
    font-size: 1.55rem;
  }

  body.chat-page .nav-actions {
    width: 100%;
    justify-content: flex-end;
  }

  body.chat-page .chat-wrapper {
    margin-top: 96px;
    min-height: calc(100vh - 96px);
  }

  body.chat-page .sidebar-header h2 {
    font-size: 1.4rem;
  }

  body.chat-page .ticket-scope-tabs {
    padding: 0 12px 10px;
  }

  body.chat-page .ticket-scope-hint {
    padding: 0 12px 8px;
  }

  body.chat-page .ticket-title {
    font-size: 0.95rem;
    max-width: none;
  }

  body.chat-page .chat-header {
    padding: 12px;
  }

  body.chat-page .ticket-details {
    padding: 10px 12px 8px;
  }

  body.chat-page .chat-input-area {
    padding: 10px 12px;
    gap: 8px;
  }

  body.chat-page .send-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
  }
}

@media (max-width: 460px) {
  body.chat-page .filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: thin;
  }

  body.chat-page .filter-btn {
    white-space: nowrap;
  }

  body.chat-page .ticket-scope-tabs {
    overflow-x: auto;
    scrollbar-width: thin;
  }

  body.chat-page .scope-tab {
    flex: 0 0 auto;
    min-width: 120px;
    white-space: nowrap;
  }

  body.chat-page .btn-sm {
    min-height: 34px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  body.chat-page .chat-wrapper {
    margin-top: 104px;
    min-height: calc(100vh - 104px);
  }
}

/* =========================================
   Chat / DM Page Specific Styles
   ========================================= */

/* Layout & Grid */
body.chat-dm-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-dm-page .navbar {
  position: sticky;
  top: 0;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.95);
  flex-shrink: 0;
}

.dm-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  gap: 1px;
  /* border separator */
}


/* Sidebar */
.dm-sidebar {
  width: 380px;
  min-width: 320px;
  background: rgba(30, 41, 59, 0.3);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Compact sidebar header */
.dm-sidebar-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.dm-user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dm-user-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.dm-user-role {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-primary);
}

.dm-user-uid {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: 'Consolas', monospace;
}

/* Sidebar tab bar */
.dm-sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.dm-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.dm-tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.dm-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

/* Tab panels */
.dm-tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 20px;
  gap: 16px;
}

.dm-tab-panel.active {
  display: flex;
}

/* Panel toolbar (search + refresh) */
.dm-panel-toolbar {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.dm-panel-toolbar .form-input {
  flex: 1;
}

/* Section within a panel */
.dm-panel-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dm-panel-section+.dm-panel-section {
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.dm-panel-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}


/* Cards in Sidebar */
.dm-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dm-card-grow {
  flex-grow: 1;
  min-height: 0;
  /* allows scrolling inside flex item */
}


.dm-section-title {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dm-row-header .dm-section-title {
  margin-bottom: 0;
}

.dm-muted {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Profile Meta */
.dm-profile-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.dm-profile-meta div {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.dm-meta-label {
  color: var(--text-muted);
}

.dm-meta-value {
  color: var(--text-primary);
  font-weight: 500;
  font-family: 'Consolas', monospace;
}

/* Forms in Sidebar */
.dm-profile-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dm-profile-form label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dm-profile-form .form-input,
.dm-profile-form .form-textarea {
  font-size: 0.9rem;
  padding: 8px 12px;
}

/* Inputs & Buttons */
.dm-input-row {
  display: flex;
  gap: 8px;
}

.dm-button-row {
  display: flex;
  gap: 8px;
}

.dm-button-row .btn {
  flex: 1;
  font-size: 0.85rem;
  padding: 8px;
}

/* Lists (Staff / Friends / Conversations) */
.dm-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 12px;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
  height: 28px;
}

.dm-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
  /* space for scrollbar */
}

.dm-conversation-list {
  flex-grow: 1;
}

/* List Items */
.dm-user-item,
.dm-conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.dm-user-item:hover,
.dm-conversation-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

.dm-conversation-item.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-primary);
}

.dm-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.dm-info {
  flex-grow: 1;
  min-width: 0;
  /* for ellipsis */
}

.dm-name {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-subtext {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.dm-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-tertiary);
}

.dm-status-indicator.online {
  background: var(--success);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.4);
}

.dm-presence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.dm-presence-badge.online {
  color: #86efac;
  background: rgba(22, 101, 52, 0.24);
  border-color: rgba(34, 197, 94, 0.35);
}

.dm-presence-badge.offline {
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(148, 163, 184, 0.25);
}

.dm-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.dm-presence-inline {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.dm-presence-inline.online {
  color: #86efac;
}

.dm-presence-inline.offline {
  color: #94a3b8;
}

.dm-avatar-presence {
  position: relative;
}

.dm-avatar-presence::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.95);
}

.dm-avatar-presence.online::after {
  background: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.dm-avatar-presence.offline::after {
  background: #64748b;
}

.dm-unread-badge {
  background: var(--accent-primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
}

/* Role Badges in List */
.role-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
  vertical-align: middle;
}

.role-badge.staff {
  background: rgba(56, 189, 248, 0.2);
  color: var(--accent-primary);
}

.role-badge.admin {
  background: rgba(248, 113, 113, 0.2);
  color: var(--danger);
}

.role-badge.owner {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warning);
}


/* Main Chat Area */
.dm-main {
  flex-grow: 1;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Empty State */
.dm-empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-muted);
}

.dm-empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* Chat Panel */
.dm-chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.dm-chat-header {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  background: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(10px);
}

.dm-chat-header h3 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

/* Message List */
.dm-message-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}


.message-item {
  display: flex;
  gap: 12px;
  max-width: 80%;
  align-items: flex-end;
  /* Align avatar to bottom of message group */
}

.message-item.own {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-item.system {
  align-self: center;
  max-width: 90%;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-align: center;
}

.msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-bottom: 4px;
  /* Align slightly above bottom edge */
}

.msg-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  /* Prevent flex overflow */
}

.message-item.own .msg-col {
  align-items: flex-end;
}

.msg-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding: 0 4px;
}

.message-item.own .msg-header {
  flex-direction: row-reverse;
}

.msg-bubble {
  background: rgba(15, 23, 42, 0.9);
  padding: 10px 14px;
  border-radius: 12px;
  border-bottom-left-radius: 2px;
  /* Standard left-side message shape */
  position: relative;
  border: 1px solid rgba(148, 163, 184, 0.24);
  width: fit-content;
  max-width: 100%;
  color: #e2e8f0;
}

.message-item.own .msg-bubble {
  background: linear-gradient(140deg, #1e293b 0%, #334155 100%);
  color: #f8fafc;
  border: 1px solid rgba(125, 168, 214, 0.35);
  border-radius: 12px;
  border-bottom-right-radius: 2px;
  /* Standard right-side message shape */
  border-bottom-left-radius: 12px;
  /* Reset left side */
}

.msg-content {
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-image-wrap {
  margin-bottom: 8px;
}

.msg-image {
  max-width: min(320px, 56vw);
  max-height: 320px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

/* Message Form */
.dm-message-form {
  padding: 20px;
  background: rgba(30, 41, 59, 0.5);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.dm-message-form textarea {
  resize: none;
  min-height: 48px;
  max-height: 120px;
  border-radius: 12px;
}

.dm-composer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dm-composer-actions {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.dm-composer-actions .btn {
  height: 48px;
  padding: 0 18px;
}

.dm-composer-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding-left: 4px;
}

.dm-attachment-preview {
  padding-top: 2px;
}

.dm-image-preview-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
}

.dm-image-preview {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.dm-image-preview-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.dm-image-preview-name {
  font-size: 0.78rem;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.dm-image-preview-size {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dm-image-remove-btn {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.65);
  color: #e2e8f0;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.dm-image-remove-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

@media (max-width: 900px) {
  .message-item {
    max-width: 92%;
  }

  .msg-image {
    max-width: min(250px, 70vw);
  }

  .dm-message-form {
    flex-direction: column;
    align-items: stretch;
  }

  .dm-composer-actions {
    justify-content: flex-end;
  }

  .dm-composer-actions .btn {
    height: 42px;
  }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Lock Overlay */
.lock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 10000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.lock-card {
  background: #1e1e1e;
  border: 1px solid var(--danger);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 500px;
  animation: shake 0.5s ease-in-out;
}

.lock-card h2 {
  color: var(--danger);
  margin-bottom: 16px;
}

.lock-meta {
  background: rgba(255, 255, 255, 0.05);
  padding: 16px;
  border-radius: 8px;
  margin: 20px 0;
  text-align: left;
}

.lock-meta div {
  margin-bottom: 8px;
  font-family: monospace;
}

.lock-note {
  font-size: 0.9rem;
  color: var(--text-muted);
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 5000;
}

.toast {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 16px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: slideIn 0.3s ease;
}

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

.toast-title {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  word-break: break-word;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition-fast);
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--text-primary);
}

/* Toast type variants */
.toast-success {
  border-left: 3px solid var(--success);
}

.toast-success .toast-title {
  color: var(--success);
}

.toast-error {
  border-left: 3px solid var(--danger);
}

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

.toast-warning {
  border-left: 3px solid var(--warning);
}

.toast-warning .toast-title {
  color: var(--warning);
}

.toast-info {
  border-left: 3px solid var(--info);
}

.toast-info .toast-title {
  color: var(--info);
}

/* Toast exit animation */
.toast.hiding {
  animation: slideOut 0.3s ease forwards;
}

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

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

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

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

/* Search Input in Sidebar */
.dm-search-input {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 8px;
}

/* Empty List Placeholder */
.dm-list-empty {
  padding: 10px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* Action buttons within list items */
.dm-list-action,
.dm-friend-chat {
  flex-shrink: 0;
  font-size: 0.8rem;
  padding: 5px 12px;
}

/* =========================================
   Tickets Page Specific Styles
   ========================================= */

/* Ticket Type Toggle Tabs */
.ticket-type-tabs {
  display: flex;
  gap: 8px;
}

.ticket-type-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: inherit;
}

.ticket-type-tab:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.ticket-type-tab.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.ticket-page .dm-main,
.ticket-page .dm-chat-panel,
.ticket-page .dm-message-list {
  min-height: 0;
}

.ticket-page #ticketMessages {
  overflow-x: hidden;
}

.ticket-page .ticket-chat-empty {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
}

.ticket-page .ticket-chat-empty h3 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.ticket-page .ticket-chat-empty p {
  margin: 0;
}

/* Ticket Detail Box */
.ticket-detail-box {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(30, 41, 59, 0.3);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-page #ticketDetailBox {
  max-height: 34vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.ticket-detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  gap: 12px;
  align-items: flex-start;
}

.ticket-page .ticket-detail-row .dm-meta-label {
  flex-shrink: 0;
}

.ticket-page .ticket-detail-row .dm-meta-value {
  min-width: 0;
  max-width: 70%;
  text-align: right;
  word-break: break-word;
}

.ticket-detail-desc {
  margin-top: 4px;
}

.ticket-detail-desc .dm-meta-label {
  display: block;
  margin-bottom: 4px;
}

.ticket-detail-desc p {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  border-radius: 8px;
}

.ticket-page #ticketDescription {
  max-height: 140px;
  overflow-y: auto;
}

.ticket-page #ticketTitle,
.ticket-page #ticketSubtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
}

.status-badge.pending {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.status-badge.approved,
.status-badge.fixed {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.status-badge.rejected,
.status-badge.closed {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.status-badge.under-review,
.status-badge.in-progress,
.status-badge.open {
  background: rgba(96, 165, 250, 0.15);
  color: var(--info);
}


/* Responsive Chat */
@media (max-width: 768px) {
  .dm-layout {
    flex-direction: column;
  }

  .dm-sidebar {
    width: 100%;
    height: auto;
    max-height: 40vh;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .dm-main {
    height: 60vh;
  }

  .dm-card {
    padding: 12px;
  }

  /* Hide less important sidebar elements on mobile if needed */
  /* .dm-profile-meta { display: none; } */

  .ticket-page #ticketDetailBox {
    max-height: 28vh;
  }

  .ticket-page #ticketDescription {
    max-height: 100px;
  }
}

/* Dedicated Profile Page */
.profile-page-container {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.profile-card {
  background: var(--surface-color);
  width: 100%;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  backdrop-filter: blur(20px);
}

.profile-header-large {
  display: flex;
  align-items: center;
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border-color);
}

.profile-avatar-large-wrapper {
  position: relative;
  cursor: pointer;
}

.profile-avatar-large {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--surface-light);
  border: 4px solid var(--surface-color);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.profile-avatar-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#largeAvatarInitials {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.avatar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  color: white;
}

.profile-avatar-large-wrapper:hover .avatar-overlay {
  opacity: 1;
}

.profile-info-large {
  flex: 1;
}

.profile-info-large h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.uid-badge {
  font-family: monospace;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.profile-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

.password-section {
  background: rgba(30, 41, 59, 0.3);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.password-section h3 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.form-grid-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

@media (max-width: 768px) {
  .profile-header-large {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

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

  .profile-card {
    padding: 24px;
  }
}

.profile-avatar-btn.has-custom-avatar,
.profile-dropdown-avatar.has-custom-avatar {
  background-size: cover;
  background-position: center;
  color: transparent !important;
}

/* DM Layout Core (Sidebar + Content) */
.dm-layout {
  display: flex;
  height: 100vh;
  padding-top: 80px;
  /* Navbar height compensation */
  overflow: hidden;
}

.dm-sidebar {
  width: 300px;
  background: rgba(11, 15, 25, 0.6);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.dm-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.dm-conversations-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dm-user-bar {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.dm-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* Sidebar Components */
.user-mini-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar-small {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: var(--text-primary);
  background-size: cover;
  background-position: center;
}

.user-info-small {
  display: flex;
  flex-direction: column;
}

.user-name-small {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
}

.user-role-small {
  font-size: 0.75rem;
  color: var(--accent-primary);
}

.sidebar-section-title {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 12px 8px 6px 8px;
  font-weight: 600;
}

.dm-conversation-item {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.dm-conversation-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dm-conversation-item.active {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid var(--accent-primary);
}

.dm-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.dm-conversation-item.active .dm-avatar-placeholder {
  background: var(--accent-primary);
  color: white;
}

.dm-conversation-info {
  flex: 1;
}

.dm-conversation-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.dm-conversation-preview {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Profile Layout Refactor (Sidebar) */
.profile-content-area {
  padding: 2rem;
  overflow-y: auto;
  background: radial-gradient(circle at 50% 10%, rgba(20, 20, 30, 0.4) 0%, transparent 70%);
}

.profile-tab-content {
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

.profile-header-centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  text-align: center;
}

.profile-badges.centered {
  justify-content: center;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.overview-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.overview-item label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.overview-value {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-all;
}

.bio-box {
  white-space: pre-wrap;
  min-height: 80px;
  font-size: 1rem;
  line-height: 1.5;
}

.profile-card.no-shadow {
  box-shadow: none !important;
  background: transparent !important;
  border: none !important;
  padding: 0;
}

@media (max-width: 768px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }
}

.profile-dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.profile-avatar-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-primary));
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.profile-avatar-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.3);
}

.profile-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  width: 280px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-dropdown-wrapper:hover .profile-dropdown,
.profile-dropdown-wrapper.active .profile-dropdown {
  display: flex;
}

.profile-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.profile-dropdown-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-light);
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.profile-dropdown-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.profile-dropdown-role {
  font-size: 0.75rem;
  color: var(--accent-primary);
  font-weight: 500;
  text-transform: uppercase;
}

.profile-dropdown-uid {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 10px;
  border-radius: 6px;
}

.profile-dropdown-actions {
  display: flex;
  gap: 8px;
}

.profile-dropdown-actions .btn {
  flex: 1;
  font-size: 0.8rem;
}

/* Profile Modal */
.profile-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.profile-modal-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.profile-modal {
  background: var(--surface-color);
  width: 100%;
  max-width: 500px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-modal-overlay:not(.hidden) .profile-modal {
  transform: translateY(0);
}

.profile-modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: inherit;
  z-index: 10;
}

.profile-modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.profile-modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.profile-modal-close:hover {
  color: var(--text-primary);
}

.profile-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.profile-modal-avatar-row {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.profile-modal-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-primary));
  color: white;
  font-size: 2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

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

.profile-field-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.profile-password-section {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-password-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.profile-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

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

/* Profile Avatar Button */
.profile-avatar-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 0;
  overflow: hidden;
  position: relative;
}

.profile-avatar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
}

#profileAvatarInitials {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  border-radius: 50%;
  color: var(--text-primary);
  /* Ensure image covers the full span */
}

/* Chat List Item Refactor (Stacked) */
.dm-name-text {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  /* Removed nowrap to allow wrapping */
}

.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.role-badge.owner {
  background: rgba(234, 179, 8, 0.15);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.role-badge.admin {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.role-badge.developer {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.role-badge.staff {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  /* var(--bg-primary) with opacity */
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
  border: 2px solid rgba(15, 23, 42, 0.5);
  /* Creates padding effect */
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Firefox Scrollbar Support */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) rgba(15, 23, 42, 0.5);
}

/* Responsive Design & Mobile Support */
@media (max-width: 768px) {

  /* Navbar */
  .navbar-content {
    height: 60px;
    padding: 0 16px;
  }

  .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 16px;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
  }

  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 12px 16px;
    font-size: 1rem;
  }

  /* Hamburger Menu Button */
  .mobile-menu-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: -8px;
  }

  .mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background: white;
    transition: 0.3s;
  }

  .mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  /* Chat & Ticket Layout (Mobile) */
  .dm-layout {
    flex-direction: column;
    height: calc(100vh - 60px);
  }

  .dm-sidebar {
    width: 100%;
    height: 100%;
    position: absolute;
    z-index: 20;
    background: var(--bg-primary);
    transform: translateX(0);
    transition: transform 0.3s ease;
  }

  .dm-sidebar.hidden-mobile {
    transform: translateX(-100%);
  }

  .dm-main {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 10;
  }

  /* Mobile sidebar toggle button inside chat */
  .mobile-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    margin-right: 12px;
  }
}

@media (min-width: 769px) {

  .mobile-menu-btn,
  .mobile-sidebar-toggle {
    display: none;
  }

  .dm-sidebar {
    transform: none !important;
    /* Always show on desktop */
    width: 320px;
    position: relative;
  }
}

/* --- Admin Page Fine-Tuning --- */

/* Center content in the moderation form card */
#adminModerationPanel .form-card {
  text-align: center;
}

/* Center the 'Apply Moderation Action' button */
#adminModerationPanel .form-card .btn-danger {
  margin: 20px auto 0;
  display: block;
  width: fit-content;
  min-width: 200px;
}

/* Ensure empty state messages span the full grid width and are centered */
.tools-grid .empty-state,
#moderationList .empty-state,
#adminsList .empty-state,
#bugsList .empty-state,
#suggestionsList .empty-state {
  grid-column: 1 / -1;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  width: 100%;
}

/* =========================================
   Ticket Page Cross-Device Scrolling Fixes
   ========================================= */
.ticket-page .dm-layout {
  min-height: 0;
  height: calc(100vh - 80px - var(--safe-top));
  height: calc(100dvh - 80px - var(--safe-top));
}

.ticket-page .dm-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ticket-page .dm-card-grow {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ticket-page #ticketList {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
}

.ticket-page #ticketMessages,
.ticket-page #ticketDetailBox {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

@media (max-width: 768px) {
  .ticket-page .dm-layout {
    position: relative;
    height: calc(100vh - 60px - var(--safe-top));
    height: calc(100dvh - 60px - var(--safe-top));
    min-height: 0;
  }

  .ticket-page .dm-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(88vw, 360px);
    max-width: 88vw;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 30;
    border-right: 1px solid var(--border-color);
    border-bottom: none;
    background: rgba(15, 23, 42, 0.98);
    box-shadow: 16px 0 40px rgba(0, 0, 0, 0.35);
    padding-bottom: max(8px, var(--safe-bottom));
  }

  .ticket-page .dm-sidebar.hidden-mobile {
    transform: translateX(-105%);
  }

  .ticket-page .dm-main {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  .ticket-page .mobile-sidebar-toggle {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 25;
  }

  .ticket-page .dm-card {
    padding: 14px;
  }

  .ticket-page .ticket-type-tabs {
    flex-wrap: wrap;
  }

  .ticket-page .ticket-type-tab {
    min-width: 130px;
  }
}

@media (min-width: 769px) {
  .ticket-page .dm-sidebar.hidden-mobile {
    transform: none !important;
  }
}

/* =========================================
   Global Cross-Device UI Compatibility Layer
   ========================================= */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  overflow-x: hidden;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

input,
select,
textarea,
button {
  font: inherit;
}

body.mobile-menu-open {
  overflow: hidden;
}

.profile-mobile-toolbar {
  display: none;
}

@media (hover: none) and (pointer: coarse) {

  .btn,
  .nav-link,
  .ticket-type-tab,
  .dm-tab,
  .status-btn,
  .chat-send-btn,
  .send-btn,
  .mobile-menu-btn,
  .mobile-sidebar-toggle {
    min-height: 44px;
  }
}

@media (max-width: 1200px) {
  .container {
    padding: 0 16px;
  }

  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
  }
}

@media (max-width: 992px) {
  .main-content {
    padding-top: calc(112px + var(--safe-top));
    padding-bottom: calc(24px + var(--safe-bottom));
  }

  .section-header,
  .centered-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 30px;
  }

  .filter-row,
  .filter-row.filter-row-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 12px;
  }

  .main-content {
    padding-top: calc(86px + var(--safe-top));
    padding-bottom: calc(20px + var(--safe-bottom));
  }

  .navbar {
    height: calc(60px + var(--safe-top));
  }

  .navbar .brand {
    font-size: 1.2rem;
  }

  .navbar .brand svg {
    width: 26px;
    height: 26px;
  }

  .nav-actions {
    gap: 8px;
    flex-wrap: wrap;
  }

  .btn {
    padding: 10px 12px;
    font-size: 0.88rem;
  }

  .stats-grid,
  .compact-grid,
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tool-card,
  .form-card,
  .profile-card {
    padding: 16px;
    border-radius: 14px;
  }

  .profile-mobile-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
  }

  .profile-content-area {
    padding: 14px 12px;
  }

  .profile-tab-content {
    max-width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal {
    align-items: flex-start;
    padding: calc(10px + var(--safe-top)) max(10px, var(--safe-right)) max(10px, var(--safe-bottom)) max(10px, var(--safe-left));
  }

  .modal-content,
  .modal-content.modal-wide {
    width: 100%;
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 20px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
  }

  body.chat-page .chat-wrapper,
  body.chat-dm-page .dm-layout {
    min-height: 0;
    height: calc(100vh - 60px - var(--safe-top));
    height: calc(100dvh - 60px - var(--safe-top));
  }

  body.chat-page .sidebar,
  body.chat-page .chat-area,
  body.chat-dm-page .dm-sidebar,
  body.chat-dm-page .dm-main {
    min-height: 0;
  }

  body.chat-page .ticket-list,
  body.chat-page .messages-container,
  body.chat-dm-page .dm-sidebar,
  body.chat-dm-page .dm-tab-panel,
  body.chat-dm-page .dm-list,
  body.chat-dm-page .dm-conversation-list,
  body.chat-dm-page #ticketList,
  body.chat-dm-page .dm-message-list {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  body.chat-dm-page .dm-message-form {
    padding: 10px;
    gap: 8px;
    padding-bottom: max(10px, var(--safe-bottom));
  }

  body.chat-dm-page .dm-message-form textarea,
  body.chat-page .chat-input-area textarea,
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px;
  }
}

@media (max-width: 576px) {
  .header-title h1 {
    font-size: 1.55rem;
    line-height: 1.2;
  }

  .header-title p {
    font-size: 0.95rem;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .dm-avatar,
  .msg-avatar {
    width: 34px;
    height: 34px;
    font-size: 0.95rem;
  }

  .dm-name {
    font-size: 0.9rem;
  }

  .dm-subtext {
    font-size: 0.76rem;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  .navbar {
    height: calc(58px + var(--safe-top));
  }

  .main-content {
    padding-top: calc(72px + var(--safe-top));
  }

  body.chat-page .chat-wrapper,
  body.chat-dm-page .dm-layout {
    height: calc(100dvh - 58px - var(--safe-top));
  }

  .modal-content,
  .modal-content.modal-wide {
    max-height: calc(100dvh - 12px);
  }
}

/* =========================================
   Mobile UI Rewrite
   ========================================= */
.dm-sidebar-backdrop,
.mobile-sidebar-header {
  display: none;
}

.mobile-sidebar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mobile-sidebar-close {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-sidebar-toggle-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

@media (max-width: 900px) {
  body:not(.chat-dm-page) .navbar {
    height: auto !important;
    min-height: calc(112px + var(--safe-top));
  }

  body:not(.chat-dm-page) .navbar .container {
    padding: 0 10px;
  }

  body:not(.chat-dm-page) .navbar-content {
    height: auto !important;
    padding: 8px 0 10px;
    align-items: flex-start;
    gap: 8px;
  }

  body:not(.chat-dm-page) .nav-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
  }

  body:not(.chat-dm-page) .nav-actions::-webkit-scrollbar {
    display: none;
  }

  body:not(.chat-dm-page) .nav-actions .btn {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.84rem;
  }

  body:not(.chat-dm-page) .main-content {
    padding-top: calc(132px + var(--safe-top)) !important;
  }

  body:not(.chat-dm-page) .hero h1 {
    font-size: 2.1rem !important;
    line-height: 1.12;
  }

  body:not(.chat-dm-page) .hero p {
    font-size: 0.98rem !important;
    line-height: 1.45;
  }

  body:not(.chat-dm-page) .hero-actions {
    flex-wrap: wrap;
    gap: 10px;
  }

  body.chat-dm-page .navbar {
    height: auto !important;
    min-height: calc(112px + var(--safe-top));
  }

  body.chat-dm-page .navbar .container {
    padding: 0 10px;
  }

  body.chat-dm-page .navbar-content {
    height: auto !important;
    padding: 8px 0 10px;
    align-items: flex-start;
    gap: 8px;
    flex-direction: column;
  }

  body.chat-dm-page .brand {
    font-size: 1.05rem;
    gap: 10px;
    line-height: 1.15;
  }

  body.chat-dm-page .brand svg {
    width: 24px;
    height: 24px;
  }

  body.chat-dm-page .nav-actions {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  body.chat-dm-page .nav-actions::-webkit-scrollbar {
    display: none;
  }

  body.chat-dm-page .nav-actions .btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 14px;
    font-size: 0.85rem;
  }

  body.chat-dm-page .profile-dropdown-wrapper {
    margin-left: auto;
    flex: 0 0 auto;
  }

  body.chat-dm-page .dm-layout {
    position: relative !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    gap: 0 !important;
    padding-top: 0 !important;
    height: calc(100dvh - 112px - var(--safe-top));
    min-height: 0;
    overflow: hidden;
  }

  body.chat-dm-page .dm-main {
    position: relative;
    z-index: 10;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
  }

  body.chat-dm-page .dm-sidebar-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 65;
    background: rgba(2, 6, 23, 0.58);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  body.chat-dm-page.sidebar-open .dm-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.chat-dm-page .dm-sidebar {
    position: absolute !important;
    inset: 0;
    z-index: 70;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100%;
    border: 0 !important;
    background: linear-gradient(180deg, rgba(12, 18, 34, 0.98), rgba(4, 8, 20, 0.98));
    backdrop-filter: blur(14px);
    padding: 10px;
    overflow-y: auto;
    transform: translateX(-102%);
    transition: transform 0.24s ease;
  }

  body.chat-dm-page.sidebar-open .dm-sidebar {
    transform: translateX(0);
  }

  body.chat-dm-page .dm-sidebar.hidden-mobile {
    transform: translateX(-102%);
  }

  body.chat-dm-page .mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 2px 4px;
  }

  body.chat-dm-page .mobile-sidebar-toggle {
    position: static !important;
    left: auto !important;
    top: auto !important;
    margin: 0 !important;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(30, 41, 59, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.28);
    color: var(--text-primary);
    width: auto;
    flex-shrink: 0;
  }

  body.chat-dm-page .dm-empty-state {
    width: min(94vw, 430px);
    padding: 20px 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.66);
    box-shadow: 0 16px 42px rgba(2, 6, 23, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
  }

  body.chat-dm-page .dm-empty-state h3 {
    font-size: 1.32rem;
    line-height: 1.2;
    margin: 0;
  }

  body.chat-dm-page .dm-empty-state p {
    font-size: 0.92rem;
    line-height: 1.46;
    margin: 0;
  }

  body.chat-dm-page .dm-chat-header {
    height: auto;
    min-height: 66px;
    padding: 10px 12px;
    gap: 10px;
    align-items: center;
  }

  body.chat-dm-page .dm-chat-header h3 {
    font-size: 1rem;
    margin-bottom: 2px;
  }

  body.chat-dm-page .dm-chat-header .dm-muted {
    font-size: 0.78rem;
    line-height: 1.35;
  }

  body.chat-dm-page .dm-message-list {
    padding: 14px 12px 18px;
    gap: 12px;
  }

  body.chat-dm-page .msg-bubble {
    max-width: 100%;
  }

  body.chat-dm-page .dm-message-form {
    padding: 10px !important;
    gap: 8px;
    padding-bottom: max(10px, var(--safe-bottom));
  }

  body.chat-dm-page .dm-composer-actions {
    justify-content: flex-end;
  }

  body.chat-dm-page .dm-composer-actions .btn {
    height: 42px;
    padding: 0 14px;
  }

  body.chat-dm-page .dm-sidebar>.dm-card {
    padding: 14px;
    border-radius: 14px;
    gap: 10px;
  }

  body.chat-dm-page .dm-sidebar .dm-list,
  body.chat-dm-page .dm-sidebar .dm-conversations-list,
  body.chat-dm-page .dm-sidebar .dm-tab-panel,
  body.chat-dm-page .dm-sidebar #ticketList {
    min-height: 0;
    max-height: none;
  }

  body.chat-dm-page .dm-card-grow {
    flex: 1 1 auto;
    min-height: min(56vh, 460px);
  }

  .ticket-page .dm-sidebar>.dm-card:first-of-type {
    display: none;
  }

  .ticket-page .ticket-type-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .ticket-page .ticket-type-tab {
    min-width: 0;
    justify-content: center;
    padding: 10px 8px;
  }

  .ticket-page .ticket-detail-box {
    padding: 14px 12px;
  }

  .ticket-page .ticket-detail-row {
    flex-direction: column;
    gap: 4px;
  }

  .ticket-page .ticket-detail-row .dm-meta-value {
    max-width: 100%;
    text-align: left;
  }

  .ticket-page #ticketDetailBox {
    max-height: 30vh;
  }

  .profile-mobile-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 2px 0;
  }
}

@media (max-width: 768px) {
  body:not(.chat-dm-page) .nav-links {
    top: calc(112px + var(--safe-top));
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
  }

  body:not(.chat-dm-page) .main-content {
    padding-top: calc(138px + var(--safe-top)) !important;
  }
}

/* =========================================
   Mobile Navbar + Modal Hotfix
   ========================================= */
@media (max-width: 900px) {
  body:not(.chat-dm-page) .navbar-content {
    position: relative;
    align-items: center !important;
    justify-content: center;
  }

  body:not(.chat-dm-page) .mobile-menu-btn {
    position: absolute;
    left: 0;
    top: 10px;
    margin-right: 0 !important;
    z-index: 5;
  }

  body:not(.chat-dm-page) .brand {
    width: 100%;
    justify-content: center;
    text-align: center;
    margin: 0 auto;
  }

  body:not(.chat-dm-page) .nav-actions {
    justify-content: center !important;
  }

  body.chat-dm-page .navbar-content {
    align-items: center !important;
    justify-content: center;
  }

  body.chat-dm-page .brand {
    width: 100%;
    justify-content: center;
    text-align: center;
    margin: 0 auto;
  }

  body.chat-dm-page .nav-actions {
    justify-content: center !important;
  }

  body.chat-dm-page .profile-dropdown-wrapper {
    margin-left: 0 !important;
  }

  .modal {
    align-items: center !important;
    padding: max(12px, var(--safe-top)) max(12px, var(--safe-right)) max(12px, var(--safe-bottom)) max(12px, var(--safe-left)) !important;
  }

  .modal-content,
  .modal-content.modal-wide {
    width: min(94vw, 720px) !important;
    max-width: min(94vw, 720px) !important;
    min-width: min(340px, 94vw);
    max-height: calc(100dvh - 24px) !important;
    padding: clamp(18px, 3.2vw, 24px) !important;
    border-radius: 16px;
    transform: none !important;
  }

  .modal.active .modal-content {
    animation: none !important;
    transform: none !important;
  }

  .profile-modal {
    width: min(94vw, 720px);
    max-width: min(94vw, 720px);
    min-width: min(340px, 94vw);
  }

  .custom-modal {
    width: min(94vw, 560px);
    max-width: min(94vw, 560px);
    min-width: min(320px, 94vw);
  }


}


/* Global Modal Wide */
.modal-wide {
  width: min(94vw, 1000px) !important;
  max-width: min(94vw, 1000px) !important;
}

/* Multi-File Upload & Grid Styles */
.dm-attachment-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.dm-image-preview-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.dm-image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dm-video-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: black;
}

.dm-file-preview-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.dm-image-remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dm-image-preview-meta {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  font-size: 10px;
  padding: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat Message Grid */
.msg-attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.msg-image-wrap {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.msg-image-wrap img,
.msg-image-wrap video {
  display: block;
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  background: #000;
}

.msg-file-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  margin-top: 4px;
}

.msg-file-icon {
  font-weight: bold;
  background: var(--accent-primary);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
}

.msg-file-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.msg-file-name {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.9rem;
}


.msg-file-size {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Code Preview Alignment Fix */
#codePreviewModal .profile-modal-body pre {
  margin: 0 !important;
  padding: 10px !important;
  text-align: left !important;
  border-radius: 0 0 16px 16px;
  background: #1e1e1e !important;
  /* Dark background for code */
}

#codePreviewModal .profile-modal-body code {
  font-family: 'Fira Code', Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  font-size: 0.9rem;
  text-shadow: none !important;
}

/* Prism line numbers adjustment if needed */
pre.line-numbers {
  padding-left: 3.8em !important;
  /* Override default if necessary */
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .modal-wide {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 85vh !important;
  }

  .dm-attachment-preview-list {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 6px;
  }

  .msg-attachment-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  #codePreviewModal .profile-modal-body {
    height: 60vh !important;
  }

  .dm-image-remove-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }
}