/* ==========================================================================
   SyncDesk UI — WhatsApp-style, светлая и тёмная темы.
   Тема переключается атрибутом <html data-theme="light|dark"> (см. syncdesk.js).
   ========================================================================== */

:root,
:root[data-theme="light"] {
  color-scheme: light;

  --bg-app: #f0f2f5;
  --bg-sidebar: #ffffff;
  --bg-chat: #efeae2;
  --bg-panel: #ffffff;
  --bg-header: #f0f2f5;
  --bg-input: #f0f2f5;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f6f6;
  --bg-card-active: #e9edef;
  --bg-overlay: rgba(11, 20, 26, 0.55);
  --bg-subtle: #f7f8fa;

  --bubble-out: #d9fdd3;
  --bubble-in: #ffffff;
  --bubble-internal-out: #fff1b8;
  --bubble-internal-in: #fff8dc;
  --bubble-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);

  --accent-emerald: #00a884;
  --accent-emerald-hover: #008069;
  --accent-emerald-soft: rgba(0, 168, 132, 0.12);
  --accent-active: #25d366;
  --accent-amber: #c27a00;
  --accent-red: #d93025;
  --accent-blue: #1d6fd1;
  --tick-read: #53bdeb;
  --tick-sent: #8696a0;

  --text-primary: #111b21;
  --text-secondary: #54656f;
  --text-muted: #8696a0;
  --text-link: #027eb5;
  --on-accent: #ffffff;

  --border-color: #e9edef;
  --border-subtle: rgba(17, 27, 33, 0.08);

  --chat-dot: rgba(11, 20, 26, 0.045);
  --hover-tint: rgba(11, 20, 26, 0.06);

  --c-blue: #1d6fd1;
  --c-amber: #b26b00;
  --c-green: #067a62;
  --c-pink: #c2185b;
  --c-gray: #54656f;
  --c-red: #c5221f;

  --shadow-sm: 0 1px 2px rgba(11, 20, 26, 0.12);
  --shadow-md: 0 4px 14px rgba(11, 20, 26, 0.14);
  --shadow-lg: 0 14px 40px rgba(11, 20, 26, 0.28);
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg-app: #0b141a;
  --bg-sidebar: #111b21;
  --bg-chat: #0b141a;
  --bg-panel: #111b21;
  --bg-header: #202c33;
  --bg-input: #2a3942;
  --bg-card: #182229;
  --bg-card-hover: #202c33;
  --bg-card-active: #2a3942;
  --bg-overlay: rgba(0, 0, 0, 0.7);
  --bg-subtle: #162127;

  --bubble-out: #005c4b;
  --bubble-in: #202c33;
  --bubble-internal-out: #5a4a10;
  --bubble-internal-in: #3a3115;
  --bubble-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.35);

  --accent-emerald: #00a884;
  --accent-emerald-hover: #02906f;
  --accent-emerald-soft: rgba(0, 168, 132, 0.18);
  --accent-active: #25d366;
  --accent-amber: #f5b041;
  --accent-red: #f87171;
  --accent-blue: #60a5fa;
  --tick-read: #53bdeb;
  --tick-sent: #8696a0;

  --text-primary: #e9edef;
  --text-secondary: #8696a0;
  --text-muted: #667781;
  --text-link: #53bdeb;
  --on-accent: #ffffff;

  --border-color: #222d34;
  --border-subtle: rgba(134, 150, 160, 0.15);

  --chat-dot: rgba(255, 255, 255, 0.035);
  --hover-tint: rgba(255, 255, 255, 0.07);

  --c-blue: #60a5fa;
  --c-amber: #fbbf24;
  --c-green: #34d399;
  --c-pink: #f472b6;
  --c-gray: #9ca3af;
  --c-red: #f87171;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, 0.6);
}

:root {
  --font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  --header-h: 60px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-family);
  font-size: 14px;
  background-color: var(--bg-app);
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

button { font-family: inherit; color: inherit; }
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-emerald);
  outline-offset: 1px;
}

/* ----- SVG иконки ----- */
.sync-icon {
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
}

.sync-spin { animation: spin 0.9s linear infinite; }

/* ----- Основной каркас ----- */
.syncdesk-app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  background-color: var(--bg-app);
  overflow: hidden;
  position: relative;
}

.syncdesk-col-left {
  width: clamp(340px, 28vw, 440px);
  flex-shrink: 0;
  height: 100%;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 10;
  transition: transform 0.3s ease;
}

.syncdesk-col-center {
  flex: 1;
  min-width: 0;
  height: 100%;
  background-color: var(--bg-chat);
  background-image: radial-gradient(var(--chat-dot) 1.4px, transparent 1.4px);
  background-size: 22px 22px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: background-color 0.25s ease;
}

