.back {
  margin: 0 0 8px;
}

.back a {
  color: var(--nav);
}

.manager-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.manager-heading h1 {
  margin: 0;
}

.manager-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e7f0f8;
  color: var(--nav);
  display: grid;
  place-items: center;
  flex: none;
}

.manager-icon svg {
  width: 24px;
  height: 24px;
}

#manager-cards .card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}

.card-icon svg {
  width: 24px;
  height: 24px;
}

#manager-cards .card-value {
  margin: 0;
}

.card-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.card-note i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.leads-section > h2 {
  text-align: center;
}

.lead-filters {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}

.lead-filters button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}

.lead-filters button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.lead-filters i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: block;
  flex: none;
}

.lead-filters button[aria-pressed="true"] i {
  box-shadow: 0 0 0 1px var(--paper);
}

.lead-filter-note {
  margin: 12px 0 0;
  color: var(--muted);
  text-align: center;
}

#panel-categories .is-dim {
  opacity: 0.25;
}

.leads {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  background: var(--paper);
}

.leads th,
.leads td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.leads th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.leads th button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  padding: 0;
}

.leads th[aria-sort="ascending"] button::after {
  content: " ↑";
}

.leads th[aria-sort="descending"] button::after {
  content: " ↓";
}

.leads td:first-child,
.leads td:nth-child(2) {
  white-space: nowrap;
}

.dialog-open {
  border: 0;
  background: transparent;
  color: var(--nav);
  font: inherit;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
}

#dialog-panel {
  width: min(1100px, calc(100% - 48px));
  height: min(90vh, 960px);
  max-height: 90vh;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 12px 40px rgba(30, 30, 30, 0.12);
}

#dialog-panel[open] {
  display: flex;
  flex-direction: column;
}

#dialog-panel::backdrop {
  background: rgba(30, 30, 30, 0.45);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid #f0eeeb;
  flex: none;
}

.dialog-summary {
  min-width: 0;
}

.dialog-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.status-pill {
  margin: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.3;
  background: #f0eeeb;
  color: #6a6864;
}

.status-pill.is-failed {
  background: #fdecef;
  color: #c45c6a;
}

.status-pill.is-success {
  background: #e7f6ee;
  color: #2e7d50;
}

.status-pill.is-waiting {
  background: #fff6e8;
  color: #a97820;
}

#dialog-reason {
  margin: 6px 0 0;
  color: #8a8884;
  font-size: 13px;
  line-height: 1.45;
}

.dialog-notice {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #e2b340;
  border-radius: 10px;
  background: #fff8e8;
  color: #6b4e12;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

.dialog-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #e6e6e6;
  border-radius: 50%;
  background: #fff;
  color: #6a6864;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}

.dialog-close svg {
  width: 14px;
  height: 14px;
}

#dialog-messages {
  padding: 8px 20px 24px;
  overflow: auto;
  flex: 1;
  background: #fff;
}

.chat-day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 8px;
  color: var(--muted);
  font-size: 13px;
}

.chat-day::before,
.chat-day::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e6e6e6;
}

.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0;
}

.chat-row.is-out {
  justify-content: flex-end;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 12px;
  font-weight: 650;
}

.chat-row.is-in .chat-avatar {
  background: #fdecef;
  color: #c45c6a;
}

.chat-row.is-out .chat-avatar {
  background: #e8eef4;
  color: #5d6b7a;
}

.chat-row.is-bot .chat-avatar {
  background: #f3eefe;
  color: #6b5b95;
}

.chat-body {
  max-width: 72%;
  min-width: 0;
}

.chat-row.is-out .chat-body {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chat-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 6px;
  font-size: 14px;
}

.chat-name strong {
  font-weight: 650;
}

.chat-channel,
.chat-name time {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.chat-channel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.channel-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.channel-telegram {
  color: #2aabee;
}

.channel-viber {
  color: #7360f2;
}

.channel-chaport {
  color: #2e9e6a;
}

.channel-other,
.channel-call,
.channel-system {
  color: #8a8884;
}

.chat-bubble {
  border-radius: 12px;
  padding: 10px 12px 8px;
}

.chat-row.is-in .chat-bubble {
  background: #fff;
  border: 1px solid #eceae6;
}

.chat-row.is-out .chat-bubble {
  background: #e8f3fb;
}

.chat-text {
  margin: 0;
  white-space: pre-wrap;
}

.chat-clock {
  display: block;
  margin-top: 4px;
  text-align: right;
  font-size: 11px;
  color: #9a9894;
}

.chat-event {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 14px auto;
  max-width: 640px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.chat-event-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-event .chat-text {
  margin: 0;
}

.chat-event.is-call {
  align-items: stretch;
  max-width: 560px;
  text-align: left;
}

.chat-event.is-call .chat-event-line {
  justify-content: center;
}

.call-script {
  width: 100%;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid #eceae6;
  border-radius: 12px;
  background: #fff;
}

.call-turn {
  margin: 0;
  padding: 10px 14px 12px;
  border-top: 1px solid #f0eeea;
  color: #2c2c2a;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}

.call-turn:first-child {
  border-top: 0;
}

.call-turn span {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  font-weight: 700;
}

.call-turn.is-client span {
  color: #8a5a2b;
}

.call-turn.is-manager {
  background: #f7fbfe;
}

.call-turn.is-manager span {
  color: #2f6fa8;
}

.empty-row {
  color: var(--muted);
}
