/* Keep the wrapper's width, and thus the list's width and scroll, unchanged.
   Only its child covers the working area. The sidebar remains accessible. */
div:has(> [data-side-panel][data-ds-company-expanded='true']) {
  position: relative;
}
[data-side-panel][data-ds-company-expanded='true'] > aside {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  border-left: none;
}
.ds-company-card-expansion {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 4px 6px;
  border: 0;
  border-radius: var(--t-border-radius-sm);
  color: var(--t-font-color-secondary);
  background: transparent;
  font: inherit;
  font-size: var(--t-font-size-sm);
  cursor: pointer;
}
.ds-company-card-expansion:hover {
  background: var(--t-background-transparent-light);
}
.ds-company-card-expansion:focus-visible {
  outline: 2px solid var(--t-color-blue);
  outline-offset: 2px;
}

/* The stock record command menu ("Меню команд", the vertical-dots button)
   renders its dropdown behind the expanded card, so the button looks dead.
   Hide it only while the card fills the working area. */
body:has([data-ds-company-expanded='true']) [data-testid='page-header-side-panel-button'] {
  display: none;
}

/* Twenty disables text selection on many UI elements; our custom panels must
   stay copyable (research reports, queue comments, proposal previews). */
[data-testid='company-research-panel'],
[data-testid='company-research-panel'] *,
[data-testid='today-queue'],
[data-testid='today-queue'] *,
[data-testid='proposal-wizard'],
[data-testid='proposal-wizard'] * {
  -webkit-user-select: text;
  user-select: text;
}

@media (max-width: 768px) {
  .ds-mobile-company-close {
    min-height: 40px;
    flex-shrink: 0;
    padding: 6px 10px;
    margin-right: 8px;
    border: 1px solid var(--t-border-color-medium, #d1d5db);
    border-radius: 6px;
    background: var(--t-background-primary, #fff);
    color: var(--t-font-color-primary, #374151);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
  }
  .ds-mobile-company-close:focus-visible {
    outline: 2px solid var(--t-color-blue, #3b82f6);
    outline-offset: 2px;
  }
  .s9ltriw { box-sizing: border-box; max-width: calc(100vw - 16px); }
  .s9ltriw > .s1u0tjra { max-width: 100%; max-height: inherit; overflow-y: auto; overscroll-behavior: contain; }
  .s9ltriw .s1207e8j, .s9ltriw .s4j15w3 { min-width: 0; max-width: 100%; min-height: 0; }
}
