[data-quick-notes] {
  margin-inline-start: auto;
}

a[data-notebook-view] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.nqn-nav, .npl-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
}

.neg-quick-notes {
  width: min(46rem, calc(100% - 1.5rem));
  max-height: min(52rem, calc(100dvh - 1.5rem));
  overflow: auto;
  overscroll-behavior: contain;
  margin: auto;
  padding: clamp(1rem, 3vw, 1.65rem);
  border: 1px solid var(--workshop-line);
  border-top: 4px solid var(--workshop-red);
  border-radius: .75rem;
  background: white;
  color: var(--workshop-ink);
  box-shadow: 0 .8rem 3.5rem #241b2233;
  line-height: 1.45;
}

.neg-quick-notes::backdrop { background: #201b20a6; }
html:has(.neg-quick-notes[open]) { overflow: hidden; }

.neg-quick-notes :is(h2, h3, p) { margin: 0; }
.neg-quick-notes h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); }
.neg-quick-notes h3 { font-size: 1.15rem; }
.neg-quick-notes :is(small, .nqn-heading p) { color: var(--workshop-muted); }
.neg-quick-notes .nqn-heading { display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between; }
.neg-quick-notes .nqn-compose { margin: 1.1rem 0 1.35rem; }
.neg-quick-notes label { display: block; font-weight: 650; margin: 0 0 .35rem; }
.neg-quick-notes :is(textarea, input[type="text"]) {
  display: block;
  width: 100%;
  padding: .65rem .75rem;
  border: 1px solid #898086;
  border-radius: .45rem;
  color: inherit;
  background: white;
  font: inherit;
}
.neg-quick-notes textarea { resize: vertical; }
.neg-quick-notes .nqn-compose input { max-width: 27rem; margin-bottom: .85rem; }
.neg-quick-notes .nqn-actions { display: flex; gap: .75rem; align-items: center; margin-top: .6rem; }
.neg-quick-notes :is(.primary-button, .secondary-button) { min-height: 2.45rem; margin: 0; padding: .45rem .8rem; }
.neg-quick-notes .nqn-feedback:not(:empty), .neg-quick-notes [data-manual] { margin: .65rem 0; font-size: .94rem; }
.neg-quick-notes .nqn-saved { border-top: 1px solid var(--workshop-line); padding-top: 1rem; }
.neg-quick-notes .nqn-saved .nqn-heading { align-items: center; flex-wrap: wrap; }
.neg-quick-notes table { margin: .8rem 0; width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .93rem; }
.neg-quick-notes th, .neg-quick-notes td {
  padding: .55rem .5rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--workshop-line);
  overflow-wrap: anywhere;
}
.neg-quick-notes th { background: #f6f3f4; }
.neg-quick-notes th.nqn-category-column { width: 20%; }
.neg-quick-notes th:nth-last-child(2) { width: 14%; }
.neg-quick-notes th:last-child { width: 23%; }
.neg-quick-notes td:first-child { white-space: pre-wrap; }
.neg-quick-notes .nqn-inline-category { display: none; }

@media (max-width: 36rem) {
  .neg-quick-notes .nqn-category-column { display: none; }
  .neg-quick-notes .nqn-inline-category { display: block; margin-bottom: .15rem; font-weight: 650; color: var(--workshop-red-hover); }
  .neg-quick-notes th:nth-last-child(2) { width: 20%; }
  .neg-quick-notes th:last-child { width: 28%; }
  .neg-quick-notes :is(th, td) { padding: .45rem .25rem; }
}

/* Keep the switch and close controls still while the saved rows arrive. */
dialog.neg-quick-notes, dialog.neg-personal-log.npl-list {
  --notebook-top: clamp(.75rem, 5vh, 3rem);
  position: fixed;
  inset: var(--notebook-top) 0 auto;
  margin: 0 auto;
  max-height: min(var(--notebook-height-limit, 100vh), calc(100vh - var(--notebook-top) - .75rem));
  max-height: min(var(--notebook-height-limit, 100dvh), calc(100dvh - var(--notebook-top) - .75rem));
  overflow: auto;
  scrollbar-gutter: stable;
}

dialog.neg-quick-notes { --notebook-height-limit: 52rem; }

@media print {
  [data-quick-notes], .neg-quick-notes { display: none !important; }
  .neg-quick-notes::backdrop { background: transparent; }
}
