/* v93 — sticky task-list header, table frame, scoped panels, category picker, realtime chat */

/* The task table is the scroll surface; the project/action header remains outside. */
body.app-project-list-scroll #listView,
body.app-project-list-scroll #listView .list-scroll-x {
  min-height: 0 !important;
}
body.app-project-list-scroll #listView .list-scroll-x {
  position: relative !important;
  width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
body.app-project-list-scroll #listView .grid-shell {
  isolation: isolate;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  background-image: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: visible !important;
}
body.app-project-list-scroll #listView #gridHeader,
body.app-project-list-scroll #listView .grid-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 150 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background: var(--bg-surface, #fff) !important;
  box-shadow: 0 1px 0 var(--border, #dfeef0), 0 5px 12px rgba(7, 77, 83, .06) !important;
  transform: translateZ(0);
}
body.app-project-list-scroll #listView #taskSections {
  position: relative;
  z-index: 1;
}

/* Multi-select category access shown directly in every add/invite dialog. */
.org-invite-category-group { margin-top: 4px; }
.invite-category-checkbox-dropdown { width: 100%; }
.invite-category-check-row {
  display: grid;
  grid-template-columns: 18px 10px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 4px;
  cursor: pointer;
  border-radius: 7px;
}
.invite-category-check-row:hover { background: var(--bg-hover, #eef8f9); }
.invite-category-check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent, #007380);
}
.invite-category-check-row .invite-category-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-help {
  display: block;
  margin-top: 5px;
  color: var(--text-muted, #718096);
  font-size: 11px;
  line-height: 1.35;
}

/* More usable Team Chat workspace: narrower conversation-name column. */
:root { --chat-sidebar-w: 210px; }
body.app-nav-messages .global-messages-page .chat-sidebar,
body.app-nav-messages .chat-sidebar {
  flex: 0 0 var(--chat-sidebar-w) !important;
  width: var(--chat-sidebar-w) !important;
  min-width: var(--chat-sidebar-w) !important;
  max-width: var(--chat-sidebar-w) !important;
}
body.app-nav-messages .chat-sidebar-header {
  padding-left: 12px !important;
  padding-right: 10px !important;
}
body.app-nav-messages .chat-sidebar-label,
body.app-nav-messages .chat-sidebar-label-row {
  padding-left: 12px !important;
  padding-right: 9px !important;
}
body.app-nav-messages .chat-sidebar .chat-ch-btn {
  padding-left: 10px !important;
  padding-right: 8px !important;
}
body.app-nav-messages .chat-sidebar .chat-ch-name,
body.app-nav-messages .chat-sidebar .chat-dm-name,
body.app-nav-messages .chat-sidebar .chat-ch-text {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}
@media (max-width: 1280px) {
  :root { --chat-sidebar-w: 190px; }
}
@media (max-width: 900px) {
  :root { --chat-sidebar-w: 176px; }
}
@media (max-width: 700px) {
  :root { --chat-sidebar-w: 164px; }
}

/* Remove the older decorative card surrounding the current table. */
body.app-project-list-scroll #listView.active {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  background-image: none !important;
}
.notification-category-access-group {
  grid-column: 1 / -1;
  width: 100%;
}


/* v93: only the selected project tab may render. Runtime v92 left an inline
   display:flex!important on List after tab changes; this hard boundary avoids
   the task table appearing beneath Dashboard, Calendar, Completed, or custom tabs. */
#listView:not(.active),
#dashboardView:not(.active),
#calendarView:not(.active),
#completedView:not(.active) {
  display: none !important;
}

