  :root {
      --primary: #2563EB;
      --secondary: #14B8A6;
      --sidebar-width: 272px;
      --sidebar-collapsed: 78px;
      --header-height: 70px;
  }

  * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
  }

  body {
      font-family: 'Inter', sans-serif;
      background: #F1F5F9;
      overflow-x: hidden;
  }

  .dark body,
  html.dark body {
      background: #0F172A;
  }

  ::-webkit-scrollbar {
      width: 5px;
      height: 5px;
  }

  ::-webkit-scrollbar-track {
      background: transparent;
  }

  ::-webkit-scrollbar-thumb {
      background: #94a3b8;
      border-radius: 10px;
  }

  .dark ::-webkit-scrollbar-thumb {
      background: #475569;
  }

  .sidebar {
      width: var(--sidebar-width);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      z-index: 50;
  }

  .sidebar.collapsed {
      width: var(--sidebar-collapsed);
  }

  .sidebar.collapsed .sidebar-text,
  .sidebar.collapsed .sidebar-logo-text,
  .sidebar.collapsed .sidebar-badge,
  .sidebar.collapsed .sidebar-submenu,
  .sidebar.collapsed .menu-section-title,
  .sidebar.collapsed .sidebar-upgrade {
      display: none;
  }

  .sidebar.collapsed .sidebar-link {
      justify-content: center;
      padding: 10px 12px;
  }

  .sidebar.collapsed .sidebar-logo {
      justify-content: center;
  }

  .sidebar-link {
      transition: all 0.2s ease;
      position: relative;
      border-radius: 10px;
  }

  .sidebar-link::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      height: 100%;
      width: 3px;
      background: var(--primary);
      transform: scaleY(0);
      transition: transform 0.2s ease;
      border-radius: 0 3px 3px 0;
  }

  .sidebar-link:hover::before,
  .sidebar-link.active::before {
      transform: scaleY(1);
  }

  .main-content {
      margin-left: var(--sidebar-width);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      min-height: 100vh;
  }

  .main-content.expanded {
      margin-left: var(--sidebar-collapsed);
  }

  @media (max-width: 1023px) {
      .main-content {
          margin-left: 0 !important;
      }
  }

  .header {
      height: var(--header-height);
  }

  .header.scrolled {
      box-shadow: 0 2px 15px rgba(0, 0, 0, 0.06);
  }

  .dark .header.scrolled {
      box-shadow: 0 2px 15px rgba(0, 0, 0, 0.25);
  }

  .gradient-primary {
      background: linear-gradient(135deg, #2563EB, #1d4ed8);
  }

  .gradient-secondary {
      background: linear-gradient(135deg, #14B8A6, #0d9488);
  }

  .gradient-success {
      background: linear-gradient(135deg, #22C55E, #16a34a);
  }

  .gradient-warning {
      background: linear-gradient(135deg, #F59E0B, #d97706);
  }

  .gradient-danger {
      background: linear-gradient(135deg, #EF4444, #dc2626);
  }

  .gradient-mixed {
      background: linear-gradient(135deg, #2563EB, #14B8A6);
  }

  .notif-dot::after {
      content: '';
      position: absolute;
      top: 0;
      right: 0;
      width: 8px;
      height: 8px;
      background: #EF4444;
      border-radius: 50%;
      border: 2px solid white;
  }

  .dark .notif-dot::after {
      border-color: #1E293B;
  }

  .dropdown-menu {
      transform-origin: top right;
  }

  .dropdown-menu.show {
      animation: ddIn 0.25s ease forwards;
  }

  @keyframes ddIn {
      from {
          opacity: 0;
          transform: scale(0.95) translateY(-4px);
      }

      to {
          opacity: 1;
          transform: scale(1) translateY(0);
      }
  }

  .modal-overlay {
      position: fixed;
      inset: 0;
      z-index: 70;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(4px);
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s ease;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 16px;
  }

  .modal-overlay.active {
      opacity: 1;
      visibility: visible;
  }

  .modal-box {
      background: white;
      border-radius: 20px;
      width: 100%;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
      transform: scale(0.9) translateY(20px);
      opacity: 0;
      transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .dark .modal-box {
      background: #1E293B;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  }

  .modal-overlay.active .modal-box {
      transform: scale(1) translateY(0);
      opacity: 1;
  }

  .toast-item {
      animation: toastSlide 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
      pointer-events: auto;
  }

  @keyframes toastSlide {
      from {
          opacity: 0;
          transform: translateX(100%);
      }

      to {
          opacity: 1;
          transform: translateX(0);
      }
  }

  .toast-item.removing {
      animation: toastHide 0.3s ease forwards;
  }

  @keyframes toastHide {
      to {
          opacity: 0;
          transform: translateX(100%);
      }
  }

  .page-loader {
      position: fixed;
      inset: 0;
      z-index: 9999;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: opacity 0.5s ease, visibility 0.5s ease;
  }

  .page-loader.done {
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
  }

  .loader-ring {
      width: 44px;
      height: 44px;
      border: 3px solid rgba(37, 99, 235, 0.2);
      border-top-color: #2563EB;
      border-radius: 50%;
      animation: spin 0.7s linear infinite;
  }

  @keyframes spin {
      to {
          transform: rotate(360deg);
      }
  }

  /* Messages Container */
  .messages-container {
      height: calc(100vh - var(--header-height) - 100px);
      min-height: 600px;
  }

  /* Conversation List */
  .convo-list {
      transition: all 0.2s ease;
  }

  .convo-list:hover {
      background: rgba(37, 99, 235, 0.05);
  }

  .dark .convo-list:hover {
      background: rgba(37, 99, 235, 0.1);
  }

  .convo-list.active {
      background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(20, 184, 166, 0.05));
      border-left: 3px solid #2563EB;
  }

  .dark .convo-list.active {
      background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(20, 184, 166, 0.1));
  }

  /* Online indicator */
  .online-dot {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 12px;
      height: 12px;
      background: #22C55E;
      border-radius: 50%;
      border: 2px solid white;
  }

  .dark .online-dot {
      border-color: #1E293B;
  }

  .offline-dot {
      background: #94A3B8;
  }

  .busy-dot {
      background: #F59E0B;
  }

  /* Message bubbles */
  .message-bubble {
      animation: msgIn 0.3s ease forwards;
  }

  @keyframes msgIn {
      from {
          opacity: 0;
          transform: translateY(10px);
      }

      to {
          opacity: 1;
          transform: translateY(0);
      }
  }

  .bubble-sent {
      background: linear-gradient(135deg, #2563EB, #1d4ed8);
      color: white;
      border-radius: 18px 18px 4px 18px;
      box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
  }

  .bubble-received {
      background: white;
      color: #1E293B;
      border-radius: 18px 18px 18px 4px;
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
      border: 1px solid #F1F5F9;
  }

  .dark .bubble-received {
      background: #334155;
      color: #F1F5F9;
      border-color: #475569;
  }

  /* Typing indicator */
  .typing-dot {
      width: 8px;
      height: 8px;
      background: #94A3B8;
      border-radius: 50%;
      display: inline-block;
      animation: typing 1.4s infinite ease-in-out;
  }

  .typing-dot:nth-child(1) {
      animation-delay: 0s;
  }

  .typing-dot:nth-child(2) {
      animation-delay: 0.2s;
  }

  .typing-dot:nth-child(3) {
      animation-delay: 0.4s;
  }

  @keyframes typing {

      0%,
      60%,
      100% {
          transform: translateY(0);
          opacity: 0.4;
      }

      30% {
          transform: translateY(-8px);
          opacity: 1;
      }
  }

  /* Message input */
  .message-input:focus {
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }

  /* Attachment preview */
  .attachment-preview {
      border-radius: 12px;
      overflow: hidden;
      transition: all 0.2s ease;
  }

  .attachment-preview:hover {
      transform: scale(1.02);
  }

  /* Voice message */
  .voice-message {
      display: flex;
      align-items: center;
      gap: 8px;
  }

  .voice-wave {
      display: flex;
      align-items: center;
      gap: 2px;
      height: 24px;
  }

  .voice-bar {
      width: 2px;
      background: currentColor;
      border-radius: 2px;
      opacity: 0.7;
  }

  /* Emoji picker */
  .emoji-picker {
      transition: all 0.3s ease;
  }

  /* Tab active */
  .tab-btn {
      position: relative;
      transition: all 0.2s ease;
  }

  .tab-btn.active {
      color: #2563EB !important;
  }

  .tab-btn.active::after {
      content: '';
      position: absolute;
      bottom: -1px;
      left: 0;
      right: 0;
      height: 2px;
      background: #2563EB;
      border-radius: 2px;
  }

  /* Unread badge pulse */
  @keyframes badge-pulse {

      0%,
      100% {
          transform: scale(1);
      }

      50% {
          transform: scale(1.1);
      }
  }

  .badge-pulse {
      animation: badge-pulse 2s ease-in-out infinite;
  }

  /* Message actions */
  .message-actions {
      opacity: 0;
      transition: opacity 0.2s ease;
  }

  .message-group:hover .message-actions {
      opacity: 1;
  }

  /* Mobile chat view */
  @media (max-width: 1023px) {
      .chat-view {
          position: fixed;
          inset: 0;
          z-index: 40;
          background: white;
      }

      .dark .chat-view {
          background: #0F172A;
      }

      .chat-view.hidden-mobile {
          display: none;
      }
  }