.syncdesk-col-right {
  width: 385px;
  flex-shrink: 0;
  height: 100%;
  background-color: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 11;
  overflow: hidden;
  transition: width 0.25s ease, transform 0.3s ease, border-color 0.25s;
}

.syncdesk-col-right > * { min-width: 350px; }

.syncdesk-col-right:not(.open) {
  width: 0;
  border-left-color: transparent;
}

/* ----- Шапки ----- */
.sync-header {
  height: var(--header-h);
  flex-shrink: 0;
  background-color: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px 0 16px;
  user-select: none;
}

.sync-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sync-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.sync-brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--accent-emerald);
}

.sync-title-block {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.sync-title-main {
  font-size: 16px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-title-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----- Кнопки ----- */
.sync-btn-icon {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
  font-size: 20px;
  flex-shrink: 0;
}

.sync-btn-icon:hover { background-color: var(--hover-tint); color: var(--text-primary); }
.sync-btn-icon:active { transform: scale(0.92); }
.sync-btn-icon:disabled { opacity: 0.45; cursor: not-allowed; }
.sync-btn-icon.active { background-color: var(--accent-emerald-soft); color: var(--accent-emerald); }

.sync-btn-icon-sm { width: 28px; height: 28px; font-size: 16px; }

.sync-btn-primary {
  background-color: var(--accent-emerald);
  color: var(--on-accent);
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.sync-btn-primary:hover:not(:disabled) { background-color: var(--accent-emerald-hover); box-shadow: var(--shadow-sm); }
.sync-btn-primary:active:not(:disabled) { transform: scale(0.97); }
.sync-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.sync-btn-secondary {
  background-color: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s, border-color 0.15s;
}

.sync-btn-secondary:hover { background-color: var(--hover-tint); }

.sync-btn-warning {
  background-color: color-mix(in srgb, var(--c-amber) 14%, transparent);
  color: var(--c-amber);
  border: 1px solid color-mix(in srgb, var(--c-amber) 35%, transparent);
  padding: 9px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.15s;
}

.sync-btn-warning:hover { background-color: color-mix(in srgb, var(--c-amber) 24%, transparent); }

.sync-btn-danger {
  background-color: color-mix(in srgb, var(--c-red) 12%, transparent);
  color: var(--c-red);
  border: 1px solid color-mix(in srgb, var(--c-red) 32%, transparent);
  padding: 9px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.15s;
}

.sync-btn-danger:hover:not(:disabled) { background-color: color-mix(in srgb, var(--c-red) 22%, transparent); }
.sync-btn-danger:disabled { opacity: 0.5; cursor: not-allowed; }

.sync-btn-sm { padding: 4px 11px; font-size: 12px; }

/* ----- Выпадающее меню ----- */
.sync-menu-wrap { position: relative; }

.sync-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
}

.sync-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 230px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
  z-index: 100;
  animation: popIn 0.14s ease-out;
  transform-origin: top right;
}

.sync-menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 11px 18px;
  font-size: 14.5px;
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
}

.sync-menu-item .sync-icon { color: var(--text-secondary); font-size: 19px; }
.sync-menu-item:hover { background: var(--bg-card-hover); }
.sync-menu-item.danger, .sync-menu-item.danger .sync-icon { color: var(--accent-red); }
.sync-menu-sep { height: 1px; background: var(--border-color); margin: 6px 0; }

.sync-menu-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px 12px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 6px;
}

/* ----- Аватары ----- */
.sync-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #00a884, #005c4b);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
  position: relative;
  text-transform: uppercase;
  user-select: none;
}

.sync-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
  display: block;
}

.sync-avatar-xl { width: 96px; height: 96px; font-size: 32px; }
.sync-avatar-lg { width: 49px; height: 49px; font-size: 17px; }
.sync-avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.sync-avatar-xs { width: 24px; height: 24px; font-size: 10px; }

.sync-avatar-bot {
  background: linear-gradient(135deg, #8b5cf6, #6366f1) !important;
  color: #fff;
}

.sync-avatar-online::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  border-radius: var(--radius-full);
  background-color: var(--accent-active);
  border: 2px solid var(--bg-header);
  z-index: 2;
}

/* ----- Profile Avatar Wrap ----- */
.sync-profile-avatar-wrap {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto 16px;
  cursor: pointer;
}

.sync-profile-avatar-wrap .sync-avatar {
  width: 100%;
  height: 100%;
  font-size: 34px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  border: 3px solid var(--border-color);
  transition: transform 0.2s, border-color 0.2s;
}

