.fav-batch { margin: 14px 0 4px; padding: 12px 0; border-top: 1px solid var(--line); }
.fav-batch-heading, .fav-batch-selection { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.fav-batch-selection { margin: 12px 0; }
.fav-batch-selection .link-btn { margin-left: 0; }
.fav-batch-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 12px; }
.fav-batch-copy label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; cursor: pointer; }
.fav-batch-copy input { accent-color: var(--ink); }
.fav-print-sheet { display: none; }
@page favorite-citations { margin: 17mm; }
@media print {
  body:has(> .fav-print-sheet) {
    display: block; height: auto; min-height: 0; margin: 0; overflow: visible; background: white; color: #191919;
  }
  body:has(> .fav-print-sheet) > :not(.fav-print-sheet) { display: none !important; }
  .fav-print-sheet { display: block; page: favorite-citations; font: 10pt/1.55 'Noto Sans SC', sans-serif; overflow-wrap: anywhere; }
  .fav-print-sheet header { padding-bottom: 3mm; border-bottom: 1pt solid #555; margin-bottom: 5mm; }
  .fav-print-sheet h1, .fav-print-sheet h2, .citation-line b { font-family: 'Noto Serif SC', serif; }
  .fav-print-sheet h1 { margin: 0; font-size: 20pt; line-height: 1.35; }
  .fav-print-sheet h2 { margin: 0; font-size: 14pt; line-height: 1.45; }
  .fav-print-sheet p { margin: 1mm 0 0; }
  .fav-print-sheet section + section { margin-top: 5mm; }
  .citation-book { break-inside: avoid; break-after: avoid; }
  .fav-print-sheet header p, .citation-book p, .citation-line span { font-size: 9pt; color: #444; }
  .fav-print-sheet ul { list-style: none; margin: 0; padding: 0; }
  .fav-print-sheet li { padding: 2.5mm 0; border-bottom: .5pt solid #ccc; break-inside: avoid; }
  .citation-line { display: flex; gap: 2mm; align-items: baseline; }
  .citation-line b { min-width: 0; font-size: 11.5pt; }
  .citation-line span { flex: none; }
  .citation-page { margin-inline-start: auto; }
  .citation-note { white-space: pre-wrap; }
  .citation-url { display: block; margin-top: 1mm; color: #555; font-size: 8pt; text-decoration: none; }
}
.fav-batch textarea[readonly] { box-sizing: border-box; width: 100%; margin: 0 0 12px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: inherit; resize: vertical; }
.fav-batch-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.fav-batch-form .form-field { flex: 1 1 145px; min-width: 0; }
.fav-batch-form input, .fav-batch-form select { width: 100%; min-width: 0; }
.fav-batch-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.fav-batch-mobile-actions { display: none; }
.fav-batch [data-batch-undo] { margin-top: 6px; }
.fav-batch .form-status:empty { display: none; }
.fav-batch .form-status { display: block; margin: 8px 0 0; }
.fav-batch-errors { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--body); }
.fav-batch-row { display: flex; align-items: center; gap: 4px; }
.fav-batch-row > input { flex: 0 0 18px; width: 18px; height: 18px; margin: 12px 8px; accent-color: var(--ink); cursor: pointer; }
.fav-batch-row > .row { flex: 1; min-width: 0; }
.fav-tag-filter-actions { flex-wrap: wrap; }
.fav-tag-dialog {
  box-sizing: border-box; width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  padding: 20px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--ink);
}
.fav-tag-dialog::backdrop { background: #0006; }
.fav-tag-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.fav-tag-dialog-head h2 { margin: 0; font: 700 22px/1.4 var(--hero-font); }
.fav-tag-dialog form { display: grid; gap: 12px; }
.fav-tag-dialog button:disabled { opacity: .55; cursor: default; }
.fav-tag-impact {
  margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--quote); color: var(--body); font-size: 14px; line-height: 1.65; overflow-wrap: anywhere;
}
@media (min-width: 760px) {
  .results-head:has(.fav-cats) { max-height: 65%; overflow-y: auto; }
}
@media (max-width: 759px) {
  .results-list:has(.fav-batch.is-selecting) { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .results-list:has(.fav-batch.is-selecting) .fav-row-tags { display: none; }
  .fav-batch-row:has(input:checked) { background: var(--quote); }
  .fav-batch.is-selecting .fav-batch-panel { display: none; }
  .fav-batch.is-selecting .fav-batch-mobile-actions {
    display: block; position: fixed; z-index: 8; inset-inline: 0; bottom: 0;
    width: 100%; min-height: calc(48px + env(safe-area-inset-bottom));
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    border: 0; border-top: 1px solid var(--line); background: var(--dark); color: #fff;
    font: inherit; font-weight: 600; cursor: pointer;
  }
  .fav-batch.is-selecting.actions-open .fav-batch-panel {
    display: block; position: fixed; z-index: 8; inset-inline: 0; bottom: calc(48px + env(safe-area-inset-bottom));
    max-height: 52vh; max-height: 52dvh; overflow-y: auto; overscroll-behavior: contain;
    padding: 12px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
    border-top: 1px solid var(--line); background: var(--panel); box-shadow: 0 -4px 16px rgb(0 0 0 / 8%);
  }
  .fav-batch.is-selecting .fav-batch-selection { margin-top: 0; }
}
