/* =============================================================
   Grist Extension — styles.css
   ============================================================= */

/* ─── SIDEBAR ─────────────────────────────────────────────── */
#gext-sidebar {
  position: fixed;
  bottom: 60px;
  left: 0;
  width: min(250px, calc(100vw - 20px));
  max-height: calc(100vh - 88px);
  background: var(--grist-color-light-bg, #fff);
  border-right: 1px solid #e2e8f0;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 4px 16px rgba(0,0,0,.1);
  z-index: 9996;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  overflow: hidden;
  will-change: transform;
  transition: width .2s ease, transform .28s cubic-bezier(0.16, 1, 0.3, 1);
}

#gext-sidebar.gext-collapsed {
  display: none;
}

#gext-sidebar.gext-collapsed .gext-sidebar-header {
  padding: 10px 6px;
  justify-content: flex-start;
  background: transparent !important;
  border: none !important;
}

#gext-sidebar.gext-collapsed #gext-my-badge,
#gext-sidebar.gext-collapsed .gext-sidebar-title,
#gext-sidebar.gext-collapsed .gext-sidebar-section-title,
#gext-sidebar.gext-collapsed .gext-sidebar-hint {
  display: none;
}

.gext-presence-panel {
  transition: opacity .18s ease;
}

/* Новый пользователь в панели — slide in */
.gext-user-row {
  animation: gext-user-appear .2s ease;
}
@keyframes gext-user-appear {
  from { opacity: 0; transform: translateX(-8px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ─── SIDEBAR HEADER ─────────────────────────────────────── */
.gext-sidebar-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #f7fafc;
}

.gext-sidebar-header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gext-sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gext-sidebar-title {
  flex: 1;
  font-weight: 600;
  color: #2d3748;
}

.gext-sidebar-mode-tabs {
  display: flex;
  gap: 6px;
}

.gext-sidebar-mode {
  border: 1px solid #d7dee8;
  background: #fff;
  color: #4a5568;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.gext-sidebar-mode.active {
  background: #ebf4ff;
  border-color: #90cdf4;
  color: #2b6cb0;
}

.gext-notification-badge {
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e53e3e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

#gext-sidebar-toggle {
  border: none;
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background: transparent;
  color: #718096;
  box-shadow: none;
}
/* закрытый — floating pill, опускается к кнопке чата */
/* закрытый — floating pill */
#gext-sidebar.gext-collapsed {
  display: none;
}


.gext-sidebar-section-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #a0aec0;
}

.gext-sidebar-hint {
  padding: 8px 12px;
  font-size: 11px;
  color: #a0aec0;
}

/* ─── PRESENCE PANEL ─────────────────────────────────────── */
.gext-presence-panel {
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.gext-notifications-panel {
  padding: 8px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.gext-notifications-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gext-notifications-mark-all {
  border: none;
  background: transparent;
  color: #2b6cb0;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.gext-notifications-mark-all:disabled {
  color: #a0aec0;
  cursor: default;
}

.gext-notifications-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gext-notification-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.gext-notification-compose-title,
.gext-notification-compose-body,
.gext-notification-compose-level {
  width: 100%;
  min-width: 0;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
  color: #1a202c;
  font: inherit;
}

.gext-notification-compose-title,
.gext-notification-compose-level {
  height: 34px;
  padding: 0 10px;
}

.gext-notification-compose-body {
  resize: vertical;
  min-height: 62px;
  padding: 8px 10px;
}

.gext-notification-compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gext-notification-compose-level {
  flex: 1;
}

.gext-notification-compose-send {
  flex-shrink: 0;
  height: 34px;
  border: none;
  border-radius: 8px;
  padding: 0 12px;
  background: #2b6cb0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.gext-notification-item {
  border: 1px solid #e2e8f0;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  width: 100%;
}

.gext-notification-item.unread {
  background: #f8fbff;
  border-color: #bee3f8;
}

.gext-notification-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.gext-notification-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.gext-notification-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.gext-notification-title {
  font-size: 12px;
  font-weight: 700;
  color: #1a202c;
}

.gext-notification-time {
  font-size: 10px;
  color: #718096;
  flex-shrink: 0;
}

.gext-notification-text {
  font-size: 11px;
  line-height: 1.45;
  color: #4a5568;
}

.gext-notifications-empty {
  border: 1px dashed #d7dee8;
  background: rgba(148, 163, 184, 0.06);
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  color: #718096;
}

.gext-notifications-empty-icon {
  font-size: 22px;
  margin-bottom: 6px;
}

.gext-notifications-empty-title {
  font-size: 13px;
  font-weight: 700;
  color: #2d3748;
  margin-bottom: 4px;
}

.gext-notifications-empty-sub {
  font-size: 11px;
  line-height: 1.5;
}

.gext-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.07);
}

.gext-user-row:hover {
  background: rgba(148, 163, 184, 0.12);
}

.gext-user-name-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.gext-user-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #2d3748;
  font-size: 13px;
  font-weight: 600;
}

.gext-user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  color: #2563eb;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.gext-user-badge[hidden] {
  display: none !important;
}

.gext-user-status {
  margin-left: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── AVATAR ──────────────────────────────────────────────── */
.gext-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-transform: uppercase;
}

