:root {
  --primary: #409eff;
  --primary-hover: #66b1ff;
  --border: #dcdfe6;
  --bg: #f5f7fa;
  --text: #303133;
  --muted: #909399;
  --card: #fff;
  --danger: #f56c6c;
  --success: #67c23a;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

.layout {
  display: flex;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
}
.layout.sidebar-collapsed .sidebar {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border: none;
}
.layout.sidebar-collapsed .sidebar-toggle {
  left: 0;
}
.sidebar {
  width: 220px;
  min-width: 220px;
  background: #304156;
  color: #bfcbd9;
  flex-shrink: 0;
  height: 100vh;
  overflow: hidden;
  transition: width 0.2s ease, min-width 0.2s ease;
  z-index: 20;
}
.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 220px;
}
.sidebar-brand {
  margin: 0;
  padding: 16px 14px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid #263445;
  flex-shrink: 0;
  display: block;
  text-decoration: none;
}
.sidebar-brand:hover {
  color: #fff;
}
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.sidebar-nav a {
  display: block;
  padding: 14px 18px;
  color: #bfcbd9;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #263445;
  color: #fff;
  border-left-color: var(--primary);
}
.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid #263445;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: #304156;
}
.sidebar-toggle {
  position: fixed;
  left: 220px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 20px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 6px 6px 0;
  background: var(--card);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06);
  transition: left 0.2s ease, color 0.15s ease;
}
.sidebar-toggle:hover {
  color: var(--primary);
  background: #f0f7ff;
}
.layout.sidebar-collapsed .sidebar-toggle {
  border-left: 1px solid var(--border);
  border-radius: 0 6px 6px 0;
}
.sidebar-btn {
  width: 100%;
  justify-content: center;
  font-size: 13px;
  padding: 8px 10px;
}
.sidebar-btn.btn-primary {
  border-color: var(--primary);
}
.sidebar-status {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre-line;
}
.sidebar-status-busy {
  color: var(--text, #1a1a1a);
  font-weight: 500;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}
.content {
  padding: 20px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { border-color: #c6e2ff; color: var(--primary); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--muted);
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  background: var(--card);
  font-size: 13px;
}
.chip.active { background: #ecf5ff; border-color: #b3d8ff; color: var(--primary); }

.list-filters {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}
.filter-checkbox.hidden { display: none; }
.filter-checkbox input { width: 16px; height: 16px; cursor: pointer; }

.stage-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  border: 1px solid transparent;
}
.stage-blue { background: #e8f4ff; color: #1a6fb5; border-color: #b3d8ff; }
.stage-yellow { background: #fdf6e3; color: #9a7b0a; border-color: #f5e6a8; }
.stage-green { background: #e8f8ef; color: #2d7a46; border-color: #b3e6c8; }
.stage-pay { background: #edf9f0; color: #3d8b5a; border-color: #c8ebd4; }
.stage-red { background: #fdeeee; color: #c45656; border-color: #fbc4c4; }
.stage-default { background: #f4f4f5; color: #606266; border-color: #e4e7ed; }
.stage-deal-progress { background: #e8f4ff; color: #1a6fb5; border-color: #b3d8ff; }
.stage-deal-won { background: #e8f8ef; color: #2d7a46; border-color: #b3e6c8; }
.stage-deal-lost { background: #fdeeee; color: #c45656; border-color: #fbc4c4; }

.stage-chips .chip {
  padding: 2px 4px;
  border: none;
  background: transparent;
  border-radius: 12px;
}
.stage-chips .chip.active {
  background: rgba(64, 158, 255, 0.12);
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.stage-chips .chip .stage-badge { pointer-events: none; }

td .cell-muted { color: var(--muted); font-size: 13px; max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #ebeef5;
}
th { background: #fafafa; font-weight: 500; color: var(--muted); }
tr:hover td { background: #f5f7fa; }

.stats { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.stats-dashboard { margin-bottom: 16px; }
.stat-success b { color: #2d7a46; }

.dashboard-toolbar {
  margin-bottom: 16px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  justify-content: space-between;
}
.date-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-preset {
  padding: 6px 12px;
  font-size: 13px;
}
.btn-preset.active {
  background: #ecf5ff;
  border-color: var(--primary);
  color: var(--primary);
}
.date-range-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.date-range-inputs label { font-size: 13px; color: var(--muted); }
.date-range-inputs input[type="date"] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
}

.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  background: #fff;
  border: 1px solid var(--border);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  font-size: 14px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--primary); }
.toast span { flex: 1; }
.toast-close {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  padding: 0 2px;
}
.toast-close:hover { color: var(--text); }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 20px;
  min-width: 120px;
}
.stat b { display: block; font-size: 22px; margin-top: 4px; }
.stat span { color: var(--muted); font-size: 12px; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-box {
  width: 360px;
  background: var(--card);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.login-box h2 { margin: 0 0 24px; text-align: center; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--muted); }
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}
.responsible-tg-input {
  width: 100%;
  min-width: 140px;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}
.responsible-tg-input:focus {
  outline: none;
  border-color: var(--accent);
}
.responsibles-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
}
.error { color: var(--danger); font-size: 13px; margin-top: 8px; }
.hidden { display: none !important; }

/* До загрузки app.js показываем только страницу из URL — без вспышки «Лиды и сделки» */
html[data-boot-page="inprogress"]:not([data-app-ready]) #page-inprogress { display: block !important; }
html[data-boot-page="dashboard"]:not([data-app-ready]) #page-dashboard { display: block !important; }
html[data-boot-page="metrika"]:not([data-app-ready]) #page-metrika { display: block !important; }
html[data-boot-page="calls"]:not([data-app-ready]) #page-calls { display: block !important; }
html[data-boot-page="ai-queue"]:not([data-app-ready]) #page-ai-queue { display: block !important; }
html[data-boot-page="ai-recommendations"]:not([data-app-ready]) #page-ai-recommendations { display: block !important; }
html[data-boot-page="enrichment"]:not([data-app-ready]) #page-enrichment { display: block !important; }
html[data-boot-page="group-tasks"]:not([data-app-ready]) #page-group-tasks { display: block !important; }
html[data-boot-page="knowledge"]:not([data-app-ready]) #page-knowledge { display: block !important; }
html[data-boot-page="telegram"]:not([data-app-ready]) #page-telegram { display: flex !important; }
html[data-boot-page="settings"]:not([data-app-ready]) #page-settings { display: block !important; }

.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-box { height: 280px; position: relative; }

.plan-section-hint { font-size: 12px; font-weight: 400; }
.plans-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 20px;
}
.plan-cell label {
  font-size: 10px;
  color: var(--muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-cell input {
  width: 100%;
  padding: 4px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-top: 2px;
  font-size: 12px;
  min-width: 0;
}
@media (max-width: 1100px) {
  .plans-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.calls-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.muted { color: var(--muted); font-size: 13px; }

.subtabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: -4px 0 20px;
}
.subtab {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subtab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.enrichment-tabs {
  flex-wrap: wrap;
  margin: 12px 0 12px;
  gap: 0;
}
.enrichment-tabs .subtab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}
.en-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: #eef2f7;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.subtab.active .en-tab-count {
  background: #dbeafe;
  color: var(--primary);
}
.enrichment-table tbody tr {
  cursor: pointer;
}
.enrichment-table tbody tr:hover td {
  background: #f8fafc;
}
.en-site-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 20px;
}
.en-site-modal.hidden {
  display: none;
}
.en-site-modal-card {
  width: min(860px, 100%);
  max-height: 86vh;
  overflow: auto;
}
.en-site-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.en-site-modal-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}
.en-site-modal-head p {
  margin: 0;
}
.en-site-modal-body {
  overflow: auto;
}

.settings-form { max-width: 640px; }
.settings-form .form-group { margin-bottom: 18px; }
.users-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1100px) {
  .users-layout { grid-template-columns: 1fr; }
}
.users-modules {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.users-modules-disabled { opacity: 0.55; }
.users-mod-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 6px 0;
  cursor: pointer;
}
.users-actions { white-space: nowrap; }
.users-actions .btn { margin-right: 4px; }
.dir-services-list {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  background: var(--bg, #fff);
  margin-top: 8px;
}
.settings-form .dir-service-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 5px 6px;
  font-weight: 400;
  font-size: 13px;
  line-height: 1.25;
  min-height: 28px;
  cursor: pointer;
  border-radius: 3px;
}
.settings-form .dir-service-row:hover {
  background: rgba(0, 0, 0, 0.04);
}
.settings-form .dir-service-row input[type="checkbox"] {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  align-self: center;
  accent-color: var(--primary, #2563eb);
}
.settings-form .dir-service-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-form .dir-service-count {
  flex: 0 0 auto;
  color: var(--muted, #888);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}
.settings-form .dir-service-owned {
  flex: 0 1 auto;
  max-width: 42%;
  font-size: 11px;
  color: var(--muted, #888);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.settings-form .dir-service-row.is-disabled {
  opacity: 0.65;
  cursor: default;
}
.btn-sm { padding: 4px 8px; font-size: 12px; }
.sidebar nav a.nav-hidden { display: none !important; }
.settings-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}
.settings-form input[type="url"],
.settings-form input[type="password"],
.settings-form input[type="text"],
.settings-form input[type="number"],
.settings-form input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.settings-form input:focus {
  outline: none;
  border-color: var(--primary);
}
.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 200px; }
.form-group-narrow { max-width: 140px; }
.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.form-msg {
  margin-top: 12px;
  font-size: 13px;
}
.form-msg.ok { color: var(--success); }
.form-msg.err { color: var(--danger); }

.prompts-list { display: flex; flex-direction: column; gap: 20px; }
.prompt-card {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  background: #fafafa;
}
.prompt-card h4 {
  margin: 0 0 4px;
  font-size: 15px;
}
.prompt-card .prompt-id {
  font-size: 12px;
  color: var(--muted);
  font-family: Consolas, monospace;
  margin-bottom: 8px;
}
.prompt-card textarea {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.5;
  resize: vertical;
}
.prompt-card textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.prompts-toolbar {
  margin-bottom: 14px;
}

.prompts-table-wrap {
  margin-top: 8px;
}
.prompts-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.prompts-table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}
.prompts-table th,
.prompts-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.prompt-id-cell {
  font-size: 12px;
  word-break: break-all;
}
button.linklike {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-align: left;
}
button.linklike:hover {
  opacity: 0.85;
}
.prompts-edit-nav {
  margin: 0 0 16px;
}
.btn-linklike {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font-size: 14px;
  text-decoration: underline;
}
.prompt-edit-form textarea {
  width: 100%;
  min-height: 280px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.checkbox-inline input {
  margin: 0;
}

.prompt-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.prompt-title-input {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
}
.prompt-built-in-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #eef2f7;
  color: var(--muted);
}
.prompt-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 10px;
  font-size: 12px;
}
.prompt-analysis-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.prompt-analysis-flag input {
  margin: 0;
}
.prompt-field-label {
  display: block;
  margin: 8px 0 4px;
  font-size: 12px;
}
.prompt-optional {
  font-weight: normal;
  opacity: 0.85;
}
.prompt-desc-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 4px;
}

/* Timeline panel */
.timeline-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 199;
}
.timeline-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.timeline-panel {
  position: fixed;
  top: 0;
  left: 220px;
  right: 0;
  bottom: 0;
  width: auto;
  height: 100vh;
  background: #eef1f5;
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
}
.timeline-panel.open {
  transform: translateX(0);
}
body.timeline-open {
  overflow: hidden;
}
.layout.sidebar-collapsed .timeline-panel {
  left: 0;
}
.tl-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.tl-col-project {
  flex: 1 1 70%;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 24px 32px;
  background: #f4f6f9;
  border-right: 1px solid var(--border);
}
.tl-col-history {
  flex: 1 1 30%;
  max-width: none;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--card);
}
.tl-loading-placeholder {
  padding: 24px;
}
.tl-history-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tl-history-head h2 {
  margin: 0;
  font-size: 17px;
}
.tl-history-meta {
  margin: 4px 0 0;
  font-size: 12px;
}
.tl-history-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.tl-head-action-btn {
  box-sizing: border-box;
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tl-close-btn {
  font-size: 22px;
}
#timelineRefreshBtn,
#timelineExportBtn {
  font-size: 12px;
}
#timelineRefreshBtn.is-done {
  color: #059669;
  border-color: #6ee7b7;
  background: #ecfdf5;
}
#timelineRefreshBtn.btn.is-loading::after {
  border: 2px solid rgba(0, 0, 0, 0.12);
  border-top-color: var(--accent);
}
.tl-analyze-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tl-analyze-progress-panel {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #f0f7ff;
  flex-shrink: 0;
}
.tl-analyze-progress-panel.hidden {
  display: none;
}
.tl-progress-track {
  height: 8px;
  background: #dbeafe;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.tl-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  border-radius: 4px;
  transition: width 0.25s ease;
}
.tl-progress-text {
  margin: 0;
  font-size: 12px;
  color: #1e40af;
}
/* ——— Карточка проекта (левая колонка) ——— */
.tl-project-card {
  max-width: 1100px;
}
.tl-pc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}
.tl-pc-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tl-pc-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}
.tl-pc-title-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tl-pc-site-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: #64748b;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.tl-pc-site-link:hover {
  color: #2563eb;
  border-color: #93c5fd;
  background: #eff6ff;
}
.tl-pc-b24-btn {
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.3;
}
.tl-pc-live-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: #dcfce7;
  color: #166534;
}
.tl-pc-enrich-status {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
  animation: tl-pc-pulse 1.4s ease-in-out infinite;
}
.tl-pc-enrich-status.hidden {
  display: none;
}
@keyframes tl-pc-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}
.tl-pc-inn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.tl-pc-inn-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.tl-pc-inn-input {
  width: 118px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  padding: 2px 0;
  outline: none;
}
.tl-pc-inn-input::placeholder {
  color: #94a3b8;
  font-weight: 500;
}
.tl-pc-inn-search-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #64748b;
  text-decoration: none;
  line-height: 0;
  padding: 2px;
  border-radius: 4px;
}
.tl-pc-inn-search-link:hover {
  color: #2563eb;
  background: #eff6ff;
}
.tl-pc-inn-input:focus {
  outline: none;
}
.tl-pc-company-name {
  font-size: 11px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tl-pc-inn-chip:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.tl-pc-revenue-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
}
.tl-pc-revenue-unknown {
  background: #f1f5f9;
  color: #64748b;
}
.tl-pc-revenue-low {
  background: #fee2e2;
  color: #b91c1c;
}
.tl-pc-revenue-mid {
  background: #fef3c7;
  color: #b45309;
}
.tl-pc-revenue-high {
  background: #dcfce7;
  color: #15803d;
}
.tl-pc-revenue-badge.hidden {
  display: none;
}
.tl-pc-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.tl-pc-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
}
.tl-pc-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.tl-pc-kpi-row--open {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.tl-pc-closed-summary {
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--card);
  min-height: 64px;
}
.tl-pc-closed-summary--lost {
  border-color: #fca5a5;
  background: #fef2f2;
}
.tl-pc-closed-summary--won {
  border-color: #86efac;
  background: #f0fdf4;
}
.tl-pc-closed-summary--closed {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.tl-pc-closed-summary-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.tl-pc-closed-summary--lost .tl-pc-closed-summary-label {
  color: #b91c1c;
}
.tl-pc-closed-summary--won .tl-pc-closed-summary-label {
  color: #15803d;
}
.tl-pc-closed-summary-text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #0f172a;
}
.tl-pc-kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  min-height: 88px;
}
.tl-pc-kpi-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}
.tl-pc-kpi-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #16a34a;
}
.tl-pc-kpi-prob {
  color: #16a34a;
}
.tl-pc-kpi-value-sm {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}
.tl-pc-kpi-health {
  display: block;
  font-size: 14px;
  font-weight: 700;
}
.tl-pc-kpi-health.risk-high { color: #dc2626; }
.tl-pc-kpi-health.risk-medium { color: #d97706; }
.tl-pc-kpi-health.risk-low { color: #16a34a; }
.tl-pc-kpi-sub {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  line-height: 1.3;
}
.tl-pc-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.tl-pc-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
}
.tl-pc-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.tl-pc-section-head h3 {
  margin: 0;
}
.tl-pc-updated {
  font-size: 11px;
}
.tl-pc-section-map {
  margin-bottom: 16px;
}
.tl-pc-deal-map {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tl-pc-map-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  width: 100%;
  min-height: 108px;
  padding: 14px 14px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  font: inherit;
  color: inherit;
}
.tl-pc-map-tile:hover {
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.12);
}
.tl-pc-map-tile.done {
  border-color: #86efac;
  background: #f0fdf4;
}
.tl-pc-map-tile.current {
  border-color: #fcd34d;
  background: #fffbeb;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.tl-pc-map-tile.pending {
  opacity: 0.7;
}
.tl-pc-map-tile-icon-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.tl-pc-map-prob {
  font-size: 12px;
  font-weight: 800;
  color: #b45309;
  line-height: 1;
}
.tl-pc-map-tile.current .tl-pc-map-tile-icon {
  border-color: #f59e0b;
  color: #f59e0b;
}
.tl-pc-map-tile.current .tl-pc-date-badge {
  background: #fef3c7;
  color: #92400e;
}
.tl-pc-map-tile.current .tl-pc-map-tile-wait {
  color: #d97706;
}
.tl-pc-map-tile.missed {
  border-color: #f87171;
  background: #fef2f2;
}
.tl-pc-map-tile.closed-lost {
  border-color: #dc2626;
  background: #fef2f2;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.tl-pc-map-tile.missed .tl-pc-map-tile-icon,
.tl-pc-map-tile.closed-lost .tl-pc-map-tile-icon {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}
.tl-pc-map-tile.missed .tl-pc-date-badge,
.tl-pc-map-tile.closed-lost .tl-pc-date-badge {
  background: #fee2e2;
  color: #991b1b;
}
.tl-pc-map-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
  margin-bottom: 8px;
}
.tl-pc-map-tile-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
  background: #fff;
}
.tl-pc-map-tile.done .tl-pc-map-tile-icon {
  border-color: #22c55e;
  background: #22c55e;
  color: #fff;
}
.tl-pc-date-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
}
.tl-pc-map-tile.done .tl-pc-date-badge {
  background: #dcfce7;
  color: #166534;
}
.tl-pc-map-tile-label {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: #1e293b;
}
.tl-pc-map-tile-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: #64748b;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tl-pc-map-tile-wait {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #ef4444;
}
.tl-stage-modal {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 230;
  padding: 20px;
}
.tl-stage-modal.hidden {
  display: none;
}
.tl-stage-modal-card {
  width: min(560px, 100%);
  max-height: 80vh;
  overflow: auto;
}
.tl-stage-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.tl-stage-modal-head h3 {
  margin: 0;
  font-size: 18px;
}
.tl-event-modal {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 240;
  padding: 24px;
}
.tl-event-modal.hidden {
  display: none;
}
.tl-event-modal-card {
  width: min(72vw, 960px);
  min-width: min(92vw, 420px);
  max-height: min(78vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tl-event-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.tl-event-modal-head h3 {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 1.35;
}
.tl-event-modal-meta {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}
.tl-event-modal-meta .tl-skip-cell {
  display: inline;
  margin: 0;
  vertical-align: baseline;
}
.tl-event-modal-meta .tl-skip-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: baseline;
  max-width: none;
  white-space: nowrap;
  flex-wrap: nowrap;
}
.tl-event-modal-meta .tl-skip-label-text {
  white-space: nowrap;
  hyphens: none;
}
.tl-event-modal-meta .tl-skip-fixed {
  display: inline;
}
.tl-event-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 18px;
}
.tl-event-modal-card--call {
  width: min(90vw, 1080px);
  max-height: min(90vh, 900px);
}
.tl-event-modal-card--summary {
  width: min(92vw, 1120px);
  max-height: min(92vh, 940px);
}
.tl-call-summary-block {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.tl-call-summary-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.tl-call-summary-label {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.tl-call-summary-prompt {
  flex: 1;
  min-width: min(100%, 280px);
  max-width: 420px;
}
.tl-call-summary-status {
  margin: 8px 0 0;
  font-size: 12px;
}
.tl-call-summary-status.ok { color: #2d7a46; }
.tl-call-summary-status.err { color: #c0392b; }
.tl-call-summary-status.loading { color: var(--muted); }
.tl-call-summary-result {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}
.tl-call-summary-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.tl-call-summary-text {
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-height: min(42vh, 360px);
  overflow-y: auto;
}
.btn-call-summary-run.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-call-summary-run.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: trigger-spin 0.75s linear infinite;
}
.tl-event-modal-body .el-tl-detail {
  border: none;
  padding: 0;
  margin: 0;
}
.tl-stage-summary {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.5;
  color: #1e293b;
}
.tl-stage-list-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tl-stage-bullets {
  margin: 0 0 14px;
  padding-left: 1.2em;
}
.tl-stage-bullets li {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.45;
  color: #334155;
}
.tl-stage-bullets li:last-child {
  margin-bottom: 0;
}
.tl-stage-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.tl-stage-detail-item {
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.tl-stage-detail-item:last-child {
  border-bottom: none;
}
.tl-stage-phrase {
  margin: 0 0 4px;
  font-size: 14px;
  line-height: 1.4;
}
.tl-stage-meta {
  margin: 0;
  font-size: 12px;
}
.tl-pc-info-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 12px;
  margin-bottom: 12px;
}
.tl-pc-info-grid .tl-pc-section {
  margin-bottom: 0;
  height: 100%;
}
.tl-pc-know-col-wide {
  grid-column: span 1;
}
.tl-pc-know-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.tl-pc-know-inner--stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tl-pc-know-constraints {
  grid-column: 1 / -1;
  padding-top: 4px;
  border-top: 1px solid #f1f5f9;
}
.tl-pc-subsection-title {
  margin: 14px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
.tl-pc-attention-block {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.tl-pc-attention-block .tl-pc-attention-row {
  grid-template-columns: 1fr;
}
.tl-pc-change-timeline {
  overflow-x: auto;
  padding: 6px 2px 2px;
  -webkit-overflow-scrolling: touch;
}
.tl-pc-change-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-width: max-content;
  padding-bottom: 4px;
}
.tl-pc-milestone {
  position: relative;
  flex: 0 0 112px;
  text-align: center;
  padding: 0 4px;
}
.tl-pc-milestone:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(50% + 20px);
  width: calc(100% - 40px);
  height: 2px;
  background: #e2e8f0;
  z-index: 0;
}
.tl-pc-milestone-dot {
  position: relative;
  z-index: 1;
  width: 36px;
  height: 36px;
  margin: 0 auto 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #334155;
}
.tl-pc-milestone-dot--start,
.tl-pc-milestone-dot--call {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.tl-pc-milestone-dot--email_in,
.tl-pc-milestone-dot--email_out {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.tl-pc-milestone-dot--meeting {
  background: #ede9fe;
  border-color: #c4b5fd;
  color: #6d28d9;
}
.tl-pc-milestone-dot--comment,
.tl-pc-milestone-dot--comment_wa,
.tl-pc-milestone-dot--comment_tg,
.tl-pc-milestone-dot--comment_max,
.tl-pc-milestone-dot--comment_summary {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}
.tl-pc-milestone.is-waiting .tl-pc-milestone-dot {
  background: #fff;
  border-color: #f87171;
  color: #dc2626;
  box-shadow: 0 0 0 3px #fee2e2;
}
.tl-pc-milestone-date {
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
}
.tl-pc-milestone-label {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted);
}

/* Путь сделки — 7 точек с временем между этапами */
.tl-pc-journey {
  overflow-x: auto;
  padding: 8px 2px 2px;
  -webkit-overflow-scrolling: touch;
}
.tl-pc-journey-track {
  display: flex;
  align-items: flex-start;
  min-width: max-content;
}
.tl-pc-journey-node {
  flex: 0 0 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0 2px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: center;
}
.tl-pc-journey-node[disabled] {
  cursor: default;
}
.tl-pc-journey-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  border: 2px solid #e2e8f0;
  background: #fff;
  color: #94a3b8;
}
.tl-pc-journey-node--done .tl-pc-journey-dot {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}
.tl-pc-journey-node--success .tl-pc-journey-dot {
  background: #16a34a;
  border-color: #16a34a;
  color: #fff;
}
.tl-pc-journey-node--fail .tl-pc-journey-dot {
  background: #fee2e2;
  border-color: #f87171;
  color: #dc2626;
}
.tl-pc-journey-node--empty .tl-pc-journey-dot {
  background: #f8fafc;
  border-style: dashed;
  border-color: #cbd5e1;
}
.tl-pc-journey-node:not([disabled]):hover .tl-pc-journey-dot {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.tl-pc-journey-date {
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
}
.tl-pc-journey-node--empty .tl-pc-journey-date {
  color: var(--muted);
  font-weight: 500;
}
.tl-pc-journey-label {
  font-size: 10px;
  line-height: 1.3;
  color: var(--muted);
}
.tl-pc-journey-conn {
  flex: 1 1 32px;
  min-width: 32px;
  position: relative;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tl-pc-journey-conn::before {
  content: '';
  position: absolute;
  top: 17px;
  left: 0;
  right: 0;
  height: 2px;
  background: #cbd5e1;
}
.tl-pc-journey-conn.is-empty::before {
  background: repeating-linear-gradient(90deg, #cbd5e1 0 5px, transparent 5px 10px);
}
.tl-pc-journey-gap {
  position: relative;
  z-index: 1;
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  background: var(--card-bg, #fff);
  padding: 1px 5px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  white-space: nowrap;
}
.tl-journey-ev-date,
.tl-journey-ev-kind {
  font-size: 12px;
}
.tl-pc-task-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.tl-pc-task-text {
  flex: 1 1 auto;
}
.tl-pc-task-prob {
  flex: 0 0 auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.tl-pc-know-block h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}
.tl-pc-know-block ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
}
@media (max-width: 1100px) {
  .tl-pc-deal-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tl-pc-info-grid {
    grid-template-columns: 1fr;
  }
  .tl-pc-know-inner {
    grid-template-columns: 1fr;
  }
}
.tl-pc-kpi-deadline {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #dc2626;
  margin-top: 2px;
}
.tl-pc-kpi-badge {
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tl-pc-kpi-badge .deadline-edit-btn {
  margin-left: 2px;
}
.tl-pc-kpi-action-text {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: #334155;
}
.tl-pc-info-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
}
.tl-pc-info-label {
  color: var(--muted);
  flex-shrink: 0;
}
.tl-pc-info-value {
  text-align: right;
  font-weight: 500;
}
.tl-pc-info-row--block {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.tl-pc-info-row--block .tl-pc-info-value,
.tl-pc-desc-body,
.tl-pc-desc-preview,
.tl-pc-desc-full {
  text-align: left;
  font-weight: 400;
  line-height: 1.45;
  white-space: pre-line;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  min-width: 0;
}
.tl-pc-desc-toggle {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent, #2563eb);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}
.tl-pc-desc-full.hidden,
.tl-pc-desc.is-open .tl-pc-desc-preview {
  display: none;
}
.tl-pc-desc.is-open .tl-pc-desc-full {
  display: inline;
}
.tl-pc-attach-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tl-pc-attach-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
  min-width: 0;
}
.tl-pc-attach-name {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.tl-pc-attach-ext {
  color: var(--muted);
  font-weight: 600;
}
.tl-pc-attach-link {
  color: var(--accent, #2563eb);
  text-decoration: underline;
}
.tl-pc-attach-meta {
  font-size: 11px;
}
.tl-pc-know-block h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--muted);
}
.tl-pc-know-block ul {
  margin: 0 0 12px;
  padding-left: 16px;
  font-size: 12px;
  line-height: 1.45;
}
.tl-pc-know-block ul:last-child {
  margin-bottom: 0;
}
.tl-pc-metrics-list {
  font-size: 12px;
}
.tl-pc-metric-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
}
.tl-pc-metric-prices {
  margin: 8px 0 0;
  padding-left: 16px;
  font-size: 11px;
}
.tl-pc-attention-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.tl-pc-attention-card {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.35;
}
.tl-pc-attention-warn { background: #fef9c3; border: 1px solid #fde047; }
.tl-pc-attention-danger { background: #fee2e2; border: 1px solid #fca5a5; }
.tl-pc-attention-orange { background: #ffedd5; border: 1px solid #fdba74; }
.tl-pc-attention-icon {
  font-weight: 700;
  flex-shrink: 0;
}
.tl-pc-objections {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}
.tl-pc-empty {
  margin: 0;
  font-size: 12px;
}
@media (max-width: 1100px) {
  .tl-pc-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tl-pc-kpi-row--open {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tl-pc-info-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 900px) {
  .tl-layout {
    flex-direction: column;
  }
  .tl-col-project {
    flex: 0 0 50%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .tl-col-history {
    flex: 1 1 50%;
    max-width: none;
  }
}
.timeline-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.timeline-panel-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}
.timeline-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}
#timelineClose {
  font-size: 22px;
  line-height: 1;
  padding: 4px 10px;
}
.timeline-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px 20px;
}
.el-tl {
  list-style: none;
  margin: 0;
  padding: 0 0 0 4px;
}
.el-tl-item {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 0 0 14px 22px;
}
.el-tl-item:last-child {
  padding-bottom: 0;
}
.el-tl-item::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 14px;
  bottom: 0;
  width: 2px;
  background: #e4e7ed;
}
.el-tl-item:last-child::before {
  display: none;
}
.el-tl-node {
  position: absolute;
  left: 0;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #409eff;
  z-index: 1;
}
.el-tl-node--call { border-color: #8b5cf6; }
.el-tl-node--email_in { border-color: #3b82f6; }
.el-tl-node--email_out { border-color: #0ea5e9; }
.el-tl-node--comment { border-color: #64748b; }
.el-tl-node--todo,
.el-tl-node--task { border-color: #f59e0b; }
.el-tl-card {
  flex: 1;
  min-width: 0;
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 10px 12px 10px 28px;
  position: relative;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.el-tl-card:not(.el-tl-card--inbound):not(.el-tl-card--outbound):hover {
  border-color: #c6e2ff;
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.1);
}
.el-tl-card--inbound {
  border: 2px solid #86efac;
  background: #f0fdf4;
  box-shadow: 0 0 0 1px #dcfce7;
}
.el-tl-card--inbound:hover {
  border-color: #4ade80;
  box-shadow: 0 0 0 1px #bbf7d0, 0 2px 8px rgba(34, 197, 94, 0.12);
}
.el-tl-card--outbound {
  border: none;
  background: #fffbeb;
  box-shadow:
    0 -2px 0 0 #facc15,
    0 2px 0 0 #facc15,
    -2px 0 0 0 #facc15,
    2px 0 0 0 #facc15,
    0 0 0 2px #fef9c3;
}
.el-tl-card--outbound:hover {
  box-shadow:
    0 -2px 0 0 #eab308,
    0 2px 0 0 #eab308,
    -2px 0 0 0 #eab308,
    2px 0 0 0 #eab308,
    0 0 0 2px #fde68a,
    0 2px 8px rgba(234, 179, 8, 0.15);
}
.el-tl-head .dl-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  vertical-align: middle;
}
.el-tl-head .deadline-edit-btn {
  flex-shrink: 0;
}
.el-tl-direction {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
}
.el-tl-card::after {
  content: '›';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #c0c4cc;
  font-size: 16px;
  font-weight: 700;
}
.el-tl-details {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid #ebeef5;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}
.el-tl-details[open] {
  border-color: #c6e2ff;
  box-shadow: 0 2px 8px rgba(64, 158, 255, 0.12);
}
.el-tl-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px 10px 28px;
  position: relative;
}
.el-tl-summary::after {
  content: '›';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  color: #c0c4cc;
  font-size: 16px;
  font-weight: 700;
  transition: transform 0.15s;
}
.el-tl-details[open] > .el-tl-summary::after {
  transform: translateY(-50%) rotate(90deg);
  color: #409eff;
}
.el-tl-summary::-webkit-details-marker {
  display: none;
}
.el-tl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 6px;
  overflow: hidden;
}
.el-tl-time {
  font-size: 12px;
  color: #909399;
  font-weight: 600;
}
.el-tl-type {
  font-size: 12px;
  font-weight: 600;
  color: #303133;
}
.el-tl-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  background: #f0f9eb;
  color: #67c23a;
}
.el-tl-badge-duration {
  background: #f1f5f9;
  color: #64748b;
  font-weight: 500;
}
.el-tl-ai {
  font-size: 12px;
  line-height: 1.45;
  color: #606266;
  background: #f4f4f5;
  border-radius: 4px;
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.el-tl-ai-empty {
  background: transparent;
  padding: 0;
  font-size: 11px;
}
.el-tl-detail {
  padding: 0 12px 12px;
  border-top: 1px dashed #ebeef5;
  margin-top: 0;
}
.el-tl-detail-title {
  font-size: 14px;
  font-weight: 600;
  color: #303133;
  margin: 10px 0 8px;
  line-height: 1.35;
}
.el-tl-detail .tl-author,
.el-tl-detail .tl-links,
.el-tl-detail .tl-extra {
  margin: 6px 0;
  font-size: 12px;
}
.el-tl-detail .tl-body,
.el-tl-detail .tl-transcript,
.el-tl-detail .tl-summary {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
}
.tl-skip-cell {
  display: block;
  margin: 8px 0;
}
.tl-date-group {
  margin-bottom: 12px;
}
.tl-date-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 8px 4px 6px;
  text-transform: capitalize;
}
.tl-ev-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fafafa;
}
.tl-ev-item summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
}
.tl-ev-item summary::-webkit-details-marker {
  display: none;
}
.tl-ev-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.tl-ev-time {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 42px;
}
.tl-ev-main {
  flex: 1;
  min-width: 0;
}
.tl-ev-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
}
.tl-ev-title {
  font-size: 13px;
  font-weight: 500;
  display: block;
  margin-top: 2px;
}
.tl-ev-ai {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: #334155;
  background: #f1f5f9;
  padding: 8px 10px;
  border-radius: 6px;
}
.tl-ev-detail {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}
.tl-fact-card {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  background: #f0f7ff;
}
.tl-fact-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.tl-fact-meta {
  margin-left: auto;
  font-size: 11px;
}
.tl-fact-stale {
  font-size: 11px;
  color: #b45309;
  background: #fef3c7;
  padding: 1px 6px;
  border-radius: 4px;
}
.tl-fact-warn {
  font-size: 11px;
  color: #92400e;
  background: #fde68a;
  padding: 1px 6px;
  border-radius: 4px;
}
.tl-fact-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.tl-fact-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #e0e7ff;
  color: #3730a3;
}
.tl-fact-row {
  margin-bottom: 6px;
}
.tl-fact-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}
.tl-fact-text {
  margin: 0;
  font-size: 13px;
}
.tl-fact-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tl-fact-tag {
  font-size: 12px;
  padding: 2px 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.tl-analyze-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 220;
  padding: 16px;
}
.tl-analyze-modal.hidden {
  display: none;
}
.tl-analyze-modal-card {
  max-width: 420px;
  width: 100%;
}
.tl-analyze-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.tl-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 8px;
  background: #fafafa;
}
.tl-item summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
}
.tl-item summary::-webkit-details-marker {
  display: none;
}
.tl-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.tl-skip-cell {
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 2px;
}
.tl-skip-label {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
  max-width: 148px;
}
.tl-skip-label input {
  margin: 2px 0 0;
  flex-shrink: 0;
}
.tl-skip-label-text {
  hyphens: auto;
}
.tl-main {
  flex: 1;
  min-width: 0;
}
.tl-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tl-title {
  display: block;
  font-weight: 500;
}
.tl-extra {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.tl-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.tl-detail {
  padding: 0 12px 12px 40px;
  border-top: 1px dashed var(--border);
}
.tl-body {
  font-size: 13px;
  line-height: 1.55;
  color: #303133;
}
.tl-body-p {
  margin: 0 0 10px;
}
.tl-body-p:last-child {
  margin-bottom: 0;
}
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.tl-author,
.tl-links {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 4px;
}
.tl-error {
  color: var(--danger);
}
.tl-kind-email_in summary {
  border-left: 3px solid #409eff;
}
.tl-kind-email_out summary {
  border-left: 3px solid #67c23a;
}
.tl-kind-todo summary {
  border-left: 3px solid #e6a23c;
}
.tl-kind-task summary {
  border-left: 3px solid #909399;
}
.tl-kind-call summary {
  border-left: 3px solid #9c27b0;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.link-btn:hover {
  text-decoration: underline;
}

.gt-tabs-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.gt-tabs-aside {
  margin-left: auto;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  line-height: 1.35;
}

.gt-sync-status {
  margin: 0;
}

.gt-sync-status-busy {
  color: var(--primary, #409eff);
}

.gt-sync-btn-busy:disabled {
  opacity: 0.85;
  cursor: wait;
}

.gt-tabs-meta-count {
  margin: 0;
}

.gt-points-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  background: #e8f4ff;
  color: #1d6fd8;
  flex-shrink: 0;
}

.gt-kanban-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.gt-kanban-card-top .gt-kanban-card-title {
  flex: 1;
  margin: 0;
}

/* 3 плитки: две узкие + широкая «Баллы спринта» (перебивает ip-stats-tiles на 5 колонок) */
#page-group-tasks .gt-stats.ip-stats-tiles {
  display: grid;
  grid-template-columns: minmax(140px, 0.62fr) minmax(140px, 0.62fr) minmax(520px, 2.4fr);
  gap: 12px;
  margin-bottom: 12px;
}

#page-group-tasks .gt-stats .gt-tile-sprint-wide {
  min-width: 0;
  grid-column: auto;
}

