/* Folder discovery and list density; load after mailboxes.css. */
:root { --muted: #596b7c; }

.quick-folders {
  display: none;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #c6d5e1 transparent;
  scroll-padding-inline: 12px;
}

.quick-folders button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 0 auto;
  gap: 4px;
  min-width: 62px;
  min-height: 44px;
  padding: 8px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #5a7083;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.quick-folders button:hover {
  background: #f1f6fa;
  color: #345a78;
}

.quick-folders button.active,
.quick-folders button[aria-pressed="true"] {
  border-color: #c6dcee;
  background: #eaf3fc;
  color: #185d94;
  font-weight: 600;
}

.quick-folders [data-folder-count] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  padding: 1px 3px;
  border-radius: 4px;
  background: #f0f3f7;
  color: #5a7083;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.quick-folders button.active [data-folder-count],
.quick-folders button[aria-pressed="true"] [data-folder-count] {
  background: #dcebf8;
  color: #2c6591;
}

.quick-folders button svg {
  width: 15px;
  height: 15px;
}

.list-heading > div:not(.list-heading-actions) {
  flex: 1;
  min-width: 0;
}

.list-heading-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 70%;
}

.list-heading-actions .clear-filters {
  margin-top: 0;
}

.density-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px;
  color: #597187;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

.density-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.6;
}

.density-button.active,
.density-button[aria-pressed="true"] {
  background: var(--pale);
  color: #185d94;
}

.row-subject {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
}

.message-list.compact-list .message-row {
  padding: 10px 18px 9px;
}

.message-list.compact-list .row-top {
  margin-bottom: 3px;
}

.message-list.compact-list .row-subject {
  display: block;
  -webkit-line-clamp: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.message-list.compact-list .row-snippet {
  display: none;
}

.message-list.compact-list.has-search .row-snippet {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.5;
}

.message-list.compact-list .row-foot {
  gap: 7px;
  margin-top: 3px;
}

.message-row:focus-visible {
  z-index: 1;
  outline: none;
  box-shadow: inset 0 0 0 3px #2877b2;
}

.message-row.selected:focus-visible {
  box-shadow: inset 3px 0 var(--blue), inset 0 0 0 3px #2877b2;
}

.search-scope {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 8px;
  padding: 0 20px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

#searchScopeLabel {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

#broadenSearch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 7px;
  border-radius: 6px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

#broadenSearch:hover {
  background: var(--pale);
}

.search input {
  flex: 1;
  min-width: 0;
}

.search #clearSearch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 6px;
  color: #6a8195;
}

.search #clearSearch:hover {
  background: #e2ebf3;
  color: #305e80;
}

.search #clearSearch svg {
  width: 17px;
  height: 17px;
}

#searchInput::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

@media (max-width: 1180px) {
  .quick-folders {
    display: flex;
  }

  .message-list .list-heading {
    padding-top: 18px;
  }
}

@media (max-width: 820px) {
  .quick-folders {
    padding-inline: 12px;
  }

  .list-heading-actions {
    gap: 2px;
  }

  .density-button,
  .list-heading-actions .clear-filters {
    min-height: 44px;
    padding-inline: 6px;
    font-size: 12px;
  }

  .message-list.compact-list .message-row {
    padding: 10px 16px 9px;
  }

  .message-list.compact-list .row-sender,
  .message-list.compact-list .row-subject {
    font-size: 13px;
  }

  .message-list.compact-list.has-search .row-snippet {
    font-size: 12px;
  }

  .search-scope {
    gap: 6px;
    padding-bottom: 10px;
    font-size: 12px;
  }

  #broadenSearch {
    min-height: 44px;
    padding-inline: 7px;
    font-size: 12px;
  }

  .search #clearSearch {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }
}

@media (max-width: 420px) {
  .quick-folders button[data-folder="documents"] {
    font-size: 11px;
  }

  .list-heading-actions {
    max-width: 72%;
  }
}

@media (max-width: 360px) { .quick-folders [data-folder-count] { display: none; } }
@media (min-width: 821px) and (max-width: 1180px) { .quick-folders [data-folder-count] { display: none; } }
