    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0
    }

    :root {
      --bg: #0b0e14;
      --surface: #131720;
      --surface2: #1a2030;
      --border: #1e2535;
      --accent: #4f8ef7;
      --success: #22c55e;
      --danger: #ef4444;
      --text: #e2e8f0;
      --muted: #64748b;
      --r: 14px
    }

    [data-theme="light"] {
      --bg: #f8fafc;
      --surface: #ffffff;
      --surface2: #f1f5f9;
      --border: #e2e8f0;
      --accent: #3b82f6;
      --text: #0f172a;
      --muted: #64748b
    }

    html,
    body {
      height: 100%;
      overflow: hidden
    }

    body {
      font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
      background: var(--bg);
      color: var(--text);
      display: flex;
      flex-direction: column
    }

    /* Buttons & Inputs */
    .btn {
      padding: 10px 16px;
      background: var(--accent);
      border: none;
      border-radius: 10px;
      color: #fff;
      font-family: inherit;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      transition: all .15s
    }

    .btn:hover {
      opacity: .9
    }

    .btn:disabled {
      opacity: .5;
      cursor: not-allowed
    }

    .btn-ghost {
      background: transparent;
      color: var(--muted);
      border: 1px solid transparent
    }

    .btn-ghost:hover {
      color: var(--text);
      background: var(--surface2)
    }

    .input {
      width: 100%;
      padding: 10px 14px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 10px;
      color: var(--text);
      font-family: inherit;
      font-size: 13px;
      outline: none;
      transition: border-color .2s
    }

    .input:focus {
      border-color: var(--accent)
    }

    /* Login Screen */
    #view-login {
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center
    }

    .login-card {
      width: 380px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 40px;
      box-shadow: 0 24px 80px rgba(0, 0, 0, .5)
    }

    .login-logo {
      text-align: center;
      margin-bottom: 32px
    }

    .login-logo .icon {
      width: 52px;
      height: 52px;
      background: var(--accent);
      border-radius: 14px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 26px;
      color: #fff;
      margin-bottom: 12px
    }

    .login-logo h1 {
      font-size: 22px;
      font-weight: 700
    }

    .login-logo p {
      font-size: 13px;
      color: var(--muted);
      margin-top: 4px
    }

    .form-group {
      margin-bottom: 16px
    }

    .form-group label {
      display: block;
      font-size: 12px;
      font-weight: 500;
      color: var(--muted);
      margin-bottom: 6px;
      text-transform: uppercase;
      letter-spacing: .5px
    }

    .err-msg {
      background: rgba(239, 68, 68, .12);
      border: 1px solid rgba(239, 68, 68, .3);
      color: #fca5a5;
      border-radius: 10px;
      padding: 10px 14px;
      font-size: 13px;
      margin-bottom: 16px;
      display: none
    }

    /* Portal Screen */
    #view-portal {
      flex: 1;
      display: none;
      flex-direction: row;
      height: 100%
    }

    /* Sidebar */
    .sidebar {
      /* width: 280px; */
      width: 320px;
      background: var(--surface);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      flex-shrink: 0
    }

    .sidebar-head {
      padding: 16px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between
    }

    .sidebar-head h2 {
      font-size: 14px;
      font-weight: 700;
      color: var(--accent)
    }

    .chat-actions {
      display: flex;
      gap: 8px
    }

    .chat-actions button {
      background: var(--surface2);
      border: none;
      color: var(--text);
      border-radius: 8px;
      padding: 6px 10px;
      font-size: 11px;
      cursor: pointer;
      font-weight: 600
    }

    .chat-actions button:hover {
      background: var(--border)
    }

    .chat-list {
      flex: 1;
      overflow-y: auto
    }

    .chat-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      cursor: pointer;
      border-bottom: 1px solid var(--border);
      transition: background .15s
    }

    .chat-item:hover {
      background: var(--surface2)
    }

    .chat-item.active {
      background: rgba(79, 142, 247, .1);
      border-left: 3px solid var(--accent)
    }

    .chat-item .av {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--accent);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      font-weight: 700;
      color: #fff;
      flex-shrink: 0
    }

    .chat-item .info {
      flex: 1;
      min-width: 0
    }

    .chat-item .name {
      font-size: 13.5px;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .chat-item .sub {
      font-size: 11.5px;
      color: var(--muted);
      margin-top: 3px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .sidebar-foot {
      padding: 12px 16px;
      border-top: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between
    }

    .user-info {
      font-size: 12px
    }

    .user-info b {
      display: block;
      font-weight: 600
    }

    .user-info span {
      color: var(--muted);
      font-size: 11px
    }

    /* Main Chat Area */
    .main {
      flex: 1;
      display: flex;
      flex-direction: column;
      background: var(--bg);
      height: 100%;
      overflow: hidden;
      position: relative;
    }

    .main-empty {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: var(--muted)
    }

    .main-empty .icon {
      font-size: 48px;
      margin-bottom: 16px;
      opacity: .5
    }

    .chat-header {
      padding: 14px 20px;
      border-bottom: 1px solid var(--border);
      background: var(--surface);
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-shrink: 0;
      flex-grow: 0
    }

    .chat-header .header-info {
      display: flex;
      align-items: center;
      gap: 12px
    }

    .chat-header .av {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      background: var(--accent);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: 700;
      color: #fff
    }

    .chat-header h3 {
      font-size: 15px;
      font-weight: 600
    }

    .chat-header p {
      font-size: 11px;
      color: var(--muted)
    }

    .messages {
      flex: 1 1 0%;
      min-height: 0;
      overflow-y: auto;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 12px
    }

    .msg-row {
      display: flex;
      align-items: flex-end;
      gap: 10px
    }

    .msg-row.out {
      flex-direction: row-reverse
    }

    .msg-av {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: var(--surface2);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 11px;
      font-weight: 600;
      color: var(--accent);
      flex-shrink: 0
    }

    .msg-row.out .msg-av {
      background: var(--accent);
      color: #fff
    }

    .bubble {
      max-width: 65%;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px 12px 12px 4px;
      padding: 10px 14px;
      position: relative
    }

    .msg-row.out .bubble {
      background: rgba(79, 142, 247, .15);
      border-color: rgba(79, 142, 247, .3);
      border-radius: 12px 12px 4px 12px
    }

    .sender-name {
      font-size: 11px;
      font-weight: 700;
      color: var(--accent);
      margin-bottom: 4px;
      display: block
    }

    .msg-text {
      font-size: 13.5px;
      line-height: 1.5;
      white-space: pre-wrap;
      word-break: break-word
    }

    .msg-time {
      font-size: 10px;
      color: var(--muted);
      margin-top: 6px;
      text-align: right
    }

    .file-box {
      display: flex;
      align-items: center;
      gap: 10px;
      background: var(--surface2);
      padding: 10px;
      border-radius: 8px;
      margin-bottom: 6px;
      border: 1px solid var(--border)
    }

    .file-box a {
      color: var(--accent);
      font-size: 13px;
      font-weight: 500;
      text-decoration: none
    }

    .file-box a:hover {
      text-decoration: underline
    }

    /* Input Area */
    .input-area {
      padding: 16px 20px;
      background: var(--surface);
      border-top: 1px solid var(--border);
      flex-shrink: 0;
      flex-grow: 0
    }

    .input-row {
      display: flex;
      gap: 12px;
      align-items: flex-end
    }

    .input-row textarea {
      flex: 1;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px 16px;
      color: var(--text);
      font-family: inherit;
      font-size: 14px;
      resize: none;
      outline: none;
      max-height: 120px;
      line-height: 1.5;
      transition: border-color .2s
    }

    .input-row textarea:focus {
      border-color: var(--accent)
    }

    .send-btn {
      width: 46px;
      height: 46px;
      border-radius: 12px;
      background: var(--accent);
      color: #fff;
      border: none;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0
    }

    .send-btn:hover {
      opacity: .9
    }

    .attach-btn {
      width: 46px;
      height: 46px;
      border-radius: 12px;
      background: var(--bg);
      border: 1px solid var(--border);
      color: var(--muted);
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0
    }

    .attach-btn:hover {
      color: var(--text);
      border-color: var(--text)
    }

    /* Modals */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .6);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 100;
      backdrop-filter: blur(2px)
    }

    .modal-overlay.open {
      display: flex
    }

    .modal {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 16px;
      padding: 28px;
      width: 400px;
      max-width: 90vw
    }

    .modal h3 {
      font-size: 16px;
      font-weight: 700;
      margin-bottom: 20px
    }

    .modal-actions {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      margin-top: 24px
    }

    .user-search-list {
      max-height: 200px;
      overflow-y: auto;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      margin-top: 10px
    }

    .user-search-item {
      padding: 10px 14px;
      font-size: 13px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      gap: 10px;
      cursor: pointer
    }

    .user-search-item:last-child {
      border-bottom: none
    }

    .user-search-item:hover {
      background: var(--surface2)
    }

    .user-search-item input {
      width: 16px;
      height: 16px;
      accent-color: var(--accent)
    }

    /* Scrollbars */
    ::-webkit-scrollbar {
      width: 6px
    }

    ::-webkit-scrollbar-track {
      background: transparent
    }

    ::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 6px
    }

    /* Lightbox */
    .lightbox {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      background: rgba(0, 0, 0, 0.92);
      z-index: 9999;
      display: none;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      backdrop-filter: blur(5px)
    }

    .lightbox.show {
      display: flex
    }

    .lightbox img {
      max-width: 90%;
      max-height: calc(100vh - 160px);
      border-radius: 8px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
      object-fit: contain
    }

    .lightbox-actions {
      position: absolute;
      top: 20px;
      right: 20px;
      display: flex;
      gap: 12px
    }

    .lightbox-btn {
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid rgba(255, 255, 255, 0.2);
      color: #fff;
      width: 44px;
      height: 44px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.2s;
      backdrop-filter: blur(10px)
    }

    .lightbox-btn:hover {
      background: var(--accent);
      border-color: var(--accent)
    }

    .media-img {
      max-width: 100%;
      border-radius: 8px 8px 0 0;
      cursor: pointer;
      max-height: 260px;
      object-fit: cover;
      display: block;
      margin-bottom: 0;
      transition: transform 0.2s
    }

    .media-img:hover {
      transform: scale(1.02)
    }

    /* OCR */
    .ocr-result-area {
      display: none;
      position: absolute;
      bottom: 40px;
      left: 50%;
      transform: translateX(-50%);
      width: 90%;
      max-width: 800px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 16px;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
      z-index: 100
    }

    .ocr-result-area.show {
      display: flex;
      flex-direction: column;
      gap: 12px
    }

    .ocr-result-area textarea {
      width: 100%;
      height: 120px;
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      color: var(--text);
      padding: 10px;
      font-size: 13px;
      resize: none;
      outline: none
    }

    .ocr-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      cursor: move
    }

    .ocr-header h4 {
      font-size: 14px;
      color: var(--accent);
      pointer-events: none
    }

    .ocr-loader {
      display: none;
      align-items: center;
      gap: 10px;
      font-size: 13px;
      color: var(--accent);
      margin-top: 10px
    }

    .ocr-loader.show {
      display: flex
    }

    @keyframes spin {
      to {
        transform: rotate(360deg)
      }
    }

    .ocr-spinner {
      width: 16px;
      height: 16px;
      border: 2px solid rgba(79, 142, 247, .3);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin .8s linear infinite
    }

    .ocr-overlay {
      position: absolute;
      top: 0;
      left: 0;
      pointer-events: none;
      z-index: 50;
      user-select: text
    }

    .ocr-overlay .word {
      position: absolute;
      color: transparent;
      background: rgba(79, 142, 247, 0);
      cursor: text;
      pointer-events: auto;
      white-space: nowrap;
      line-height: 1
    }

    .ocr-overlay .word::selection {
      background: rgba(79, 142, 247, 0.3);
      color: transparent
    }

    .btn-ocr {
      border: none;
      border-radius: 6px;
      padding: 6px 12px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      transition: all .2s;
      font-family: inherit
    }

    .btn-ocr-primary {
      background: var(--accent);
      color: #fff
    }

    .btn-ocr-primary:hover {
      opacity: 0.9;
      transform: translateY(-1px)
    }

    .btn-ocr-ghost {
      background: none;
      color: var(--muted);
      border: 1px solid var(--border)
    }

    .btn-ocr-ghost:hover {
      color: var(--text);
      border-color: var(--muted)
    }

    /* Mobile Responsiveness */
    .mobile-menu-btn {
      display: none;
      background: none;
      border: none;
      color: var(--text);
      font-size: 20px;
      cursor: pointer;
      padding: 4px
    }

    .sidebar-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 999;
      backdrop-filter: blur(2px)
    }

    .sidebar-overlay.open {
      display: block
    }

    .mobile-header {
      display: none;
      padding: 14px 20px;
      border-bottom: 1px solid var(--border);
      align-items: center;
      background: var(--surface)
    }

    .mobile-back-btn {
      display: none;
    }

    @media (max-width: 1024px) {
      #view-portal.chat-open .sidebar {
        display: none !important;
      }

      #view-portal.chat-open .main {
        display: flex !important;
        width: 100% !important;
      }

      #view-portal:not(.chat-open) .sidebar {
        display: flex !important;
        width: 100% !important;
      }

      #view-portal:not(.chat-open) .main {
        display: none !important;
      }

      .sidebar {
        position: static;
        height: 100%;
        transform: none;
        transition: none;
        z-index: auto;
      }

      .sidebar.open {
        transform: none;
      }

      .sidebar-overlay {
        display: none !important;
      }

      .mobile-menu-btn {
        display: none !important;
      }

      .mobile-back-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        color: var(--text);
        cursor: pointer;
        padding: 4px;
      }

      .chat-header {
        padding: 10px 16px
      }

      .mobile-header {
        display: none !important;
      }

      .messages {
        padding: 16px 12px
      }

      .bubble {
        max-width: 85%
      }

      .input-area {
        padding: 10px 12px
      }

      .login-card {
        width: 90%;
        padding: 24px
      }
    }

    @media (max-width: 768px) {
      .desktop-search-container {
        display: none !important;
      }

      .mobile-search-trigger {
        display: block !important;
      }

      .chat-header {
        padding: 8px 12px;
      }

      .chat-header .header-info {
        gap: 6px !important;
      }

      .chat-header h3 {
        font-size: 13.5px;
        max-width: 110px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .chat-header p {
        font-size: 10px;
      }

      .chat-header .btn-ghost {
        padding: 6px 8px !important;
        font-size: 10.5px !important;
      }
    }

    @media (max-width: 480px) {
      .chat-header h3 {
        max-width: 80px;
      }
    }

    .unread-dot {
      width: 8px;
      height: 8px;
      background-color: var(--accent);
      border-radius: 50%;
      box-shadow: 0 0 8px var(--accent);
      margin-left: 8px;
      align-self: center;
      flex-shrink: 0;
    }

    /* Mentions Styling */
    .mention-tag {
      background: rgba(79, 142, 247, 0.15);
      color: var(--accent);
      padding: 2px 6px;
      border-radius: 4px;
      font-weight: 500;
      display: inline-block;
    }

    .mention-dropdown {
      position: absolute;
      bottom: 100%;
      left: 60px;
      right: 60px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 10px;
      box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
      max-height: 180px;
      overflow-y: auto;
      z-index: 10;
      display: none;
    }

    .mention-item {
      padding: 10px 14px;
      font-size: 13px;
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      border-bottom: 1px solid var(--border);
      color: var(--text);
    }

    .mention-item:last-child {
      border-bottom: none;
    }

    .mention-item:hover,
    .mention-item.active {
      background: var(--surface2);
      color: var(--accent);
    }

    /* Reply Styling */
    .reply-input-banner {
      display: none;
      align-items: center;
      justify-content: space-between;
      background: var(--surface2);
      border-left: 4px solid var(--accent);
      padding: 8px 16px;
      font-size: 12px;
      border-bottom: 1px solid var(--border);
    }

    .reply-input-banner .reply-cancel {
      cursor: pointer;
      color: var(--danger);
      font-weight: 600;
    }

    .reply-bubble-preview {
      background: rgba(255, 255, 255, 0.04);
      border-left: 3px solid var(--accent);
      padding: 6px 10px;
      border-radius: 4px;
      font-size: 11px;
      margin-bottom: 6px;
      color: var(--muted);
      cursor: pointer;
      transition: background 0.2s;
    }

    .reply-bubble-preview:hover {
      background: rgba(255, 255, 255, 0.08);
    }

    .reply-bubble-preview .reply-sender {
      font-weight: 600;
      color: var(--accent);
      display: block;
      margin-bottom: 2px;
    }



    .msg-actions-trigger {
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      display: none;
      gap: 6px;
      z-index: 5;
    }

    .msg-row:not(.out) .msg-actions-trigger {
      right: -45px;
    }

    .msg-row.out .msg-actions-trigger {
      left: -45px;
    }

    .msg-row:hover .msg-actions-trigger {
      display: flex;
    }

    .btn-msg-action {
      background: var(--surface2);
      border: 1px solid var(--border);
      color: var(--muted);
      width: 26px;
      height: 26px;
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 11px;
      transition: all 0.15s;
    }

    .btn-msg-action:hover {
      background: var(--accent);
      color: #fff;
      border-color: var(--accent);
    }

    /* Highlight class for scrolled target message */
    .msg-row.highlight-blink .bubble {
      animation: blink-highlight 1.5s ease-out;
    }

    @keyframes blink-highlight {
      0% {
        box-shadow: 0 0 0 0px var(--accent);
        background: var(--surface2);
      }

      30% {
        box-shadow: 0 0 0 4px var(--accent);
        background: rgba(79, 142, 247, 0.15);
      }

      100% {
        box-shadow: 0 0 0 0px var(--accent);
      }
    }

    .sidebar-nav {
      display: flex;
      border-top: 1px solid var(--border);
      background: var(--surface);
      height: 48px;
      flex-shrink: 0;
    }

    .nav-tab {
      flex: 1;
      background: transparent;
      border: none;
      color: var(--muted);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 4px;
      font-family: inherit;
      font-size: 10px;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.15s;
    }

    .nav-tab:hover {
      color: var(--text);
      background: var(--surface2);
    }

    .nav-tab.active {
      color: var(--accent);
    }

    .nav-tab svg {
      width: 18px;
      height: 18px;
    }

    /* Modern Toggle Switches */
    .switch-container {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 14px 16px;
      background: var(--surface2);
      border-radius: 10px;
      border: 1px solid var(--border);
      transition: all 0.2s ease;
    }

    .switch-container:hover {
      border-color: rgba(79, 142, 247, 0.4);
    }

    .switch-label-group {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .switch-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
    }

    .switch-desc {
      font-size: 11px;
      color: var(--muted);
    }

    .custom-switch {
      position: relative;
      display: inline-block;
      width: 40px;
      height: 22px;
      flex-shrink: 0;
    }

    .custom-switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .slider {
      position: absolute;
      cursor: pointer;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: var(--border);
      transition: .25s ease;
      border-radius: 34px;
    }

    .slider:before {
      position: absolute;
      content: "";
      height: 16px;
      width: 16px;
      left: 3px;
      bottom: 3px;
      background-color: #fff;
      transition: .25s ease;
      border-radius: 50%;
    }

    input:checked+.slider {
      background-color: var(--accent);
    }

    input:checked+.slider:before {
      transform: translateX(18px);
    }

    /* Media loading spinner animation styles */
    .media-wrapper {
      position: relative;
      display: inline-block;
      min-width: 120px;
      min-height: 120px;
      border-radius: 8px;
      overflow: hidden;
      background: var(--surface2);
      vertical-align: middle;
    }

    .media-wrapper::before {
      content: "";
      position: absolute;
      top: 50%;
      left: 50%;
      width: 24px;
      height: 24px;
      margin: -12px 0 0 -12px;
      border: 2px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: media-spinner 0.6s linear infinite;
      z-index: 1;
      transition: opacity 0.25s ease;
    }

    .media-wrapper.loaded::before {
      opacity: 0;
      pointer-events: none;
    }

    .media-wrapper img,
    .media-wrapper video {
      opacity: 0;
      transition: opacity 0.3s ease;
    }

    .media-wrapper.loaded img,
    .media-wrapper.loaded video {
      opacity: 1;
    }

    /* Hide native webkit video loading spinner to prevent duplicate loaders */
    .media-wrapper video::-webkit-media-controls-loading-indicator {
      display: none !important;
    }

    @keyframes media-spinner {
      to {
        transform: rotate(360deg);
      }
    }

    .dropdown-item-hover {
      transition: background 0.15s ease, color 0.15s ease;
    }

    .dropdown-item-hover:hover {
      background: var(--surface2) !important;
      color: var(--accent) !important;
    }

    /* Folder Tabs Styling */
    .folder-tab {
      padding: 6px 12px;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 20px;
      color: var(--muted);
      font-size: 11.5px;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.2s ease;
      display: inline-block;
      user-select: none;
    }

    .folder-tab:hover {
      color: var(--text);
      border-color: var(--muted);
    }

    .folder-tab.active {
      background: rgba(79, 142, 247, 0.15);
      border-color: var(--accent);
      color: var(--accent);
    }

    .btn-folder-settings {
      background: transparent;
      border: none;
      color: var(--muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      padding: 6px;
      border-radius: 50%;
      transition: all 0.2s ease;
      flex-shrink: 0;
    }

    .btn-folder-settings:hover {
      color: var(--text);
      background: var(--surface2);
    }

    /* List item for folders edit view */
    .folder-list-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 10px;
      margin-bottom: 8px;
    }

    .folder-list-item-info {
      display: flex;
      flex-direction: column;
      gap: 2px;
      text-align: left;
    }

    .folder-list-item-title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
    }

    .folder-list-item-actions {
      display: flex;
      gap: 6px;
    }

    /* New Chat Dropdown Menu */
    .new-chat-dropdown {
      position: absolute;
      top: 100%;
      right: 0;
      margin-top: 8px;
      width: 220px;
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 12px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
      z-index: 1000;
      padding: 6px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes dropdownFadeIn {
      from {
        opacity: 0;
        transform: translateY(-8px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .dropdown-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      border-radius: 8px;
      cursor: pointer;
      transition: background 0.15s;
    }

    .dropdown-item:hover {
      background: var(--surface2);
    }

    .dropdown-item svg {
      color: var(--accent);
      flex-shrink: 0;
    }

    .dropdown-text {
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      min-width: 0;
    }

    .dropdown-text .title {
      font-size: 13px;
      font-weight: 600;
      color: var(--text);
      line-height: 1.2;
    }

    .dropdown-text .desc {
      font-size: 10.5px;
      color: var(--muted);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
    }

    /* Scroll Down Floating Action Button */
    .scroll-down-btn {
      position: absolute;
      bottom: 85px; /* just above input-area */
      right: 24px;
      width: 42px;
      height: 42px;
      border-radius: 50%;
      background: var(--surface);
      border: 1px solid var(--border);
      color: var(--muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
      z-index: 99;
      transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
      opacity: 0;
      transform: scale(0.8);
      pointer-events: none;
      padding: 0;
    }

    .scroll-down-btn.show {
      opacity: 1;
      transform: scale(1);
      pointer-events: auto;
    }

    .scroll-down-btn:hover {
      background: var(--surface2);
      color: var(--text);
      transform: scale(1.05);
    }

    .scroll-down-btn:active {
      transform: scale(0.95);
    }

    .scroll-down-badge {
      position: absolute;
      top: -4px;
      right: -4px;
      background: var(--accent);
      color: #ffffff;
      font-size: 10px;
      font-weight: 700;
      min-width: 18px;
      height: 18px;
      border-radius: 9px;
      padding: 0 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 2px solid var(--surface);
      box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    }
