body:has(.notes-reference-page) {
  background: #f4f4f4;
}

.notes-reference-page {
  width: min(100%, 880px);
  min-height: 100svh;
  margin: 0;
  background: #f4f4f4;
  color: #080808;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

.notes-reference-tabs {
  height: 106px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  padding: 0 10px;
  background: #fff;
}

.notes-reference-tabs a {
  position: relative;
  text-align: center;
  color: #090909;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.notes-reference-tabs a.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -25px;
  width: 28px;
  height: 10px;
  transform: translateX(-50%);
  border-radius: 10px;
  background: #050505;
}

.notes-reference-main {
  padding: 14px 20px 100px;
}

.notes-view-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  height: 92px;
  padding: 5px;
  border: 2px solid #111;
  border-radius: 12px;
  background: #f4f4f4;
}

.notes-tab-panel[hidden] {
  display: none;
}

.notes-tab-panel[aria-hidden="true"] {
  display: none;
}

.notes-tab-panel[aria-hidden="false"] {
  display: block;
}

.notes-view-switch button {
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #080808;
  font: inherit;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
}

.notes-view-switch button.active {
  background: #000;
  color: #fff;
  font-weight: 600;
}

.notes-notification-row {
  display: flex;
  align-items: center;
  height: 111px;
  margin-top: 20px;
  padding: 0 31px;
  border-radius: 15px;
  background: #fff;
  cursor: pointer;
}

.notes-notification-icon {
  display: grid;
  place-items: center;
  width: 53px;
  height: 53px;
  flex: 0 0 53px;
}

.notes-notification-icon img {
  display: block;
  width: 53px;
  height: 53px;
  object-fit: contain;
}

.notes-notification-label {
  margin-left: 12px;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.notes-notification-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.notes-toggle {
  display: flex;
  align-items: center;
  width: 103px;
  height: 63px;
  margin-left: auto;
  padding: 3px;
  border: 3px solid #e1e1e1;
  border-radius: 999px;
  background: #f5f5f5;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .03);
  transition: background .2s ease, border-color .2s ease;
}

.notes-toggle > span {
  display: block;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .2);
  transition: transform .2s ease;
}

.notes-notification-row:has(input:checked) .notes-toggle {
  border-color: #111;
  background: #111;
}

.notes-notification-row:has(input:checked) .notes-toggle > span {
  transform: translateX(40px);
}

.notes-reference-list {
  min-height: 130px;
  margin-top: 82px;
}

.notes-tab-panel[data-note-panel="settings"] {
  padding-top: 20px;
}

.notes-reference-list .empty {
  padding: 0;
  border: 0;
  color: #a3a3a3;
  font-size: 29px;
  font-weight: 500;
  line-height: 1.35;
  text-align: center;
}

.notes-reference-list .note-item {
  align-items: flex-start;
  border-color: #ddd;
}

.note-item-body {
  min-width: 0;
  flex: 1;
}

.note-item-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.note-item-meta .badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
}

.note-reply-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f1f1f1;
  color: #777;
  font-size: 12px;
}

.note-reply-status.unread {
  background: #fff0ec;
  color: #d85f4e;
  font-weight: 700;
}

.note-reply-status.replied {
  background: #edf7f0;
  color: #31834e;
}

.note-interaction-btn {
  flex: 0 0 auto;
  align-self: center;
  border: 1px solid #111;
  border-radius: 999px;
  padding: 9px 13px;
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.note-interaction-btn:focus-visible,
.note-reply-form textarea:focus-visible,
.note-reply-target select:focus-visible {
  outline: 2px solid #ff8d76;
  outline-offset: 2px;
}

.note-reply-context {
  margin-bottom: 16px;
  padding: 13px 15px;
  border-radius: 13px;
  background: #f5f5f5;
}

.note-reply-context strong {
  display: block;
  font-size: 14px;
}

.note-reply-context p {
  margin: 6px 0 0;
  color: #666;
  font-size: 13px;
  line-height: 1.6;
}

.note-reply-thread {
  display: grid;
  gap: 10px;
  max-height: 330px;
  overflow: auto;
  padding: 2px 3px 2px 0;
}

.note-reply {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 14px;
  background: #f4f4f4;
}

.note-reply.from-owner {
  justify-self: start;
  border-top-left-radius: 4px;
}

.note-reply.from-drawer {
  justify-self: end;
  border-top-right-radius: 4px;
  background: #fff0ec;
}

.note-reply > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.note-reply strong {
  font-size: 12px;
}

.note-reply time {
  color: #999;
  font-size: 10px;
}

.note-reply p {
  margin: 6px 0 0;
  color: #333;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.note-reply-empty {
  margin: 26px 0;
  color: #999;
  font-size: 13px;
  text-align: center;
}

.note-reply-form {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.note-reply-form textarea,
.note-reply-target select {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
  color: #222;
  font-size: 13px;
  resize: vertical;
}

.note-reply-target {
  display: grid;
  gap: 6px;
  color: #666;
  font-size: 12px;
}

.note-item-gallery {
  display: flex;
  gap: 7px;
  margin-top: 8px;
}

.note-item-gallery img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
}

@media (max-width: 700px) {
  .notes-reference-tabs {
    height: 74px;
    padding: 0 4px;
  }

  .notes-reference-tabs a {
    font-size: 16px;
  }

  .notes-reference-tabs a.active::after {
    bottom: -16px;
    width: 20px;
    height: 6px;
  }

  .notes-reference-main {
    padding: 14px 10px 70px;
  }

  .notes-view-switch {
    height: 65px;
    padding: 4px;
    border-width: 2px;
    border-radius: 10px;
  }

  .notes-view-switch button {
    border-radius: 7px;
    font-size: 16px;
  }

  .notes-notification-row {
    height: 82px;
    margin-top: 18px;
    padding: 0 16px;
    border-radius: 13px;
  }

  .notes-notification-icon,
  .notes-notification-icon img {
    width: 37px;
    height: 37px;
    flex-basis: 37px;
  }

  .notes-notification-label {
    margin-left: 9px;
    font-size: 19px;
  }

  .notes-toggle {
    width: 67px;
    height: 42px;
    padding: 2px;
    border-width: 2px;
  }

  .notes-toggle > span {
    width: 36px;
    height: 36px;
  }

  .notes-notification-row:has(input:checked) .notes-toggle > span {
    transform: translateX(25px);
  }

  .notes-reference-list {
    margin-top: 74px;
  }

  .notes-reference-list .empty {
    font-size: 18px;
  }

  .note-item-gallery img {
    width: 48px;
    height: 48px;
  }

  .notes-reference-list .note-item {
    gap: 10px;
    padding: 12px;
  }

  .note-interaction-btn {
    padding: 7px 9px;
    font-size: 11px;
  }

  .note-reply {
    max-width: 94%;
  }
}
