.nook-case .af-container.with-notes-sidebar .af-column:not(.collapsed) .show-when-collapsed,
.nook-case .af-container.with-notes-sidebar .af-column.collapsed .hide-when-collapsed {
  display: none;
}

.nook-case .af-container.with-notes-sidebar .collapse-toggle {
  --nook-icon-color: var(--crm-primary-color);
  height: auto;
}
.nook-case .af-container.with-notes-sidebar .collapse-toggle .btn-label {
  text-decoration: underline;
  padding-right: 0.5rem;
}

@media (min-width: 768px) {
  .nook-case .af-container.af-layout-cols.with-notes-sidebar {
    flex-flow: row nowrap;
  }

  .nook-case .af-container.with-notes-sidebar > .af-column {
    transition: all ease-out 200ms;
    flex: 1 1 100%;
  }

  .nook-case .af-container.with-notes-sidebar .nook-notes-sidebar.collapsed {
    flex-basis: 100px;
  }
}


.nook-case-notes-list {
  --nook-note-text: var(--crm-text-color);
  --nook-note-width: clamp(60%, 400px, 90%);

  /* show pager at top */
  display: flex;
  flex-direction: column-reverse;
}

.nook-case-notes-list > ul {
  padding-left: 0;

  /* scroll up to older notes */
  display: flex;
  max-height: 50rem;
  overflow-y: scroll;
  flex-direction: column-reverse;

  /* ensure no horizontal scroll */
  overflow-x: hidden;
  padding-right: 0.25rem;
}


.nook-case-note {
  --nook-note-body: var(--nook-note-text);
  --nook-note-tag: var(--crm-primary-color);
  --crm-text-color: var(--nook-note-body);

  padding: 1rem;

  border-radius: 0 2rem 0 2rem;
  background-color: var(--crm-paper);
  color: var(--nook-note-body);
  border: 1px solid var(--nook-grey-dark);

  width: var(--nook-note-width);
  min-width: 10rem;
  margin: 0.5rem;
}

.nook-case-note-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
}

.nook-case-note.nook-case-note__mine {
  margin-left: calc(100% - var(--nook-note-width));
}

.nook-case-note.nook-case-note__mine.nook-case-note__internal {
  --nook-note-body: var(--crm-primary-text-color);
  --nook-note-tag: var(--nook-note-text);
  background-color: var(--crm-primary-color);
  border: none;
}

.nook-case-note.nook-case-note__email {
  border: 1px solid var(--nook-blue-mid);
}

.nook-case-note.nook-case-note__email .nook-case-email-note-header {
  align-self: stretch;
  padding: 0 1rem 1rem;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--crm-border-color);
  margin: 0 -1rem;
}

.nook-case-note.nook-case-note__email .nook-case-email-note-header-title .crm-i {
  width: 2rem;
  height: 2rem;
  border-radius: 1rem;
  line-height: 2rem;
  text-align: center;
  margin-right: 1rem;
  background-color: var(--nook-blue-mid);
  color: var(--crm-primary-text-color);
}

.nook-case-note.nook-case-note__email .nook-case-email-note-header-title span {
  font-family: var(--crm-font-title);
  font-weight: 700;
  font-size: 1.125rem;
}

.nook-case-email-note-header-stage {
  margin-left: 3rem;
}

.nook-case-note.nook-case-note__email .nook-case-email-note-header-date {
  color: var(--nook-secondary-text-color);
}

.nook-case-note.nook-case-note__email .nook-case-email-note-email-headers {
  width: 100%;
  padding: 1rem 0;
  border-bottom: 1px solid var(--crm-border-color);
  line-height: 1.75rem;
}

.nook-case-note.nook-case-note__email .nook-case-email-note-email-headers .nook-case-email-note-email-headers-name,
.nook-case-note.nook-case-note__email .nook-case-email-note-email-headers .nook-case-email-note-email-headers-subject {
  font-weight: 500;
}

.nook-case-note.nook-case-note__email .nook-case-email-note-body {
  padding: 1rem 0;
}

.nook-case-note.nook-case-note__email .nook-case-email-note-expander {
  text-decoration: underline;
  color: var(--nook-blue-dark);
  cursor: pointer;
}

.nook-case-note.nook-case-note__email .nook-case-email-note-expander:hover {
  text-decoration: none;
}

.nook-case-note .nook-note-tag {
  display: flex;
  font-size: 0.75rem;
  color: var(--nook-note-tag);
}
.nook-case-note .nook-note-tag label,
.nook-case-note .nook-note-tag label + span {
  padding: 0 0.5rem;
  border: 1px solid var(--crm-primary-color);
  background-color: var(--nook-white);
}
.nook-case-note .nook-note-tag label {
  border-radius: 0.25rem 0 0 0.25rem;
  flex: 0 0 auto;
  border-right: 0;
}
.nook-case-note .nook-note-tag label + span {
  border-radius: 0 0.25rem 0.25rem 0;
  border-left: 0;
  padding-left: 0;
}
.nook-case-note .nook-note-tag label::after {
  content: ':';
}
.nook-case-note .nook-note-author {
  font-size: 1.25rem;
  padding-right: 1.5rem; /* don't overlap the menu button */
}
.nook-case-note .nook-note-body ul,
.nook-case-note .nook-note-body ol {
  padding-left: 1.5rem;
  margin: 0 0 10px !important;
  list-style: revert;
}
.nook-case-note .nook-note-created-date {
  font-style: italic;
}

.nook-case-note .nook-note-menu {
  width: 100%;
  display: flex;
  justify-content: flex-end;

  height: 0;
  overflow: visible;
}
.nook-case-notes-list-search {
  margin-top: 0.5rem;
}