.gt-stats .gt-tile-sprint-wide > span:first-child {
  display: block;
  line-height: 1.35;
}

.gt-stats .gt-tile-sprint-wide .ip-stat-hint {
  display: inline;
  white-space: normal;
}

.gt-stats .gt-tile-sprint-wide .dash-tile-body {
  overflow: visible;
}

.gt-stats .gt-tile-sprint-wide .ip-sales-metric-row {
  flex-wrap: nowrap;
  gap: 8px 18px;
  justify-content: space-between;
}

.gt-stats .gt-tile-sprint-wide .dash-stat-block {
  flex: 0 1 auto;
  min-width: 88px;
}

.gt-stats .gt-tile-sprint-wide .dash-stat-sub {
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
}

.gt-stats .gt-tile-sprint-wide .ip-metric-val {
  font-size: 1.2rem;
  white-space: nowrap;
}

.gt-stats .gt-tile-sprint-wide .ip-metric-pct {
  font-size: 1rem;
  white-space: nowrap;
}

@media (max-width: 1200px) {
  #page-group-tasks .gt-stats.ip-stats-tiles {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  #page-group-tasks .gt-stats .gt-tile-sprint-wide {
    grid-column: 1 / -1;
    min-width: 100%;
  }
}

.gt-stats .ip-composite-tile .ip-metric-row {
  min-height: 44px;
}