.sync-profile-avatar-wrap:hover .sync-avatar {
  border-color: var(--accent-emerald);
  transform: scale(1.02);
}

.sync-avatar-badge-btn {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-emerald);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-sidebar);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.15s, transform 0.1s;
}

.sync-avatar-badge-btn:hover {
  background: var(--accent-emerald-hover);
  transform: scale(1.1);
}

/* ----- Поиск и фильтры ----- */
.sync-search-bar {
  padding: 8px 12px 6px;
  background-color: var(--bg-sidebar);
  display: flex;
}

.sync-search-input-wrapper {
  background-color: var(--bg-input);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 12px;
  flex: 1;
  color: var(--text-secondary);
  transition: box-shadow 0.15s;
}

.sync-search-input-wrapper:focus-within { box-shadow: 0 0 0 2px var(--accent-emerald); }

.sync-search-input {
  background: transparent;
  border: none;
  outline: none !important;
  color: var(--text-primary);
  font-size: 14px;
  padding: 9px 0;
  width: 100%;
}

.sync-search-input::placeholder { color: var(--text-muted); }

.sync-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px 8px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
}

.sync-chip {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  line-height: 1.3;
  background-color: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sync-chip:hover { background-color: var(--bg-card-active); }

.sync-chip.active {
  background-color: var(--accent-emerald-soft);
  color: var(--accent-emerald-hover);
  font-weight: 600;
}

:root[data-theme="dark"] .sync-chip.active { color: var(--accent-emerald); }

/* ----- Список задач ----- */
.sync-task-list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

.sync-task-card {
  padding: 0 14px 0 12px;
  cursor: pointer;
  display: flex;
  gap: 14px;
  transition: background-color 0.12s;
  position: relative;
  align-items: stretch;
}

.sync-task-card:hover { background-color: var(--bg-card-hover); }
.sync-task-card.active { background-color: var(--bg-card-active); }

.sync-task-card > .sync-avatar { align-self: flex-start; margin: 12px 0; }

.sync-task-card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 0 11px;
  border-bottom: 1px solid var(--border-color);
}

.sync-task-card:last-child .sync-task-card-content { border-bottom-color: transparent; }

.sync-task-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.sync-task-number { color: var(--accent-emerald); font-weight: 600; font-size: 13px; }

.sync-task-title {
  color: var(--text-primary);
  font-weight: 500;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-task-card.unread .sync-task-title { font-weight: 700; }

.sync-task-card.is-closed {
  opacity: 0.65;
}
.sync-task-card.is-closed .sync-task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}
.sync-task-card.is-closed .sync-task-number {
  color: var(--text-muted);
}
.sync-task-card.is-closed .sync-task-preview {
  color: var(--text-muted);
}

.sync-task-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.sync-task-card.unread .sync-task-time { color: var(--accent-emerald); font-weight: 600; }

.sync-task-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 22px;
}

.sync-task-preview {
  color: var(--text-secondary);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sync-task-preview > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.sync-task-card.unread .sync-task-preview { color: var(--text-primary); }
.sync-task-preview .preview-author { color: var(--text-primary); font-weight: 500; flex-shrink: 0; }
.sync-task-preview .preview-lock { color: var(--accent-amber); font-size: 13px; }

.sync-task-end { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.sync-task-footer-row { display: flex; align-items: center; margin-top: 3px; }

.sync-badges-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ----- Галочки прочтения ----- */
.sync-tick { font-size: 16px; color: var(--tick-sent); display: inline-flex; }
.sync-tick.read { color: var(--tick-read); }

/* ----- Бейджи ----- */
.badge-status,
.badge-priority,
.badge-category,
.badge-workitems,
.badge-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  white-space: nowrap;
}

.badge-rating {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.sync-star-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 26px;
}
.sync-star-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 28px;
  color: var(--border-color);
  padding: 0 3px;
  transition: color 0.15s, transform 0.1s;
  line-height: 1;
}
.sync-star-btn:hover {
  transform: scale(1.18);
  color: #f59e0b;
}
.sync-star-btn.active {
  color: #f59e0b;
}