/* Keep one visible table frame (not an extra outer card). */
body.app-project-list-scroll #listView .list-scroll-x {
  box-sizing: border-box;
  border: 1px solid var(--border, #dfeef0) !important;
  border-radius: 10px !important;
  background: var(--bg-surface, #fff) !important;
}
body.app-project-list-scroll #listView .grid-shell {
  border: 0 !important;
  border-radius: 9px !important;
}
#completedView.active .completed-scroll-x {
  box-sizing: border-box;
  border: 1px solid var(--border, #dfeef0) !important;
  border-radius: 10px !important;
  background: var(--bg-surface, #fff) !important;
}
#completedView.active .grid-shell { border: 0 !important; }

/* Category-access controls must fit their modal and expose the full label/count. */
.org-invite-category-group,
.notification-category-access-group,
.team-member-category-field {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.org-invite-category-group .invite-category-access,
.team-member-category-field .invite-category-access,
.add-member-chip .invite-category-access {
  width: 100%;
  min-width: 0;
  margin: 8px 0 0 !important;
  box-sizing: border-box;
}
.invite-category-access summary {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.invite-category-access summary span { min-width: 0; }
.invite-category-access summary strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-category-access summary small {
  flex: 0 0 auto;
  max-width: 48%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.invite-category-field-label {
  margin-top: 10px;
  color: var(--text-primary, #183438);
  font-size: 12px;
  font-weight: 700;
}
.add-member-modal-body {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.add-member-selected {
  max-height: none !important;
  overflow: visible !important;
}
.tm-page-modal-body .org-invite-category-group,
.tm-add-org-member .org-invite-category-group {
  grid-column: 1 / -1;
}


/* v94: keep the single table frame visible on every edge while the sticky
   header and horizontally scrollable grid move inside it. */
body.app-project-list-scroll #listView .list-scroll-x {
  box-sizing: border-box !important;
  border: 1px solid var(--border, #d5e7e9) !important;
  border-radius: 10px !important;
  padding: 1px !important;
  background: var(--bg-surface, #fff) !important;
  background-clip: padding-box !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border, #d5e7e9) 55%, transparent) !important;
}
body.app-project-list-scroll #listView .grid-shell {
  box-sizing: border-box !important;
  margin: 0 !important;
  border-radius: 8px !important;
}
body.app-project-list-scroll #listView #gridHeader,
body.app-project-list-scroll #listView .grid-header {
  top: 0 !important;
  border-radius: 8px 8px 0 0 !important;
  background-clip: padding-box !important;
}
body.app-project-list-scroll #listView #taskSections {
  box-sizing: border-box !important;
  padding-bottom: 1px !important;
}
html[data-theme="dark"] body.app-project-list-scroll #listView .list-scroll-x {
  border-color: var(--border, #24474c) !important;
  box-shadow: inset 0 0 0 1px rgba(189, 216, 219, .12) !important;
}
/* Single continuous table frame — no inner/double corner */
body.app-project-list-scroll #listView .list-scroll-x {
  box-sizing: border-box !important;
  border: 1px solid var(--border, #d5e7e9) !important;
  border-radius: 6px !important;
  padding: 0 !important;
  overflow: auto !important;
  background: var(--bg-surface, #fff) !important;
  background-clip: border-box !important;
  box-shadow: none !important;
}

/* Do not create a second rounded box inside the table */
body.app-project-list-scroll #listView .grid-shell {
  box-sizing: border-box !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
}

/* The outer scroll frame clips the header into the correct rounded corner */
body.app-project-list-scroll #listView #gridHeader,
body.app-project-list-scroll #listView .grid-header {
  top: 0 !important;
  margin: 0 !important;
  border-radius: 0 !important;
  background-clip: border-box !important;
}

/* v95: Completed uses the exact same table-header surface and dividers as List. */
body.app-project-list-scroll #listView #gridHeader,
#completedView #completedGridHeader {
  background: var(--bg-surface, #fff) !important;
  border-bottom: 1px solid var(--border, #dfeef0) !important;
  box-shadow: 0 1px 0 var(--border, #dfeef0), 0 5px 12px rgba(7, 77, 83, .06) !important;
}

html[data-theme="light"] body.app-project-list-scroll #listView #gridHeader .gh-cell,
html:not([data-theme="dark"]) body.app-project-list-scroll #listView #gridHeader .gh-cell,
html[data-theme="light"] #completedView #completedGridHeader .gh-cell,
html:not([data-theme="dark"]) #completedView #completedGridHeader .gh-cell {
  background: var(--bg-hover, #f1f9f9) !important;
  color: var(--text-primary, #142628) !important;
  border-right: 1px solid var(--dnxt-list-divider, rgba(47, 106, 112, .42)) !important;
}

html[data-theme="dark"] body.app-project-list-scroll #listView #gridHeader .gh-cell,
html[data-theme="dark"] #completedView #completedGridHeader .gh-cell {
  background: #0b2224 !important;
  color: #f1f8f9 !important;
  border-right: 1px solid var(--dnxt-list-divider-dark, rgba(140, 207, 215, .30)) !important;
}

body.app-project-list-scroll #listView #gridHeader .gh-cell:last-child,
#completedView #completedGridHeader .gh-cell:last-child {
  border-right: 0 !important;
}

/* v96: Team Chat names/conversations column can be resized like the main sidebar. */
.chat-layout > .chat-sidebar-resize-handle {
  position: relative;
  z-index: 40;
  flex: 0 0 8px;
  width: 8px;
  min-width: 8px;
  margin-left: -4px;
  margin-right: -4px;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}
.chat-layout > .chat-sidebar-resize-handle::before {
  content: "";
  position: absolute;
  inset: 0 3px;
  background: transparent;
  transition: background .15s ease, box-shadow .15s ease;
}
.chat-layout > .chat-sidebar-resize-handle:hover::before,
.chat-layout > .chat-sidebar-resize-handle:focus-visible::before,
body.chat-sidebar-resizing .chat-layout > .chat-sidebar-resize-handle::before {
  background: color-mix(in srgb, var(--accent, #007380) 68%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent, #007380) 16%, transparent);
}
body.chat-sidebar-resizing,
body.chat-sidebar-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* Keep the established compact/mobile sidebar sizes independent of a saved
   desktop preference, and disable dragging where the mobile layout takes over. */
@media (max-width: 768px) {
  .chat-layout > .chat-sidebar-resize-handle { display: none !important; }
  body.app-nav-messages .global-messages-page .chat-sidebar,
  body.app-nav-messages .chat-sidebar {
    flex-basis: 176px !important;
    width: 176px !important;
    min-width: 176px !important;
    max-width: 176px !important;
  }
}
@media (max-width: 700px) {
  body.app-nav-messages .global-messages-page .chat-sidebar,
  body.app-nav-messages .chat-sidebar {
    flex-basis: 164px !important;
    width: 164px !important;
    min-width: 164px !important;
    max-width: 164px !important;
  }
}