.gt-page-tabs {
  margin-bottom: 0;
}

.gt-tab-analytics {
  padding-top: 4px;
}

.gt-work-mode-wrap {
  position: relative;
}

.gt-view-toggle {
  display: inline-flex;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.gt-view-toggle .gt-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 0 10px;
  height: 36px;
  border: none;
  border-radius: 0;
  background: #fff;
  color: var(--muted);
}

.gt-view-toggle .gt-view-btn + .gt-view-btn {
  border-left: 1px solid var(--border);
}

.gt-view-toggle .gt-view-btn:hover {
  background: #f5f7fa;
  color: var(--text);
}

.gt-view-toggle .gt-view-btn.active {
  background: #e8f4ff;
  color: var(--accent, #2563eb);
}

.gt-view-icon {
  display: block;
}

.gt-kanban {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
  min-height: 200px;
}

.gt-kanban-col {
  flex: 0 0 240px;
  min-width: 220px;
  max-width: 280px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 280px);
}

.gt-kanban-col-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  background: #f5f7fa;
  border-radius: 8px 8px 0 0;
}

.gt-kanban-col-count {
  color: var(--muted);
  font-weight: 500;
}

.gt-kanban-col-body {
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gt-kanban-card {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.gt-kanban-card:hover {
  border-color: #b3d8ff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.gt-kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  word-break: break-word;
}

.gt-kanban-card-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.gt-kanban-empty {
  margin: 0;
  padding: 8px 4px;
  font-size: 12px;
  text-align: center;
}

.gt-analytics-hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
}

.gt-analytics-dashboard {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.gt-an-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 1100px) {
  .gt-an-grid {
    grid-template-columns: 1fr 1fr;
  }

  .gt-an-grid .gt-an-card-lifetime {
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .gt-an-grid {
    grid-template-columns: 1fr;
  }

  .gt-an-grid .gt-an-card-lifetime {
    grid-column: auto;
  }
}

.gt-an-card {
  background: #f5f7fa;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
}

.gt-an-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}

.gt-an-sub {
  margin: 0 0 12px;
  font-size: 12px;
}

.gt-an-big {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

.gt-an-big-blue {
  color: #409eff;
}

.gt-an-sprint-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.gt-an-sprint-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gt-an-trend {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.gt-an-trend-up {
  background: #e8f8ef;
  color: #1a7f37;
}

.gt-an-trend-down {
  background: #fdecec;
  color: #c45656;
}

.gt-sparkline {
  flex-shrink: 0;
  overflow: visible;
}

.gt-spark-area {
  fill: url(#gtSparkFill);
}

.gt-spark-line {
  fill: none;
  stroke: #409eff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gt-spark-point {
  cursor: default;
}

.gt-spark-hit {
  fill: transparent;
}

.gt-spark-dot {
  fill: #409eff;
  stroke: #fff;
  stroke-width: 1.5;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.gt-spark-point:hover .gt-spark-dot,
.gt-spark-point:focus .gt-spark-dot {
  opacity: 1;
}

.gt-spark-tip {
  font-size: 10px;
  font-weight: 600;
  fill: var(--text, #1e293b);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.gt-spark-point:hover .gt-spark-tip,
.gt-spark-point:focus .gt-spark-tip {
  opacity: 1;
}

.gt-spark-label {
  font-size: 9px;
  fill: var(--muted);
}

.gt-an-foot {
  margin: 12px 0 0;
  font-size: 12px;
}

.gt-an-lifetime-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.gt-an-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.gt-an-lifetime-bar,
.gt-person-bar {
  height: 8px;
  background: #e4e7ed;
  border-radius: 999px;
  overflow: hidden;
}

.gt-an-lifetime-bar span,
.gt-person-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #79bbff, #409eff);
  border-radius: 999px;
}

.gt-an-people-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.gt-an-people-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.gt-an-search {
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.gt-an-sort {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
}

.gt-an-people-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.gt-person-card {
  position: relative;
  flex: 0 0 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px 14px;
  text-align: center;
}

.gt-person-rank {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.gt-person-rank-gold {
  color: #b8860b;
}

.gt-person-avatar {
  width: 56px;
  height: 56px;
  margin: 8px auto 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d9ecff, #b3d8ff);
  color: #1d6fd8;
  font-weight: 700;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gt-person-name {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.gt-person-points {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #409eff;
}

.gt-person-sub {
  margin: 4px 0 10px;
  font-size: 11px;
}

.gt-an-empty {
  margin: 0;
  padding: 12px;
}

.gt-analytics-matrix-details {
  margin-top: 8px;
}

.gt-analytics-matrix-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.gt-matrix-wrap {
  overflow-x: auto;
}

.gt-matrix-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}

.gt-matrix-sprint {
  min-width: 52px;
  max-width: 72px;
  white-space: normal;
  line-height: 1.25;
  padding: 6px 4px;
}

.gt-matrix-sprint-num {
  display: block;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.gt-matrix-sprint-period {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.gt-matrix-table th,
.gt-matrix-table td {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.gt-matrix-corner,
.gt-matrix-person,
.gt-matrix-table tbody th[scope='row'] {
  text-align: left;
  font-weight: 600;
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 1;
}

.gt-matrix-month {
  font-weight: 600;
  text-transform: lowercase;
  background: #f5f7fa;
}

.gt-matrix-sprint {
  font-size: 12px;
  color: var(--muted);
  background: #fafafa;
}

.gt-matrix-points {
  border: none;
  background: none;
  color: var(--primary);
  font-weight: 700;
  font-size: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.gt-matrix-points:hover {
  background: #ecf5ff;
  text-decoration: underline;
}

button.gt-matrix-points.gt-an-big {
  font-size: 36px;
  line-height: 1.1;
  padding: 0 4px;
}

button.gt-matrix-points.gt-an-big-blue {
  color: #409eff;
}

.gt-matrix-total-row th,
.gt-matrix-total-row td {
  border-top: 2px solid var(--border);
  background: #fafafa;
  font-weight: 600;
}

.gt-sprint-task-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.gt-sprint-task-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.gt-sprint-task-pts {
  flex-shrink: 0;
  white-space: nowrap;
}

.gt-sprint-task-meta {
  margin: 4px 0 0;
  font-size: 12px;
}

#gtCommentsOpenB24.hidden {
  display: none;
}

#page-group-tasks .gt-cell-assigned {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

#page-group-tasks .stage-badge {
  max-width: 280px;
}

.gt-comments-body {
  padding: 12px 16px 24px;
  overflow: auto;
  max-height: calc(100vh - 120px);
}

.gt-comment {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.gt-comment-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13px;
}

.gt-comment-body {
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.row-b24-link {
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.6;
}
.row-b24-link:hover {
  opacity: 1;
}
/* Таблица «Лиды и сделки» */
.ip-table-wrap table.ip-table .cell-activity,
.ip-table-wrap table.ip-table .cell-deadline,
.ip-table-wrap table.ip-table .cell-assigned,
.ip-table-wrap table.ip-table td.cell-muted {
  white-space: nowrap;
}
.ip-table-wrap table.ip-table .cell-assigned {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-activity {
  white-space: nowrap;
  text-align: center;
}
.activity-compact {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.activity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #ecf5ff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
.activity-popover {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 50;
  min-width: 200px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  color: var(--text);
  pointer-events: none;
}
.activity-popover-line {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.activity-popover-line + .activity-popover-line {
  margin-top: 5px;
}
.activity-popover-line .crm-icon {
  flex-shrink: 0;
  color: var(--muted);
}
.activity-pop-label {
  flex: 0 0 auto;
  color: var(--muted);
}
.activity-pop-val {
  font-weight: 700;
  color: var(--text);
}
.activity-pop-extra {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 4px;
}
.activity-pop-extra strong {
  font-weight: 700;
}
.activity-pop-ok {
  color: var(--success);
}
.activity-pop-miss {
  color: var(--danger);
}
.activity-compact:hover .activity-popover,
.activity-compact:focus-within .activity-popover {
  display: block;
}
.cell-deadline {
  font-size: 12px;
  line-height: 1.35;
  max-width: 180px;
}
.cell-deadlines-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cell-deadlines-stack .deadline-line-wrap {
  flex-wrap: nowrap;
}
.deadline-line .deadline-dt {
  white-space: nowrap;
}
.crm-icon {
  display: inline-block;
  vertical-align: -2px;
  flex-shrink: 0;
}
.icon-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 6px;
  white-space: nowrap;
}
.deadline-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.deadline-overdue {
  color: var(--danger);
  font-weight: 600;
}
.row-alert-overdue,
.row-alert-no-deadline {
  background: #fef0f0;
}
.row-alert-email {
  background: #fdf6ec;
}
.row-alert-overdue.row-alert-email,
.row-alert-no-deadline.row-alert-email {
  background: linear-gradient(90deg, #fef0f0 50%, #fdf6ec 50%);
}
.alert-badge {
  font-size: 16px;
}
.alert-email {
  filter: saturate(1.2);
}

.call-ok { color: var(--success); font-size: 12px; font-weight: 600; }
.call-miss { color: var(--danger); font-size: 12px; font-weight: 600; }
.call-outcome {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
  padding: 2px 8px;
  border-radius: 4px;
}
.call-outcome-success { background: #f0f9eb; color: var(--success); }
.call-outcome-missed { background: #fef0f0; color: var(--danger); }
.tl-main .call-outcome {
  margin-left: 6px;
  vertical-align: middle;
}
.tl-kind-icon {
  color: var(--muted);
}
.tl-transcribe-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.tl-transcribe-status { font-size: 12px; }
.tl-audio { width: 100%; max-width: 100%; display: block; }
.tl-call-player-block {
  margin-top: 18px;
}
.el-tl-detail .tl-call-player-block,
.tl-event-modal-body .tl-call-player-block {
  margin-top: 20px;
}
.tl-audio-player {
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.tl-audio-speed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.tl-audio-speed-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-right: 4px;
}
.tl-audio-speed-btn {
  min-width: 44px;
  padding: 4px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tl-audio-speed-btn:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
}
.tl-audio-speed-btn.is-active {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #1d4ed8;
}
.tl-player-hint, .tl-player-err { font-size: 12px; margin: 8px 0 0; }
.tl-player-err { color: var(--danger); }
.type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.type-lead { background: #ecf5ff; color: #409eff; }
.type-deal { background: #f0f9eb; color: #67c23a; }
.type-unbound { background: #fdf6ec; color: #e6a23c; }

.call-bind-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1200;
  width: min(420px, calc(100vw - 32px));
  padding: 20px;
}
.call-bind-modal.hidden,
#callBindBackdrop.hidden {
  display: none;
}
.call-bind-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 12px 0;
}
.call-bind-field select,
.call-bind-field input {
  width: 100%;
}
.call-bind-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* В работе: первые плитки — по контенту, «К оплате» забирает остаток */
.ip-stats-tiles {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}
#page-inprogress .ip-stats-tiles > .stat:not(.ip-tile-pay) {
  flex: 0 0 auto;
  width: max-content;
  max-width: none;
  min-width: max-content;
}
#page-inprogress .ip-stats-tiles > .ip-tile-pay {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  grid-column: auto;
}
#page-inprogress .ip-stats-tiles > .stat:not(.ip-tile-pay) .ip-metric-row .dash-stat-block {
  flex: 0 0 auto;
  min-width: max-content;
}
#page-inprogress .ip-stats-tiles > .stat:not(.ip-tile-pay) .ip-metric-row .dash-stat-sub,
#page-inprogress .ip-stats-tiles > .stat:not(.ip-tile-pay) .ip-metric-row .ip-metric-val {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.ip-tile-work.stat {
  padding: 10px 14px;
}
.ip-tile-work.ip-composite-tile > span {
  font-size: 14px;
  margin-bottom: 6px;
}
.ip-tile-work .ip-metric-row {
  min-height: 40px;
}
.ip-tile-work .ip-metric-row .ip-metric-val {
  font-size: 17px;
}
.ip-tile-sales-count.stat {
  padding: 12px 18px;
}
@media (max-width: 1100px) {
  #page-inprogress .ip-stats-tiles {
    flex-wrap: wrap;
  }
  #page-inprogress .ip-stats-tiles > .stat:not(.ip-tile-pay) {
    flex: 1 1 calc(50% - 6px);
    width: auto;
    min-width: 0;
  }
  #page-inprogress .ip-stats-tiles > .ip-tile-pay {
    flex: 1 1 100%;
  }
}
.ip-tile-narrow {
  min-width: 0;
}
.ip-tile-pay .ip-metric-row .dash-stat-block {
  padding: 0 8px;
}
.ip-stat-hint,
.ip-stat-period {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}
.ip-composite-tile > span {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.ip-composite-tile .dash-tile-body {
  margin-top: 0;
}
.ip-metric-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0;
  min-height: 44px;
}
.ip-metric-row .dash-stat-block {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 10px;
  border-left: 1px solid var(--border);
}
.ip-metric-row .dash-stat-block:first-child {
  border-left: none;
  padding-left: 0;
}
.ip-metric-row .dash-stat-block:last-child {
  padding-right: 0;
}
.ip-metric-row .ip-metric-val {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.ip-metric-row .ip-metric-val.ip-metric-money {
  color: #27ae60;
}
.ip-metric-row .ip-metric-val.ip-metric-total {
  color: var(--text);
}
.ip-metric-row .ip-metric-val.ip-metric-pay-detail {
  color: #d4a017;
}
.ip-metric-row .dash-stat-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ip-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.ip-search {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}
.ip-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.ip-work-mode-wrap,
.ip-service-wrap {
  position: relative;
}
.ip-sales-tile .ip-sales-metric-row .ip-metric-val {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.ip-sales-tile .ip-metric-pct {
  font-size: 13px;
  font-weight: 600;
}
.ip-sales-tile .ip-metric-pct-up { color: #27ae60; }
.ip-sales-tile .ip-metric-pct-down { color: #e74c3c; }
.ip-sales-tile .ip-metric-val.ip-metric-money { color: #27ae60; }
.triggers-intro { margin: 0 0 14px; font-size: 13px; }
.triggers-desc { font-size: 12px; line-height: 1.35; }
.triggers-result {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.triggers-table .col-trigger-name {
  width: 22%;
  max-width: 280px;
}
.triggers-table .col-trigger-name .triggers-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.triggers-table .col-trigger-schedule {
  width: 14%;
  min-width: 100px;
}
.triggers-table .col-trigger-next-run {
  white-space: nowrap;
  min-width: 8.5rem;
}

.triggers-table .col-trigger-last-run {
  width: 11%;
  min-width: 88px;
  white-space: nowrap;
}
.triggers-table .col-trigger-telegram,
.triggers-table .trigger-chats-col {
  width: 28%;
  min-width: 220px;
  max-width: 360px;
  vertical-align: top;
}
.triggers-table .col-trigger-result {
  width: 18%;
  min-width: 140px;
  max-width: 240px;
}
.trigger-chats-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.trigger-chat-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.trigger-chat-check {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
}
.trigger-chat-check input { margin-top: 2px; flex-shrink: 0; }
.trigger-chat-dirs {
  margin: 0 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.trigger-chat-dirs-label {
  font-size: 11px;
  margin-bottom: 2px;
}
.trigger-dir-check {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  cursor: pointer;
}
.trigger-dir-check input { flex-shrink: 0; }
.triggers-table .col-trigger-run,
.triggers-table td.col-trigger-run { width: 44px; padding-right: 4px; }
.telegram-chats-block { margin: 12px 0; }
.telegram-chats-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.telegram-chats-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
}
.telegram-chats-list li { padding: 4px 0; }
.trigger-run-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.trigger-run-btn:hover:not(:disabled) {
  background: var(--surface-hover, rgba(0, 0, 0, 0.04));
  border-color: var(--accent);
}
.trigger-run-btn:disabled {
  cursor: wait;
  opacity: 0.85;
}
.trigger-run-btn .trigger-play { display: flex; }
.trigger-run-btn .trigger-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: trigger-spin 0.75s linear infinite;
}
.trigger-run-btn.is-running .trigger-play { display: none; }
.trigger-run-btn.is-running .trigger-spinner { display: block; }
@keyframes trigger-spin {
  to { transform: rotate(360deg); }
}

.deadline-line-wrap {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
}
.deadline-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  margin: 0;
  border: none;
  background: transparent;
  color: #b0b4bc;
  cursor: pointer;
  vertical-align: middle;
  border-radius: 4px;
}
.deadline-edit-btn:hover {
  color: var(--accent);
  background: rgba(0, 0, 0, 0.04);
}
.deadline-edit-icon { display: block; }
.deadline-editor-popover {
  position: fixed;
  z-index: 2500;
  width: min(320px, calc(100vw - 24px));
  padding: 14px 14px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}
.dl-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.dl-cal-head button {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
}
.dl-cal-head button:hover { background: var(--bg); }
.dl-cal-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: capitalize;
}
.dl-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  margin-bottom: 8px;
}
.dl-cal-dow {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 0 4px;
}
.dl-cal-dow:nth-child(6),
.dl-cal-dow:nth-child(7) { color: #c0392b; }
.dl-cal-day {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  width: 34px;
  height: 30px;
  border-radius: 6px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: background 0.1s;
}
.dl-cal-day:hover { background: var(--bg); }
.dl-cal-day.other-month { color: var(--muted); opacity: 0.5; }
.dl-cal-day.today {
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px var(--primary);
}
.dl-cal-day.selected {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.dl-cal-day.weekend { color: #c0392b; }
.dl-cal-day.selected.weekend { color: #fff; }
.dl-cal-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.dl-cal-time-label {
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.dl-cal-time-input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}
.deadline-editor-close {
  position: absolute;
  top: 8px;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.deadline-editor-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.deadline-editor-input {
  width: 100%;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}
.deadline-editor-status,
.call-summary-status {
  margin: 10px 0 0;
  font-size: 13px;
}
.deadline-editor-status.ok,
.call-summary-status.ok { color: #2d7a46; }
.deadline-editor-status.err,
.call-summary-status.err { color: #c0392b; }
.deadline-editor-status.loading,
.call-summary-status.loading { color: var(--muted); }
.btn-block { width: 100%; }
.btn.is-loading,
#deadlineEditorSubmit.is-loading,
#callSummarySubmit.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn.is-loading::after,
#deadlineEditorSubmit.is-loading::after,
#callSummarySubmit.is-loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: trigger-spin 0.75s linear infinite;
}
.dl-badge-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tl-transcribe-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
}
.tl-summary {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.tl-summary-hint { font-size: 12px; }
.call-summary-overlay {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.35);
}
.call-summary-card {
  width: min(420px, 100%);
  padding: 18px;
}
.call-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.call-summary-head h3 { margin: 0; font-size: 16px; }
.call-summary-prompt { width: 100%; margin: 8px 0 14px; }
.ip-work-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  padding: 4px 0;
}
.ip-work-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 14px;
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
}
.ip-work-menu-item:hover,
.ip-work-menu-item.active {
  background: #ecf5ff;
  color: var(--primary);
}
.ip-load-more-wrap {
  margin: 0 0 10px;
  text-align: center;
}
.ip-copy-wrap {
  position: relative;
}
.ip-copy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ip-copy-toggle[aria-expanded="true"] {
  border-color: var(--primary);
  color: var(--primary);
  background: #ecf5ff;
}
.ip-copy-chevron {
  font-size: 10px;
  line-height: 1;
  opacity: 0.75;
}
.ip-copy-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 40;
  min-width: 260px;
  padding: 4px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.ip-copy-menu.hidden {
  display: none;
}
.ip-copy-menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
  color: inherit;
}
.ip-copy-menu-item:hover {
  background: #f0f4f8;
}
.ip-columns-wrap {
  position: relative;
  display: inline-flex;
}
.btn-icon.ip-columns-btn {
  padding: 6px 8px;
  min-width: 34px;
  line-height: 1;
  color: var(--muted);
}
.btn-icon.ip-columns-btn:hover {
  color: var(--primary);
  border-color: #b3d8ff;
  background: #ecf5ff;
}
.ip-columns-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 220px;
  max-height: 70vh;
  overflow: auto;
  padding: 8px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.ip-columns-menu.hidden {
  display: none;
}
.ip-columns-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.ip-columns-item:hover {
  background: #f5f7fa;
}
.ip-columns-item input {
  width: 15px;
  height: 15px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.ip-quick-btn.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #ecf5ff;
}
.btn-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-filter-toggle.active {
  border-color: var(--primary);
  color: var(--primary);
  background: #ecf5ff;
}
.filter-arrow {
  display: inline-flex;
  align-items: center;
}
.ip-filters-panel {
  margin-bottom: 12px;
  padding: 12px 0 0;
  border-top: 1px solid var(--border);
}
.ip-filters-panel.hidden {
  display: none;
}
.ip-filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.ip-filter-label {
  flex: 0 0 140px;
  font-size: 13px;
  color: var(--muted);
  padding-top: 6px;
}
.filter-chips-row {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.filter-chips-row .chip {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: inherit;
}
.filter-chips-row .chip.active {
  background: #ecf5ff;
  border-color: #b3d8ff;
  color: var(--primary);
  font-weight: 500;
}
.ip-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.ip-shown-count { margin: 0 0 10px; font-size: 13px; }
.th-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.th-sortable:hover { color: var(--primary); }
.th-sort-active { color: var(--primary); }
.sort-arrow { font-size: 10px; }

/* Timeline enhancements */
.tl-kind-comment summary { border-left: 3px solid #909399; }
.tl-kind-comment_wa summary { border-left: 3px solid #25d366; }
.tl-kind-comment_tg summary { border-left: 3px solid #2aabee; }
.tl-kind-comment_max summary { border-left: 3px solid #7c5cff; }
.tl-kind-comment_summary summary { border-left: 3px solid #e6a23c; }
.tl-kind-comment_rechka summary { border-left: 3px solid #6b4eff; background: linear-gradient(90deg, rgba(107, 78, 255, 0.06), transparent 48px); }
.tl-rechka-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #5b3fe6;
  background: #ede9ff;
  border: 1px solid #d4cbff;
}
.tl-skip-fixed {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tl-item-active {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 1px rgba(64, 158, 255, 0.25);
  background: #f5faff;
}
.tl-item-active > summary { background: #ecf5ff; }
.dl-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
}
.dl-badge-ok { background: #e8f8ef; color: #2d7a46; }
.dl-badge-overdue { background: #fef0f0; color: var(--danger); }
.tl-main .dl-badge { margin-right: 6px; }

.timeline-panel-tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--border);
}
.tl-tab {
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tl-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.tl-view-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.tl-view-pane.hidden {
  display: none !important;
}
.tl-chat-view {
  padding: 0;
}
.tl-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
}
.tl-chat-empty p {
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 6px;
}
.tl-chat-msg {
  margin-bottom: 10px;
}
.tl-chat-msg-body {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
.tl-chat-msg-user .tl-chat-msg-body {
  background: #ecf5ff;
  margin-left: 20px;
  white-space: pre-wrap;
}
.tl-chat-msg-ai .tl-chat-msg-body {
  background: var(--bg);
  margin-right: 4px;
}
.tl-chat-sources {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  min-width: 0;
  overflow: hidden;
}
.tl-chat-source {
  background: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2px 8px;
  font: inherit;
  font-size: 11px;
  color: var(--primary);
  cursor: pointer;
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tl-chat-source:hover {
  border-color: var(--primary);
  background: #ecf5ff;
}
.tl-chat-source-static {
  cursor: default;
  color: var(--muted);
}
.tl-chat-source-attachment {
  cursor: default;
  color: #fff;
  background: #8b5cf6;
  border-color: #8b5cf6;
}
.tl-chat-source-attachment:hover {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}
.tl-chat-suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.tl-chat-suggest {
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font: inherit;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.tl-chat-suggest:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.tl-chat-form {
  padding: 8px 16px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.tl-chat-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 52px;
  box-sizing: border-box;
}
.tl-chat-input:focus {
  outline: none;
  border-color: var(--primary);
}
.tl-chat-form-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
}
/* ─── Шторка «ИИ по портфелю» ─── */
/* z-index ниже карточки: карточка открывается поверх чата, чат остаётся под ней. */
.pc-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 189;
}
.pc-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.pc-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(720px, 100vw);
  background: var(--card, #fff);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 190;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pc-panel.open {
  transform: translateX(0);
}
.pc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pc-head h2 {
  margin: 0;
  font-size: 16px;
}
.pc-meta {
  margin: 4px 0 0;
  font-size: 12px;
}
.pc-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pc-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
}
.pc-suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 8px;
  flex-shrink: 0;
}
.pc-suggest {
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font: inherit;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.pc-suggest:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.pc-form {
  padding: 8px 16px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.pc-entity {
  background: #ecf5ff;
  border: 1px solid #cfe3fb;
  border-radius: 4px;
  padding: 0 5px;
  font: inherit;
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
}
.pc-entity:hover {
  border-color: var(--primary);
  text-decoration: underline;
}

.tl-foreign-calls {
  padding: 10px 16px 0;
}
.tl-foreign-calls.hidden {
  display: none;
}
.tl-fc-box {
  border: 1px solid var(--warn-border, #e6c07b);
  border-radius: 8px;
  background: var(--warn-bg, #fff8e6);
  padding: 8px 12px;
}
.tl-fc-box > summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.tl-fc-hint {
  margin: 6px 0 8px;
  font-size: 12px;
}
.tl-fc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tl-fc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.tl-fc-line {
  font-size: 13px;
}
.tl-fc-where {
  font-size: 12px;
}
.tl-fc-match {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  border-radius: 10px;
  background: var(--ok-bg, #e6f4ea);
  color: var(--ok-text, #1e7d34);
}
.tl-kind-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 16px 0;
}
.tl-kind-filters.hidden {
  display: none;
}
.tl-kind-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  line-height: 1.3;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tl-kind-chip:hover {
  border-color: #b3d8ff;
  color: var(--primary);
}
.tl-kind-chip.active {
  background: #ecf5ff;
  border-color: #b3d8ff;
  color: var(--primary);
  font-weight: 600;
}
.tl-kind-chip-reset {
  color: var(--muted);
  border-style: dashed;
}
.tl-kind-chip-reset:hover {
  color: var(--text);
}
.tl-hide-missed {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.timeline-tab-panel {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.timeline-tab-panel.hidden {
  display: none;
}
#timelineTabEvents {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
#timelineTabEvents .timeline-list {
  flex: 1;
}
.tl-ai-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}
.tl-ai-prompt-row {
  padding: 0 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tl-ai-prompt-row label {
  font-size: 13px;
  color: var(--muted);
}
.tl-ai-prompt-row select {
  max-width: 100%;
}
.tl-analysis-loading {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--primary);
}
.tl-analysis-loading.hidden {
  display: none;
}
.tl-analysis-view {
  padding: 0 16px 12px;
  max-height: 45vh;
  overflow: auto;
}
.tl-analysis-view.hidden {
  display: none;
}
.tl-analysis-md {
  font-size: 14px;
  line-height: 1.55;
}
.tl-analysis-md h1,
.tl-analysis-md h2,
.tl-analysis-md h3 {
  margin: 1em 0 0.4em;
  font-size: 1em;
}
.tl-analysis-md h1 { font-size: 1.15em; }
.tl-analysis-md ul {
  margin: 0.4em 0;
  padding-left: 1.2em;
}
.tl-analysis-history {
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 28vh;
  overflow: auto;
}
.tl-context-overlay {
  position: fixed;
  inset: 0;
  z-index: 160;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.tl-context-overlay.hidden {
  display: none;
}
.tl-context-card {
  width: min(900px, 100%);
  max-height: min(85vh, 840px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
}
.tl-context-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.tl-context-head h3 {
  margin: 0;
  font-size: 16px;
}
.tl-context-hint {
  margin: 0 0 10px;
  font-size: 12px;
}
.tl-context-pre {
  flex: 1;
  margin: 0;
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.45;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.tl-analysis-item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  text-align: left;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}
.tl-analysis-item:hover,
.tl-analysis-item.active {
  border-color: var(--primary);
  background: #ecf5ff;
}
.tl-analysis-item-kind {
  font-weight: 600;
}

.calls-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.calls-select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  background: #fff;
}
.calls-table .calls-audio {
  width: 180px;
  max-width: 100%;
  height: 28px;
}
.cell-recording {
  min-width: 190px;
}
.transcription-status {
  margin-bottom: 10px;
  font-size: 13px;
  padding: 8px 12px;
  background: #f5f7fa;
  border-radius: 6px;
}
.cell-transcript {
  max-width: 280px;
  font-size: 12px;
  line-height: 1.35;
}
.transcript-done { color: var(--text); }
.transcript-pending { color: #e6a23c; }
.transcript-processing { color: var(--primary); }
.transcript-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}
.transcript-progress-bar {
  height: 6px;
  background: #e4e7ed;
  border-radius: 3px;
  overflow: hidden;
}
.transcript-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.transcript-progress-label {
  font-size: 11px;
  color: var(--primary);
  line-height: 1.3;
}
.transcript-err { color: var(--danger); cursor: help; }
.ai-queue-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 10px;
}
.ai-queue-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.ai-queue-table td:first-child { width: 40px; }
.ai-queue-flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #fdf6ec;
  color: #b88230;
  font-size: 11px;
  cursor: help;
}
.transcript-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}
.btn-sm {
  font-size: 12px;
  padding: 4px 10px;
}
.btn-transcribe {
  white-space: nowrap;
}
.transcript-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.transcript-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 24px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.transcript-panel-audio {
  margin-bottom: 16px;
}
.transcript-panel-audio audio {
  width: 100%;
  max-width: 100%;
}
.tl-transcript {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.tl-transcript strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.calls-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 20px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.calls-bulk-meta { flex: 1; min-width: 220px; }
.calls-bulk-hint { margin: 0 0 4px; font-size: 13px; }
.calls-bulk-stats { margin: 0; font-size: 14px; font-weight: 500; color: var(--text); }
.openai-balance {
  align-self: center;
  padding: 6px 12px;
  border-radius: 6px;
  background: #ecfdf5;
  color: #047857;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.openai-balance.openai-balance-warn {
  background: #fff7ed;
  color: #c2410c;
}

.dash-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100vh - 40px);
  min-height: 0;
  max-height: none;
  margin-bottom: 0;
}
.dash-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.dash-view-tabs {
  flex-shrink: 0;
  margin: 0 0 10px;
}
.dash-view-panel:not(.hidden) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.dash-sales-count-hint {
  flex-shrink: 0;
  margin: 0 0 12px;
  font-size: 13px;
}

.dash-funnel-hint {
  flex-shrink: 0;
  margin: 0 0 14px;
  font-size: 13px;
}
.dash-funnel-unified {
  padding: 20px 12px 18px;
  margin-bottom: 24px;
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}
.dash-funnel-unified .dash-funnel-chart-wrap {
  padding: 0;
  margin-bottom: 0;
}
.dash-funnel-visual-unified {
  margin: 0 auto;
  max-width: 100%;
}
.dash-funnel-text-overlay-unified {
  display: flex;
  flex-direction: column;
}
.dash-funnel-header-center {
  color: var(--text);
}
.dash-funnel-cap-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 100%;
  padding: 0 4px;
  box-sizing: border-box;
}
.dash-funnel-wing-delta-cap {
  flex-direction: column;
  gap: 1px;
  padding: 0 3px;
}
.dash-funnel-wing-delta-cap .dash-funnel-wing-cap-sub {
  font-size: 10px;
  line-height: 1.15;
  word-break: break-word;
}
.dash-funnel-seg-row-first .dash-funnel-seg-text-money .dash-funnel-seg-label {
  margin-bottom: 4px;
}
.dash-funnel-seg-row-first .dash-funnel-seg-text-money .dash-funnel-seg-val-money {
  font-size: 22px;
  line-height: 1.15;
  white-space: normal;
}
.dash-funnel-wing-side-money {
  padding: 0 4px;
}
.dash-funnel-wing-side-money .dash-funnel-side-label {
  font-size: 11px;
  line-height: 1.15;
  margin-bottom: 3px;
  white-space: normal;
}
.dash-funnel-wing-side-money .dash-funnel-seg-val-money {
  font-size: 14px;
  line-height: 1.15;
  white-space: normal;
  word-break: break-word;
  max-width: 100%;
}
.dash-funnel-wing-cap-title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
}
.dash-funnel-fact-cap-title {
  font-size: 14px;
}
.dash-funnel-wing-cap-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.25;
  color: var(--muted);
}
.dash-funnel-wing-header-cap {
  flex-direction: column;
  gap: 1px;
}
.dash-funnel-wing-side {
  color: #fff;
  flex-direction: column;
  gap: 0;
}
.dash-funnel-wing-side .dash-funnel-side-label {
  color: #fff;
  opacity: 0.95;
}
.dash-funnel-wing-side .dash-funnel-seg-val,
.dash-funnel-wing-side .dash-funnel-seg-val-money {
  color: #fff;
  font-size: 21px;
}
.dash-funnel-wing-side .dash-funnel-seg-val-money {
  font-size: 19px;
}
.dash-funnel-wing-delta-band {
  color: var(--text);
}
.dash-funnel-wing-delta-band .dash-funnel-wing-delta {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.dash-funnel-wing-delta-cap .dash-funnel-wing-cap-title {
  color: var(--text);
}
.dash-funnel-wing-delta-cap .dash-funnel-wing-cap-sub {
  color: var(--muted);
}
.dash-funnel-chart-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}
.dash-funnel-visual {
  position: relative;
  margin: 0 auto;
}
.dash-funnel-visual-wings {
  max-width: none;
}
.dash-funnel-svg-bg {
  display: block;
  width: 100%;
  height: auto;
  position: relative;
  z-index: 0;
}
.dash-funnel-text-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  z-index: 1;
}
.dash-funnel-seg-row {
  position: relative;
  box-sizing: border-box;
}
.dash-funnel-seg-row:not(.dash-funnel-seg-row-wings) {
  display: flex;
}
.dash-funnel-seg-row:not(.dash-funnel-seg-row-wings) .dash-funnel-seg-text {
  flex: 1;
  height: 100%;
}
.dash-funnel-seg-row-wings .dash-funnel-wing,
.dash-funnel-seg-row-wings .dash-funnel-seg-text {
  position: absolute;
  top: 0;
  height: 100%;
  box-sizing: border-box;
}
.dash-funnel-wing {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 3px;
  pointer-events: none;
}
.dash-funnel-wing b {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.dash-funnel-unified .dash-funnel-convs {
  margin-top: 16px;
  padding-top: 14px;
}
.dash-funnel-seg-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  line-height: 1.2;
  padding: 0 10px;
  box-sizing: border-box;
  overflow: visible;
  height: 100%;
}
.dash-funnel-seg-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 3px;
}
.dash-funnel-seg-val {
  display: block;
  font-size: 21px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
}
.dash-funnel-seg-val-money {
  font-size: 19px;
}
.dash-funnel-rub {
  font-weight: 700;
}
.dash-funnel-seg-conv {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-top: 5px;
  line-height: 1.2;
}
.dash-funnel-wing-side .dash-funnel-side-conv {
  color: #fff;
  opacity: 0.92;
  font-size: 13px;
  margin-top: 3px;
}
.dash-funnel-convs {
  width: 100%;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dash-funnel-conv-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 6px 10px;
  text-align: center;
  line-height: 1.4;
}
.dash-funnel-conv-from {
  color: var(--muted);
  flex: 1 1 100%;
  font-size: 13px;
  font-weight: 500;
}
.dash-funnel-conv-pct {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.dash-funnel-delta-up { color: #27ae60; }
.dash-funnel-delta-down { color: #e74c3c; }
.dash-funnel-delta-neutral { color: var(--muted); }
.dash-funnel-table-wrap {
  padding: 12px 14px;
  overflow-x: auto;
  margin-top: 8px;
}
.dash-funnel-yoy-table {
  min-width: 1280px;
  font-size: 12px;
}
.dash-funnel-yoy-table th,
.dash-funnel-yoy-table td {
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
}
.dash-funnel-yoy-h-period,
.dash-funnel-yoy-period {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card);
}
.dash-funnel-yoy-h-leads { color: #409eff; }
.dash-funnel-yoy-h-deals { color: #409eff; }
.dash-funnel-yoy-h-sales { color: #409eff; }
.dash-funnel-yoy-h-conv { color: #9b59b6; }
.dash-funnel-yoy-h-sum { color: #27ae60; }
.dash-funnel-yoy-row-quarter td,
.dash-funnel-yoy-row-quarter .dash-funnel-yoy-period {
  background: #eef5fc;
  font-weight: 600;
}
.dash-funnel-yoy-row-summary td,
.dash-funnel-yoy-row-summary .dash-funnel-yoy-period {
  background: #eef5fc;
  font-weight: 700;
}
.dash-funnel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.dash-funnel-table th,
.dash-funnel-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.dash-funnel-table th {
  background: var(--bg);
  font-weight: 600;
  font-size: 12px;
}
.dash-funnel-td-num {
  text-align: right;
  white-space: nowrap;
}
.dash-funnel-table-note {
  margin: 10px 0 0;
  font-size: 12px;
}

.dash-sources-hint {
  margin: 0 0 12px;
  font-size: 13px;
}
.dash-sources-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.dash-sources-chart-card {
  padding: 12px 16px 16px;
}
.dash-sources-chart-wrap {
  min-height: 320px;
  height: 340px;
}
.dash-sources-chart-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.dash-sources-chip--overview {
  font-weight: 600;
}
.dash-sources-tables {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}
.dash-sources-table-card {
  padding: 12px 16px 16px;
  min-width: 0;
  width: 100%;
}
.dash-sources-table-title {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 600;
}
.dash-sources-table-wrap {
  max-height: none;
  overflow-x: auto;
  width: 100%;
}
.dash-sources-table {
  width: 100%;
}
.dash-sources-table th,
.dash-sources-table td {
  font-size: 12px;
}
.dash-sources-h-name {
  min-width: 120px;
  vertical-align: bottom;
}
.dash-sources-h-metric {
  text-align: center;
  color: #409eff;
  border-bottom: 1px solid var(--border);
}
.dash-sources-td-name {
  font-weight: 500;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-sources-row-summary td {
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: rgba(0, 0, 0, 0.02);
}
.dash-sources-row-summary .dash-sources-td-name {
  font-weight: 700;
}

.dash-sources-row[data-source-key] {
  cursor: pointer;
}
.dash-sources-row[data-source-key]:hover td {
  background: rgba(64, 158, 255, 0.06);
}
.dash-sources-row.is-active td {
  background: rgba(64, 158, 255, 0.12);
}
.dash-sources-monthly-card {
  padding: 12px 16px 16px;
}
.dash-sources-monthly-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 8px;
}
.dash-sources-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dash-sources-chip {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-sources-monthly-hint {
  margin: 0 0 10px;
  font-size: 12px;
}
.dash-sources-monthly-table th {
  text-align: center;
}
.dash-sources-yoy-cell {
  font-size: 11px;
  color: var(--muted);
}

.dash-sources-row-group td {
  font-weight: 700;
  background: rgba(64, 158, 255, 0.08);
  border-top: 1px solid var(--border);
}
.dash-sources-row-member td {
  background: rgba(0, 0, 0, 0.015);
}
.dash-sources-row-member .dash-sources-td-name {
  padding-left: 20px;
  font-weight: 500;
  color: var(--muted);
}
.dash-sources-member-mark {
  opacity: 0.55;
  margin-right: 2px;
}
.dash-sources-row-group .dash-sources-td-name {
  font-weight: 700;
}

.dash-top {
  flex-shrink: 0;
  padding: 12px 16px !important;
  margin-bottom: 0 !important;
}
.dash-month-bar {
  display: flex;
  justify-content: center;
}
.dash-month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dash-month-title {
  margin: 0;
  min-width: 140px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
}
.dash-tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-width: 280px;
}
.dash-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-tile-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
}
.dash-tile-values {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
}
.dash-stats-row .dash-stat-tile {
  min-width: 0;
  padding: 10px 12px;
  container-type: inline-size;
}
@media (max-width: 1400px) {
  .dash-stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .dash-stats-row { grid-template-columns: 1fr; }
}
.dash-stat-tile > span {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.dash-stat-tile .dash-tile-body { margin-top: 0; }
.dash-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 6px 10px;
}
@container (max-width: 480px) {
  .dash-stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-stat-plan-num,
  .dash-stat-fact-num {
    font-size: 16px;
  }
}
.dash-period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.dash-period-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  flex: 0 0 auto;
}
.dash-tile-metric-toggle { white-space: nowrap; }
.dash-display-toggle {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.dash-display-toggle .btn-preset {
  padding: 5px 10px;
  font-size: 12px;
}
.dash-service-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
  flex-wrap: wrap;
}
.dash-num-table-wrap {
  overflow: auto;
  max-height: min(320px, 50vh);
  margin-top: 4px;
}
.dash-num-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.dash-num-table th,
.dash-num-table td {
  padding: 4px 6px;
  border: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.dash-num-table th:first-child,
.dash-num-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
}
.dash-service-wrap label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.dash-service-select {
  min-width: 200px;
  max-width: 280px;
}
.plan-service-tabs {
  margin: 12px 0 8px;
}
.plan-service-hint {
  margin: 0 0 16px;
  font-size: 13px;
}
.dash-period-toggle {
  display: flex;
  gap: 6px;
}
.dash-period-toggle .btn-preset {
  padding: 5px 14px;
  font-size: 13px;
}

.dash-range-popover {
  position: fixed;
  z-index: 1200;
  min-width: 260px;
  max-width: 320px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.dash-range-popover.hidden {
  display: none;
}
.dash-range-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.dash-range-cal-title {
  font-weight: 600;
  font-size: 14px;
}
.dash-range-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.dash-range-month {
  padding: 8px 4px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.dash-range-month:hover {
  border-color: var(--primary);
  background: #f0f7ff;
}
.dash-range-month.in-range {
  background: #ecf5ff;
  border-color: #b3d8ff;
}
.dash-range-month.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.dash-range-label {
  margin: 10px 0 8px;
  font-size: 12px;
  min-height: 1.2em;
}
.dash-range-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dash-stat-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dash-stat-metric {
  min-width: 0;
}
.dash-stat-sub {
  font-size: 11px;
  color: var(--muted);
  text-transform: lowercase;
}
.dash-stat-plan-num,
.dash-stat-fact-num {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-stat-fact-num { color: #27ae60; }
.dash-delta-num {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
}
.dash-delta-num .dash-delta-arrow {
  font-size: 12px;
  font-weight: 600;
}
.dash-delta-up { color: #27ae60; }
.dash-delta-down { color: #e74c3c; }
.dash-delta-neutral { color: var(--muted); font-weight: 500; }

.select-styled {
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  background-color: var(--card);
  color: var(--text);
  cursor: pointer;
  min-width: 100px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23909399' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.select-styled:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.15);
}

.multiselect-dropdown { position: relative; }
.multiselect-dropdown .multiselect-display {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  box-sizing: border-box;
}
.multiselect-panel {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  padding: 6px 0;
  margin-top: 2px;
  max-height: 220px;
  overflow-y: auto;
}
.multiselect-dropdown.open .multiselect-panel { display: block; }
.multiselect-panel label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}
.multiselect-panel label:hover { background: var(--hover, rgba(0,0,0,.04)); }
.multiselect-panel input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

.plans-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.plans-toolbar label {
  font-size: 14px;
  color: var(--muted);
}

.dash-charts-grid {
  display: grid;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.dash-charts-grid-general {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr;
}
.dash-charts-grid-general.dash-charts-grid-promo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr;
}
.dash-charts-grid-general.dash-charts-grid-promo [data-dash-general="support-extra"] {
  display: none;
}
.dash-charts-grid-sales {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr;
}
.dash-charts-grid-sales.dash-charts-grid-promo {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: 1fr 1fr;
}
.dash-chart-cell {
  display: flex;
  flex-direction: column;
  padding: 8px 10px 10px !important;
  margin-bottom: 0 !important;
  min-height: 0;
  overflow: hidden;
}
.dash-chart-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.25;
  min-height: 0;
  overflow: hidden;
}
.dash-chart-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.dash-chart-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  padding: 0 6px;
  border-radius: 4px;
  background: #e8f5e9;
  color: #2e7d32;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}
.dash-chart-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}
@media (max-width: 1100px) {
  .dash-charts-grid-sales {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(180px, 1fr));
  }
  .dash-charts-grid-sales.dash-charts-grid-promo {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(160px, 1fr));
  }
}
@media (max-width: 900px) {
  .dash-tiles { grid-template-columns: repeat(2, 1fr); }
  .dash-charts-grid-general,
  .dash-charts-grid-sales {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(auto-fill, minmax(220px, 1fr));
  }
  .dash-charts-grid-general.dash-charts-grid-promo,
  .dash-charts-grid-sales.dash-charts-grid-promo {
    grid-template-columns: 1fr;
  }
  .dash-page { height: auto; min-height: 0; }
  .dash-body { flex: none; }
}

.metrika-period-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.metrika-period-nav .input-date {
  padding: 4px 8px;
  border: 1px solid var(--border, #d0d7de);
  border-radius: 6px;
  background: var(--card, #fff);
  color: inherit;
  font: inherit;
}

.metrika-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: auto;
  min-height: 0;
  padding-bottom: 24px;
}
.metrika-charts-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
.metrika-chart-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-bottom: 0 !important;
}
.metrika-chart-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
}
.metrika-chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  flex: 0 0 auto;
}
.metrika-chart-wrap-tall {
  height: 360px;
}
.metrika-pages-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
.metrika-tree-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0 !important;
  max-height: 440px;
}
.metrika-tree-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.metrika-tree-actions {
  display: flex;
  gap: 6px;
}
.metrika-tree-hint {
  margin: 0 0 8px;
  font-size: 12px;
}
.metrika-page-tree {
  overflow: auto;
  flex: 1;
  min-height: 0;
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 6px;
}
.metrika-tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
  font-size: 13px;
}
.metrika-tree-twist {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border, #d0d7de);
  border-radius: 4px;
  background: var(--card, #fff);
  cursor: pointer;
  padding: 0;
  color: var(--text, #111);
  line-height: 20px;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.metrika-tree-twist:hover {
  background: #f1f5f9;
}
.metrika-tree-twist.invisible {
  visibility: hidden;
  pointer-events: none;
}
.metrika-tree-label {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.metrika-tree-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metrika-tree-metric {
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
@media (max-width: 1100px) {
  .metrika-charts-row {
    grid-template-columns: 1fr;
  }
  .metrika-pages-layout {
    grid-template-columns: 1fr;
  }
  .metrika-tree-card {
    max-height: 320px;
  }
}

/* ─── База знаний ─── */

.kb-page {
  height: 100%;
}

.kb-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
  height: calc(100vh - 72px);
}

.kb-layout > .card {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin-bottom: 0;
  overflow: hidden;
}

/* Список документов */

.kb-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.kb-sidebar-head h2 {
  font-size: 15px;
  margin: 0;
}

.kb-search {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 6px;
}

.kb-stats {
  font-size: 11px;
  margin: 0 0 8px;
  line-height: 1.4;
}

.kb-sidebar-actions {
  display: flex;
  gap: 4px;
  flex: 1 0 100%;
}

.kb-sidebar-actions .btn {
  flex: 1;
}

.kb-node-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: 3px;
}

.kb-dot-published {
  background: #67c23a;
}

.kb-dot-draft {
  background: #e6a23c;
}

.kb-tree {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}

.kb-list-empty {
  font-size: 12px;
  padding: 8px 0;
}

.kb-node {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  font: inherit;
  color: var(--text);
  padding: 3px 4px 3px calc(4px + var(--kb-depth, 0) * 13px);
}

.kb-node:hover {
  background: var(--bg);
}

.kb-node-doc {
  cursor: pointer;
  font-size: 13px;
  gap: 6px;
}

.kb-node-doc.active {
  background: #ecf5ff;
  border-color: var(--primary);
}

.kb-node-folder.selected {
  background: #ecf5ff;
}

.kb-node-space > .kb-node-label .kb-node-name {
  font-weight: 600;
}

.kb-node-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}

.kb-caret {
  flex: 0 0 auto;
  width: 15px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.kb-caret-empty {
  cursor: default;
  opacity: 0.35;
}

.kb-node-label {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.kb-node-count {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--muted);
}

.kb-node-actions {
  display: none;
  gap: 2px;
  flex: 0 0 auto;
}

.kb-node-folder:hover .kb-node-actions {
  display: flex;
}
.kb-folder-editor {
  padding: 0;
}
.kb-folder-info {
  padding: 0 4px;
}
.kb-root-drop {
  margin-top: 8px;
  padding: 10px;
  border: 2px dashed var(--border);
  border-radius: 6px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.kb-root-drop.kb-drop-target {
  border-color: var(--primary);
  background: #dbeafe;
}
.kb-root-drop-label {
  font-size: 12px;
}
.kb-dragging {
  opacity: 0.4;
}
.kb-drop-target {
  outline: 2px dashed var(--primary);
  outline-offset: -2px;
  background: #dbeafe;
  border-radius: 6px;
}
[draggable="true"] {
  cursor: grab;
}
[draggable="true"]:active {
  cursor: grabbing;
}

.kb-node-actions button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.kb-node-actions button:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.kb-breadcrumbs {
  font-size: 11px;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  line-height: 1.6;
}

.kb-badge-published {
  background: #f0f9eb;
  color: #529b2e;
}

.kb-badge-draft {
  background: #fdf6ec;
  color: #b88230;
}

.kb-sidebar-foot {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.kb-sidebar-foot .btn {
  width: 100%;
}

/* Редактор */

.kb-empty {
  padding: 24px 8px;
  max-width: 560px;
}

.kb-empty h2 {
  margin-top: 0;
}

.kb-editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.kb-editor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.kb-title-input {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
}

.kb-title-input:hover {
  border-color: var(--border);
}

.kb-title-input:focus {
  border-color: var(--primary);
  background: #fff;
  outline: none;
}

.kb-editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.kb-save-state {
  font-size: 11px;
  color: #b88230;
  white-space: nowrap;
}

.kb-meta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px 12px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.kb-meta-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.kb-meta-field > span {
  font-size: 11px;
  color: var(--muted);
}

.kb-meta-field input,
.kb-meta-field select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  min-width: 0;
  width: 100%;
}

.kb-meta-field-wide {
  grid-column: span 2;
}

.kb-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.kb-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: -1px;
}

.kb-tab:hover {
  color: var(--text);
}

.kb-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.kb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.kb-toolbar .btn {
  font-size: 11px;
  padding: 3px 8px;
}

.kb-panes {
  display: grid;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.kb-panes-edit {
  grid-template-columns: 1fr;
}

.kb-panes-edit .kb-pane-preview {
  display: none;
}

.kb-panes-preview {
  grid-template-columns: 1fr;
}

.kb-panes-preview .kb-pane-edit {
  display: none;
}

.kb-panes-split {
  grid-template-columns: 1fr 1fr;
}

.kb-pane-edit,
.kb-pane-preview {
  min-height: 0;
  overflow: hidden;
  display: flex;
}

.kb-textarea {
  width: 100%;
  flex: 1;
  min-height: 0;
  resize: none;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  tab-size: 2;
}

.kb-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.kb-preview {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fcfcfd;
}

.kb-pane-history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.kb-history-list {
  margin-top: 8px;
}

.kb-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

/* Разметка внутри предпросмотра и ответов ИИ */

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 18px 0 8px;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 19px; }
.markdown-body h2 { font-size: 16px; }
.markdown-body h3 { font-size: 14px; }

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body p,
.markdown-body li {
  font-size: 13px;
  line-height: 1.65;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 20px;
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  font-size: 12px;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border);
  padding: 5px 8px;
  text-align: left;
}

.markdown-body th {
  background: var(--bg);
  font-weight: 600;
}

.markdown-body blockquote {
  margin: 10px 0;
  padding: 6px 12px;
  border-left: 3px solid var(--primary);
  background: #ecf5ff;
  color: #4a5560;
  font-size: 13px;
}

.markdown-body code {
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: Consolas, Menlo, monospace;
  font-size: 12px;
}

.markdown-body pre {
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 4px;
  overflow-x: auto;
  font-size: 12px;
}

.markdown-body pre code {
  background: none;
  padding: 0;
}

/* Помощник и подсказки */

.kb-aside-tabs {
  flex-shrink: 0;
}

.kb-aside-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.kb-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.kb-chat-empty p {
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 6px;
}

.kb-msg {
  margin-bottom: 10px;
  max-width: 100%;
}

.kb-msg-body {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.kb-msg-user .kb-msg-body {
  background: #ecf5ff;
  margin-left: 24px;
  white-space: pre-wrap;
}

.kb-msg-ai .kb-msg-body {
  background: var(--bg);
  margin-right: 8px;
}

.kb-msg-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.kb-msg-actions .btn {
  font-size: 11px;
  padding: 3px 8px;
}

.kb-chat-suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.kb-suggest {
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font: inherit;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}

.kb-suggest:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.kb-chat-form {
  flex-shrink: 0;
}

.kb-chat-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 52px;
}

.kb-chat-input:focus {
  outline: none;
  border-color: var(--primary);
}

.kb-chat-form-actions {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
}

.kb-guide {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

@media (max-width: 1500px) {
  .kb-layout {
    grid-template-columns: 240px minmax(0, 1fr) 320px;
  }
}

@media (max-width: 1200px) {
  .kb-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    height: auto;
  }
  .kb-aside {
    grid-column: 1 / -1;
    height: 460px;
  }
  .kb-layout > .card {
    height: auto;
  }
  .kb-editor {
    min-height: 520px;
  }
}

/* AI recommendations */
.ai-rec-table tr.ai-rec-row {
  cursor: pointer;
}
.ai-rec-table tr.ai-rec-row.is-open {
  background: rgba(37, 99, 235, 0.06);
}
.ai-rec-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 8px 4px 12px;
}
.ai-rec-detail-col h4 {
  margin: 0 0 8px;
  font-size: 13px;
}
.ai-rec-touches {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
}
.ai-rec-draft-body {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  margin: 8px 0;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 6px;
  max-height: 240px;
  overflow: auto;
}
.ai-rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
@media (max-width: 900px) {
  .ai-rec-detail {
    grid-template-columns: 1fr;
  }
}

/* Attachment pills & notice */
.tl-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.tl-attachment-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  background: #8b5cf6;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  margin: 2px 4px 2px 0;
  border: none;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background 0.15s;
}
.tl-attachment-pill:hover {
  background: #7c3aed;
  color: #fff;
}
.tl-attachment-format {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  opacity: 0.85;
}
.tl-attachment-pill.is-image {
  background: #94a3b8;
}
.tl-attachment-pill.is-image:hover {
  background: #7e8fa3;
}
.tl-attachment-size {
  opacity: 0.8;
  font-size: 11px;
}
.tl-attachment-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-left: 4px;
  flex-shrink: 0;
  background: #f59e0b;
}
.tl-attachment-status-dot.is-done { background: #16a34a; }
.tl-attachment-status-dot.is-error { background: #dc2626; }
.tl-attachment-status-dot.is-skipped { background: #94a3b8; }
.tl-attachment-status-dot.is-pending { background: #f59e0b; }
.tl-attachments--detail {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
.tl-attachment-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}
.tl-attachment-card-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.tl-attachment-card-size {
  font-size: 12px;
  color: #64748b;
}
.tl-attachment-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: lowercase;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #c2410c;
}
.tl-attachment-status.is-done {
  background: #ecfdf5;
  color: #15803d;
}
.tl-attachment-status.is-error {
  background: #fef2f2;
  color: #b91c1c;
}
.tl-attachment-status.is-skipped {
  background: #f1f5f9;
  color: #64748b;
}
.tl-attachment-status.is-pending {
  background: #fff7ed;
  color: #c2410c;
}
.tl-attachment-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tl-attachment-modal {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 260;
  padding: 24px;
}
.tl-attachment-modal.hidden { display: none; }
.tl-attachment-modal-card {
  width: min(72vw, 820px);
  min-width: min(92vw, 360px);
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tl-attachment-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #f1f5f9;
}
.tl-attachment-modal-head h3 {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 1.35;
}
.tl-attachment-modal-meta {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
}
.tl-attachment-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px;
}
.tl-attachment-modal-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #1e293b;
}
.tl-attachment-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid #f1f5f9;
}
.tl-attachment-notice {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  margin: 4px 0 8px;
  border-radius: 8px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  font-size: 13px;
}
.tl-attachment-notice.hidden { display: none; }
.tl-attach-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #6d4c00;
}
.tl-pending-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tl-pending-toggle {
  background: none;
  border: none;
  color: #6d4c00;
  cursor: pointer;
  font-size: 12px;
  text-decoration: underline;
  padding: 0;
}
.tl-pending-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tl-pending-list.hidden { display: none; }
.tl-pending-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(255,255,255,0.7);
  font-size: 12px;
}
.tl-pending-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #333;
}
.tl-pending-item-size {
  color: #888;
  font-size: 11px;
  flex-shrink: 0;
}
.tl-pending-item-status {
  font-size: 11px;
  flex-shrink: 0;
}
.tl-pending-item-status.done { color: #16a34a; }
.tl-pending-item-status.error { color: #dc2626; }
.tl-pending-item-status.processing { color: #d97706; }
.tl-pending-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

/* ─── Telegram client module ─── */
.tg-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  gap: 12px;
  overflow: hidden;
}
.content:has(> #page-telegram:not(.hidden)) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tg-auth-card {
  max-width: 480px;
}
.tg-auth-hint {
  margin: 0 0 12px;
}
.tg-auth-step {
  margin-top: 12px;
}
.tg-auth-msg {
  margin-top: 12px;
  min-height: 1.2em;
}
.tg-auth-msg.err {
  color: #dc2626;
}
.tg-client {
  --tg-dialogs-w: 280px;
  --tg-ai-w: 360px;
  --tg-wallpaper: #ffffff;
  --tg-bubble-in: #ffffff;
  --tg-bubble-out: #effdde;
  display: grid;
  grid-template-columns: max-content 6px minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  position: relative;
}
.tg-client.is-ai-open {
  grid-template-columns: max-content 6px minmax(0, 1fr) 6px var(--tg-ai-w, 360px);
}
.tg-client.is-resizing {
  cursor: col-resize;
  user-select: none;
}
.tg-client.is-resizing .tg-chat,
.tg-client.is-resizing .tg-dialogs,
.tg-client.is-resizing .tg-ai-panel {
  pointer-events: none;
}
.tg-sidebar {
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  padding: 0;
  margin-bottom: 0;
  border-radius: 4px;
}
.tg-split {
  position: relative;
  width: 6px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: col-resize;
  flex-shrink: 0;
  z-index: 2;
  touch-action: none;
}
.tg-split::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 1px;
  width: 3px;
  background: transparent;
  transition: background 0.12s ease;
}
.tg-split:hover::before,
.tg-client.is-resizing .tg-split::before,
.tg-client.is-ai-resizing .tg-ai-split::before {
  background: #94a3b8;
}
.tg-client.is-ai-resizing {
  cursor: col-resize;
  user-select: none;
}
.tg-client.is-dialogs-compact .tg-dialogs {
  position: relative;
  width: 72px;
  padding: 0;
  align-items: stretch;
}
.tg-client.is-dialogs-compact .tg-dialogs-head,
.tg-client.is-dialogs-compact .tg-dialog-search-wrap,
.tg-client.is-dialogs-compact .tg-dialog-tabs,
.tg-client.is-dialogs-compact .tg-dialog-main,
.tg-client.is-dialogs-compact .tg-chat-search-panel {
  display: none !important;
}
.tg-client.is-dialogs-compact .tg-dialog-list {
  position: absolute;
  inset: 0;
  gap: 0;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 4px 0;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.22) transparent;
}
.tg-client.is-dialogs-compact .tg-dialog-list::-webkit-scrollbar {
  width: 2px;
}
.tg-client.is-dialogs-compact .tg-dialog-list::-webkit-scrollbar-track {
  background: transparent;
}
.tg-client.is-dialogs-compact .tg-dialog-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.22);
  border-radius: 2px;
}
.tg-client.is-dialogs-compact .tg-dialog-item {
  position: relative;
  justify-content: center;
  align-items: center;
  padding: 8px 0;
  margin: 0;
  width: 100%;
  gap: 0;
  box-sizing: border-box;
  border: none;
  border-radius: 0;
  background: transparent;
}
.tg-client.is-dialogs-compact .tg-dialog-item:hover {
  background: #eef5fc;
}
.tg-client.is-dialogs-compact .tg-dialog-item.is-active {
  background: #cfe6ff;
  border: none;
}
.tg-client.is-dialogs-compact .tg-avatar {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tg-client.is-dialogs-compact .tg-avatar-hit {
  width: 42px;
  height: 42px;
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.tg-client.is-dialogs-compact .tg-avatar-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  line-height: 1;
  text-align: center;
}
.tg-client.is-dialogs-compact .tg-dialog-unread--compact {
  position: absolute;
  top: 4px;
  right: 8px;
  z-index: 1;
}
.tg-ai-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  width: var(--tg-ai-w, 360px);
  margin-bottom: 0;
  padding: 0;
  border-radius: 4px;
}
.tg-ai-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tg-ai-head-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  position: relative;
  flex: 1;
}
.tg-ai-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tg-ai-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 0;
}
#tgAiRangeBtn {
  max-width: min(168px, 46vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  padding: 4px 10px;
}
.tg-ai-head-sub {
  font-size: 12px;
}
.tg-ai-range-pop {
  position: absolute;
  top: calc(100% + 4px);
  left: auto;
  right: 0;
  z-index: 30;
  width: 100%;
  max-width: 320px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.tg-ai-range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tg-ai-cal .dl-cal-day.in-range {
  background: #dbeafe;
  border-radius: 0;
}
.tg-ai-cal .dl-cal-day.range-start,
.tg-ai-cal .dl-cal-day.range-end,
.tg-ai-cal .dl-cal-day.selected {
  background: var(--primary, #409eff);
  color: #fff;
  border-radius: 6px;
}
.tg-ai-cal .dl-cal-day.range-start.weekend,
.tg-ai-cal .dl-cal-day.range-end.weekend,
.tg-ai-cal .dl-cal-day.selected.weekend {
  color: #fff;
}
.tg-ai-range-dates {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tg-ai-range-dates label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.tg-ai-date {
  width: auto;
  min-width: 0;
  flex: 1;
}
.tg-ai-range-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.tg-ai-open-btn {
  font-weight: 700;
  letter-spacing: 0.02em;
  min-width: var(--tg-control-h, 36px);
}
.tg-ai-messages {
  flex: 1;
  min-height: 0;
  padding: 12px;
}
.tg-ai-form {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 10px 12px;
}
#tgAiOpen.is-active {
  color: var(--primary);
  border-color: var(--primary);
}
.tg-topics-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}
.tg-topics-bar.hidden {
  display: none;
}
.tg-topic-chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #f5f7fa;
  color: inherit;
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.tg-topic-chip:hover {
  background: #eef5fc;
}
.tg-topic-chip.is-active {
  background: #d6ebff;
  border-color: #8ec0f5;
  color: #1d4ed8;
  font-weight: 600;
}
.tg-msg-ctx {
  position: fixed;
  z-index: 4200;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}
.tg-msg-ctx-reacts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(0, 0, 0, 0.06);
}
.tg-msg-ctx-react {
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tg-msg-ctx-react:hover {
  background: #f3f4f6;
}
.tg-msg-ctx-menu {
  min-width: 200px;
  padding: 6px 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
}
.tg-msg-ctx-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: #1f2937;
  cursor: pointer;
  text-align: left;
}
.tg-msg-ctx-item:hover {
  background: #f3f4f6;
}
.tg-msg-ctx-item svg {
  flex-shrink: 0;
  color: #4b5563;
}
.tg-msg-ctx-item.is-danger {
  color: #dc2626;
}
.tg-msg-ctx-item.is-danger svg {
  color: #dc2626;
}
.tg-msg-ctx-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tg-twemoji {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}
.tg-twemoji-sm {
  width: 16px;
  height: 16px;
}
.tg-select-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 2px 0;
}
.tg-select-bar.hidden { display: none; }
.tg-select-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}
.tg-select-btn {
  border: none;
  border-radius: 4px;
  background: #3390ec;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 8px 14px;
  cursor: pointer;
  line-height: 1.2;
}
.tg-select-btn:hover:not(:disabled) {
  background: #2b7fd6;
}
.tg-select-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tg-select-btn-danger {
  background: #e53935;
}
.tg-select-btn-danger:hover:not(:disabled) {
  background: #c62828;
}
.tg-select-cancel {
  border: none;
  background: transparent;
  color: #3390ec;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 8px 10px;
  cursor: pointer;
  flex-shrink: 0;
}
.tg-select-cancel:hover {
  color: #1d6bb8;
}
.tg-client.is-selecting .tg-msg {
  cursor: pointer;
}
.tg-msg-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #98a2b3;
  background: #fff;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  align-self: center;
  margin: 0 4px 0 2px;
}
.tg-msg.is-selected .tg-msg-check {
  background: #3390ec;
  border-color: #3390ec;
}
.tg-msg.is-selected .tg-msg-bubble {
  outline: 2px solid rgba(51, 144, 236, 0.45);
}
.tg-client.is-selecting .tg-msg.out {
  flex-direction: row;
}
.tg-forward-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(60vh, 420px);
  overflow: auto;
  margin-top: 10px;
}
.tg-forward-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.tg-forward-item:hover {
  background: #f3f4f6;
}
.tg-forward-item-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-ai-priority-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #e8f1fb;
  border: 1px solid #b6d4f5;
  color: #1d4ed8;
  font-size: 13px;
}
.tg-ai-priority-chip.hidden { display: none; }
.tg-reaction-recent {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  overflow: visible;
  flex-shrink: 0;
}
.tg-reaction-mini-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  margin-left: -4px;
  overflow: hidden;
  background: #dbeafe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: #1d4ed8;
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
  isolation: isolate;
}
.tg-reaction-mini-avatar:first-child {
  margin-left: 0;
}
.tg-reaction-mini-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 1;
  border-radius: 50%;
  background: #dbeafe;
  display: block;
}
.tg-reaction-mini-avatar:not(.is-fallback) span {
  display: none;
}
.tg-reaction-mini-avatar.is-fallback span {
  display: inline;
  z-index: 0;
  position: relative;
}
.tg-reaction-user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tg-reaction-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: #dbeafe;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #1d4ed8;
}
.tg-reaction-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Тонкие overlay-scrollbar'ы в Telegram */
#page-telegram .tg-dialog-list,
#page-telegram .tg-messages,
#page-telegram .tg-folder-rail,
#page-telegram .tg-ai-messages,
#page-telegram .tg-chat-search-results,
#page-telegram .tg-topics-bar {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.28) transparent;
}
#page-telegram .tg-dialog-list::-webkit-scrollbar,
#page-telegram .tg-messages::-webkit-scrollbar,
#page-telegram .tg-folder-rail::-webkit-scrollbar,
#page-telegram .tg-ai-messages::-webkit-scrollbar,
#page-telegram .tg-chat-search-results::-webkit-scrollbar,
#page-telegram .tg-topics-bar::-webkit-scrollbar {
  width: 3px;
  height: 3px;
}
#page-telegram .tg-dialog-list::-webkit-scrollbar-track,
#page-telegram .tg-messages::-webkit-scrollbar-track,
#page-telegram .tg-folder-rail::-webkit-scrollbar-track,
#page-telegram .tg-ai-messages::-webkit-scrollbar-track,
#page-telegram .tg-chat-search-results::-webkit-scrollbar-track,
#page-telegram .tg-topics-bar::-webkit-scrollbar-track {
  background: transparent;
}
#page-telegram .tg-dialog-list::-webkit-scrollbar-thumb,
#page-telegram .tg-messages::-webkit-scrollbar-thumb,
#page-telegram .tg-folder-rail::-webkit-scrollbar-thumb,
#page-telegram .tg-ai-messages::-webkit-scrollbar-thumb,
#page-telegram .tg-chat-search-results::-webkit-scrollbar-thumb,
#page-telegram .tg-topics-bar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.28);
  border-radius: 3px;
}
.tg-folder-rail {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  flex-shrink: 0;
  width: 72px;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 8px 4px;
  background: #2b3138;
  border-radius: 0;
  color: #aeb6bf;
  scrollbar-width: thin;
}
.tg-folder-rail-menu {
  min-height: 40px;
  margin-bottom: 4px;
}
.tg-sidebar {
  position: relative;
}
.tg-burger-menu {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  pointer-events: none;
}
.tg-burger-menu.hidden { display: none; }
.tg-burger-menu-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(15, 23, 42, 0.22);
  cursor: pointer;
  pointer-events: auto;
}
.tg-burger-shell {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  margin: 10px 10px 10px 82px;
  max-width: calc(100% - 92px);
  max-height: calc(100% - 20px);
  pointer-events: auto;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  background: #fff;
  box-sizing: border-box;
}
.tg-burger-menu.has-sub .tg-burger-shell {
  width: calc(100% - 92px);
  max-width: none;
  flex: 1;
}
.tg-burger-menu-card {
  position: relative;
  z-index: 1;
  margin: 0;
  align-self: stretch;
  width: min(300px, 42vw);
  min-width: 240px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: none;
  border-radius: 0;
  border: none;
  background: #fff;
  overflow: auto;
}
.tg-burger-menu.has-sub .tg-burger-menu-card {
  border-right: 1px solid #e5e7eb;
}
.tg-burger-sub {
  flex: 1;
  min-width: 0;
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tg-burger-sub.hidden { display: none; }
.tg-burger-sub-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}
.tg-burger-sub-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 16px;
}
.tg-burger-sub-label {
  margin: 12px 0 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tg-burger-sub-label:first-child { margin-top: 0; }
.tg-theme-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tg-theme-swatch {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid transparent;
  background: var(--sw, #ddd);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.tg-theme-swatch.is-active {
  border-color: var(--primary);
}
.tg-burger-item-nav {
  justify-content: flex-start;
}
.tg-burger-chevron {
  margin-left: auto;
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
}
.tg-burger-item.is-loading {
  opacity: 0.75;
  pointer-events: none;
}
.tg-burger-item.is-loading::after {
  content: '';
  width: 14px;
  height: 14px;
  margin-left: auto;
  border: 2px solid #d1d5db;
  border-top-color: var(--primary, #409eff);
  border-radius: 50%;
  animation: tg-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes tg-spin {
  to { transform: rotate(360deg); }
}
.tg-prompts-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tg-prompts-list,
.tg-prompts-public {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tg-prompt-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tg-prompt-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.tg-prompt-toggle:hover {
  background: #f3f4f6;
}
.tg-prompt-toggle-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-prompt-chevron {
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
  transition: transform 0.15s ease;
}
.tg-prompt-card.is-open .tg-prompt-chevron {
  transform: rotate(90deg);
}
.tg-prompt-body {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 0 12px 12px;
  border-top: 1px solid #eee;
  padding-top: 10px;
}
.tg-prompt-card.is-open .tg-prompt-body {
  display: flex;
}
.tg-prompt-card.is-public {
  padding: 10px;
  gap: 8px;
}
.tg-prompt-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.tg-prompt-title {
  box-sizing: border-box;
  width: 100%;
  height: var(--tg-control-h, 36px);
  min-height: var(--tg-control-h, 36px);
  max-height: var(--tg-control-h, 36px);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  line-height: 1.2;
}
.tg-prompt-field textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  background: #fff;
  min-height: 72px;
  height: auto;
  resize: vertical;
  line-height: 1.35;
}
.tg-prompt-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.tg-prompt-actions {
  display: flex;
  gap: 8px;
}
.tg-prompt-public-title {
  font-weight: 600;
  font-size: 14px;
}
.tg-prompt-public-content {
  font-size: 13px;
  white-space: pre-wrap;
}
.tg-prompt-public-meta {
  font-size: 12px;
}
.tg-burger-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.tg-burger-item:hover {
  background: #f3f4f6;
}
.tg-burger-item.is-danger {
  color: #dc2626;
}
.tg-burger-account {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  cursor: default;
}
.tg-burger-account:hover {
  background: transparent;
}
.tg-burger-item-label {
  font-size: 12px;
  color: var(--muted);
}
.tg-burger-account .tg-account-select {
  width: 100%;
}
#page-telegram .tg-burger-account .tg-account-select.select-styled {
  height: auto;
  min-height: var(--tg-control-h);
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  background-color: var(--card, #fff);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23909399' d='M3 4.5L6 7.5L9 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
}
#page-telegram .tg-burger-account .tg-account-select.select-styled:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.15);
}
.tg-folder-rail-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-height: 52px;
  padding: 6px 2px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 11.5px;
  line-height: 1.15;
  text-align: center;
  word-break: break-word;
}
.tg-folder-rail-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e8eef4;
}
.tg-folder-rail-item.is-active {
  background: #3390ec;
  color: #fff;
}
.tg-folder-rail-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 16px;
  line-height: 1;
}
.tg-folder-rail-ico svg {
  display: block;
}
.tg-folder-rail-label {
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.tg-folder-rail-sep {
  flex-shrink: 0;
  height: 1px;
  margin: 8px 8px;
  background: rgba(255, 255, 255, 0.18);
}
.tg-dialogs,
.tg-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  overflow: hidden;
}
.tg-dialogs {
  width: var(--tg-dialogs-w, 280px);
  flex: 0 0 auto;
  min-width: 0;
  padding: 12px 12px 12px 10px;
  border: none;
  border-radius: 0;
  background: var(--card, #fff);
  box-sizing: border-box;
}
#page-telegram .tg-sidebar.card,
#page-telegram .tg-chat.card {
  margin-bottom: 0;
}
#page-telegram .tg-chat.card,
.tg-chat {
  background: var(--tg-wallpaper, #ffffff);
  border-color: var(--border);
}
.tg-dialogs-head {
  display: none;
}
.tg-dialog-tabs {
  display: none;
}
.tg-dialog-search-wrap {
  margin-bottom: 6px;
}
.tg-dialog-search-wrap.hidden {
  display: none;
}
.tg-account-select {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card);
  font: inherit;
  font-size: 14px;
  color: inherit;
}
.tg-account-select:focus,
.tg-input:focus,
.tg-composer-input:focus,
#page-telegram .ip-search:focus {
  outline: none;
  border-color: var(--primary);
}
.tg-dialogs-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
}
.tg-dialog-search-wrap {
  margin-bottom: 6px;
}
.tg-dialog-search-wrap.hidden {
  display: none;
}
.tg-dialog-search {
  width: 100%;
  flex: none;
  margin-bottom: 0;
  box-sizing: border-box;
}
.tg-dialog-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0 0 4px;
  border-bottom: 1px solid var(--border);
}
.tg-dialog-tab {
  flex: 1;
  min-width: 0;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  padding: 6px 4px 7px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.2;
  color: #6b7280;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
}
.tg-dialog-tab:hover {
  color: #374151;
}
.tg-dialog-tab.active {
  color: var(--primary);
  font-weight: 600;
  border-bottom-color: var(--primary);
}
#tgBtnDialogSearch.is-active {
  color: var(--primary);
  border-color: var(--primary);
}
.tg-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  background: var(--card);
}
.tg-auth-card .form-group {
  margin-bottom: 14px;
}
.tg-auth-card .form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}
.tg-dialog-list {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}
.tg-dialog-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
  width: 100%;
}
.tg-avatar-hit {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  line-height: 0;
}
.tg-avatar-hit:hover .tg-avatar {
  box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.35);
}
.tg-dialog-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.tg-dialog-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tg-dialog-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: #a0a7b0;
  transform: rotate(45deg);
  margin-left: 4px;
}
.tg-dialog-item.is-pinned {
  background: transparent;
}
.tg-avatar {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  background: #dbeafe;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tg-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.tg-avatar-letter {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}
.tg-avatar:not(.is-fallback) .tg-avatar-letter {
  visibility: hidden;
}
.tg-avatar-saved {
  background: linear-gradient(145deg, #5ca8f5 0%, #2a8de9 55%, #1e78d0 100%);
  color: #fff;
}
.tg-avatar-saved svg {
  width: 20px;
  height: 20px;
  display: block;
}
.tg-webpage {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 6px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.03);
  text-decoration: none;
  color: inherit;
  max-width: min(100%, 320px);
}
.tg-webpage:hover {
  background: rgba(37, 99, 235, 0.06);
}
.tg-webpage-img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
}
.tg-webpage-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tg-webpage-site {
  font-size: 11px;
  color: #2563eb;
  font-weight: 600;
}
.tg-webpage-title {
  font-size: 13px;
  font-weight: 600;
}
.tg-webpage-desc {
  font-size: 12px;
  color: #555;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tg-webpage-url {
  font-size: 11px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-msg-link {
  color: #2563eb;
  text-decoration: underline;
  word-break: break-all;
}
button.tg-msg-hashtag {
  display: inline;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: #2563eb;
  text-decoration: underline;
  cursor: pointer;
  word-break: break-all;
}
button.tg-msg-hashtag:hover {
  color: #1d4ed8;
}
.tg-dialog-item:hover {
  background: #f5f7fa;
}
.tg-dialog-item.is-active {
  background: #ecf5ff;
  border-color: #b3d8ff;
}
.tg-dialog-title {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tg-dialog-time {
  font-size: 11px;
  color: #888;
  flex-shrink: 0;
}
.tg-dialog-preview {
  font-size: 12px;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}
.tg-dialog-preview-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tg-dialog-item.is-unread .tg-dialog-title {
  font-weight: 700;
}
.tg-dialog-item.is-unread .tg-dialog-preview {
  color: #333;
  font-weight: 500;
}
.tg-dialog-unread {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #3390ec;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-sizing: border-box;
}
.tg-msg-service {
  align-self: center;
  max-width: min(90%, 420px);
  margin: 4px 0;
}
.tg-msg-service-text {
  text-align: center;
  font-size: 13px;
  line-height: 1.35;
  color: #8a8a8a;
  padding: 4px 10px;
}
.tg-msg.is-pending .tg-msg-bubble {
  opacity: 0.72;
}
.tg-chat-empty {
  margin: auto;
  padding: 24px;
  background: transparent;
}
.tg-chat-active {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
  background: transparent;
}
.tg-discussion-panel {
  position: absolute;
  inset: 0;
  z-index: 15;
  display: flex;
  flex-direction: column;
  background: var(--tg-wallpaper, #ffffff);
}
.tg-discussion-panel.hidden { display: none; }
.tg-discussion-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tg-discussion-head-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tg-discussion-messages {
  flex: 1;
  min-height: 0;
}
.tg-discussion-start {
  display: flex;
  justify-content: center;
  margin: 10px 0 6px;
}
.tg-discussion-start span {
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: #6b7280;
}
.tg-msg-comments {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 6px;
  padding: 8px 2px 2px;
  border: none;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  background: transparent;
  color: #3390ec;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
}
.tg-msg-comments:hover {
  color: #1d6bb8;
}
.tg-msg-comments-ava {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #93c5fd, #60a5fa);
  flex-shrink: 0;
}
.tg-msg-comments-label {
  flex: 1;
  min-width: 0;
}
.tg-msg-comments-chevron {
  color: #9ca3af;
  font-size: 18px;
  line-height: 1;
}
.tg-msg-views {
  margin-right: 6px;
  opacity: 0.75;
  font-size: 11px;
}
.tg-chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.tg-chat-head-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  width: auto;
  border: none;
  background: transparent;
  padding: 4px 6px;
  margin: 0;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
  border-radius: 4px;
}
.tg-chat-head-btn:hover {
  background: #f5f7fa;
}
.tg-chat-head-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.tg-chat-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tg-chat-search-bar.hidden { display: none; }
.tg-chat-search-input {
  width: min(240px, 36vw);
  flex: none;
}
.tg-icon-btn {
  width: var(--tg-control-h, 36px);
  min-width: var(--tg-control-h, 36px);
  padding: 0;
}
.tg-icon-btn svg { display: block; }
.tg-menu-wrap { position: relative; }
.tg-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  min-width: 260px;
  padding: 8px;
  margin: 0;
}
.tg-menu.hidden { display: none; }
.tg-menu-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 4px;
}
.tg-menu-check input { margin-top: 2px; }
.tg-chat-search-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tg-chat-search-panel.hidden { display: none; }
.tg-chat-search-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tg-chat-search-results {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}
.tg-search-hit {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.tg-search-hit:hover { background: #f5f7fa; }
.tg-search-hit-text {
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tg-search-hit-time { font-size: 11px; }
.tg-msg-highlight .tg-msg-bubble {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
.tg-chat-head-avatar .tg-avatar {
  width: 40px;
  height: 40px;
}
.tg-chat-head-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tg-chat-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-chat-sub {
  margin: 0;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-msg-from {
  display: block;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0 0 2px;
  font-size: 13px;
  line-height: 1.25;
  color: var(--primary);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  text-align: left;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-msg-from:hover {
  text-decoration: underline;
}
.tg-messages {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 8px 12px;
  min-height: 0;
  background: transparent;
}
.tg-msg {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  max-width: min(85%, 560px);
  margin-top: 6px;
  position: relative;
}
.tg-msg.is-grouped {
  margin-top: 2px;
}
.tg-msg.in {
  align-self: flex-start;
}
.tg-msg.out {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.tg-msg-avatar-slot {
  width: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 1px;
}
.tg-msg-avatar {
  width: 36px;
  height: 36px;
}
.tg-msg-avatar .tg-avatar-letter {
  font-size: 14px;
}
.tg-msg-main {
  position: relative;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.tg-msg.out .tg-msg-main {
  align-items: flex-end;
}
.tg-msg-reply-btn {
  position: absolute;
  top: -10px;
  right: 0;
  z-index: 3;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  color: #6b7280;
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}
.tg-msg.in:hover .tg-msg-reply-btn,
.tg-msg-reply-btn:focus {
  display: inline-flex;
}
.tg-msg-reply-btn:hover {
  color: #374151;
  background: #fff;
}
.tg-msg-bubble {
  position: relative;
  padding: 6px 9px 5px;
  border-radius: 12px 12px 12px 4px;
  background: var(--tg-bubble-in, #fff);
  border: 1px solid var(--border);
  max-width: 100%;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}
.tg-msg.out .tg-msg-bubble {
  background: var(--tg-bubble-out, #effdde);
  border-color: #d1e8b9;
  border-radius: 12px 12px 4px 12px;
}
.tg-msg-text {
  font-size: 14.5px;
  line-height: 1.35;
  word-break: break-word;
}
.tg-msg-text-empty {
  min-height: 1em;
}
.tg-msg-meta {
  float: right;
  clear: both;
  margin: 2px 0 -1px 10px;
  padding-top: 4px;
  font-size: 11px;
  line-height: 1;
  color: #8a8a8a;
  white-space: nowrap;
  user-select: none;
}
.tg-msg-edited {
  border: none;
  background: transparent;
  padding: 0 4px 0 0;
  margin: 0;
  font: inherit;
  font-size: 11px;
  line-height: 1;
  color: #8a8a8a;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.tg-msg-edited:hover {
  color: #555;
}
.tg-msg.out .tg-msg-edited {
  color: #5d9a4a;
}
.tg-msg.is-deleted .tg-msg-bubble {
  opacity: 0.72;
}
.tg-msg.is-deleted .tg-msg-text,
.tg-msg.is-deleted .tg-dialog-preview {
  color: #9ca3af;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.tg-msg.is-deleted .tg-msg-text a,
.tg-msg.is-deleted .tg-media-file {
  text-decoration: line-through;
  color: #9ca3af;
}
.tg-edit-history-modal {
  position: fixed;
  inset: 0;
  z-index: 4100;
  display: grid;
  place-items: center;
  padding: 16px;
}
.tg-edit-history-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
}
.tg-edit-history-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: min(70vh, 560px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.tg-edit-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.tg-edit-history-body {
  padding: 10px 12px 14px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: inherit;
}
.tg-edit-history-item {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafafa;
}
.tg-edit-history-item.is-current {
  border-color: #93c5fd;
  background: #f0f7ff;
}
.tg-edit-history-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.tg-edit-history-text {
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}
.tg-msg.out .tg-msg-meta {
  color: #5d9a4a;
}
.tg-msg-text::after {
  content: '';
  display: table;
  clear: both;
}
.tg-msg-text b,
.tg-msg-text strong { font-weight: 700; }
.tg-msg-text i,
.tg-msg-text em { font-style: italic; }
.tg-msg-text u { text-decoration: underline; }
.tg-msg-text s { text-decoration: line-through; }
.tg-msg-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.06);
}
.tg-msg-text pre {
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.06);
  overflow-x: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.tg-msg-text blockquote,
.tg-msg-quote-block {
  margin: 4px 0;
  padding: 2px 0 2px 10px;
  border-left: 3px solid #3390ec;
  color: inherit;
}
.tg-msg-spoiler {
  background: #242f3d;
  color: transparent;
  border-radius: 3px;
  cursor: pointer;
}
.tg-msg-spoiler.is-revealed {
  background: transparent;
  color: inherit;
}
.tg-msg-fwd {
  font-size: 13px;
  line-height: 1.25;
  color: #3390ec;
  margin: 0 0 6px;
  padding: 0 0 0 8px;
  border-left: 3px solid #3390ec;
}
.tg-msg.out .tg-msg-fwd {
  color: #4fae4e;
  border-left-color: #4fae4e;
}
.tg-msg-fwd-from {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.tg-msg-fwd-from:hover {
  text-decoration: underline;
}
.tg-msg-fwd-from-static {
  font-weight: 600;
}
.tg-msg-reply {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 6px;
  padding: 4px 8px;
  border-left: 3px solid #3390ec;
  border-radius: 0 6px 6px 0;
  background: rgba(51, 144, 236, 0.08);
  font-size: 12px;
  line-height: 1.3;
  max-width: 100%;
}
.tg-msg.out .tg-msg-reply {
  border-left-color: #4fae4e;
  background: rgba(79, 174, 78, 0.1);
}
.tg-msg-reply-from {
  font-weight: 600;
  color: #3390ec;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-msg.out .tg-msg-reply-from { color: #4fae4e; }
.tg-msg-reply-text {
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-media-img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  border-radius: 8px;
  margin-top: 6px;
}
.tg-media-file {
  display: inline-flex;
  margin-top: 6px;
}
@media (max-width: 900px) {
  .tg-client {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    max-height: none;
  }
  .tg-client.is-ai-open {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .tg-sidebar {
    max-height: 42vh;
  }
  .tg-folder-rail {
    max-height: none;
  }
  .tg-split {
    display: none;
  }
  .tg-dialogs {
    width: auto;
    flex: 1;
    min-width: 0;
    max-height: none;
  }
  .tg-client.is-dialogs-compact .tg-dialogs {
    width: auto;
  }
  .tg-chat {
    min-height: 0;
    height: auto;
  }
  .tg-ai-panel {
    width: auto;
    max-height: 40vh;
  }
  .tg-page {
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

.tg-media-photo {
  display: block;
  padding: 0;
  margin: 0 0 6px;
  border: none;
  background: transparent;
  cursor: zoom-in;
  max-width: 100%;
}
.tg-media-img {
  display: block;
  max-width: min(100%, 320px);
  max-height: 280px;
  border-radius: 10px;
  object-fit: cover;
}
.tg-media-sticker {
  display: block;
  max-width: 160px;
  max-height: 160px;
  margin-bottom: 4px;
}
.tg-media-audio {
  margin: 0 0 4px;
  min-width: 220px;
}
.tg-media-audio-label {
  font-size: 12px;
  margin-bottom: 4px;
}
.tg-audio-player {
  width: 100%;
  max-width: 280px;
  height: 36px;
}
.tg-voice {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  max-width: 280px;
  margin: 0;
  user-select: none;
}
.tg-voice-audio {
  display: none;
}
.tg-voice-play {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: #3390ec;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.tg-msg.out .tg-voice-play {
  background: #5d9a4a;
}
.tg-voice-play:hover {
  filter: brightness(1.05);
}
.tg-voice-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.tg-voice-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tg-voice-wave {
  display: block;
  flex: 1;
  min-width: 0;
  width: 100%;
  height: 28px;
  cursor: pointer;
}
.tg-voice-time {
  font-size: 11px;
  color: #8a8a8a;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-top: 1px;
}
.tg-msg.out .tg-voice-time {
  color: #5d9a4a;
}
.tg-voice-speed {
  flex-shrink: 0;
  box-sizing: border-box;
  height: 20px;
  min-width: 34px;
  padding: 0 5px;
  border: 1px solid rgba(51, 144, 236, 0.35);
  border-radius: 4px;
  background: #fff;
  color: #3390ec;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  cursor: pointer;
  white-space: nowrap;
}
.tg-msg.out .tg-voice-speed {
  border-color: rgba(93, 154, 74, 0.4);
  color: #5d9a4a;
  background: #fff;
}
.tg-voice-speed:hover {
  background: rgba(51, 144, 236, 0.06);
}
.tg-msg.out .tg-voice-speed:hover {
  background: rgba(93, 154, 74, 0.08);
}
.tg-msg.has-voice .tg-msg-bubble {
  padding: 5px 8px 3px;
}
.tg-msg.has-voice .tg-msg-text-empty {
  min-height: 0;
  line-height: 0;
}
.tg-msg.has-voice .tg-msg-text-empty .tg-msg-meta {
  margin: 0 0 0 8px;
  padding-top: 0;
  line-height: 1.15;
  font-size: 11px;
}
.tg-media-video {
  display: block;
  max-width: min(100%, 320px);
  max-height: 280px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: #000;
}
.tg-media-round {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
}
.tg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
  clear: both;
  overflow: visible;
}
.tg-reaction {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 7px;
  overflow: visible;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.tg-reaction:hover {
  border-color: var(--primary);
  background: rgba(64, 158, 255, 0.1);
}
.tg-msg.out .tg-reaction {
  background: rgba(93, 154, 74, 0.12);
}
.tg-reaction-count {
  font-size: 11px;
  color: #555;
  font-weight: 600;
}
.tg-reaction-popup {
  position: fixed;
  z-index: 4500;
  width: min(260px, calc(100vw - 16px));
  max-height: 280px;
  overflow: auto;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}
.tg-reaction-popup-inner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
}
.tg-reaction-user {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.tg-reaction-user:hover {
  background: #f5f7fa;
}
.tg-reaction-user-emoji {
  flex-shrink: 0;
  font-size: 16px;
  line-height: 1;
  width: 22px;
  text-align: center;
}
.tg-reaction-user-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.tg-reaction-user-name {
  font-size: 13px;
  font-weight: 600;
}
.tg-reaction-user-time {
  font-size: 11px;
}
.tg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
}
.tg-lightbox.hidden {
  display: none;
}
.tg-lightbox-backdrop {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  border: none;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}
.tg-lightbox-inner {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: min(92vw, 960px);
  max-height: 90vh;
  margin: 0;
  pointer-events: none;
}
.tg-lightbox-img {
  display: block;
  max-width: 92vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  object-fit: contain;
  background: #111;
  pointer-events: auto;
}
.tg-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: none;
  pointer-events: auto;
}

.tg-composer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.tg-composer-reply {
  flex: 1 1 100%;
  margin: 0;
}
.tg-composer-reply.hidden {
  display: none;
}
.tg-composer-reply-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-left: 3px solid #3390ec;
  border-radius: 0 6px 6px 0;
  background: rgba(51, 144, 236, 0.08);
}
.tg-composer-reply-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
}
.tg-composer-reply-meta strong {
  color: #3390ec;
}
.tg-composer-reply-meta span {
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tg-composer-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tg-composer-files {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tg-composer-files.hidden { display: none; }
.tg-composer-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 4px;
  background: #f5f7fa;
  border: 1px solid var(--border);
  font-size: 12px;
}
.tg-composer-file-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}
.tg-composer-file-remove {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
}
.tg-composer-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 36px;
  max-height: 160px;
  resize: none;
  overflow-y: auto;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  background: var(--card);
}
.tg-profile-modal {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.tg-profile-modal.hidden {
  display: none;
}
.tg-profile-modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(15, 23, 42, 0.45);
  cursor: pointer;
}
.tg-profile-modal-card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  max-height: 86vh;
  overflow: auto;
  margin: 0;
}
.tg-profile-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.tg-profile-modal-head h3 {
  margin: 0;
  font-size: 18px;
}
.tg-profile-modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tg-profile-top {
  display: flex;
  gap: 14px;
  align-items: center;
}
.tg-profile-top .tg-avatar {
  width: 72px;
  height: 72px;
}
.tg-profile-top .tg-avatar-letter {
  font-size: 28px;
}
.tg-profile-top .tg-avatar-saved svg {
  width: 32px;
  height: 32px;
}
.tg-profile-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.tg-profile-status {
  margin: 4px 0 0;
  font-size: 13px;
}
.tg-profile-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tg-profile-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fafafa;
}
.tg-profile-row-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.tg-profile-row-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}
.tg-profile-row-value a {
  color: var(--primary);
}
.tg-reaction-emoji {
  font-size: 16px;
  line-height: 1;
}
.tg-reaction-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}
.tg-reaction-custom {
  padding: 3px 6px;
}
.tg-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.tg-lightbox-prev { left: 16px; }
.tg-lightbox-next { right: 16px; }
.tg-lightbox-nav.hidden { display: none; }
.tg-lightbox-counter {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  color: #fff;
  font-size: 13px;
  background: rgba(0,0,0,0.45);
  padding: 4px 10px;
  border-radius: 999px;
}

#page-telegram {
  --tg-control-h: 36px;
}
#page-telegram .btn,
#page-telegram .ip-search,
#page-telegram .tg-account-select,
#page-telegram .tg-input {
  box-sizing: border-box;
  min-height: var(--tg-control-h);
  height: var(--tg-control-h);
  border-radius: 4px;
}
#page-telegram textarea.tg-composer-input {
  height: auto;
  min-height: var(--tg-control-h);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
#page-telegram textarea.tg-composer-input::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
#page-telegram .tg-dialogs-head,
#page-telegram .tg-chat-head-tools {
  align-items: center;
}
#page-telegram .tg-composer {
  align-items: flex-end;
}

.tg-profile-modal-card--wide {
  width: min(560px, 100%);
}
.tg-profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tg-profile-tab-panel {
  min-height: 120px;
  max-height: 48vh;
  overflow: auto;
}
.tg-profile-members {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tg-profile-member {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.tg-profile-member:hover { background: #f5f7fa; }
.tg-profile-member .tg-avatar {
  width: 36px;
  height: 36px;
}
.tg-profile-member-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tg-profile-member-name {
  font-weight: 600;
  font-size: 13px;
}
.tg-shared-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tg-shared-thumb {
  display: block;
  padding: 0;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  background: #111;
}
.tg-shared-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tg-shared-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tg-shared-link,
.tg-shared-doc {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fafafa;
  text-decoration: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.tg-shared-link-title,
.tg-shared-doc-name {
  font-size: 13px;
  font-weight: 600;
}