.badge-status {
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-status-new { background: color-mix(in srgb, var(--c-blue) 15%, transparent); color: var(--c-blue); }
.badge-status-assigned { background: color-mix(in srgb, var(--c-amber) 15%, transparent); color: var(--c-amber); }
.badge-status-inprogress { background: color-mix(in srgb, var(--c-green) 15%, transparent); color: var(--c-green); }
.badge-status-awaitingclient { background: color-mix(in srgb, var(--c-pink) 15%, transparent); color: var(--c-pink); }
.badge-status-closed { background: color-mix(in srgb, var(--c-gray) 15%, transparent); color: var(--c-gray); }
.badge-status-cancelled { background: color-mix(in srgb, var(--c-red) 15%, transparent); color: var(--c-red); }

.badge-priority { padding: 2px 8px; font-size: 10.5px; font-weight: 700; }
.badge-priority-critical { background: #d93025; color: #fff; }
.badge-priority-high { background: color-mix(in srgb, var(--c-red) 16%, transparent); color: var(--c-red); }
.badge-priority-normal { background: color-mix(in srgb, var(--c-blue) 14%, transparent); color: var(--c-blue); }
.badge-priority-low { background: color-mix(in srgb, var(--c-gray) 14%, transparent); color: var(--c-gray); }

.badge-category { padding: 2px 8px; font-size: 11px; background: var(--bg-input); color: var(--text-secondary); }

.badge-workitems {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald-hover);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
}

:root[data-theme="dark"] .badge-workitems { color: var(--accent-emerald); }

.sync-unread-badge {
  background-color: var(--accent-active);
  color: #0b141a;
  font-weight: 700;
  font-size: 12px;
  height: 20px;
  min-width: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sync-unread-badge.on-icon {
  position: absolute;
  top: 2px;
  right: 0;
  height: 17px;
  min-width: 17px;
  font-size: 10.5px;
  padding: 0 4px;
  border: 2px solid var(--bg-header);
  box-sizing: content-box;
}

/* ----- Пустые состояния ----- */
.sync-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
  color: var(--text-secondary);
  gap: 8px;
}

.sync-empty-icon { font-size: 42px; color: var(--text-muted); opacity: 0.8; }

.sync-welcome {
  margin: auto;
  max-width: 460px;
  width: calc(100% - 32px);
  background: var(--bg-sidebar);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  text-align: center;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.35s;
}

.sync-welcome-badge {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-emerald), #25d366);
  color: #fff;
  font-size: 40px;
  box-shadow: 0 8px 22px rgba(0, 168, 132, 0.35);
  margin-bottom: 8px;
}

