    :root {
      --bg: #f5f7fb;
      --panel: #ffffff;
      --line: #e1e4e8;
      --text: #1e1e1e;
      --muted: #888888;
      --accent: #007bff;
      --sidebar-w: 238px;
    }

    * {
      box-sizing: border-box !important;
      font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif !important;
    }

    html, body {
      margin: 0;
      padding: 0;
      height: 100%;
      color: var(--text);
      background: var(--bg);
    }

    .app {
      display: block;
      height: 100vh;
      background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    }

    .header {
      height: 60px;
      border-bottom: 1px solid var(--line);
      background: var(--panel);
      padding: 8px 12px;
      display: block;
      width: 100%;
      overflow: visible;
      position: relative;
      z-index: 200;
      white-space: nowrap;
    }

    .filter-item {
      display: inline-block;
      vertical-align: bottom;
      min-width: 100px;
      width: 17%;
      max-width: 24%;
      min-height: 44px;
      height: auto;
      margin-right: 8px;
      overflow: visible;
    }

    .filter-item.account-filter {
      height: auto;
      min-height: 46px;
      vertical-align: bottom;
    }

    .account-picker {
      position: relative;
      min-width: 0;
      max-width: 100%;
      width: 100%;
      z-index: 400;
    }

    .account-selected {
      width: 100%;
      border: 1px solid #dcdfe6;
      background: #f8f9fa;
      border-radius: 6px;
      padding: 5px 34px 5px 6px;
      display: block;
      cursor: pointer;
      text-align: left;
      min-height: 42px;
      height: auto;
      position: relative;
      overflow: hidden;
    }

    .account-selected .account-avatar,
    .account-option .account-avatar {
      float: left;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      object-fit: cover;
      background: #e8edf3;
      border: 1px solid #d7dee7;
      margin: 2px 8px 2px 2px;
      position: static;
      vertical-align: middle;
    }

    .account-lines {
      display: block;
      overflow: hidden;
      padding-right: 4px;
    }

    .account-line-name,
    .account-line-phone {
      display: block;
      width: 100%;
      clear: both;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .account-line-name {
      font-size: 12px;
      font-weight: 700;
      color: #1e1e1e;
      line-height: 1.25;
    }

    .account-line-phone {
      font-size: 10px;
      color: #6f7781;
      margin-top: 2px;
      line-height: 1.2;
    }

    .account-selected .account-msgr {
      position: absolute;
      right: 6px;
      top: 50%;
      margin-top: -11px;
    }

    .account-option {
      width: 100%;
      border: 0;
      background: #fff;
      padding: 6px 34px 6px 6px;
      display: block;
      text-align: left;
      cursor: pointer;
      position: relative;
      min-height: 42px;
      overflow: hidden;
    }

    .account-option .account-msgr {
      position: absolute;
      right: 8px;
      top: 50%;
      margin-top: -11px;
    }

    .account-msgr {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      display: inline-block;
      text-align: center;
      line-height: 22px;
      color: #fff;
      font-size: 11px;
      font-weight: 700;
      vertical-align: middle;
    }

    .account-msgr.viber { background: #7360f2; }
    .account-msgr.telegram { background: #2aabee; }
    .account-msgr.default { background: #95a4b5; }

    .account-list {
      position: absolute;
      top: calc(100% + 4px);
      left: 0;
      right: 0;
      border: 1px solid #d5dbe3;
      border-radius: 10px;
      background: #fff;
      max-height: 280px;
      overflow: auto;
      z-index: 1000;
      display: none;
    }

    .account-list.open {
      display: block;
    }

    .account-option:hover {
      background: #f0f3f7;
    }

    #accountFilter {
      display: none;
    }

    .filter-item label {
      display: none;
    }

    select, input[type="search"], textarea {
      border: 1px solid #dcdfe6;
      border-radius: 6px;
      background: #f8f9fa;
      color: var(--text);
      font-size: 13px;
      font-family: inherit;
    }

    .filter-item select {
      height: 40px;
      width: 100%;
      padding: 6px 28px 6px 8px;
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
      background-image: linear-gradient(45deg, transparent 50%, #7a8696 50%), linear-gradient(135deg, #7a8696 50%, transparent 50%);
      background-position: calc(100% - 14px) 17px, calc(100% - 9px) 17px;
      background-size: 5px 5px, 5px 5px;
      background-repeat: no-repeat;
      text-align: center;
      text-align-last: center;
    }

    #tagsFilter { display: none; }

    .filter-picker {
      position: relative;
      width: 100%;
      z-index: 350;
      overflow: visible;
    }

    .filter-picker.open {
      z-index: 1200;
    }

    .filter-picker-btn {
      width: 100%;
      height: 40px;
      border: 1px solid #dcdfe6;
      border-radius: 6px;
      background: #f8f9fa;
      color: var(--text);
      font-size: 13px;
      font-family: inherit;
      padding: 6px 28px 6px 8px;
      text-align: center;
      cursor: pointer;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      appearance: none;
      -webkit-appearance: none;
    }

    .filter-picker-list {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      margin-top: 4px;
      border: 1px solid #d5dbe3;
      border-radius: 8px;
      background: #fff;
      max-height: 240px;
      overflow: auto;
      z-index: 1201;
      display: none;
      box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
      padding: 4px 0;
    }

    .filter-picker-list.open {
      display: block !important;
      min-height: 28px;
    }

    .filter-picker-empty {
      display: block;
      padding: 8px 10px;
      font-size: 12px;
      color: #6f7781;
      text-align: center;
    }

    #responsibleFilter,
    #groupFilter,
    #tagsFilter {
      position: absolute;
      left: -9999px;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
    }

    .filter-picker-option {
      display: block;
      padding: 6px 10px;
      cursor: pointer;
      font-size: 13px;
      color: #1e1e1e;
      overflow: hidden;
      min-height: 28px;
      line-height: 1.3;
    }

    .filter-picker-option:hover {
      background: #f0f3f7;
    }

    .filter-picker-mark {
      display: inline-block;
      width: 18px;
      text-align: center;
      font-size: 14px;
      line-height: 1;
      vertical-align: middle;
      color: #007bff;
    }

    .filter-picker-option.is-selected {
      background: #e8f1ff;
    }

    .filter-picker-option-tag {
      position: relative;
      padding-right: 28px;
    }

    .filter-picker-option-tag .filter-picker-option-text {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding-right: 4px;
    }

    .filter-picker-option-tag .filter-picker-mark {
      position: absolute;
      right: 8px;
      top: 50%;
      margin-top: -8px;
    }

    .filter-picker-option:not(.filter-picker-option-tag) .filter-picker-mark {
      float: left;
      margin-right: 6px;
    }

    .filter-picker-option:not(.filter-picker-option-tag) .filter-picker-option-text {
      display: block;
      overflow: hidden;
    }

    .main {
      display: block;
      position: relative;
      overflow: hidden;
      height: calc(100vh - 60px);
    }

    .sidebar {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: var(--sidebar-w);
      min-width: 240px;
      max-width: 620px;
      border-right: 1px solid var(--line);
      background: #fff;
      display: block;
      overflow-x: hidden;
      overflow-y: auto;
      border-radius: 8px 0 0 8px;
      box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
    }

    .sidebar-header {
      padding: 4px 12px !important;
      padding-left: 14px !important;
      padding-right: 14px !important;
      box-sizing: border-box !important;
      width: 100%;
      margin: 0;
      border-bottom: 1px solid var(--line);
      display: block;
      background: #cdd8e6;
    }

    .tools-row {
      display: block;
      width: 100%;
      white-space: nowrap;
      text-align: center;
      margin-bottom: 6px !important;
      margin-left: 0;
      margin-right: 0;
    }

    .tools-row button {
      margin: 0 4px 0 0;
      display: inline-block;
      vertical-align: middle;
      width: auto;
      min-width: 32px;
      text-align: center;
      height: 28px;
      border: 1px solid #d9e1eb;
      background: #f4f7fb;
      color: #35506f;
      border-radius: 7px;
      cursor: pointer;
      font-weight: 700;
      transition: transform 0.2s, background-color 0.2s, border-color 0.2s, color 0.2s;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
      padding: 4px !important;
    }

    .tools-row button:hover {
      transform: translateY(-1px);
      filter: brightness(1.03);
    }

    .tools-row button.active {
      border-color: #007bff;
      background: #007bff;
      color: #fff;
    }

    .tools-row button svg {
      color: currentColor;
    }

    .search-container,
    .modern-search {
      display: block;
      width: 90% !important;
      background: #f0f2f5 !important;
      border-radius: 20px !important;
      padding: 0 10px !important;
      height: 24px !important;
      border: none !important;
      outline: none !important;
      margin: 3px auto !important;
      box-sizing: border-box !important;
      box-shadow: none !important;
      position: relative;
    }

    .search-icon {
      position: absolute;
      left: 10px;
      top: 4px;
      color: #8897a8;
      pointer-events: none;
      width: 14px;
      height: 14px;
      font-size: 14px;
      line-height: 1;
      display: inline-block;
    }

    .search-container input {
      background: transparent !important;
      border: none !important;
      outline: none !important;
      width: 100% !important;
      margin: 0 !important;
      padding-left: 28px !important;
      font-size: 13px !important;
      height: 100%;
      color: #233244;
      padding-top: 0;
      padding-bottom: 0;
      -webkit-appearance: none;
      appearance: none;
      border: none !important;
      box-shadow: none !important;
      border-radius: 0;
    }

    .search-container input:focus {
      outline: none !important;
      border: 0 !important;
      box-shadow: none !important;
      background: transparent !important;
    }

    .contact-list {
      display: block;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 0;
    }

    .group {
      background: transparent;
    }

    .group-header {
      width: 100%;
      border: 0;
      background: #f2f4f7;
      padding: 5px 12px 5px 10px;
      font-size: 12px;
      color: #35506f !important;
      font-weight: 600;
      text-transform: none;
      letter-spacing: 0;
      border-top: 1px solid #e5e9ee;
      border-bottom: 1px solid #e5e9ee;
      text-align: left;
      display: block;
      cursor: pointer;
      position: relative;
    }

    .group-header.level-1 {
      background: #dfe7f1;
      color: #163e78 !important;
      font-weight: 600;
      font-size: 12px;
    }

    .group-header.level-2 {
      background: #edf2f8;
      color: #35506f !important;
      font-size: 11px;
      font-weight: 600;
    }

    .group-header-label {
      display: block;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      padding-right: 4px;
    }

    .group-header-count {
      font-weight: 500;
      color: #6f7781;
    }

    .group-header .arrow {
      display: inline-block;
      width: 12px;
      font-size: 10px;
      color: #6f7781;
      vertical-align: baseline;
    }

    .group-items { padding: 0; }

    .contact {
      display: block;
      overflow: hidden;
      border-bottom: 1px solid #e1e4e8;
      padding: 3px 4px 4px 4px;
      cursor: pointer;
      background: transparent;
      min-height: 40px;
      word-wrap: break-word;
    }

    .contact:hover {
      background: #f0f3f7;
    }

    .contact.unread { background: #eef6ff; }

    .contact.selected {
      background: #cfe6ff;
      border-left: 3px solid #0b63d1;
      padding-left: 3px;
      box-shadow: inset 0 0 0 1px #9fc7f5;
    }

    .avatar-wrap {
      float: left;
      width: 36px;
      height: 36px;
      margin-right: 8px;
      position: relative;
      vertical-align: middle;
    }

    .avatar-main {
      width: 36px !important;
      height: 36px !important;
      border-radius: 50%;
      object-fit: cover;
      background: #e8edf3;
      vertical-align: middle;
      display: block;
    }

    .avatar-account {
      position: absolute;
      top: -2px;
      right: -2px;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      border: 1px solid #fff;
      object-fit: cover;
      background: #e8edf3;
    }

    .messenger-badge {
      position: absolute;
      right: 0;
      bottom: 0;
      width: 13px;
      height: 13px;
      border-radius: 50%;
      border: 1px solid #fff;
      font-size: 7px;
      color: #fff;
      font-weight: 700;
      display: block;
      text-align: center;
      line-height: 11px;
    }
    .messenger-badge.viber { background: #7360f2; }
    .messenger-badge.telegram { background: #2aabee; }

    .contact-main {
      display: block;
      overflow: hidden;
      word-wrap: break-word;
      padding-right: 0;
      zoom: 1;
    }

    .contact-meta-right {
      float: right;
      width: 68px;
      text-align: right;
      margin-left: 4px;
      padding-top: 1px;
    }

    .contact-meta-right .time {
      display: block;
      width: 100%;
      font-size: 10px;
      color: #8d8d8d;
      white-space: nowrap;
      text-align: right;
      line-height: 1.2;
      overflow: visible;
    }

    .contact-meta-right .unread-dot {
      display: inline-block;
      width: auto;
      max-width: 26px;
      margin: 3px 0 0 auto;
      float: right;
      clear: right;
      min-width: 14px;
      height: 14px;
      line-height: 14px;
      font-size: 9px;
      padding: 0 4px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      vertical-align: middle;
      box-sizing: border-box;
    }

    .contact-stack {
      display: block;
      overflow: hidden;
      zoom: 1;
    }

    .contact-name,
    .contact-phone {
      display: block;
      width: 100%;
      clear: none;
      word-wrap: break-word;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .contact-name {
      font-size: 12px;
      font-weight: 700;
      color: #1e1e1e;
      line-height: 1.25;
    }

    .contact-phone {
      font-size: 11px;
      color: #666;
      margin-top: 2px;
      line-height: 1.2;
    }

    .contact-preview {
      display: block;
      width: 100%;
      margin-top: 3px;
      max-height: 1.35em;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .contact-preview .last {
      font-size: 11px;
      color: #666;
    }

    .tag-list {
      display: block;
      width: 100%;
      margin-top: 3px;
      overflow: hidden;
      max-height: 2.5em;
      line-height: 1.15;
    }
    .tag {
      font-size: 9px;
      border-radius: 3px;
      padding: 1px 5px;
      border: 1px solid #bbdefb;
      background: #e3f2fd;
      color: #0d47a1;
      max-width: 72px;
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 1.2;
      display: inline-block;
      vertical-align: middle;
      font-weight: 700;
      margin: 0 3px 2px 0;
      box-shadow: none;
    }

    .unread-dot {
      display: inline-block;
      width: auto;
      min-width: 14px;
      max-width: 26px;
      height: 14px;
      border-radius: 999px;
      background: #007bff;
      color: #fff;
      text-align: center;
      line-height: 14px;
      font-size: 9px;
      font-weight: 700;
      padding: 0 4px;
      box-sizing: border-box;
    }

    .contact-item-preview img {
      width: 20px !important;
      height: 20px !important;
      display: inline-block;
      vertical-align: middle;
      object-fit: contain;
      margin-right: 4px;
      background: transparent !important;
      border: 0 !important;
      box-shadow: none !important;
    }

    .contact-item-preview img.twemoji {
      width: 18px !important;
      height: 18px !important;
      margin-right: 3px;
      vertical-align: text-bottom;
    }

    .sidebar::-webkit-scrollbar,
    .contact-list::-webkit-scrollbar,
    .messages::-webkit-scrollbar {
      width: 6px;
    }

    .sidebar::-webkit-scrollbar-track,
    .contact-list::-webkit-scrollbar-track,
    .messages::-webkit-scrollbar-track {
      background: transparent;
    }

    .sidebar::-webkit-scrollbar-thumb,
    .contact-list::-webkit-scrollbar-thumb,
    .messages::-webkit-scrollbar-thumb {
      background: #cfd8e3;
      border-radius: 8px;
    }

    .main-resizer {
      position: absolute;
      left: var(--sidebar-w);
      top: 0;
      bottom: 0;
      width: 4px;
      cursor: col-resize;
      background: #dce3eb;
      z-index: 5;
    }

    .chat-area {
      position: absolute;
      left: calc(var(--sidebar-w) + 4px);
      top: 0;
      right: 0;
      bottom: 0;
      display: block;
      min-width: 0;
      min-height: 0;
      background: linear-gradient(180deg, #f1ebe4 0%, #e5ddd5 100%);
      border-radius: 0 8px 8px 0;
      box-shadow: 0 2px 12px 0 rgba(0,0,0,0.1);
      overflow: hidden;
    }

    .chat-info {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      z-index: 2;
      border-bottom: 1px solid var(--line);
      padding: 8px 10px;
      background: #fff;
      overflow: hidden;
    }

    .messages {
      position: absolute;
      top: 90px;
      bottom: 150px;
      left: 0;
      right: 0;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 12px;
      display: block;
      background: transparent;
      scrollbar-width: thin;
      scrollbar-color: #ccd6e2 transparent;
    }

    .composer {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 2;
      border-top: 1px solid var(--line);
      padding: 12px;
      background: transparent;
    }

    .chat-top {
      display: block;
      width: 100%;
      overflow: hidden;
      padding-right: 2px;
    }

    .chat-top.chat-top-head {
      min-height: 52px;
    }

    .chat-head-right {
      float: right;
      width: 56%;
      max-width: 58%;
      text-align: right;
      padding-left: 8px;
      overflow: hidden;
    }

    .chat-head-right .chat-head-avatar {
      float: right;
      width: 40px !important;
      height: 40px !important;
      display: block;
      margin: 2px 0 4px 10px;
      border-radius: 50%;
      border: 1px solid #d7dee7;
      object-fit: cover;
      background: #e8edf3;
    }

    .chat-head-right-text {
      display: block;
      overflow: hidden;
      zoom: 1;
    }

    .chat-head-right .chat-h-name.chat-h-right,
    .chat-head-right .chat-h-phone.chat-h-right {
      text-align: right;
    }

    .chat-head-partner {
      margin-top: 5px;
      text-align: right;
    }

    .chat-head-partner .partner-btn {
      display: inline-block;
      margin-top: 0;
      max-width: 100%;
      text-align: center;
      -webkit-appearance: none;
      appearance: none;
    }

    .chat-head-left {
      float: left;
      width: 42%;
      max-width: 44%;
      overflow: hidden;
      text-align: left;
    }

    .chat-head-left .logo-box {
      width: 36px !important;
      height: 36px !important;
      float: left;
      margin: 2px 8px 2px 0;
      display: block;
      border-radius: 50%;
      border: 1px solid #d7dee7;
      object-fit: cover;
      background: #e8edf3;
    }

    .chat-head-body {
      display: block;
      overflow: hidden;
      zoom: 1;
    }

    .chat-h-name,
    .chat-h-phone {
      display: block;
      width: 100%;
      clear: both;
      word-wrap: break-word;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .chat-h-name {
      font-size: 13px;
      font-weight: 700;
      color: #1e1e1e;
      line-height: 1.25;
    }

    .chat-h-phone {
      font-size: 11px;
      color: #6f7781;
      margin-top: 2px;
      line-height: 1.2;
    }

    .chat-top::after {
      content: "";
      display: block;
      clear: both;
      height: 0;
      font-size: 0;
      line-height: 0;
    }

    .chat-status {
      display: inline-block;
      vertical-align: middle;
      font-size: 12px;
      color: #2f9d4e;
    }

    .chat-status-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: #2fcb5a;
      display: inline-block;
      vertical-align: middle;
      margin-right: 4px;
    }

    .chat-info .partner-btn {
      border: 0;
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 11px;
      font-weight: 700;
      display: inline-block;
      background: #eef5ff !important;
      color: #2f5d9d !important;
      cursor: pointer;
      margin-top: 4px;
      -webkit-appearance: none;
      appearance: none;
    }

    .chat-info .partner-btn.missing,
    #partnerBtn.partner-btn.missing {
      background: #ffeef0 !important;
      color: #c02b3a !important;
      border: 1px solid #ffd1d6 !important;
    }

    .messages::after {
      content: "";
      display: block;
      clear: both;
      height: 0;
      line-height: 0;
      font-size: 0;
    }

    .messages > .empty {
      display: block;
      clear: both;
      float: none;
      width: 100%;
      margin-bottom: 0;
      text-align: center;
    }

    .msg {
      display: block;
      clear: both;
      float: left;
      max-width: 75%;
      margin-bottom: 15px;
      padding: 10px;
      border-radius: 10px;
      position: relative;
      word-wrap: break-word;
      word-break: break-word;
      background-color: #f0f0f0;
      border: 0;
      text-align: left;
      font-size: 13px;
      line-height: 1.35;
      color: #1e1e1e;
      box-sizing: border-box;
    }
    .msg.out {
      float: right;
      clear: both;
      text-align: right;
      background-color: #dcf8c6;
    }

    .msg[data-open-url] {
      cursor: pointer;
    }

    .msg[data-open-url] .msg-media,
    .msg[data-open-url] .msg-media img,
    .msg[data-open-url] .msg-media video,
    .msg[data-open-url] .msg-media audio {
      cursor: pointer;
    }

    .message-content {
      display: block;
      text-align: inherit;
      word-wrap: break-word;
    }

    .message-content img {
      max-width: 250px !important;
      max-height: 250px !important;
      width: auto;
      height: auto;
      display: block;
      margin: 8px 0;
      border-radius: 8px;
      object-fit: contain;
      border: 0;
      box-shadow: none;
      background: transparent;
      background-color: transparent !important;
    }

    .msg-system-banner {
      display: block;
      clear: both;
      float: none;
      width: 100%;
      margin: 10px 0 12px;
      padding: 4px 6px;
      text-align: center;
      font-size: 11px;
      line-height: 1.35;
      color: #6f7781;
      word-wrap: break-word;
      overflow: hidden;
    }

    .msg-system-banner .msg-system-dash {
      color: #b8c0cc;
      letter-spacing: 0;
      white-space: nowrap;
    }

    .msg-system-banner .msg-system-time {
      color: #35506f;
      font-weight: 700;
      white-space: nowrap;
    }

    .msg-system-banner .msg-system-text {
      color: #5f6772;
      font-weight: 600;
    }

    .msg-system-banner.msg-system-banner--dialog-ended .msg-system-time,
    .msg-system-banner.msg-system-banner--dialog-ended .msg-system-text {
      color: #7a0f14 !important;
      font-weight: 700;
    }

    .msg-system-banner.msg-system-banner--dialog-ended .msg-system-dash {
      color: #c99599 !important;
    }

    .msg-system {
      display: block;
      clear: both;
      float: none;
      width: auto;
      max-width: 90%;
      margin: 0 auto 15px;
      background: #e9edf3;
      color: #5f6772;
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 11px;
      line-height: 1.2;
      text-align: center;
    }

    .msg-manager {
      display: block;
      font-size: 11px;
      font-weight: 700;
      margin-bottom: 4px;
      color: #ffffff;
      background: #4caf50;
      border-radius: 999px;
      padding: 2px 9px;
      letter-spacing: 0.2px;
      line-height: 1.5;
      max-width: 100%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      text-align: right;
    }

    .msg:not(.out) .msg-manager {
      text-align: left;
    }

    .msg-date-sep,
    .chat-date-separator {
      display: block;
      clear: both;
      float: none;
      width: auto;
      max-width: 90%;
      margin: 0 auto 15px;
      background: rgba(180,195,215,0.55);
      color: #4a5568;
      border-radius: 999px;
      padding: 3px 12px;
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.2px;
      text-align: center;
      text-transform: none;
      pointer-events: none;
    }

    .msg-time {
      display: block;
      font-size: 0.78em;
      opacity: 0.7;
      margin-top: 4px;
      text-align: right;
    }

    .msg.out .msg-time {
      text-align: right;
    }

    .msg-error {
      margin-top: 6px;
      color: #ffccd1;
      font-size: 11px;
      line-height: 1.25;
      font-weight: 700;
    }

    .msg.has-error {
      border-color: #ef4444;
      box-shadow: inset 0 0 0 1px rgba(239,68,68,0.2);
    }

    .msg:not(.out).has-error .msg-error {
      color: #c02b3a;
    }

    .msg-media {
      margin-bottom: 4px;
    }

    .msg-media img {
      width: auto !important;
      height: auto !important;
      max-width: 280px !important;
      max-height: 280px !important;
      object-fit: contain;
      border-radius: 8px;
      background: transparent !important;
      border: 0 !important;
      box-shadow: none !important;
      display: block;
    }

    .msg-media-link {
      color: inherit;
      text-decoration: none;
    }

    .msg-video,
    .msg-audio {
      max-width: 280px;
      width: 100%;
      display: block;
      border-radius: 8px;
      background: transparent;
      outline: none;
    }

    .msg-file-card {
      display: block;
      border: 1px solid #d7deea;
      border-radius: 10px;
      background: rgba(255,255,255,0.6);
      padding: 7px 10px;
      max-width: 260px;
      text-decoration: none;
      color: inherit;
    }

    .msg.out .msg-file-card {
      background: rgba(255,255,255,0.5);
    }

    .msg-file-head {
      display: block;
      min-width: 0;
    }

    .msg-file-icon {
      width: 28px;
      height: 28px;
      border-radius: 8px;
      background: #e5ebf5;
      color: #35506f;
      display: inline-block;
      vertical-align: middle;
      margin-right: 8px;
      font-size: 12px;
      font-weight: 700;
      line-height: 28px;
      text-align: center;
    }

    .msg-file-meta {
      min-width: 0;
      display: inline-block;
      vertical-align: middle;
      max-width: calc(100% - 40px);
    }

    .msg-file-title {
      display: block;
      font-size: 12px;
      font-weight: 700;
      line-height: 1.2;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .msg-file-type {
      display: block;
      margin-top: 2px;
      font-size: 10px;
      color: #6b7789;
      text-transform: uppercase;
      letter-spacing: 0.2px;
    }

    .msg.media-plain {
      background: transparent !important;
      border: 0 !important;
      box-shadow: none !important;
      padding: 0;
    }

    .msg.media-plain .message-content:empty {
      display: none;
    }

    .msg.media-plain .msg-time {
      color: #5f6772;
      padding: 0 2px;
    }

    .msg-file-name {
      display: block;
      margin-top: 4px;
      font-size: 11px;
      opacity: 0.9;
    }

    .message-content a,
    .reply-text a {
      color: inherit;
      text-decoration: underline;
      text-underline-offset: 2px;
      word-break: break-all;
    }

    .reply-block {
      border-left: 3px solid #9bb8df;
      background: rgba(255,255,255,0.45);
      border-radius: 8px;
      padding: 6px 8px;
      margin-bottom: 6px;
    }

    .msg.out .reply-block {
      border-left-color: #8cb376;
      background: rgba(255,255,255,0.35);
    }

    .reply-label {
      font-size: 10px;
      font-weight: 700;
      opacity: 0.8;
      margin-bottom: 3px;
      text-transform: uppercase;
      letter-spacing: 0.2px;
    }

    .reply-text {
      font-size: 12px;
      line-height: 1.35;
      white-space: pre-wrap;
      word-break: break-word;
    }

    img.emoji {
      height: 1.2em !important;
      width: 1.2em !important;
      margin: 0 0.15em !important;
      vertical-align: middle !important;
      display: inline-block !important;
    }

    .message-content img.twemoji {
      display: inline-block;
      width: 16px !important;
      height: 16px !important;
      margin: 0 1px !important;
      border-radius: 0;
      vertical-align: -0.15em;
      line-height: 1;
    }

    .msg.reaction .message-content img,
    .msg.reaction .message-content img.twemoji {
      width: 20px !important;
      height: 20px !important;
      max-width: 20px !important;
      max-height: 20px !important;
      display: inline-block !important;
      margin: 0 3px !important;
      border-radius: 0 !important;
      object-fit: contain;
      vertical-align: middle;
    }

    .new-msg-notice {
      display: none;
      clear: both;
      width: auto;
      max-width: 100%;
      margin: 0 auto 15px;
      border: 1px solid #bfd8ff;
      background: #eaf3ff;
      color: #1f4f8f;
      border-radius: 999px;
      padding: 4px 10px;
      font-size: 11px;
      font-weight: 700;
      cursor: pointer;
      text-align: center;
    }

    .new-msg-notice.show {
      display: block;
    }

    .composer > .attach-list {
      margin-bottom: 8px;
    }

    .composer > .emoji-panel {
      margin-bottom: 0;
    }

    .composer > .new-msg-notice.show {
      margin-bottom: 8px;
    }

    .composer > .composer-row {
      margin-top: 0;
    }

    .attach-list {
      display: block;
      font-size: 0;
    }

    .attach-item {
      border: 1px solid #d5dbe3;
      border-radius: 999px;
      padding: 4px 8px;
      font-size: 12px;
      line-height: 1.3;
      display: inline-block;
      vertical-align: middle;
      margin: 0 6px 6px 0;
      background: #f5f8fc;
      white-space: nowrap;
    }

    .attach-item span {
      display: inline-block;
      vertical-align: middle;
      max-width: 220px;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-right: 6px;
    }

    .attach-item button {
      border: 0;
      background: transparent;
      color: #ef4444;
      font-weight: 700;
      cursor: pointer;
      padding: 0;
      line-height: 1;
      display: inline-block;
      vertical-align: middle;
    }

    .composer-row {
      position: relative;
      width: 100%;
      box-sizing: border-box;
      min-height: 38px;
      padding-left: 92px;
      padding-right: 92px;
    }

    .composer-row > #emojiToggle,
    .composer-row > #attachBtn,
    .composer-row > #sendBtn,
    .composer-row > #endDialogBtn {
      position: absolute;
      top: 1px;
      width: 40px;
      height: 36px;
      padding: 0;
      text-align: center;
      box-sizing: border-box;
      display: block;
      line-height: 34px;
    }

    .composer-row > #emojiToggle svg,
    .composer-row > #attachBtn svg,
    .composer-row > #sendBtn svg,
    .composer-row > #endDialogBtn svg {
      display: inline-block;
      vertical-align: middle;
      width: 18px;
      height: 18px;
      margin: 0;
    }

    .composer-row > #emojiToggle {
      left: 0;
    }

    .composer-row > #attachBtn {
      left: 48px;
    }

    .composer-row > #sendBtn {
      right: 48px;
    }

    .composer-row > #endDialogBtn {
      right: 0;
    }

    .composer-row > #messageInput {
      display: block;
      width: 100%;
      box-sizing: border-box;
      margin: 0;
    }

    .icon-btn, .send-btn, .end-btn {
      height: 36px;
      border-radius: 18px;
      border: 1px solid #d5dbe3;
      background: #fff;
      color: #4a5663;
      cursor: pointer;
      font-weight: 700;
      padding: 0 10px;
      white-space: nowrap;
    }

    .send-btn,
    .end-btn {
      font-size: 16px;
      line-height: 1;
      min-width: 36px;
      padding: 0;
    }

    .end-btn {
      color: #c02b3a;
      border-color: #ffd1d6;
      background: #fff5f6;
    }

    .send-btn svg,
    .end-btn svg {
      width: 18px;
      height: 18px;
    }

    .icon-btn svg {
      width: 18px;
      height: 18px;
      display: block;
    }

    .composer-row > .icon-btn svg,
    .composer-row > .send-btn svg,
    .composer-row > .end-btn svg {
      margin: 0;
    }

    .send-btn:hover {
      background: #f1f4f8;
      border-color: #c8d3df;
    }

    .end-btn:hover {
      background: #ffeef0;
      border-color: #ffb8bf;
    }

    #messageInput {
      width: 100%;
      min-height: 38px;
      max-height: 120px;
      padding: 8px 10px;
      resize: none;
      line-height: 1.35;
      border-radius: 18px;
      font-size: 16px !important;
    }

    .emoji-panel {
      position: absolute;
      bottom: 60px;
      left: 12px;
      border: 1px solid #ddd;
      background: #fff;
      border-radius: 12px;
      padding: 10px;
      display: none;
      width: 240px;
      z-index: 1000;
      box-shadow: 0 5px 15px rgba(0,0,0,0.1);
      overflow: hidden;
      font-size: 0;
      line-height: 0;
    }
    .emoji-panel.open {
      display: block;
    }
    .emoji-btn {
      border: 0;
      background: transparent;
      color: #44505d;
      font-size: 20px;
      cursor: pointer;
      line-height: 1.1;
      padding: 0;
      border-radius: 6px;
      min-height: 32px;
      width: 32px;
      height: 32px;
      margin: 4px;
      text-align: center;
      vertical-align: top;
      transition: transform 0.1s;
      font-family: inherit !important;
      display: inline-block;
    }
    .emoji-btn:hover {
      background: #f1f4f8;
      transform: scale(1.05);
    }

    .empty {
      text-align: center;
      color: var(--muted);
      font-size: 13px;
      padding: 18px;
    }

    .api-state {
      padding: 6px 10px;
      font-size: 12px;
      color: #b3404d;
      background: #fff3f4;
      border-bottom: 1px solid #ffd2d8;
      display: none;
    }


    .api-state.show {
      display: block;
    }

    @media (max-width: 1200px) {
      .header { height: auto; min-height: 60px; white-space: normal; }
      .account-picker { width: 100%; max-width: 100%; }
    }