/* ─── ROW PRESENCE BADGE ─────────────────────────────────── */
/* position/top/left/transform задаются inline через getBoundingClientRect */
.gext-presence-badge-row {
  border: 2px solid transparent;
  border-radius: 50%;
  z-index: 9995;
  pointer-events: none;
}

/* ─── НИЖНИЕ КНОПКИ ──────────────────────────────────────── */
#gext-bottom-btns {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 6px;
}

#gext-statusbar-toggle,
#gext-profile-btn,
#gext-media-btn {
  background: #f0f2f5;
  color: #1a1d27;
  border: none;
  border-radius: 20px;
  padding: 4px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: background .15s;
  user-select: none;
  position: relative;
}
#gext-profile-notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #ef4444; color: #fff;
  font-size: 9px; font-weight: 700; line-height: 1;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 4px;
  display: none; align-items: center; justify-content: center;
  border: 2px solid #fff;
  pointer-events: none;
}

#gext-statusbar-toggle:hover,
#gext-profile-btn:hover,
#gext-media-btn:hover { background: #e2e6ea; }

.gext-build-disabled {
  opacity: .58;
  cursor: not-allowed !important;
  filter: grayscale(.25);
}

.gext-build-disabled:hover { background: #f0f2f5 !important; }

/* ─── SHARED TARGET / OVERLAY CONTRACT ───────────────────── */
/* Reusable by shell modules that need target focus, preview glow and tooltip motion. */
.gext-ui-card-backdrop {
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, .12),
    0 32px 120px rgba(0, 0, 0, .38),
    0 8px 32px rgba(0, 0, 0, .18);
}

.gext-ui-target-mask {
  position: fixed;
  top: 0;
  left: 0;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .20), 0 10px 34px rgba(0, 0, 0, .25);
  pointer-events: none;
  transition:
    transform .68s cubic-bezier(.19,1,.22,1),
    width .68s cubic-bezier(.19,1,.22,1),
    height .68s cubic-bezier(.19,1,.22,1),
    border-radius .68s cubic-bezier(.19,1,.22,1),
    opacity .26s ease;
}

.gext-ui-target-tooltip {
  position: fixed;
  top: 0;
  left: 0;
  box-sizing: border-box;
  width: min(340px, calc(100vw - 24px));
  height: auto;
  min-height: 0;
  max-height: calc(100vh - 24px);
  transition:
    transform .68s cubic-bezier(.19,1,.22,1),
    opacity .26s ease;
}

.gext-ui-fading .gext-ui-target-mask,
.gext-ui-fading .gext-ui-target-tooltip {
  opacity: 0;
}

.gext-ui-preview-focus {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100070;
  box-sizing: border-box;
  border: 2px solid rgba(49, 130, 206, .72);
  border-radius: 10px;
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, .14), 0 0 24px rgba(49, 130, 206, .30);
  animation: gext-ui-preview-pulse 1.35s ease-in-out infinite;
  transition:
    transform .24s cubic-bezier(.22,.61,.36,1),
    width .24s cubic-bezier(.22,.61,.36,1),
    height .24s cubic-bezier(.22,.61,.36,1);
}

@keyframes gext-ui-preview-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(49, 130, 206, .10), 0 0 18px rgba(49, 130, 206, .20); }
  50% { box-shadow: 0 0 0 5px rgba(49, 130, 206, .18), 0 0 28px rgba(49, 130, 206, .32); }
}

#gext-edge-nav {
  position: fixed;
  right: var(--gext-edge-nav-right, 12px);
  bottom: 74px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: right .18s ease, transform .28s cubic-bezier(0.16,1,0.3,1), opacity .28s ease;
}

#gext-search-btn,
#gext-scroll-top-btn,
#gext-scroll-bottom-btn {
  width: 30px;
  height: 26px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

#gext-search-btn {
  width: 30px;
  height: 26px;
  font-size: 13px;
}

#gext-search-btn,
#gext-scroll-top-btn,
#gext-scroll-bottom-btn {
  background: #f0f2f5;
  color: #1a1d27;
  border: none;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: background .15s;
  padding: 0;
}

#gext-search-btn:hover,
#gext-scroll-top-btn:hover,
#gext-scroll-bottom-btn:hover { background: #e2e6ea; }

#gext-print-btn {
  background: #f0f2f5;
  color: #1a1d27;
  border: none;
  border-radius: 20px;
  width: 30px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: background .15s;
  padding: 0;
}

#gext-print-btn:hover { background: #e2e6ea; }

#gext-statusbar {
  position: fixed;
  bottom: 40px;
  left: 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 20px;
  font-size: 12px;
  z-index: 9998;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  transition: opacity .2s ease, transform .2s ease;
  background: #f7f8fa;
  color: #1a1d27;
}

#gext-statusbar.gext-bar-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* кнопка-конус — только мобиль */
#gext-bars-toggle {
  display: none;
}

#gext-statusbar-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: opacity .15s ease;
}

.gext-statbar-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.gext-statbar-row-workers {
  border-top: 1px solid #e2e6ea;
  padding-top: 6px;
  gap: 16px;
}

.gext-stat-worker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0,0,0,0.05);
  border-radius: 6px;
  padding: 2px 8px;
}

.gext-stat b {
  color: #1a1d27;
}

.gext-stat-online b {
  color: #276749;
}

/* ─── SPOTLIGHT ──────────────────────────────────────────── */
#gext-spotlight {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.18);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  z-index: 99999;
  animation: gext-fade-in .15s ease;
}

