.app-header.channel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-inline: 24px;
}

.channel-header-title {
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
}

.channel-header-title span,
.channel-header-title a {
  color: #0384f6;
}

.channel-header .channel-create {
  flex: 0 0 auto;
  min-height: 40px;
  border: 0;
  border-radius: 14px;
  padding: 0 16px;
  background: #0384f6;
  color: white;
  font-size: 14px;
  font-weight: 400;
}

.channel-header .channel-create:hover:not(:disabled),
.channel-row-actions .channel-open:hover {
  background: #2195fb;
}

.channels-page {
  display: grid;
  grid-template-columns: minmax(0, 20%) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.channels-nav {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-right: 1px solid #ffffff26;
  padding: 20px;
}

.channels-nav .search-box,
.channels-filters .search-box {
  min-width: 0;
}

.channels-nav .search-box > svg,
.channels-filters .search-box > svg {
  left: 12px;
}

.channels-nav .field,
.channels-filters .field,
.channels-filters .select {
  min-height: 40px;
  border-radius: 14px;
  background-color: #1c2236;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.channels-nav .search-box > .field,
.channels-filters .search-box > .field {
  padding-left: 36px;
  color: var(--text);
}

.channels-filters .select {
  padding-left: 12px;
}

.channel-space-all,
.channel-space {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 40px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.channel-space-all {
  margin-block: 16px;
  padding: 0 16px;
}

.channel-space {
  gap: 8px;
  padding: 0 8px 0 34px;
}

.channel-space-all:hover,
.channel-space:hover {
  background: #ffffff0d;
}

.channel-space-all[aria-current="page"],
.channel-space[aria-current="page"],
.channel-space-all[aria-pressed="true"],
.channel-space[aria-pressed="true"],
.channel-space-all.is-active,
.channel-space.is-active {
  background: #2c3554;
}

.channel-space-organization {
  margin: 4px 16px 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
}

.channels-nav [data-space-list] {
  display: grid;
  min-height: 0;
  gap: 4px;
  overflow: auto;
  align-content: start;
}

.channel-space-name,
.channel-space > span:first-of-type:not(.channel-count):not(.space-count) {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel-count,
.channel-space .space-count {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 24px;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 6px;
  background: #3f3f46;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.channel-space .channel-count,
.channel-space .space-count {
  margin-left: auto;
}

.channel-space-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
}

.channel-space-actions .channel-create-space,
.channel-space-actions .channel-sort {
  display: inline-grid;
  place-items: center;
  min-height: 40px;
  border: 1px solid #ffffff26;
  border-radius: 14px;
  padding: 0 12px;
  background: #1c2236;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.channel-space-actions .channel-create-space {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel-space-actions .channel-sort {
  flex: 0 0 40px;
  width: 40px;
  padding: 0;
}

.channel-space-actions button:hover:not(:disabled) {
  background: #2c3554;
}

.channels-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px 16px 40px;
}

.channels-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.channel-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  min-height: 103px;
  border: 1px solid #ffffff26;
  border-radius: 14px;
  padding: 16px;
  background: #1c2236;
}

.channel-stat h2 {
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
}

.channel-stat strong {
  font-size: 30px;
  font-weight: 600;
  line-height: 45px;
  font-variant-numeric: tabular-nums;
}

.channels-filters {
  display: grid;
  grid-template-columns: minmax(0, 22%) repeat(3, minmax(0, 18%));
  gap: 16px;
  margin-block: 20px;
}

.channel-groups {
  min-width: 0;
  border: 1px solid #ffffff26;
  border-radius: 12px;
  padding: 16px 24px;
  background: #1c2236;
}

.channel-group + .channel-group {
  border-top: 1px solid #ffffff1c;
}

.channel-group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 56px;
  padding: 16px 0;
  list-style: none;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  cursor: pointer;
}

.channel-group-heading::-webkit-details-marker {
  display: none;
}

.channel-group-heading:focus-visible {
  border-radius: 8px;
  outline: 2px solid #489fff;
  outline-offset: 2px;
}

.channel-group-heading h2 {
  min-width: 0;
  font: inherit;
  overflow-wrap: anywhere;
}

.channel-group-heading .caption,
.channel-group-heading .channel-group-organization,
.channel-group-heading .channel-group-divider {
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.channel-group-heading > svg:last-child,
.channel-group-heading .channel-group-chevron {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--muted);
}

.channel-group[open] .channel-group-chevron {
  transform: rotate(180deg);
}

.channel-group-body {
  padding-block: 8px;
}

.channel-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  padding: 12px;
  background: #0f1b2b;
}

.channel-table {
  width: 100%;
  min-width: 920px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-size: 14px;
  line-height: 20px;
}

