.m-fav,
.m-note,
.favorite-card-icon,
.favorites-close,
.favorites-comment-btn {
  font-family: inherit;
}

.m-fav {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 41, 55, 0.68);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  cursor: pointer;
  opacity: 0;
  transform: translateY(2px);
  transition: .2s ease-in-out;
}

.m-fav.is-active {
  color: #ff4f7d;
  opacity: 1;
  transform: none;
}

.m-fav.is-active svg path {
  fill: currentColor;
  stroke: currentColor;
}

.m-item:hover .m-fav,
.m-item:focus-within .m-fav {
  opacity: 1;
  transform: none;
}

.m-fav:hover {
  background: rgba(0,0,0,.38);
}

.m-note {
  position: absolute;
  top: 48px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 41, 55, 0.68);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  cursor: pointer;
  opacity: 0;
  transform: translateY(2px);
  transition: .2s ease-in-out;
}

.m-note.is-active {
  color: #ff4f7d;
  opacity: 1;
  transform: none;
}

.m-note.is-active svg path {
  fill: currentColor;
  stroke: currentColor;
}

.m-item:hover .m-note,
.m-item:focus-within .m-note {
  opacity: 1;
  transform: none;
}

.m-note:hover {
  background: rgba(0,0,0,.38);
}

.m-fav-badge {
  display:none !important;
}

.m-fav-badge.is-active {
  display: inline-flex;
}

#lightboxFavorite.is-active {
  color: #ff6b91;
}

#lightboxFavorite.is-active svg path {
  fill: currentColor;
  stroke: currentColor;
}

.lightbox-favorite-panel {
  position: fixed;
  top: 86px;
  right: 76px;
  width: 300px;
  max-width: calc(100vw - 120px);
  margin: 0;
  color: #111827;
  padding: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .12);
  z-index: 10001;
}

.lightbox-favorite-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.lightbox-favorite-panel-head label {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
}

.lightbox-favorite-save {
  min-width: 72px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid #dbe3f0;
  border-radius: 999px;
  background: #f6f8ff;
  color: #4338ca;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  transition: background .16s ease, border-color .16s ease, transform .05s ease;
}

.lightbox-favorite-save:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.lightbox-favorite-save:active {
  transform: translateY(1px);
}

.lightbox-favorite-note {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid #dbe3f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #111827;
  font: inherit;
  line-height: 1.45;
  padding: 12px;
  box-sizing: border-box;
  outline: none;
}

.lightbox-favorite-note:focus {
  border-color: #a5b4fc;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}

@media (max-width: 900px) {
  .lightbox-favorite-panel {
    position: fixed;
    right: 16px;
    bottom: 76px;
    top: auto;
    width: min(280px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    margin: 0;
    padding: 12px;
    box-shadow: 0 12px 28px rgba(15,23,42,.18);
  }
}

.favorites-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.98);
  z-index: 1200;
  overflow: auto;
}

.favorites-overlay-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 36px 28px 56px;
  position: relative;
}

.favorites-close {
  position: absolute;
  top: 18px;
  left: 18px;
}

.favorites-summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 0 0 28px;
  padding: 0 0 0 48px;
}

.favorites-summary-title {
  font-size: 32px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.favorites-summary-meta {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
}

.favorites-summary-divider {
  width: 1px;
  height: 18px;
  background: #d9deeb;
}

.favorites-grid {
  --gap: 10px;
}

.favorites-grid.masonry {
  display: block;
  column-count: 4;
  column-gap: var(--gap);
}

@media (max-width: 1200px) {
  .favorites-grid.masonry {
    column-count: 3;
  }
}

@media (max-width: 780px) {
  .favorites-grid.masonry {
    column-count: 2;
  }
}

@media (max-width: 520px) {
  .favorites-grid.masonry {
    column-count: 1;
  }
}

.favorite-masonry-item {
  position: relative;
  background: transparent;
  border-radius: 8px;
  overflow: hidden;
  min-height: 0;
  height: auto;
  align-self: start;
  display: inline-block;
  width: 100%;
  margin: 0 0 var(--gap);
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
}

.favorite-masonry-photo {
  width: 100%;
  height: auto;
  display: block;
}

.favorite-overlay-btn {
  position: absolute;
  top: 48px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 41, 55, 0.68);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  cursor: pointer;
  opacity: 0;
  transform: translateY(2px);
  transition: .2s ease-in-out;
}

.favorite-overlay-note {
  right: 12px;
}

.favorite-overlay-note.is-active {
  color: #ff4f7d;
  opacity: 1;
  transform: none;
}

.favorite-overlay-note.is-active svg path {
  fill: currentColor;
  stroke: currentColor;
}

.favorite-masonry-item:hover .favorite-overlay-btn,
.favorite-masonry-item:hover .m-fav,
.favorite-masonry-item:focus-within .favorite-overlay-btn,
.favorite-masonry-item:focus-within .m-fav,
.favorite-masonry-item:hover .favorite-masonry-name,
.favorite-masonry-item:focus-within .favorite-masonry-name {
  opacity: 1;
  transform: none;
}

.favorite-overlay-btn:hover {
  background: rgba(0,0,0,.38);
}

.favorite-masonry-name {
  max-width: none;
}

.favorite-masonry-file {
  font-size: 12px;
  font-weight: 500;
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-masonry-set {
  margin-top: 3px;
  font-size: 11px;
  color: rgba(255,255,255,.82);
}

.favorites-empty {
  padding: 28px;
  border: 1px dashed #d7ddea;
  border-radius: 16px;
  color: var(--muted);
}

.favorite-note-modal {
  position: fixed;
  inset: 0;
  z-index: 1250;
}

.favorite-note-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14,18,33,0.4);
}

.favorite-note-card {
  position: relative;
  width: min(760px, calc(100vw - 32px));
  margin: 10vh auto 0;
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(21, 26, 46, 0.28);
}

.favorite-note-card--read {
  width: min(560px, calc(100vw - 32px));
}

.favorite-note-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  align-items: stretch;
}

.favorite-note-preview-wrap {
  height: 160px;
  border: 1px solid #dbe3f0;
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.favorite-note-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.favorite-note-input {
  width: 100%;
  height: 160px;
  min-height: 160px;
  resize: none;
  margin-top: 0;
}

.favorite-note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 720px) {
  .favorite-note-card {
    width: min(460px, calc(100vw - 32px));
  }
  .favorite-note-layout {
    grid-template-columns: 1fr;
  }
  .favorite-note-preview-wrap {
    height: 140px;
  }
}

.favorite-comment-body {
  margin-top: 14px;
  padding: 14px;
  background: #f7f9fd;
  border-radius: 12px;
  white-space: pre-wrap;
  color: var(--text);
}

.activity-table .favorites-comment-btn,
.favorites-comment-btn {
  border: 0;
  background: transparent;
  color: #111827 !important;
  cursor: pointer;
  padding: 0;
  text-align: left;
  max-width: 280px;
  font: inherit;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: none;
  min-width: 0;
  justify-content: flex-start;
}

.activity-table .favorites-comment-btn:hover,
.activity-table .favorites-comment-btn:focus,
.favorites-comment-btn:hover,
.favorites-comment-btn:focus {
  color: #111827 !important;
  text-decoration: underline;
  outline: none;
  background: transparent;
  transform: none;
  box-shadow: none;
}

.favorites-comment-empty {
  color: var(--muted);
}

.favorites-email-card {
  max-width: 420px;
}

@media (max-width: 900px) {
  .favorites-summary {
    padding-left: 36px;
    flex-direction: column;
  }
}