@keyframes gext-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.gext-spotlight-box {
  width: 420px;
  height: 680px;
  background: #ffffff;
  border: 1px solid #e2e6ea;
  border-radius: 14px;
  box-shadow: 0 32px 120px rgba(0,0,0,.45), 0 8px 32px rgba(0,0,0,.2);
  overflow: hidden;
  animation: gext-slide-down .15s ease;
  display: flex;
  flex-direction: column;
}

#gext-spotlight-iframe {
  flex: 1;
  width: 100%;
  border: none;
  display: block;
}

.gext-sp-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(160,174,192,0.3);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: gext-spin 0.7s linear infinite;
}

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

@keyframes gext-slide-down {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.gext-spotlight-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e6ea;
}

.gext-spotlight-icon {
  font-size: 16px;
  opacity: 0.5;
  flex-shrink: 0;
}

#gext-spotlight-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  color: #1a1d27;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#gext-spotlight-input::placeholder { color: #a0aec0; }

.gext-spotlight-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #a0aec0;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  transition: color .12s;
}
.gext-spotlight-close:hover { color: #4a5568; }

#gext-spotlight-results {
  max-height: 360px;
  overflow-y: auto;
}

#gext-spotlight-results::-webkit-scrollbar { width: 4px; }
#gext-spotlight-results::-webkit-scrollbar-track { background: transparent; }
#gext-spotlight-results::-webkit-scrollbar-thumb { background: #2d3555; border-radius: 2px; }