.sync-welcome h3 { font-size: 22px; font-weight: 500; }
.sync-welcome p { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

.sync-welcome-hint {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ----- Вкладки чата ----- */
.sync-chat-tabs {
  display: flex;
  background-color: var(--bg-header);
  border-top: 1px solid var(--border-color);
  padding: 0 16px;
  gap: 4px;
  flex-shrink: 0;
}

.sync-chat-tab {
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s, border-color 0.15s;
  user-select: none;
}

.sync-chat-tab:hover { color: var(--text-primary); }
.sync-chat-tab.active { color: var(--accent-emerald); border-bottom-color: var(--accent-emerald); }
.sync-chat-tab.tab-internal.active { color: var(--accent-amber); border-bottom-color: var(--accent-amber); }

/* ----- Баннеры ----- */
.sync-banner {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  flex-wrap: wrap;
  animation: fadeIn 0.3s;
  flex-shrink: 0;
}

.sync-banner-text { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }

.sync-banner-offer {
  background-color: var(--accent-emerald-soft);
  border-bottom: 1px solid color-mix(in srgb, var(--accent-emerald) 35%, transparent);
  color: var(--text-primary);
}

.sync-banner-offer .sync-icon { color: var(--accent-emerald); }

.sync-banner-approval {
  background-color: color-mix(in srgb, var(--c-amber) 13%, var(--bg-sidebar));
  border-bottom: 1px solid color-mix(in srgb, var(--c-amber) 35%, transparent);
  color: var(--text-primary);
}

.sync-banner-approval .sync-icon { color: var(--c-amber); }

.sync-banner-internal {
  background-color: color-mix(in srgb, var(--c-amber) 12%, var(--bg-sidebar));
  border-bottom: 1px solid color-mix(in srgb, var(--c-amber) 30%, transparent);
  color: var(--text-secondary);
  font-size: 12.5px;
  justify-content: center;
}

.sync-banner-internal .sync-icon { color: var(--c-amber); }

.sync-banner-readonly {
  background: var(--bg-header);
  color: var(--text-secondary);
  justify-content: center;
  border-top: 1px solid var(--border-color);
  padding: 16px;
}

/* ----- Лента сообщений ----- */
.sync-chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 14px 6% 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

.sync-date-chip {
  align-self: center;
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: var(--bubble-shadow);
  margin: 10px 0 8px;
  user-select: none;
}

.sync-message-row {
  display: flex;
  width: 100%;
  animation: msgIn 0.18s ease-out;
  align-items: flex-start;
  gap: 8px;
}

.sync-message-row.outgoing { justify-content: flex-end; }
.sync-message-row.incoming { justify-content: flex-start; }
.sync-message-row.first-in-group { margin-top: 6px; }

.sync-msg-avatar-col {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  margin-top: 2px;
}

.sync-msg-avatar-placeholder {
  width: 32px;
  height: 32px;
}

.sync-message-row.system { justify-content: center; margin: 6px 0; }

.sync-system-msg {
  background: var(--bg-sidebar);
  color: var(--text-secondary);
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 8px;
  box-shadow: var(--bubble-shadow);
  max-width: 80%;
  text-align: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sync-message-bubble {
  max-width: min(68%, 560px);
  min-width: 90px;
  padding: 6px 8px 6px 10px;
  border-radius: 8px;
  position: relative;
  box-shadow: var(--bubble-shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-primary);
}

.sync-message-row.outgoing .sync-message-bubble { background-color: var(--bubble-out); }
.sync-message-row.incoming .sync-message-bubble { background-color: var(--bubble-in); }
.sync-message-row.outgoing.first-in-group .sync-message-bubble { border-top-right-radius: 0; }
.sync-message-row.incoming.first-in-group .sync-message-bubble { border-top-left-radius: 0; }

.sync-message-bubble.bubble-internal-out {
  background-color: var(--bubble-internal-out);
  border: 1px solid color-mix(in srgb, var(--c-amber) 35%, transparent);
}

.sync-message-bubble.bubble-internal-in {
  background-color: var(--bubble-internal-in);
  border: 1px solid color-mix(in srgb, var(--c-amber) 28%, transparent);
}

.sync-message-sender {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sync-message-sender.sender-bot { color: #a55bd6; }

.sync-message-role-tag {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--hover-tint);
  color: var(--text-secondary);
  font-weight: 500;
}

.sync-message-text {
  font-size: 14.2px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  padding-right: 4px;
}

.sync-message-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  user-select: none;
  align-self: flex-end;
}

.sync-message-row.outgoing .sync-message-meta { color: var(--text-secondary); }

.sync-message-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.sync-reaction-pill {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 1px 7px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: background-color 0.15s;
  user-select: none;
}

.sync-reaction-pill:hover { background-color: var(--bg-card-hover); }
.sync-reaction-pill.reacted { border-color: var(--accent-emerald); background-color: var(--accent-emerald-soft); }

/* ----- Вложения ----- */
.sync-attachments { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }

.sync-att-image {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  max-width: 100%;
  line-height: 0;
}

.sync-att-image img {
  display: block;
  max-width: 100%;
  width: auto;
  max-height: 320px;
  min-width: 180px;
  object-fit: cover;
  border-radius: 6px;
  transition: filter 0.15s;
}

.sync-att-image:hover img { filter: brightness(0.92); }

.sync-att-image .sync-att-zoom {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(11, 20, 26, 0.6);
  color: #fff;
  border-radius: 6px;
  padding: 4px;
  display: inline-flex;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.15s;
}

.sync-att-image:hover .sync-att-zoom { opacity: 1; }

.sync-att-placeholder {
  width: 240px;
  height: 140px;
  max-width: 100%;
  border-radius: 6px;
  background: var(--hover-tint);
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.3;
}

.sync-att-placeholder .sync-icon { font-size: 26px; }

.sync-attachment-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--hover-tint);
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
  min-width: 220px;
  transition: background-color 0.15s;
}

.sync-attachment-card:hover { background: color-mix(in srgb, var(--text-muted) 25%, transparent); }

.sync-att-file-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--accent-emerald);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.sync-att-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sync-att-name { font-size: 13.5px; font-weight: 500; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.sync-att-size { font-size: 11.5px; color: var(--text-secondary); }

/* ----- Предпросмотр (лайтбокс) ----- */
.sync-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(5, 10, 14, 0.92);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.18s;
  outline: none;
}

.sync-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  color: #e9edef;
}

.sync-lightbox-bar .sync-btn-icon { color: #e9edef; }
.sync-lightbox-bar .sync-btn-icon:hover { background: rgba(255, 255, 255, 0.12); }
.sync-lightbox-name { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sync-lightbox-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px 24px;
  overflow: auto;
}

.sync-lightbox-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
  transition: transform 0.2s ease;
}

.sync-lightbox-stage img.zoomed {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

/* ----- Поле ввода ----- */
.sync-chat-composer {
  background-color: var(--bg-header);
  padding: 8px 12px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.sync-composer-box {
  flex: 1;
  min-width: 0;
  background-color: var(--bg-sidebar);
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--bubble-shadow);
}

:root[data-theme="dark"] .sync-composer-box { background-color: var(--bg-input); }

.sync-composer-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.4;
  padding: 11px 16px;
  max-height: 140px;
  overflow-y: auto;
  outline: none !important;
  resize: none;
  font-family: inherit;
}

