html body #root .app-shell.product-shell.original-ui.header-only-shell
  > .workspace-header .header-main-navigation > .platform-switcher {
  display: none;
}

html body #root .app-shell.product-shell.original-ui.header-only-shell
  > .workspace-header .header-main-navigation > .header-primary-navigation {
  margin-inline-start: 0;
  padding-inline-start: 0;
  border-inline-start: 0;
}

/* Keep the native dialog and its focus handling. The contents own their layout. */
html body dialog.modal.crm-modal[data-dialog-standard].wide:has(.stream-telegram-body) {
  width: min(760px, calc(100% - 32px));
  max-width: none;
  max-height: min(730px, calc(100dvh - 32px));
  background: var(--surface, #fff);
}
html body dialog.crm-modal:has(.stream-telegram-body) .crm-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line, #e7e5e9);
}
html body dialog.crm-modal:has(.stream-telegram-body) .crm-modal-heading h2 {
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.25;
}
html body dialog.crm-modal:has(.stream-telegram-body) .crm-modal-heading p {
  font-size: 13px;
  margin-block: 5px 0;
}
html body dialog.crm-modal .stream-telegram-body { padding: 20px 24px; }
.stream-telegram-body .stream-telegram-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr);
  align-items: start;
  gap: 18px;
}
.stream-telegram-paneside, .stream-telegram-recipients { min-width: 0; }
.stream-telegram-body h3 { margin: 0 0 8px; font-size: 14px; font-weight: 650; line-height: 20px; }
.stream-telegram-columns, .stream-telegram-people {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 3px;
  padding: 4px;
  max-height: min(42dvh, 338px);
  overflow: auto;
  overscroll-behavior: contain;
}
.stream-telegram-columns { background: var(--surface-soft, #f6f5f7); border: 1px solid var(--line, #e7e5e9); border-radius: 12px; }
.stream-telegram-body .stream-telegram-column {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink, #201e24);
  font: inherit;
  font-size: 13px;
  text-align: start;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.stream-telegram-column:hover { background: var(--surface, #fff); }
.stream-telegram-body .stream-telegram-column[aria-pressed="true"] {
  border-color: #d9caea;
  background: #eee6f7;
  color: #39274d;
  font-weight: 650;
}
.stream-telegram-count, .stream-telegram-selection {
  flex: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted, #635e68);
}
.stream-telegram-count { border-radius: 6px; background: var(--surface, #fff); padding: 1px 6px; font-size: 12px; }
.stream-telegram-recipient-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.stream-telegram-recipient-head h3 { margin: 0; }
.stream-telegram-selection { font-size: 12px; }
.stream-telegram-body .stream-telegram-recipients > input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line, #e7e5e9);
  border-radius: 9px;
  background: var(--surface, #fff);
  color: var(--ink, #201e24);
}
.stream-telegram-people { border: 1px solid var(--line, #e7e5e9); border-radius: 12px; }
html body dialog.crm-modal .stream-telegram-people > label.stream-telegram-person {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: start;
  cursor: pointer;
}
html body dialog.crm-modal .stream-telegram-people > label.stream-telegram-person:hover { background: var(--surface-soft, #f6f5f7); }
html body dialog.crm-modal .stream-telegram-people > label:has(input:checked) {
  background: #f5effa;
  border-color: #e7ddf0;
}
html body dialog.crm-modal .stream-telegram-person > input[type="checkbox"] {
  appearance: auto;
  position: static;
  display: block;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  inset: auto;
  margin: 0;
  padding: 0;
  transform: none;
  accent-color: #695384;
}
.stream-telegram-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ebe4f3;
  color: #58426e;
  font-size: 13px;
  font-weight: 650;
}
.stream-telegram-person-name { min-width: 0; line-height: 1.3; }
.stream-telegram-person-name strong, .stream-telegram-person-name small {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.stream-telegram-person-name strong { font-size: 13px; color: var(--ink, #201e24); }
.stream-telegram-person-name small { margin-top: 2px; font-size: 12px; color: var(--muted, #635e68); }
.stream-telegram-body .stream-telegram-note {
  margin: 14px 0 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--surface-soft, #f6f5f7);
  color: var(--muted, #635e68);
  font-size: 12px;
  line-height: 1.45;
}
.stream-telegram-body :is(button, input):focus-visible { outline: 2px solid var(--ui-focus, #7352a0); outline-offset: -2px; }
.stream-telegram-people > p { margin: 16px 10px; color: var(--muted, #635e68); }
@media (max-width: 600px) {
  html body dialog.modal.crm-modal[data-dialog-standard].wide:has(.stream-telegram-body) {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
  }
  html body dialog.crm-modal:has(.stream-telegram-body) .crm-modal-header,
  html body dialog.crm-modal .stream-telegram-body { padding: 14px; }
  .stream-telegram-body .stream-telegram-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .stream-telegram-columns { display: flex; max-height: none; }
  .stream-telegram-body .stream-telegram-column { width: auto; max-width: 220px; flex: 0 0 auto; min-height: 44px; }
  .stream-telegram-people { max-height: min(32dvh, 270px); }
}

/* Stream command area. Keep navigation, search and source actions distinct. */
#root .app-shell.product-shell.original-ui .stream-triage > .stream-search-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "heading actions"
    "summary actions";
  align-items: center;
  gap: 2px 20px;
  margin-block: 0 12px;
}
#root .app-shell.product-shell.original-ui .stream-triage > .stream-search-header > .stream-search-heading-main { grid-area: heading; }
#root .app-shell.product-shell.original-ui .main[data-app-route] .stream-triage > .stream-search-header .stream-search-heading-main h2 {
  min-height: 0;
  font-size: 24px;
  letter-spacing: -.03em;
  line-height: 1.25;
}
#root .app-shell.product-shell.original-ui .main[data-app-route] .stream-triage > .stream-search-header .stream-search-heading-main h2::before { content: none; }
#root .app-shell.product-shell.original-ui .stream-triage .stream-search-signal { display: none; }
#root .app-shell.product-shell.original-ui .stream-triage > .stream-search-header > .stream-summary {
  grid-area: summary;
  order: 0;
  padding: 0;
}
#root .app-shell.product-shell.original-ui .stream-triage .stream-overview-counts {
  display: flex;
  gap: 4px 16px;
  margin: 0;
  flex-wrap: wrap;
}
#root .app-shell.product-shell.original-ui .stream-triage .stream-stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0;
  border: 0;
}
#root .app-shell.product-shell.original-ui .stream-triage .stream-stat-pill :is(dt, dd) {
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.3;
}
#root .app-shell.product-shell.original-ui .stream-triage .stream-stat-pill dd { font-weight: 600; }
#root .app-shell.product-shell.original-ui .stream-triage .stream-source-count {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  text-decoration: none;
  gap: 3px;
}
#root .app-shell.product-shell.original-ui .stream-triage .stream-source-count svg { width: 12px; height: 12px; }
#root .app-shell.product-shell.original-ui .stream-triage .stream-source-count:hover { text-decoration: underline; text-underline-offset: 3px; }
#root .app-shell.product-shell.original-ui .stream-triage > .stream-search-header .discovery-actions {
  display: flex;
  grid-area: actions;
  justify-content: flex-end;
  justify-self: end;
  gap: 6px;
  margin-inline: 0;
}
#root .app-shell.product-shell.original-ui .stream-triage .discovery-actions > .button {
  min-height: 42px;
  min-width: 42px;
  border-radius: 9px;
  font-size: 13px;
}
#root .app-shell.product-shell.original-ui .stream-triage .discovery-actions > .stream-telegram-launch {
  width: auto;
  padding: 7px 12px;
  background: #f3edf8;
  color: #51396a;
  border-color: #e7dbef;
  text-align: center;
}
#root .app-shell.product-shell.original-ui .stream-triage .discovery-actions > .stream-telegram-launch:hover { background: #ece1f4; }
#root .app-shell.product-shell.original-ui .stream-triage .discovery-actions > :is(.stream-create-column, button[data-usage-action="stream.column.create"]) {
  background: var(--ink, #211e25);
  color: #fff;
  border-color: transparent;
}
#root .app-shell.product-shell.original-ui .stream-triage .discovery-actions > :is(.stream-create-column, button[data-usage-action="stream.column.create"]):hover:not(:disabled) { background: #38323f; }
#root .app-shell.product-shell.original-ui .stream-triage .stream-controls-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 10px;
  margin: 0 0 8px;
}
#root .app-shell.product-shell.original-ui .stream-triage .stream-controls-row > .discovery-feed-filters { grid-area: auto; }
#root .app-shell.product-shell.original-ui .stream-triage .discovery-segment {
  display: inline-flex;
  gap: 2px;
  width: auto;
  max-width: 100%;
  padding: 3px;
  border: 1px solid var(--line, #e7e5e9);
  border-radius: 10px;
  background: var(--surface-soft, #f6f5f7);
}
#root .app-shell.product-shell.original-ui .stream-triage .discovery-segment > button {
  min-height: 36px;
  padding: 6px 10px;
  color: var(--muted, #635e68);
  background: transparent;
  border-radius: 7px;
  white-space: nowrap;
}
#root .app-shell.product-shell.original-ui .stream-triage .discovery-segment > button[aria-pressed="true"] {
  background: var(--surface, #fff);
  color: var(--ink, #211e25);
  box-shadow: 0 1px 3px #241c3520;
  font-weight: 650;
}
#root .app-shell.product-shell.original-ui .stream-triage .discovery-feed-filters > .discovery-search,
#root .app-shell.product-shell.original-ui .stream-triage .discovery-feed-filters > .discovery-filter-toggle {
  margin: 0;
  min-height: 44px;
  border-radius: 9px;
}
#root .app-shell.product-shell.original-ui .stream-triage .discovery-filter-toggle[aria-expanded="true"] {
  background: #f3edf8;
  border-color: #e0d1eb;
  color: #51396a;
}
#root .app-shell.product-shell.original-ui .stream-triage .stream-controls-row .stream-contact-legend { gap: 4px; }
#root .app-shell.product-shell.original-ui .stream-triage .stream-period-select { gap: 5px; margin-block: 0; }
@media (max-width: 1120px) {
  #root .app-shell.product-shell.original-ui .stream-triage .stream-controls-row { grid-template-columns: minmax(0, 1fr) auto; }
  #root .app-shell.product-shell.original-ui .stream-triage .stream-controls-row > .discovery-feed-filters { grid-area: 2 / 1 / auto / -1; }
}
@media (max-width: 840px) {
  #root .app-shell.product-shell.original-ui .stream-triage > .stream-search-header {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "heading" "summary" "actions";
  }
  #root .app-shell.product-shell.original-ui .stream-triage > .stream-search-header .discovery-actions {
    justify-self: stretch;
    justify-content: flex-start;
    margin-block-start: 4px;
  }
}
@media (max-width: 540px) {
  #root .app-shell.product-shell.original-ui .stream-triage > .stream-search-header {
    row-gap: 4px;
  }
  #root .app-shell.product-shell.original-ui .stream-triage > .stream-search-header .discovery-actions { flex-wrap: wrap; }
  #root .app-shell.product-shell.original-ui .stream-triage .discovery-actions > .button { min-width: 44px; min-height: 44px; }
  #root .app-shell.product-shell.original-ui .stream-triage .discovery-actions > .stream-telegram-launch { flex: 1 1 auto; }
  #root .app-shell.product-shell.original-ui .stream-triage .discovery-segment > button { min-height: 41px; padding-inline: 8px; }
}