.icon-zoom {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.icon-zoom::after {
  content: '';
  position: fixed;
  width: 120px;
  height: 120px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 99999;
  transform: translate(16px, -50%);
}
.icon-zoom img {
  display: block;
  border-radius: 3px;
}
.icon-zoom:hover::after { opacity: 0; } /* fallback — не работает с attr(data-src) в фоне */

/* реальный зум через <span class="icon-zoom-popup"> */
.icon-zoom-popup {
  position: fixed;
  display: none;
  width: 120px;
  height: 120px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  pointer-events: none;
  z-index: 99999;
  padding: 8px;
  box-sizing: border-box;
}
.icon-zoom-popup img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.icon-zoom:hover .icon-zoom-popup { display: block; }

body.gext-dark .icon-zoom-popup { background:#1e2130; border-color:#3a3f5c; }

.gext-result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  cursor: pointer;
  border-bottom: 1px solid #f0f2f5;
  transition: background .1s;
}

.gext-result-row:hover  { background: #f7f8fa; }
.gext-result-row:last-child { border-bottom: none; }

.gext-result-plate {
  font-weight: 700;
  font-size: 13px;
  color: #2d3748;
  min-width: 95px;
  font-family: 'Courier New', monospace;
  background: #eef0f3;
  padding: 3px 7px;
  border-radius: 5px;
  letter-spacing: .04em;
}

.gext-result-brand {
  flex: 1;
  color: #4a5568;
  font-size: 13px;
}

.gext-result-lk {
  font-size: 11px;
  color: #718096;
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gext-result-status {
  font-size: 12px;
  flex-shrink: 0;
}

.gext-spotlight-empty {
  padding: 32px 20px;
  text-align: center;
  color: #a0aec0;
  font-size: 13px;
}

.gext-spotlight-footer {
  padding: 8px 18px;
  border-top: 1px solid #e2e6ea;
  font-size: 10px;
  color: #a0aec0;
  display: flex;
  gap: 14px;
}

.gext-spotlight-footer kbd {
  background: #eef0f3;
  color: #718096;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-family: inherit;
}

/* ─── TOAST NOTIFICATIONS ────────────────────────────────── */
#gext-toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99998;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.gext-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2d3748;
  color: #fff;
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 280px;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  font-size: 13px;
  pointer-events: all;
  animation: gext-slide-in .2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.gext-toast-app {
  border: none;
  text-align: left;
  cursor: pointer;
}

.gext-toast-success { border-left: 4px solid #68d391; }
.gext-toast-warning { border-left: 4px solid #f6e05e; }
.gext-toast-info    { border-left: 4px solid #63b3ed; }

.gext-toast-text { flex: 1; }

.gext-toast-sub {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: rgba(255,255,255,.84);
  font-weight: 400;
}

.gext-toast-close {
  background: none;
  border: none;
  color: #a0aec0;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  line-height: 1;
}

/* ─── PRESENCE EDGE INDICATOR (строка вне поля зрения) ───── */
.gext-presence-edge {
  position: fixed;
  left: 240px;
  width: fit-content;
  max-width: 260px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 6px;
  border-radius: 6px;
  z-index: 9990;
  pointer-events: none;
  font-size: 11px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #fff;
  opacity: 0.88;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

.gext-presence-edge .gext-avatar {
  width: 18px;
  height: 18px;
  font-size: 9px;
  flex-shrink: 0;
}

.gext-presence-edge-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}

/* ─── COMMENT DOT ────────────────────────────────────────── */
.gext-comment-dot {
  position: absolute;
  top: 2px;
  right: 24px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3182ce;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
}

/* ─── LEFT BTNS ─────────────────────────────────────────── */
#gext-left-btns {
  position: fixed;
  bottom: 8px;
  left: 8px;
  z-index: 9997;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
#gext-sidebar-pill {
  background: #f0f2f5;
  color: #1a1d27;
  border: none;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#gext-sidebar-pill:hover { background: #e2e6ea; }

/* ─── CHAT BUTTON ───────────────────────────────────────── */
#gext-chat-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f0f2f5;
  color: #1a1d27;
  border: none;
  border-radius: 20px;
  padding: 4px 12px 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  transition: background .15s;
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#gext-chat-btn:hover           { background: #e2e6ea; }
#gext-chat-btn.gext-chat-btn-open { background: #3182CE; color: #fff; }
#gext-chat-btn.gext-chat-btn-open:hover { background: #2b6cb0; }

.gext-chat-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #E53E3E;
  color: #fff;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 2px;
}

/* ─── CHAT PANEL ────────────────────────────────────────── */
@keyframes gext-panel-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes gext-panel-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

#gext-chat-panel {
  position: fixed;
  bottom: 44px;
  left: 0;
  width: 280px;
  height: 360px;
  z-index: 9998;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 0 12px 12px 0;
  box-shadow: 2px 4px 20px rgba(0,0,0,.15);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  will-change: transform, opacity;
}
#gext-chat-panel.gext-chat-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: gext-panel-in .28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
#gext-chat-panel.gext-chat-closing {
  visibility: visible;
  pointer-events: none;
  animation: gext-panel-out .2s ease forwards;
}
/* height/width управляется через inline style в chat.js */
#gext-chat-panel {
  transition: height .28s cubic-bezier(0.16,1,0.3,1),
              width  .28s cubic-bezier(0.16,1,0.3,1);
}

.gext-chat-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #f7f8fa;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.gext-chat-hdr-title { font-weight: 700; color: #1a1d27; font-size: 13px; }
.gext-chat-hdr-actions { display: flex; align-items: center; gap: 2px; }
.gext-chat-expand-btn,
.gext-chat-close-btn {
  background: none;
  border: none;
  color: #718096;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gext-chat-expand-btn { font-size: 13px; }
.gext-chat-expand-btn:hover,
.gext-chat-close-btn:hover { background: #e2e6ea; color: #1a1d27; }

.gext-chat-load-more {
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #3182CE;
  padding: 6px;
  cursor: pointer;
  background: #f0f7ff;
  flex-shrink: 0;
  border-bottom: 1px solid #bee3f8;
  transition: background .15s;
}
.gext-chat-load-more:hover { background: #bee3f8; }

/* Messages area */
#gext-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
}

/* Individual message */
.gext-msg {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 100%;
  padding: 5px 7px 5px 5px;
  border-radius: 8px;
  transition: background .12s;
}
.gext-msg:hover { background: #f0f4f8; }

/* Hover reply pill — sits on the top-right border line */
.gext-msg-reply-btn {
  position: absolute;
  top: 0;
  right: 6px;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,.82);
  border: 1px solid rgba(203,213,224,.7);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 500;
  color: #718096;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  backdrop-filter: blur(4px);
  transition: background .12s, color .12s;
  z-index: 1;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.gext-msg:hover .gext-msg-reply-btn { display: flex; }
.gext-msg-reply-btn:hover { background: rgba(49,130,206,.12); color: #3182CE; border-color: rgba(49,130,206,.3); }

.gext-msg-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Avatar inside message */
.gext-msg-avatar {
  width: 22px;
  height: 22px;
  font-size: 11px;
  flex-shrink: 0;
}

.gext-msg-name {
  font-weight: 600;
  font-size: 12px;
  color: #2d3748;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: text !important;
  -webkit-user-select: text !important;
}
.gext-msg-time { font-size: 10px; color: #a0aec0; flex-shrink: 0; }

/* Reply preview inside message */
.gext-msg-reply {
  background: #f0f4f8;
  border-left: 3px solid #3182CE;
  border-radius: 0 4px 4px 0;
  padding: 3px 7px;
  font-size: 11px;
  color: #4a5568;
  overflow: hidden;
  display: flex;
  gap: 4px;
  align-items: baseline;
}
.gext-reply-author { font-weight: 600; color: #3182CE; flex-shrink: 0; }
.gext-reply-text   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #718096; }

/* Message body — отступ под аватарку (22px + 6px gap) */
.gext-msg-body {
  font-size: 13px;
  color: #1a1d27;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
  padding: 1px 0 0 28px;
  user-select: text !important;
  -webkit-user-select: text !important;
  cursor: text;
}

/* Own messages — subtle tint */
.gext-msg-mine .gext-msg-body { color: #1a365d; }
.gext-msg-mine .gext-msg-name { color: #2b6cb0; }

/* Grouped / compact message — no header, tight spacing */
.gext-msg-compact { padding-top: 2px; }
.gext-msg-compact .gext-msg-body {
  padding-left: 28px;
  position: relative;
}
.gext-msg-inline-time {
  display: none;
  font-size: 10px;
  color: #a0aec0;
  margin-left: 6px;
  vertical-align: baseline;
  user-select: none;
}
.gext-msg-compact:hover .gext-msg-inline-time { display: inline; }

/* Scroll-highlight flash */
@keyframes gext-msg-flash {
  0%,100% { background: transparent; }
  30%     { background: #bee3f8; }
}
.gext-msg-highlight { animation: gext-msg-flash .8s ease; }

/* Date separator */
.gext-chat-date-sep {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 4px;
  user-select: none;
}
.gext-chat-date-sep::before,
.gext-chat-date-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}
.gext-chat-date-sep span {
  font-size: 11px;
  color: #a0aec0;
  font-weight: 500;
  white-space: nowrap;
}

/* Empty state */
.gext-chat-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #a0aec0;
  user-select: none;
}

/* Scroll-to-bottom button */
.gext-scroll-down {
  position: absolute;
  bottom: 112px;
  right: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  z-index: 2;
  transition: background .12s;
  color: #4a5568;
}
.gext-scroll-down:hover { background: #f0f4f8; }
.gext-scroll-down-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #E53E3E;
  color: #fff;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* Context menu separator & danger */
.gext-ctx-sep { height: 1px; background: #e2e8f0; margin: 3px 0; }
.gext-ctx-danger       { color: #E53E3E; }
.gext-ctx-danger:hover { background: #fff5f5; color: #E53E3E; }

/* Scrollbar for messages */
#gext-chat-msgs::-webkit-scrollbar       { width: 4px; }
#gext-chat-msgs::-webkit-scrollbar-track { background: transparent; }
#gext-chat-msgs::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 2px; }
#gext-chat-msgs:hover::-webkit-scrollbar-thumb { background: #cbd5e0; }

/* Reply bar (composing) */
.gext-chat-reply-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #ebf8ff;
  border-top: 1px solid #bee3f8;
  flex-shrink: 0;
  font-size: 12px;
}
.gext-reply-inner { display: flex; align-items: baseline; gap: 3px; flex: 1; overflow: hidden; }
.gext-reply-arrow { color: #3182CE; font-size: 13px; flex-shrink: 0; }
.gext-reply-name  { font-weight: 600; color: #2b6cb0; flex-shrink: 0; }
.gext-reply-preview {
  color: #718096;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.gext-reply-cancel {
  background: none;
  border: none;
  color: #718096;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  padding: 1px 4px;
  border-radius: 4px;
  transition: background .15s;
}
.gext-reply-cancel:hover { background: #bee3f8; }

/* Input area */
.gext-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid #e2e8f0;
  background: #f7f8fa;
  flex-shrink: 0;
  position: relative;
}
.gext-emoji-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 2px;
  line-height: 1;
  border-radius: 4px;
  transition: background .15s;
}
.gext-emoji-btn:hover { background: #e2e6ea; }
.gext-chat-input {
  flex: 1;
  border: 1px solid #cbd5e0;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  line-height: 1.4;
  min-height: 32px;
  max-height: 80px;
  background: #fff;
  color: #1a1d27;
  transition: border-color .15s;
}
.gext-chat-input:focus { border-color: #3182CE; }
.gext-chat-submit {
  background: #3182CE;
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 15px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.gext-chat-submit:hover { background: #2b6cb0; }

/* Emoji picker */
.gext-emoji-picker {
  position: absolute;
  bottom: 56px;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  z-index: 1;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.gext-emoji-item {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  padding: 3px;
  line-height: 1;
  transition: background .1s;
  text-align: center;
}
.gext-emoji-item:hover { background: #f0f4f8; }

/* Context menu */
.gext-chat-ctx {
  position: fixed;
  z-index: 10001;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  padding: 4px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13px;
  min-width: 150px;
}
.gext-ctx-item {
  padding: 8px 14px;
  cursor: pointer;
  color: #1a1d27;
  transition: background .12s;
}
.gext-ctx-item:hover          { background: #f0f4f8; }
.gext-ctx-item[data-action="delete"] { color: #E53E3E; }
.gext-ctx-item[data-action="delete"]:hover { background: #fff5f5; }

/* Sidebar transition for chat push */
#gext-sidebar { transition: width .2s ease, bottom .25s ease; }

/* ─── ANIMATIONS ─────────────────────────────────────────── */
@keyframes gext-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── ТЁМНАЯ ТЕМА (класс выставляет JS applyGristTheme) ─────
   Чтобы адаптировать новый элемент — добавь одно правило сюда,
   JS трогать не нужно.
   ──────────────────────────────────────────────────────────── */
body.gext-dark #gext-sidebar                  { background: #1a1d27 !important; border-color: #2d3148; }
body.gext-dark .gext-sidebar-header           { background: #22263a !important; border-color: #2d3148 !important; }
body.gext-dark .gext-sidebar-title,
body.gext-dark .gext-user-name                { color: #e2e8f0; }
body.gext-dark .gext-user-table               { color: #f1f5f9; }
body.gext-dark .gext-user-row                 { background: rgba(148, 163, 184, 0.08); }
body.gext-dark .gext-user-row:hover           { background: rgba(148, 163, 184, 0.14); }
body.gext-dark .gext-user-badge               { background: rgba(96, 165, 250, 0.18); color: #93c5fd; }
body.gext-dark .gext-user-agent               { color: #7c8aa5; }
body.gext-dark .gext-user-status              { background: rgba(15, 23, 42, 0.55); }
body.gext-dark .gext-sidebar-mode             { background: #1a1d27; border-color: #2d3148; color: #cbd5e1; }
body.gext-dark .gext-sidebar-mode.active      { background: rgba(59, 130, 246, 0.18); border-color: rgba(96, 165, 250, 0.45); color: #bfdbfe; }
body.gext-dark .gext-sidebar-section-title,
body.gext-dark .gext-sidebar-hint             { color: #6b7280; }
body.gext-dark #gext-sidebar-toggle           { color: #a0aec0; }
body.gext-dark #gext-sidebar.gext-collapsed #gext-sidebar-toggle { background: #2d3748; color: #e2e8f0; }
body.gext-dark .gext-notifications-mark-all   { color: #93c5fd; }
body.gext-dark .gext-notifications-mark-all:disabled { color: #64748b; }
body.gext-dark .gext-notification-item        { background: #22263a; border-color: #2d3148; }
body.gext-dark .gext-notification-item.unread { background: rgba(43, 108, 176, 0.16); border-color: rgba(96, 165, 250, 0.32); }
body.gext-dark .gext-notification-title       { color: #e2e8f0; }
body.gext-dark .gext-notification-time        { color: #94a3b8; }
body.gext-dark .gext-notification-text        { color: #cbd5e1; }
body.gext-dark .gext-notifications-empty      { background: rgba(148, 163, 184, 0.08); border-color: #3a4157; color: #94a3b8; }
body.gext-dark .gext-notifications-empty-title { color: #e2e8f0; }
body.gext-dark .gext-notification-compose { background: rgba(15, 23, 42, 0.72); border-color: #334155; }
body.gext-dark .gext-notification-compose-title,
body.gext-dark .gext-notification-compose-body,
body.gext-dark .gext-notification-compose-level { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.gext-dark .gext-notification-compose-send { background: #3b82f6; }
body.gext-dark #gext-statusbar                { background: #1a1d27; color: #e2e8f0; }
body.gext-dark .gext-stat b                   { color: #e2e8f0; }
body.gext-dark .gext-stat-online b            { color: #68d391; }
body.gext-dark .gext-statbar-row-workers      { border-color: rgba(255,255,255,0.12); }
body.gext-dark .gext-stat-worker              { background: rgba(255,255,255,0.07); }
body.gext-dark #gext-statusbar-toggle,
body.gext-dark #gext-profile-btn,
body.gext-dark #gext-sidebar-pill,
body.gext-dark #gext-chat-btn,
body.gext-dark #gext-bars-toggle              { background: #22263a; color: #e2e8f0; }
body.gext-dark #gext-statusbar-toggle:hover,
body.gext-dark #gext-profile-btn:hover,
body.gext-dark #gext-sidebar-pill:hover,
body.gext-dark #gext-chat-btn:hover,
body.gext-dark #gext-bars-toggle:hover        { background: #2d3748; }
body.gext-dark #gext-search-btn,
body.gext-dark #gext-scroll-top-btn,
body.gext-dark #gext-scroll-bottom-btn,
body.gext-dark #gext-print-btn                { background: #22263a; color: #e2e8f0; }
body.gext-dark .gext-spotlight-box            { background: #1a1d27; border-color: #2d3148; }
body.gext-dark #gext-spotlight-input          { color: #e2e8f0; }
body.gext-dark .gext-spotlight-header,
body.gext-dark .gext-spotlight-footer         { border-color: #2d3148; }
body.gext-dark .gext-spotlight-close          { color: #6b7280; }
body.gext-dark .gext-result-row               { border-color: #2d3148; }
body.gext-dark .gext-result-row:hover         { background: #2d3748; }
body.gext-dark .gext-result-plate             { background: #22263a; color: #e2e8f0; }
body.gext-dark .gext-result-brand             { color: #a0aec0; }
body.gext-dark #gext-sync-pill                { background: #2d3748; color: #e2e8f0; }

/* ─── ТЁМНАЯ ТЕМА — ЧАТ ─────────────────────────────────── */
body.gext-dark #gext-chat-panel               { background: #1a1d27; }
body.gext-dark .gext-chat-hdr                 { background: #22263a; border-color: #2d3148; }
body.gext-dark .gext-chat-hdr-title           { color: #e2e8f0; }
body.gext-dark .gext-chat-expand-btn,
body.gext-dark .gext-chat-close-btn           { color: #6b7280; }
body.gext-dark .gext-chat-expand-btn:hover,
body.gext-dark .gext-chat-close-btn:hover     { background: #2d3748; color: #e2e8f0; }
body.gext-dark .gext-chat-load-more           { background: #22263a; color: #63b3ed; border-color: #2d3148; }
body.gext-dark .gext-chat-load-more:hover     { background: #2d3748; }
body.gext-dark .gext-msg:hover                { background: #22263a; }
body.gext-dark .gext-msg-name                 { color: #e2e8f0; }
body.gext-dark .gext-msg-body                 { color: #cbd5e0; }
body.gext-dark .gext-msg-mine .gext-msg-name  { color: #90cdf4; }
body.gext-dark .gext-msg-mine .gext-msg-body  { color: #bee3f8; }
body.gext-dark .gext-msg-reply                { background: #22263a; border-color: #3182CE; }
body.gext-dark .gext-msg-reply-btn            { background: rgba(30,33,48,.9); border-color: #3a3f5c; color: #a0aec0; }
body.gext-dark .gext-chat-date-sep::before,
body.gext-dark .gext-chat-date-sep::after     { background: #2d3148; }
body.gext-dark .gext-chat-date-sep span       { color: #6b7280; }
body.gext-dark .gext-chat-empty               { color: #6b7280; }
body.gext-dark .gext-scroll-down              { background: #22263a; border-color: #3a3f5c; color: #a0aec0; }
body.gext-dark .gext-scroll-down:hover        { background: #2d3748; }
body.gext-dark .gext-chat-reply-bar           { background: #1e2235; border-color: #2d3148; }
body.gext-dark .gext-chat-input-area          { background: #22263a; border-color: #2d3148; }
body.gext-dark .gext-chat-input               { background: #1a1d27; border-color: #3a3f5c; color: #e2e8f0; }
body.gext-dark .gext-chat-input:focus         { border-color: #3182CE; }
body.gext-dark .gext-emoji-btn                { color: #a0aec0; }
body.gext-dark .gext-emoji-btn:hover          { background: #2d3748; }
body.gext-dark .gext-emoji-picker             { background: #22263a; border-color: #2d3148; }
body.gext-dark .gext-emoji-item:hover         { background: #2d3748; }
body.gext-dark .gext-chat-ctx                 { background: #1a1d27; border-color: #2d3148; }
body.gext-dark .gext-ctx-item                 { color: #e2e8f0; }
body.gext-dark .gext-ctx-item:hover           { background: #22263a; }
body.gext-dark .gext-ctx-sep                  { background: #2d3148; }
body.gext-dark .gext-mention-dd               { background: #1a1d27; border-color: #2d3148; }
body.gext-dark .gext-mention-item             { color: #e2e8f0; }
body.gext-dark .gext-mention-item:hover,
body.gext-dark .gext-mention-item.active      { background: #22263a; }
body.gext-dark .gext-chat-toast               { background: #22263a; border-color: #2d3148; }
body.gext-dark .gext-toast-name               { color: #e2e8f0; }
body.gext-dark #gext-chat-msgs::-webkit-scrollbar-thumb { background: #3a3f5c; }

.gext-user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  min-width: 0;
}

.gext-user-table {
  font-size: 10px;
  color: #1a1d27;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gext-user-agent {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── SYNC PILL ──────────────────────────────────────────── */
#gext-sync-pill-slot {
  position: relative;
  width: 0;
  overflow: visible;
  flex-shrink: 0;
}

#gext-sync-pill {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  background: #f0f2f5;
  color: #1a1d27;
  border: none;
  border-radius: 20px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
  cursor: default;
  user-select: none;
  opacity: 0.45;
  max-width: 120px;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.4s, max-width 0.35s ease, box-shadow 0.4s;
}

#gext-sync-pill.gext-sync-active {
  opacity: 1;
  max-width: 280px;
}

#gext-sync-pill.gext-sync-active.gext-sync-expanded .gext-sync-dot.ok {
  box-shadow: 0 0 0 0 rgba(72,187,120,0.6);
  animation: gext-sync-pulse 1s ease-out;
}

@keyframes gext-sync-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(72,187,120,0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(72,187,120,0); }
  100% { box-shadow: 0 0 0 0 rgba(72,187,120,0); }
}

.gext-sync-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(203, 213, 224, 0.5);
  flex-shrink: 0;
  transition: background 0.4s, box-shadow 0.4s;
}

.gext-sync-dot.ok   { background: #48bb78; box-shadow: 0 0 4px rgba(72,187,120,0.7); }
.gext-sync-dot.warn { background: #ed8936; box-shadow: 0 0 4px rgba(237,137,54,0.7); }
.gext-sync-dot.err  { background: #fc8181; box-shadow: 0 0 4px rgba(252,129,129,0.7); }

/* ─── CHAT TOAST (уведомление о новом сообщении) ────────── */
#gext-chat-toast-stack {
  position: fixed;
  bottom: 130px;
  left: 8px;
  z-index: 10010;
  display: flex;
  flex-direction: column-reverse;
  gap: 6px;
  pointer-events: none;
}
.gext-chat-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #718096;
  border-radius: 10px;
  padding: 10px 12px;
  width: 260px;
  box-shadow: 0 6px 20px rgba(0,0,0,.13);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 12px;
  cursor: pointer;
  pointer-events: auto;
  animation: gext-toast-in .22s cubic-bezier(.22,1,.36,1);
  user-select: none;
}
.gext-chat-toast.gext-toast-mention {
  border-left-color: #2b6cb0;
  background: #f0f7ff;
}
.gext-chat-toast.gext-toast-out {
  animation: gext-toast-out .2s ease forwards;
}
@keyframes gext-toast-in {
  from { transform: translateX(-110%); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}
@keyframes gext-toast-out {
  to   { transform: translateX(-110%); opacity: 0; }
}
.gext-toast-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
.gext-toast-body {
  flex: 1;
  min-width: 0;
}
.gext-toast-name {
  font-weight: 600;
  color: #2d3748;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}
.gext-toast-mention .gext-toast-name::before {
  content: '@ ';
  color: #2b6cb0;
}
.gext-toast-preview {
  color: #718096;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gext-toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #a0aec0;
  cursor: pointer;
  font-size: 13px;
  padding: 0 0 0 4px;
  line-height: 1;
}
.gext-toast-close:hover { color: #718096; }

/* ─── @ MENTION CHIP ────────────────────────────────────── */
.gext-mention {
  display: inline-block;
  background: #ebf4ff;
  color: #2b6cb0;
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 600;
  font-size: .92em;
  cursor: default;
}

/* ─── MENTION DROPDOWN ──────────────────────────────────── */
.gext-mention-dd {
  position: absolute;
  bottom: 56px;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  max-height: 180px;
  overflow-y: auto;
  z-index: 10002;
  display: none;
}
.gext-mention-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #2d3748;
  transition: background .1s;
}
.gext-mention-item:hover,
.gext-mention-item.active {
  background: #ebf4ff;
}
.gext-mention-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
}

/* ─── MENTION BADGE (@ иконка на кнопке чата) ──────────── */
.gext-mention-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #2b6cb0;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  animation: gext-mention-pulse 1.4s ease infinite;
}
@keyframes gext-mention-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.25); }
}

/* ─── ПЕЧАТЬ — скрываем все кастомные оверлеи ───────────── */
/* ─── МОБИЛЬНЫЕ (touch) ──────────────────────────────────── */
@media (pointer: coarse) {
  /* Кнопки левого стака крупнее, подняты над навигационной панелью браузера */
  #gext-left-btns {
    bottom: 80px;
    left: 8px;
  }
  #gext-sidebar-pill,
  #gext-chat-btn,
  #gext-statusbar-toggle {
    padding: 8px 18px;
    font-size: 14px;
    border-radius: 24px;
    height: auto;
  }
  /* Сайдбар шире и крупнее */
  #gext-sidebar {
    width: 280px;
    font-size: 14px;
    bottom: 140px;
  }
  /* Нижний бар — крупнее и выше над панелью браузера */
  #gext-bottom-btns {
    bottom: 80px;
    gap: 10px;
    z-index: 9997;
  }
  #gext-edge-nav {
    bottom: 140px;
    gap: 8px;
  }
  /* Скрытие всего ui-root */
  #gext-ui-root {
    transition: transform .28s cubic-bezier(0.16,1,0.3,1), opacity .28s ease;
  }
  body.gext-bars-hidden #gext-ui-root {
    transform: translateY(160px);
    opacity: 0;
    pointer-events: none;
  }
  /* Кнопка-конус для возврата панели */
  #gext-bars-toggle {
    display: block;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    background: #f0f2f5;
    border: none;
    border-radius: 16px 16px 0 0;
    padding: 10px 52px 6px;
    font-size: 20px;
    color: #718096;
    box-shadow: 0 -2px 8px rgba(0,0,0,.12);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.gext-bars-hidden #gext-bars-toggle {
    opacity: 1;
    pointer-events: auto;
  }
  #gext-search-btn,
  #gext-scroll-top-btn,
  #gext-scroll-bottom-btn,
  #gext-print-btn {
    width: 42px;
    height: 42px;
    font-size: 18px;
    border-radius: 50%;
  }
  #gext-sync-pill {
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 24px;
    max-width: 160px;
  }
}

/* ─── ОВЕРЛЕЙ ПРОФИЛЯ ─── */
#gext-profile-overlay,
#gext-media-overlay,
#gext-tasks-overlay,
#gext-statistics-overlay,
#gext-spravka-marok-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.18);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  animation: gext-fade-in .15s ease;
}
.gext-profile-box {
  width: min(1100px, 94vw);
  height: min(700px, 90vh);
}
.gext-media-box {
  width: min(1540px, 98vw);
  height: min(940px, 96vh);
}
.gext-tasks-box {
  width: min(1480px, 98vw);
  height: min(940px, 96vh);
}
.gext-statistics-box {
  width: min(1480px, 98vw);
  height: min(940px, 96vh);
}
.gext-spravka-marok-box {
  width: min(1480px, 98vw);
  height: min(940px, 96vh);
}
.gext-media-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #1a1d27;
}
.gext-statistics-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #1a1d27;
}
.gext-spravka-marok-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #1a1d27;
}
#gext-profile-iframe,
#gext-media-iframe,
#gext-tasks-iframe,
#gext-statistics-iframe,
#gext-spravka-marok-iframe {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  border: none;
  display: block;
}
body.gext-dark .gext-profile-box { background: #1a1d27; border-color: #2d3148; }
body.gext-dark .gext-media-box { background: #1a1d27; border-color: #2d3148; }
body.gext-dark .gext-media-title { color: #e2e8f0; }
body.gext-dark .gext-tasks-box { background: #1a1d27; border-color: #2d3148; }
body.gext-dark .gext-tasks-title { color: #e2e8f0; }
body.gext-dark .gext-statistics-box { background: #1a1d27; border-color: #2d3148; }
body.gext-dark .gext-statistics-title { color: #e2e8f0; }
body.gext-dark .gext-spravka-marok-box { background: #1a1d27; border-color: #2d3148; }
body.gext-dark .gext-spravka-marok-title { color: #e2e8f0; }

@media print {
  #gext-sidebar,
  #gext-sidebar-toggle,
  #gext-statusbar,
  #gext-statusbar-toggle,
  #gext-bottom-btns,
  #gext-canvas,
  #gext-toast-container,
  #gext-spotlight,
  #gext-profile-overlay,
  #gext-media-overlay,
  #gext-tasks-overlay,
  #gext-statistics-overlay,
  #gext-spravka-marok-overlay,
  #gext-presence-panel,
  #gext-chat-btn,
  #gext-chat-panel,
  #gext-chat-ctx {
    display: none !important;
  }
}
