/* ─── Dialog list ─── */
    .dialog-list { flex: 1; overflow-y: auto; overflow-x: hidden; }
    .dialog-row {
      display: flex; align-items: center; gap: 12px;
      padding: 10px 11px; margin: 0 8px 2px; border-radius: 14px;
      cursor: pointer; position: relative;
      transition: background .16s var(--ease); user-select: none;
    }
    .dialog-row:hover { background: rgba(255,255,255,.05); }
    .dialog-row.active { background: var(--accent-soft); }
    .dialog-row.active::before { content: none; }
    .dialog-row.is-important .dlg-name::before { content: '★ '; color: var(--amber); font-size: 11px; }
    .dialog-row.is-pinned .dlg-time::before { content: '📌 '; font-size: 10px; }
    .dlg-avatar { position: relative; flex-shrink: 0; }
    .dlg-photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: var(--bg3); display: block; }
    .dlg-initials {
      width: 48px; height: 48px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      font-size: 16px; font-weight: 700; color: #fff;
    }
    .online-dot {
      position: absolute; right: 0; bottom: 0;
      width: 13px; height: 13px; border-radius: 50%;
      background: var(--online); border: 2.5px solid var(--bg2);
    }
    .dlg-info { flex: 1; min-width: 0; }
    .dlg-name { font-size: 14.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .dlg-labels { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
    .dlg-label-tag { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 7px; }
    .dlg-preview { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
    .dlg-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
    .dlg-time { font-size: 11.5px; color: var(--muted); }
    .unread-badge {
      background: var(--accent); color: #fff; font-size: 10px; font-weight: 700;
      min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 2px 8px rgba(79,156,249,.45);
    }
    .dlg-star {
      font-size: 13px; color: var(--amber); opacity: 0;
      transition: opacity .1s; margin-right: -2px;
    }
    .dialog-row:hover .dlg-star, .dialog-row.is-important .dlg-star { opacity: 1; }
    .list-empty { padding: 32px 16px; text-align: center; color: var(--muted); font-size: 13px; }
    .list-loading {
      display: flex; align-items: center; justify-content: center;
      gap: 8px; padding: 24px; color: var(--muted); font-size: 13px;
    }
    .spin { animation: spin .8s linear infinite; display: inline-block; }
    @keyframes spin { to { transform: rotate(360deg); } }

    /* ─── Content pane (right column) ─── */
    .content-pane {
      display: flex; flex-direction: column;
      background: var(--bg2); overflow: hidden;
    }

    /* ─── Chat ─── */
    .chat-empty-state {
      flex: 1; display: flex; flex-direction: column;
      align-items: center; justify-content: center; gap: 14px; color: var(--muted);
      background: var(--empty-chat-bg);
    }
    .chat-empty-state img { display: none !important; }
    .chat-empty-state p { font-size: 13px; color: var(--muted); }
    .chat-empty-state svg { width: 110px; height: 110px; opacity: .5; }
    .chat-active { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
    .chat-hdr {
      display: flex; align-items: center; gap: 11px;
      padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.06);
      flex-shrink: 0; min-height: 56px;
      width: 100%; max-width: 880px; margin: 0 auto;
      background: rgba(17,17,22,.9);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    }
    .chat-back {
      display: none; width: 32px; height: 32px; border: none; background: none;
      color: var(--accent); border-radius: 8px; font-size: 18px;
      align-items: center; justify-content: center;
    }
    .chat-hdr-ava { width: 42px; height: 42px; border-radius: 50%; background: var(--bg3); overflow: hidden; flex-shrink: 0; position: relative; }
    .chat-hdr-ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .chat-hdr-ava span#chatHdrAvaFallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px; }
    .chat-hdr-info { flex: 1; min-width: 0; }
    .chat-hdr-name { font-size: 15.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .chat-hdr-status { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; margin-top: 1px; }
    .chat-hdr-status.online { color: var(--accent); }
    .chat-hdr-status svg { width: 11px; height: 11px; flex-shrink: 0; }
    .chat-hdr-actions { display: flex; gap: 4px; }
    .chat-hdr-actions .icon-btn { width: 36px; height: 36px; border-radius: 10px; font-size: 19px; }
    .chat-history {
      flex: 1; overflow-y: auto; overflow-x: hidden;
      padding: 10px 16px;
      display: flex; flex-direction: column; align-items: stretch;
      background-color: var(--chat-base);
      background-image: var(--chat-bg);
      background-attachment: local;
    }
    .date-pill {
      align-self: center; background: rgba(255,255,255,.05); color: var(--muted);
      font-size: 11px; font-weight: 500; letter-spacing: .2px;
      padding: 3px 12px; border-radius: 20px; margin: 10px 0 7px;
      border: 1px solid rgba(255,255,255,.06);
    }
    .chat-inner { width: 100%; max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 1px; }
    .msg-row { display: flex; align-items: flex-end; gap: 6px; max-width: 66%; }
    .msg-row.out { align-self: flex-end; flex-direction: row-reverse; }
    .msg-row.in  { align-self: flex-start; }
    .msg-ava { width: 26px; height: 26px; border-radius: 50%; background: var(--bg3); overflow: hidden; flex-shrink: 0; margin-bottom: 1px; }
    .msg-ava img { width: 100%; height: 100%; object-fit: cover; }
    .msg-ava.empty { opacity: 0; }
    .msg-bubble {
      padding: 9px 13px; border-radius: var(--bubble-r);
      font-size: 14.5px; line-height: 1.42;
      word-break: break-word; overflow-wrap: break-word;
      cursor: context-menu;
      box-shadow: 0 1px 2px rgba(0,0,0,.12);
    }
    .msg-row.in  .msg-bubble { background: var(--bubble-in); color: var(--text); border-radius: var(--bubble-r) var(--bubble-r) var(--bubble-r) 6px; }
    .msg-row.out .msg-bubble { background: var(--accent); color: #fff; border-radius: var(--bubble-r) var(--bubble-r) 6px var(--bubble-r); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
    .msg-time { font-size: 10px; color: var(--muted); flex-shrink: 0; align-self: flex-end; margin-bottom: 3px; padding: 0 3px; white-space: nowrap; display: none; }
    .msg-text-wrap { display: block; }
    .msg-meta {
      float: right; display: inline-flex; align-items: center; gap: 3px;
      margin: 3px 0 -2px 8px; font-size: 10.5px; white-space: nowrap; user-select: none;
    }
    .msg-row.in  .msg-meta { color: var(--muted); }
    .msg-row.out .msg-meta { color: rgba(255,255,255,.65); }
    .msg-status-icon { font-size: 14px; flex-shrink: 0; }
    .msg-row.out .msg-time { color: rgba(255,255,255,.55); }
    .msg-attach { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 3px; }
    .msg-row.out .msg-attach { color: rgba(255,255,255,.7); }
    .msg-photos { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
    .msg-photo { width: 140px; height: 140px; border-radius: 8px; object-fit: cover; cursor: pointer; }
    .msg-fwd { border-left: 2px solid rgba(255,255,255,.25); padding-left: 8px; margin-top: 4px; font-size: 12px; color: rgba(255,255,255,.7); }
    .msg-link-card {
      display: flex; align-items: center; gap: 10px;
      margin-bottom: 5px; padding: 9px 11px; border-radius: 12px;
      background: rgba(255,255,255,.07); border: none;
      cursor: pointer; text-decoration: none; max-width: 280px; color: inherit;
      transition: background .12s;
    }
    .msg-link-card:hover { background: rgba(255,255,255,.11); }
    .msg-row.out .msg-link-card { background: rgba(255,255,255,.16); }
    .msg-row.out .msg-link-card:hover { background: rgba(255,255,255,.22); }
    .msg-link-thumb {
      width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
      background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center;
      overflow: hidden; color: inherit;
    }
    .msg-link-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .msg-link-thumb i { font-size: 18px; color: inherit; }
    .msg-link-info { min-width: 0; flex: 1; }
    .msg-link-title { font-size: 12.5px; font-weight: 600; color: inherit; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .msg-link-domain { font-size: 11px; opacity: .65; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .msg-row.in .msg-fwd { border-color: var(--accent); color: var(--muted); }
    .chat-composer {
      padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.06);
      display: flex; align-items: flex-end; gap: 8px; flex-shrink: 0;
      background: rgba(17,17,22,.9);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
      width: 100%; max-width: 880px; margin: 0 auto; box-sizing: border-box;
    }
    .composer-area {
      flex: 1; min-width: 0; background: var(--input-bg);
      border: 1px solid rgba(255,255,255,.07); border-radius: 22px;
      padding: 9px 16px; display: flex; align-items: flex-end; gap: 4px;
      transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
    }
    .composer-area:focus-within {
      border-color: rgba(79,156,249,.3);
      box-shadow: 0 0 0 3px rgba(79,156,249,.07);
    }
    .composer-inp {
      flex: 1; background: none; border: none; outline: none;
      color: var(--text); font-size: 13.5px; resize: none;
      max-height: 110px; overflow-y: auto;
    }
    .composer-inp::placeholder { color: var(--muted); }
    .send-btn {
      width: 42px; height: 42px; border: none;
      background: var(--accent); box-shadow: 0 4px 14px var(--accent-soft);
      color: #fff; border-radius: 50%; font-size: 19px;
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
      transition: transform .18s var(--ease), box-shadow .18s var(--ease), opacity .18s;
      box-shadow: 0 4px 16px rgba(79,156,249,.4);
    }
    .send-btn:hover { transform: scale(1.06); box-shadow: 0 6px 24px rgba(79,156,249,.55); }
    .send-btn:active { transform: scale(.92); box-shadow: 0 2px 8px rgba(79,156,249,.3); }
    .send-btn:disabled { opacity: .4; box-shadow: none; }
    /* Context menu */
    .ctx-menu {
      position: fixed; z-index: 9999;
      background: rgba(22,22,30,.96);
      backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
      border: 1px solid rgba(255,255,255,.09);
      border-radius: 14px; padding: 5px; min-width: 168px;
      box-shadow: 0 20px 60px rgba(0,0,0,.7), 0 0 0 0.5px rgba(255,255,255,.05);
    }
    .ctx-item {
      padding: 8px 13px; border-radius: 9px; cursor: pointer;
      font-size: 13px; display: flex; align-items: center; gap: 9px;
      transition: background .14s var(--ease);
    }
    .ctx-item:hover { background: rgba(255,255,255,.08); }
    .ctx-item.danger { color: var(--red); }
    .ctx-sep { height: 1px; background: var(--border); margin: 3px 0; }
    .ctx-reactions {
      display: grid; grid-template-columns: repeat(8, minmax(30px, 1fr)); gap: 3px;
      padding: 7px 6px 8px;
    }

    .message-selection-bar { min-height:58px; padding:9px 16px; border-top:1px solid var(--border); background:var(--surface); display:flex; align-items:center; gap:10px; }
    .message-selection-bar[hidden] { display:none; }
    .message-selection-bar button { border:0; border-radius:10px; background:var(--input-bg); color:var(--text); min-height:38px; padding:0 12px; display:flex; align-items:center; gap:7px; cursor:pointer; }
    .message-selection-bar button:hover { background:var(--hover); }
    .message-selection-bar .selection-close { width:38px; padding:0; justify-content:center; }
    .message-selection-bar .selection-spacer { flex:1; }
    .message-selection-bar .danger { color:var(--red); }
    .msg-select-check { align-self:center; width:28px; height:28px; flex:0 0 28px; border:0; background:transparent; color:var(--muted); font-size:20px; cursor:pointer; }
    .msg-row.selected .msg-select-check { color:var(--accent); }
    .msg-row.selected .msg-bubble { box-shadow:0 0 0 2px var(--accent); }

    @media (max-width: 767px) {
      .message-selection-bar { position:absolute; z-index:28; left:0; right:0; bottom:0; padding-bottom:max(9px,env(safe-area-inset-bottom)); box-shadow:0 -8px 28px rgba(0,0,0,.14); }
      .message-selection-bar button span { display:none; }
      .message-selection-bar button { width:42px; justify-content:center; padding:0; }
    }
    .ctx-reaction {
      width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
      background: transparent; cursor: pointer; font-size: 20px; line-height: 1;
      display: grid; place-items: center; transition: transform .14s var(--ease), background .14s var(--ease);
    }
    .ctx-reaction:hover { transform: scale(1.16); background: rgba(255,255,255,.08); }

    @media (max-width: 767px) {
      .ctx-menu.ctx-mobile {
        inset: auto 12px calc(12px + env(safe-area-inset-bottom)) 12px;
        width: auto; min-width: 0; max-height: min(72vh, 620px); overflow-y: auto;
        border-radius: 18px; padding: 7px;
        animation: ctxSheetIn .2s var(--ease);
      }
      .ctx-mobile .ctx-item { min-height: 48px; padding: 0 14px; border-radius: 12px; font-size: 15px; }
      .ctx-mobile .ctx-item i { width: 24px; font-size: 20px; color: var(--accent); }
      .ctx-mobile .ctx-item.danger i { color: var(--red); }
      .ctx-mobile .ctx-reactions { grid-template-columns: repeat(8, 1fr); padding: 8px 2px 10px; }
      .ctx-mobile .ctx-reaction { width: 100%; height: 40px; font-size: 24px; }
      @keyframes ctxSheetIn { from { opacity:0; transform:translateY(24px) scale(.98); } to { opacity:1; transform:none; } }
    }

    /* ─── Dialog badges ─── */
    .dlg-adv-tag {
      font-size: 10px; padding: 1px 6px; border-radius: 9px;
      background: rgba(245,158,11,.15); color: var(--amber);
      display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0;
    }
    .dlg-note-dot {
      width: 6px; height: 6px; border-radius: 50%;
      background: var(--amber); flex-shrink: 0; margin-left: 4px;
    }
    .local-unread-badge {
      width: 8px; height: 8px; border-radius: 50%;
      background: var(--accent); flex-shrink: 0;
    }
    .dialog-row.local-unread .dlg-name { font-weight: 700; }

    .forward-preview {
      margin-bottom: 12px; padding: 10px 12px; border-left: 3px solid var(--accent);
      border-radius: 8px; background: var(--surface2); color: var(--text2);
      font-size: 12.5px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .forward-dialog-list { max-height: 320px; overflow-y: auto; margin-top: 9px; }
    .forward-dialog {
      width: 100%; min-height: 58px; padding: 7px 8px; display: grid;
      grid-template-columns: 42px minmax(0,1fr) 20px; align-items: center; gap: 10px;
      border: 0; border-radius: 11px; color: var(--text); background: transparent;
      text-align: left; cursor: pointer;
    }
    .forward-dialog:hover { background: var(--surface2); }
    .forward-dialog:disabled { opacity: .5; }
    .forward-dialog img, .forward-dialog-avatar {
      width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
    }
    .forward-dialog-avatar { display:grid; place-items:center; background:var(--accent); color:#fff; font-size:12px; font-weight:700; }
    .forward-dialog strong, .forward-dialog small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .forward-dialog strong { font-size:13.5px; }
    .forward-dialog small { margin-top:3px; color:var(--muted); font-size:11.5px; }
    .forward-dialog > i { color:var(--muted); }

    /* ─── Photo lightbox ─── */
    .lightbox-overlay {
      position: fixed; inset: 0; z-index: 9000;
      background: rgba(0,0,0,.92);
      display: flex; align-items: center; justify-content: center;
    }
    .lightbox-body {
      display: flex; width: 100%; height: 100%; max-width: 1400px; max-height: 92vh; margin: auto;
    }
    .lightbox-media {
      flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center;
      padding: 24px;
    }
    .lightbox-media img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
    .lightbox-sidebar {
      width: 360px; flex-shrink: 0; background: var(--bg2);
      border-left: 1px solid var(--border);
      display: flex; flex-direction: column; height: 100%;
    }
    .lightbox-actions {
      flex-shrink: 0; display: flex; align-items: center; gap: 4px;
      padding: 14px 16px; border-bottom: 1px solid var(--border);
    }
    .lightbox-action-btn {
      display: flex; align-items: center; gap: 6px; padding: 8px 12px;
      border-radius: 9px; border: none; background: var(--bg3); color: var(--text2);
      font-size: 13px; font-weight: 600; cursor: pointer; transition: background .12s, color .12s;
    }
    .lightbox-action-btn:hover { background: var(--bg4); }
    .lightbox-action-btn i { font-size: 18px; }
    .lightbox-action-btn.like.active { color: #e44; background: rgba(228,68,68,.12); }
    .lightbox-views {
      margin-left: auto; display: flex; align-items: center; gap: 5px;
      color: var(--muted); font-size: 12.5px;
    }
    .lightbox-comments { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 16px; }
    .lightbox-comment-item { padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.05); }
    .lightbox-comment-author { font-size: 12.5px; font-weight: 600; color: var(--text); }
    .lightbox-comment-text { font-size: 13px; color: var(--text2); margin-top: 2px; line-height: 1.4; white-space: pre-wrap; }
    .lightbox-comment-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
    .lightbox-comment-row {
      flex-shrink: 0; display: flex; gap: 8px; padding: 12px 16px;
      border-top: 1px solid var(--border);
    }
    .lightbox-comment-inp {
      flex: 1; background: var(--input-bg); border: 1px solid var(--border); border-radius: 20px;
      padding: 9px 16px; color: var(--text); font-family: inherit; font-size: 13.5px; outline: none;
    }
    .lightbox-comment-inp:focus { border-color: var(--accent); }
    .lightbox-comment-send {
      width: 38px; height: 38px; border-radius: 50%; border: none;
      background: var(--accent); color: #fff; cursor: pointer; flex-shrink: 0;
      display: flex; align-items: center; justify-content: center; font-size: 17px;
    }
    .lightbox-close {
      position: absolute; top: 18px; right: 18px; z-index: 2;
      width: 42px; height: 42px; border-radius: 50%; border: none;
      background: rgba(255,255,255,.1); color: #fff; cursor: pointer; font-size: 20px;
      display: flex; align-items: center; justify-content: center; transition: background .12s;
    }
    .lightbox-close:hover { background: rgba(255,255,255,.18); }
    .lightbox-nav {
      position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
      width: 48px; height: 48px; border-radius: 50%; border: none;
      background: rgba(255,255,255,.1); color: #fff; cursor: pointer; font-size: 22px;
      display: flex; align-items: center; justify-content: center; transition: background .12s;
    }
    .lightbox-nav:hover { background: rgba(255,255,255,.18); }
    .lightbox-nav.prev { left: 18px; }
    .lightbox-nav.next { right: 376px; }
    @media (max-width: 900px) {
      .lightbox-sidebar { width: 300px; }
      .lightbox-nav.next { right: 318px; }
    }

    /* ─── Modal overlay ─── */
    .orbit-overlay {
      position: fixed; inset: 0; z-index: 8000;
      background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
      display: flex; align-items: center; justify-content: center;
      opacity: 0; transition: opacity .15s; pointer-events: none;
    }
    .orbit-overlay.active { opacity: 1; pointer-events: auto; }
    .orbit-modal {
      background: var(--bg3); border: 1px solid var(--border);
      border-radius: 16px; padding: 0; overflow: hidden;
      width: 320px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
    }
    .orbit-modal-hdr {
      padding: 16px 16px 10px; border-bottom: 1px solid var(--border);
      font-size: 15px; font-weight: 700;
    }
    .orbit-modal-body { padding: 8px 4px; max-height: 340px; overflow-y: auto; }
    .lp-row {
      display: flex; align-items: center; gap: 10px;
      padding: 9px 14px; cursor: pointer; border-radius: 8px;
      transition: background .1s; position: relative;
    }
    .lp-row:hover { background: rgba(255,255,255,.06); }
    .lp-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
    .lp-name { flex: 1; font-size: 13.5px; }
    .lp-rm {
      width: 22px; height: 22px; border-radius: 50%; border: none;
      background: rgba(255,255,255,.1); color: var(--muted); font-size: 14px;
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: background .1s;
    }
    .lp-rm:hover { background: rgba(255,95,87,.25); color: var(--red); }
    .lp-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
    .orbit-modal-actions { border-top: 1px solid var(--border); display: flex; flex-direction: column; }
    .orbit-action-btn {
      padding: 12px 16px; background: none; border: none; border-top: 1px solid var(--border);
      color: var(--accent); font-size: 14px; text-align: left; cursor: pointer;
      transition: background .1s;
    }
    .orbit-action-btn:first-child { border-top: none; }
    .orbit-action-btn:hover { background: rgba(255,255,255,.04); }
    .orbit-action-btn.cancel { color: var(--muted); }
    .orbit-modal-actions-row { flex-direction:row; justify-content:flex-end; gap:8px; padding:10px 12px; }
    .orbit-modal-actions-row .orbit-action-btn { width:auto; border:0; border-radius:9px; padding:9px 14px; background:var(--accent); color:#fff; text-align:center; }
    .orbit-modal-actions-row .orbit-action-btn.cancel { background:var(--surface3); color:var(--text); }
    .orbit-modal-actions-row .orbit-action-btn.danger { background:var(--red); color:#fff; }
    .orbit-dialog-message { margin:4px 10px 8px; color:var(--text); font-size:13px; line-height:1.5; }
    .orbit-dialog-label { display:block; margin:4px 8px 7px; color:var(--muted); font-size:12px; }
    .orbit-dialog-input { box-sizing:border-box; resize:vertical; min-height:96px; }
    input.orbit-dialog-input { min-height:0; }
    .orbit-dialog-error { min-height:16px; margin:0 8px; color:var(--red); font-size:12px; }
    .post-editor-toolbar { display:flex; align-items:center; gap:7px; padding:8px 0 4px; }
    .post-tool { border:0; border-radius:9px; padding:7px 10px; background:var(--surface3); color:var(--accent); font:inherit; font-size:12px; cursor:pointer; }
    .post-tool:hover { background:var(--accent-soft); }
    .post-link-input { min-width:120px; flex:1; border:1px solid var(--border); border-radius:8px; padding:6px 8px; background:var(--input-bg); color:var(--text); font:inherit; font-size:12px; }
    .post-draft-status { margin-left:auto; color:var(--muted); font-size:10.5px; }
    .post-attachment-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:7px; margin:8px 0; }
    .post-attachment-item { position:relative; aspect-ratio:1; border-radius:9px; overflow:hidden; background:var(--surface3); }
    .post-attachment-item img { width:100%; height:100%; object-fit:cover; display:block; }
    .post-attachment-item button { position:absolute; top:4px; right:4px; width:24px; height:24px; border:0; border-radius:50%; background:rgba(0,0,0,.68); color:#fff; cursor:pointer; }
    /* Quick create label (bottom sheet) */
    .ql-sheet {
      position: fixed; inset: 0; z-index: 9000;
      display: flex; flex-direction: column;
    }
    .ql-backdrop { flex: 1; background: rgba(0,0,0,.45); }
    .ql-body {
      background: var(--bg3); border-radius: 16px 16px 0 0;
      padding: 16px 16px 24px;
    }
    .ql-title { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
    .ql-inp {
      width: 100%; background: var(--bg4); border: none; border-radius: 10px;
      padding: 11px 13px; color: var(--text); font-size: 14px; outline: none;
      margin-bottom: 12px;
    }
    .ql-inp::placeholder { color: var(--muted); }
    .ql-colors { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
    .ql-color-btn {
      width: 28px; height: 28px; border-radius: 50%;
      border: 2px solid transparent; cursor: pointer; flex-shrink: 0;
      transition: border-color .14s, transform .12s;
    }
    .ql-color-btn.sel { border-color: #fff; transform: scale(1.12); }
    .ql-save-btn {
      width: 100%; background: var(--accent); border: none; border-radius: 12px;
      padding: 13px; color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
    }
    .ql-save-btn:disabled { opacity: .6; }

    /* ─── Templates panel ─── */
    .tmpl-panel {
      flex-shrink: 0; border-top: 1px solid var(--border);
      background: var(--bg2); max-height: 240px; overflow-y: auto;
      display: none;
    }
    .tmpl-panel.open { display: block; }
    .tmpl-head {
      display: flex; align-items: center; justify-content: space-between;
      padding: 10px 14px 6px; border-bottom: 1px solid var(--border);
    }
    .tmpl-head-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
    .tmpl-empty { padding: 16px 14px; color: var(--muted); font-size: 13px; }
    .tmpl-item {
      padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border);
      transition: background .1s; position: relative; display: flex; align-items: flex-start; gap: 10px;
    }
    .tmpl-item:last-child { border-bottom: none; }
    .tmpl-item:hover { background: rgba(255,255,255,.04); }
    .tmpl-info { flex: 1; min-width: 0; }
    .tmpl-name { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
    .tmpl-body { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tmpl-del {
      width: 22px; height: 22px; border-radius: 50%; border: none;
      background: none; color: var(--muted); font-size: 14px;
      display: flex; align-items: center; justify-content: center; flex-shrink: 0;
      cursor: pointer; transition: background .1s, color .1s;
    }
    .tmpl-del:hover { background: rgba(255,95,87,.2); color: var(--red); }
    .tmpl-btn {
      width: 40px; height: 40px; border: none; background: none;
      color: var(--muted); border-radius: 50%; font-size: 21px;
      display: flex; align-items: center; justify-content: center;
      transition: color .12s, background .12s; flex-shrink: 0;
    }
    .tmpl-btn:hover { color: var(--text); }
    .tmpl-btn.active { color: var(--accent); }
    .dlg-processed-tag { display:inline-flex; align-items:center; gap:2px; padding:1px 5px; border-radius:6px; background:rgba(75,179,75,.13); color:#4bb34b; font-size:9px; font-weight:600; }
    .dialog-row.is-processed { opacity:.72; }
    .dlg-sla-tag { display:inline-flex; align-items:center; gap:2px; padding:1px 5px; border-radius:6px; background:rgba(232,71,71,.12); color:var(--red); font-size:9px; font-weight:600; }
    .dlg-assignee-tag { display:inline-flex; align-items:center; gap:3px; max-width:110px; padding:1px 6px; border-radius:6px; background:var(--accent-soft); color:var(--accent); font-size:9px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .workflow-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; padding:0 14px 10px; }
    .workflow-metric { min-width:0; border:1px solid var(--border); border-radius:9px; padding:6px 7px; background:var(--surface2); color:var(--muted); text-align:left; cursor:pointer; }
    .workflow-metric strong { display:block; color:var(--text); font-size:14px; line-height:1; }
    .workflow-metric span { display:block; margin-top:3px; font-size:9px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .workflow-metric.danger strong { color:var(--red); }
    .workflow-metric.success strong { color:#4bb34b; }
    .workflow-metric.active { border-color:var(--accent); box-shadow:0 0 0 1px var(--accent); }
    @media (max-width:599px) { .workflow-summary { grid-template-columns:repeat(2,minmax(0,1fr)); } }

    /* ─── Emoji picker panel ─── */
    .emoji-panel {
      position: absolute; right: 16px; bottom: 72px; z-index: 40;
      width: min(360px, calc(100% - 24px)); height: min(430px, calc(100% - 104px));
      display: none; flex-direction: column; overflow: hidden;
      border: 1px solid var(--border-strong); border-radius: 12px;
      background: color-mix(in srgb, var(--surface) 96%, transparent);
      box-shadow: 0 16px 44px rgba(0,0,0,.36);
      backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    }
    .emoji-panel.open { display: flex; }
    .emoji-panel-title {
      flex: 0 0 auto; padding: 12px 14px 5px;
      color: var(--muted); font-size: 12px; font-weight: 600;
    }
    .emoji-search-bar {
      display: none;
    }
    .emoji-search-inp {
      width: 100%; background: var(--bg3); border: none; border-radius: 9px;
      padding: 7px 12px; color: var(--text); font-size: 13px; outline: none;
    }
    .emoji-search-inp::placeholder { color: var(--muted); }
    .emoji-cats-row {
      order: 3; display: flex; justify-content: space-around;
      border-top: 1px solid var(--border);
      overflow-x: auto; flex-shrink: 0; padding: 2px 6px 3px;
    }
    .emoji-cats-row::-webkit-scrollbar { height: 2px; }
    .emoji-cat-tab {
      flex: 1 0 34px; min-width: 34px; height: 38px; padding: 0; font-size: 18px;
      font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
      background: none; border: none; border-top: 2px solid transparent;
      cursor: pointer; opacity: .45; transition: opacity .12s, border-color .12s, background .12s;
      border-radius: 7px;
    }
    .emoji-cat-tab:hover { opacity: .8; }
    .emoji-cat-tab.active { opacity: 1; color: var(--accent); background: var(--accent-soft); border-top-color: var(--accent); }
    .emoji-scroll {
      order: 2; flex: 1; overflow-y: auto; overflow-x: hidden;
      padding: 1px 10px 8px;
      display: grid; grid-template-columns: repeat(12, minmax(0, 1fr));
      align-content: start; gap: 0;
      scrollbar-gutter: stable;
    }
    .emoji-cat-lbl {
      grid-column: 1 / -1; font-size: 12px; font-weight: 600;
      color: var(--muted); letter-spacing: 0;
      padding: 10px 3px 5px;
    }
    .emoji-btn {
      width: 100%; aspect-ratio: 1; min-width: 0; padding: 1px; border: none;
      font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
      font-size: 22px; font-variant-emoji: emoji; line-height: 1;
      background: none; cursor: pointer; border-radius: 6px;
      transition: background .1s, transform .1s; display: flex; align-items: center; justify-content: center;
    }
    .emoji-btn:hover { background: var(--accent-soft); transform: scale(1.12); }

    @media (max-width: 599px), (max-width: 767px) and (max-height: 599px) {
      .emoji-panel {
        right: 8px; bottom: 68px; width: calc(100% - 16px);
        height: min(430px, calc(100% - 92px)); border-radius: 12px;
      }
      .emoji-scroll { grid-template-columns: repeat(11, minmax(0, 1fr)); padding-inline: 8px; }
      .emoji-btn { font-size: 21px; }
    }

    /* ─── Attach pending bubble ─── */
    .msg-attach-pending { opacity: .6; font-style: italic; }
    .msg-attach-img { max-width: 200px; max-height: 200px; border-radius: 10px; margin-top: 6px; object-fit: cover; }
    .msg-audio { width:min(260px, 70vw); height:38px; margin-top:5px; display:block; }
    .msg-reactions { display:flex; flex-wrap:wrap; gap:4px; margin-top:5px; }
    .msg-reaction { padding:2px 7px; border:1px solid transparent; border-radius:12px; background:rgba(255,255,255,.14); color:inherit; font:inherit; font-size:12px; cursor:pointer; }
    .msg-reaction.active { border-color:var(--accent); background:var(--accent-soft); }
    .dialog-attachment-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:7px; max-height:55vh; overflow:auto; }
    .dialog-attachment-photo { border:0; padding:0; background:var(--surface3); aspect-ratio:1; border-radius:9px; overflow:hidden; cursor:pointer; }
    .dialog-attachment-photo img { width:100%; height:100%; object-fit:cover; display:block; }
    .dialog-attachment-file { grid-column:1/-1; padding:9px; border-radius:9px; background:var(--surface3); }