.sync-composer-input::placeholder { color: var(--text-muted); }

.sync-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent-emerald);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s, transform 0.1s, opacity 0.15s;
}

.sync-send-btn:hover:not(:disabled) { background: var(--accent-emerald-hover); }
.sync-send-btn:active:not(:disabled) { transform: scale(0.93); }
.sync-send-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.sync-pending {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px 4px;
  background: var(--bg-header);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sync-pending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 5px 6px 5px 5px;
  max-width: 260px;
}

.sync-pending-thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--hover-tint);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  overflow: hidden;
}

.sync-pending-thumb img { width: 100%; height: 100%; object-fit: cover; }

.sync-typing {
  padding: 2px 6%;
  font-size: 12.5px;
  color: var(--accent-emerald);
  font-style: italic;
  min-height: 20px;
}

/* ----- Правая панель ----- */
.sync-details-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
  background: var(--bg-app);
}

.sync-section {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.sync-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.12s;
}

.sync-section-head:hover { background: var(--bg-card-hover); }

.sync-section-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.sync-section-head-left > span:not(.sync-section-count) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-section-head-left .sync-icon {
  color: var(--accent-emerald);
  font-size: 16px;
  flex-shrink: 0;
}

.sync-section-count {
  background: var(--accent-emerald-soft);
  color: var(--accent-emerald-hover);
  border-radius: var(--radius-full);
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
  min-width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

:root[data-theme="dark"] .sync-section-count { color: var(--accent-emerald); }

.sync-section-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sync-section-head-right .sync-btn-sm {
  padding: 3px 8px;
  font-size: 11.5px;
  height: 25px;
  gap: 4px;
}

.sync-section-chevron {
  color: var(--text-muted);
  transition: transform 0.22s ease;
  font-size: 18px;
  flex-shrink: 0;
}

.sync-section.collapsed .sync-section-chevron { transform: rotate(-90deg); }

.sync-section-body {
  padding: 2px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: slideDown 0.18s ease-out;
}

.sync-section-title {
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sync-prop-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13.5px; }
.sync-prop-row > span:first-child { color: var(--text-secondary); }
.sync-prop-row > span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }

.sync-person-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}

.sync-person-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.sync-person-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sync-person-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-person-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sync-person-row .sync-btn-sm {
  padding: 3px 8px;
  font-size: 11.5px;
  height: 26px;
  gap: 4px;
}

.sync-muted-note { color: var(--text-muted); font-size: 13px; padding: 2px 0; }

.sync-action-stack { display: flex; flex-direction: column; gap: 8px; }
.sync-action-stack > button { width: 100%; justify-content: flex-start; padding: 10px 16px; }

.sync-workitem-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background-color: var(--bg-input);
  border-radius: var(--radius-sm);
  gap: 10px;
  transition: background-color 0.15s;
}

:root[data-theme="light"] .sync-workitem-row { background-color: var(--bg-subtle); border: 1px solid var(--border-color); }

.sync-workitem-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sync-workitem-title { font-size: 13.5px; color: var(--text-primary); }
.sync-workitem-title.done { text-decoration: line-through; color: var(--text-muted); }
.sync-workitem-assignee { font-size: 11.5px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }

.sync-progress {
  height: 6px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.sync-progress > div {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-emerald), var(--accent-active));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.sync-history-item { border-left: 2px solid var(--accent-emerald); padding-left: 10px; font-size: 12.5px; }
.sync-history-meta { display: flex; justify-content: space-between; color: var(--text-muted); font-size: 11px; gap: 8px; }
.sync-history-text { font-weight: 500; color: var(--text-primary); margin-top: 2px; }

/* ----- Модальные окна ----- */
.sync-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(3px);
  animation: fadeIn 0.18s;
  padding: 12px;
}

.sync-modal-content {
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: popIn 0.18s ease-out;
}

.sync-modal-header {
  padding: 14px 14px 14px 20px;
  background: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sync-modal-header h3 { font-size: 16.5px; font-weight: 600; }

.sync-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sync-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg-sidebar);
}

.sync-alert-error {
  background: color-mix(in srgb, var(--c-red) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--c-red) 30%, transparent);
  color: var(--c-red);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ----- Формы ----- */
.sync-form-group { display: flex; flex-direction: column; gap: 6px; }
.sync-form-label { font-size: 12.5px; color: var(--accent-emerald-hover); font-weight: 600; }
:root[data-theme="dark"] .sync-form-label { color: var(--accent-emerald); }

.sync-form-control {
  background-color: var(--bg-input);
  border: 1px solid transparent;
  border-bottom: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14.5px;
  padding: 9px 12px;
  outline: none;
  font-family: inherit;
  width: 100%;
}