.channel-col-star { width: 60px; }
.channel-col-name { width: 188px; }
.channel-col-status { width: 72px; }
.channel-col-type { width: 50px; }
.channel-col-tags { width: 55px; }
.channel-col-dialogs { width: 86px; }
.channel-col-manual { width: 75px; }
.channel-col-actions { width: 198px; }

.channel-table th {
  height: 48px;
  padding: 12px 12px 20px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  text-align: left;
  white-space: nowrap;
}

.channel-table td {
  height: 66px;
  padding: 12px;
  background: #1c2236;
}

.channel-table td:first-child {
  border-radius: 8px 0 0 8px;
}

.channel-table td:last-child {
  border-radius: 0 8px 8px 0;
}

.channel-table :is(th, td):is(:nth-child(1), :nth-child(3), :nth-child(4), :nth-child(7), :nth-child(8), :nth-child(9)) {
  text-align: center;
}

.channel-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.channel-avatar {
  display: inline-grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 1px solid #ffffff26;
  border-radius: 8px;
  background: #192336;
  color: #dce9ff;
  object-fit: cover;
}

.channel-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.channel-identity > :last-child:not(.channel-avatar) {
  min-width: 0;
}

.channel-bot-name,
.channel-bot-handle {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel-bot-name {
  display: block;
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: white;
  font-weight: 500;
  line-height: 20px;
  text-align: left;
}

.channel-bot-handle {
  display: block;
  color: var(--muted);
}

.channel-bot-handle svg {
  margin-left: 4px;
}

.channel-description {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.channel-platform-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #80afe0;
}

.channel-status-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f31260;
  vertical-align: middle;
}

.channel-status-dot.is-active {
  background: #17c964;
}

.channel-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.channel-row-actions .channel-open {
  flex: 0 0 auto;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  background: #0384f6;
  color: white;
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.channel-icon-button,
.channel-favorite {
  display: inline-grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.channel-icon-button:hover:not(:disabled),
.channel-favorite:hover:not(:disabled) {
  background: #ffffff13;
}

.channel-favorite {
  color: var(--muted);
}

.channel-favorite.is-favorite,
.channel-favorite[aria-pressed="true"] {
  color: #ffaa23;
}

.channel-favorite:not(.is-favorite) svg > path {
  fill: currentColor;
}

.channel-table .channel-empty,
.channel-table .channel-empty td,
.channel-table td:has(> .channel-empty) {
  height: auto;
  border-radius: 8px;
  padding: 0;
  text-align: center;
  background: transparent;
}

.channel-empty .empty-state {
  padding-block: 28px;
}

@media (max-width: 1180px) {
  .channels-page {
    grid-template-columns: 215px minmax(0, 1fr);
  }

  .channels-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .channels-stats {
    gap: 10px;
  }
}

@media (max-width: 900px) {
  .channels-nav {
    padding: 14px;
  }

  .channels-stats,
  .channels-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .channel-groups {
    padding-inline: 16px;
  }
}

@media (max-width: 700px) {
  .app-header.channel-header {
    gap: 10px;
    padding-inline: 12px;
  }

  .channel-header-title {
    font-size: 15px;
    line-height: 20px;
  }

  .channel-header .channel-create {
    min-height: 36px;
    padding-inline: 10px;
    font-size: 12px;
  }

  .channels-page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    height: auto;
    min-height: 100%;
  }

  .channels-nav {
    border-right: 0;
    border-bottom: 1px solid #ffffff26;
  }

  .channels-nav [data-space-list] {
    max-height: 160px;
  }

  .channels-content {
    padding-inline: 12px;
  }

  .channel-stat {
    min-height: 86px;
    padding: 12px;
  }
}
.channel-workspace { border-left: 0; }
.channels-nav { border-left: 1px solid #ffffff26; }
.channel-space-browser { display: flex; flex-direction: column; min-height: 0; }
.channel-group-label { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.channel-group-heading .channel-group-chevron { transition: transform .16s ease; }
.channel-table td:first-child { padding-left: 16px; }
.channel-table td:last-child { padding-right: 16px; }
.channel-avatar { padding: 0; }
.channel-bot-text { display: grid; gap: 2px; }
.channel-bot-handle { display: flex; align-items: center; gap: 3px; }
.channel-bot-handle > span { overflow: hidden; text-overflow: ellipsis; }
.channel-bot-handle a { display: inline-flex; flex: 0 0 auto; }
.channel-tags { display: grid; gap: 3px; min-width: 0; }
.channel-tags > span { overflow: hidden; border-radius: 4px; padding: 1px 3px; background: #2c3554; font-size: 11px; line-height: 15px; text-overflow: ellipsis; white-space: nowrap; }