.sync-form-control:focus { border-bottom-color: var(--accent-emerald); }

/* ----- Выбор пользователей ----- */
.sync-picker-list {
  display: flex;
  flex-direction: column;
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  scrollbar-width: thin;
}

.sync-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  cursor: pointer;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  width: 100%;
  transition: background-color 0.12s;
}

.sync-user-row:last-child { border-bottom: none; }
.sync-user-row:hover { background: var(--bg-card-hover); }
.sync-user-row.selected { background: var(--accent-emerald-soft); }

.sync-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.12s;
  font-size: 14px;
}

.sync-check.radio { border-radius: 50%; }
.sync-user-row.selected .sync-check { background: var(--accent-emerald); border-color: var(--accent-emerald); color: #fff; }

/* ----- Анимации ----- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.96) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ----- Адаптивность ----- */
.sync-back-btn { display: none; }

@media (max-width: 1100px) {
  .syncdesk-col-right {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: min(385px, 100%);
    transform: translateX(100%);
    box-shadow: -8px 0 28px rgba(0, 0, 0, 0.25);
    transition: transform 0.28s ease;
  }
  .syncdesk-col-right:not(.open) { width: min(385px, 100%); }
  .syncdesk-col-right.open { transform: translateX(0); }
}

@media (max-width: 768px) {
  .syncdesk-col-left {
    width: 100%;
    max-width: 100%;
    position: absolute;
    inset: 0;
  }
  .syncdesk-col-left.hide-mobile { transform: translateX(-100%); }

  .syncdesk-col-center {
    width: 100%;
    position: absolute;
    inset: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease;
  }
  .syncdesk-col-center.show-mobile { transform: translateX(0); }

  .sync-back-btn { display: inline-flex; }
  .sync-chat-feed { padding: 10px 10px 8px; }
  .sync-message-bubble { max-width: 86%; }
  .syncdesk-col-right { width: 100%; }
  .syncdesk-col-right:not(.open) { width: 100%; }
  .syncdesk-col-right > * { min-width: 0; }
  .sync-typing { padding: 2px 12px; }
  .sync-welcome { display: none; }
}

@media (max-width: 420px) {
  .sync-header { padding: 0 6px 0 10px; }
  .sync-brand { font-size: 20px; }
  .sync-title-sub { display: none; }
  .sync-task-title { font-size: 15px; }
}

/* ==========================================================================
   WhatsApp Drag & Drop Overlay (Скриншот 1)
   ========================================================================== */
.sync-drop-zone {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sync-drag-overlay {
  position: absolute;
  inset: 16px;
  z-index: 600;
  border: 2.5px dashed var(--accent-emerald);
  border-radius: 20px;
  background-color: color-mix(in srgb, var(--accent-emerald) 14%, var(--bg-chat));
  backdrop-filter: blur(1.5px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--accent-emerald);
  pointer-events: none;
  animation: fadeIn 0.15s ease-out;
  box-shadow: 0 0 0 16px var(--bg-chat);
}

.sync-drag-overlay-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent-emerald) 22%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-emerald);
}

.sync-drag-overlay-title {
  font-size: 21px;
  font-weight: 600;
  color: var(--accent-emerald);
  letter-spacing: -0.2px;
}

.sync-drag-overlay-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ==========================================================================
   WhatsApp Attachment Staging Screen (Скриншот 2)
   ========================================================================== */
.sync-staging-view {
  position: absolute;
  inset: 0;
  z-index: 550;
  background-color: var(--bg-chat);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.16s ease-out;
  overflow: hidden;
}

.sync-staging-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
}

.sync-staging-title-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  flex: 1;
  text-align: center;
}

.sync-staging-filename {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 480px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-staging-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.sync-staging-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: auto;
}

.sync-staging-stage img {
  max-width: min(85%, 680px);
  max-height: min(54vh, 500px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  background-color: var(--bg-card);
}

.sync-staging-doc-card {
  width: 320px;
  max-width: 90%;
  height: 380px;
  max-height: 52vh;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.sync-staging-doc-icon {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent-emerald) 16%, transparent);
  color: var(--accent-emerald);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sync-staging-doc-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-all;
  max-width: 100%;
}

.sync-staging-doc-size {
  font-size: 13px;
  color: var(--text-secondary);
}

.sync-staging-doc-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: auto;
}

.sync-staging-bottom {
  flex-shrink: 0;
  background-color: var(--bg-header);
  padding: 12px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--border-color);
}

.sync-staging-caption-row {
  width: min(650px, 100%);
  display: flex;
  align-items: center;
}

.sync-staging-caption-box {
  flex: 1;
  background-color: var(--bg-input);
  border-radius: 24px;
  display: flex;
  align-items: center;
  padding: 4px 16px;
  gap: 8px;
}

.sync-staging-caption-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none !important;
  color: var(--text-primary);
  font-size: 14.5px;
  padding: 9px 0;
}

.sync-staging-caption-input::placeholder {
  color: var(--text-muted);
}

.sync-staging-strip-row {
  width: min(650px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sync-staging-thumbs-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
}

.sync-staging-thumbs-strip::-webkit-scrollbar { display: none; }

.sync-staging-thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--bg-card);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.15s, transform 0.1s;
}

.sync-staging-thumb:hover { transform: scale(1.04); }
.sync-staging-thumb.active { border-color: var(--accent-emerald); }

.sync-staging-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sync-staging-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(11, 20, 26, 0.7);
  color: #fff;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 11px;
  opacity: 0.85;
}

.sync-staging-thumb-remove:hover { opacity: 1; background: var(--accent-red); }

.sync-staging-add-btn {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  border: 1.5px dashed var(--text-muted);
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s;
}

.sync-staging-add-btn:hover { border-color: var(--accent-emerald); color: var(--accent-emerald); }

.sync-staging-send-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  color: #fff;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  transition: background-color 0.15s, transform 0.1s, opacity 0.15s;
}

.sync-staging-send-btn:hover:not(:disabled) { background-color: var(--accent-emerald-hover); }
.sync-staging-send-btn:active:not(:disabled) { transform: scale(0.93); }
.sync-staging-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   WhatsApp Web Login Screen (Полноэкранная авторизация)
   ========================================================================== */
.sync-login-page {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  align-items: center;
}

.sync-login-top-bar {
  width: 100%;
  height: 220px;
  background-color: var(--accent-emerald);
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 36px;
}

:root[data-theme="dark"] .sync-login-top-bar {
  background-color: #202c33;
}

.sync-login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sync-login-card {
  width: min(580px, 94%);
  margin-top: -140px;
  margin-bottom: 40px;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  padding: 36px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: popIn 0.2s ease-out;
  position: relative;
  z-index: 10;
}

.sync-login-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
}

.sync-login-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
}

.sync-login-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
}

.sync-login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sync-login-divider {
  text-align: center;
  position: relative;
  margin: 10px 0 4px;
}

.sync-login-divider hr {
  border: none;
  border-top: 1px solid var(--border-color);
}

.sync-login-divider span {
  position: relative;
  top: -10px;
  background-color: var(--bg-card);
  padding: 0 12px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.sync-demo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 520px) {
  .sync-demo-grid {
    grid-template-columns: 1fr;
  }
  .sync-login-card {
    padding: 24px 20px;
    margin-top: -150px;
  }
  .sync-login-top-bar {
    padding: 16px 20px;
  }
}

.sync-demo-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.sync-demo-btn:hover {
  background-color: var(--hover-tint);
  border-color: var(--accent-emerald);
  transform: translateY(-1px);
}

.sync-demo-btn-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.sync-demo-btn-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.sync-login-footer-security {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ---------- Делегирование задач ---------- */
.badge-delegation {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.badge-delegation.for-me {
  background: rgba(245, 158, 11, 0.18);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-weight: 700;
  animation: pulseDelegation 2s infinite ease-in-out;
}

@keyframes pulseDelegation {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.02); }
}

.sync-banner-delegation {
  background: rgba(59, 130, 246, 0.12);
  border-left: 4px solid #3b82f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin: 8px 16px 0;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
}

.sync-banner-delegation-info {
  background: rgba(100, 116, 139, 0.08);
  border-left: 4px solid #94a3b8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin: 8px 16px 0;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.sync-delegation-card {
  margin-top: 10px;
  padding: 12px;
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.22);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sync-delegation-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.badge-delegation-pending {
  font-size: 11.5px;
  font-weight: 700;
  color: #2563eb;
  background: rgba(59, 130, 246, 0.15);
  padding: 2px 8px;
  border-radius: 6px;
}

.sync-delegation-time {
  font-size: 11px;
  color: var(--text-secondary);
}

.sync-delegation-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Company Task Grouping & Accordion
   ========================================================================== */

.sync-company-group {
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
}

.sync-company-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, border-color 0.15s ease;
  border-left: 3px solid transparent;
}

.sync-company-accordion-header:hover {
  background: var(--bg-card-hover);
}

.sync-company-accordion-header.expanded {
  background: var(--bg-card-active);
  border-left-color: var(--accent-emerald);
}

.sync-company-chevron {
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}

.sync-company-tasks {
  background: var(--bg-sidebar);
}



