/* Capture overlay for the interactive prototype. Imported catalog styles remain untouched. */
/* Button look: ../Дизайн-система/controls.css (.ds-icon-btn / .capture-primary / .capture-secondary / .capture-text). */
.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.topbar-actions .header-search-wrap {
  width: 320px;
  min-width: 320px;
  flex: 0 0 320px;
}

.topbar-actions .search { width: 100%; }

.capture-choice:focus-visible,
.capture-result:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}



.capture-head-actions,
.catalog-head-actions,
.history-head-actions,
.capture-action-row,
.capture-nav-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-head-actions,
.history-head-actions { justify-content: flex-end; }

.capture-focus-menu { position: relative; }
.capture-focus-menu summary { list-style: none; }
.capture-focus-menu summary::-webkit-details-marker { display: none; }
.capture-focus-menu[open] .capture-menu-list,
.capture-book-more[open] .capture-menu-list { display: grid; }
.capture-book-more { position: relative; align-self: flex-start; }
.capture-book-more > summary { list-style: none; cursor: pointer; }
.capture-book-more > summary::-webkit-details-marker { display: none; }
.capture-menu-list {
  position: absolute;
  z-index: 8;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  min-width: 180px;
  padding: 7px;
  border: 0;
  border-radius: var(--radius-field);
  background: var(--surface);
  box-shadow: var(--ui-popup-shadow, var(--shadow-card));
}
.capture-menu-list button { width: 100%; text-align: left; }

.capture-empty-reading {
  min-height: 270px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  text-align: center;
}
.capture-empty-reading h2 { margin: 0 0 8px; color: var(--ink); font-size: var(--type-panel-size); line-height: var(--type-panel-line); }
.capture-empty-reading p { max-width: 430px; margin: 0 0 18px; color: var(--muted); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.capture-empty-reading.is-add-placeholder {
  place-content: stretch;
  justify-items: stretch;
  padding: 0;
  text-align: left;
}
.capture-empty-add-card {
  display: grid;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}
.capture-empty-cover {
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px dashed color-mix(in srgb, var(--ink, #111) 22%, transparent);
  background: color-mix(in srgb, var(--soft, #f4f4f4) 88%, white);
}
.capture-empty-cover span {
  font-size: var(--type-caption-size, 14px);
  line-height: 1.35;
  text-align: center;
}

.book-action-panel {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-field);
  background: var(--soft);
}
.book-action-panel h3 { margin: 0 0 10px; color: var(--ink); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.book-action-primary { width: 100%; }
.book-action-secondary { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }

.book-drawer-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.manual-badge,
.incomplete-impression {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 7px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: var(--type-micro-size); line-height: var(--type-micro-line);
  font-weight: var(--weight-bold);
}
.library-book.is-manual { border-style: dashed; }

.capture-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  background: rgba(20,20,19,.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-screen) var(--motion-ease-out);
}
.capture-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
.capture-backdrop[hidden],
.capture-drawer[hidden] { display: none; }
html.capture-responsive,
html.capture-responsive body {
  min-width: 0;
  overflow: hidden;
  overscroll-behavior: none;
}
@media (max-width: 1199px) {
  html.capture-responsive .capture-backdrop { touch-action: none; }
  /* Capture sheet is above the home dock — hide tabbar so it never peeks through. */
  html.capture-responsive .capture-backdrop {
    z-index: 110;
  }
  html.capture-responsive #capture-drawer {
    z-index: 111;
  }
  html.capture-responsive .home-tabbar {
    visibility: hidden;
    pointer-events: none;
  }
  html.capture-responsive.home-responsive .app-shell,
  html.capture-responsive.home-responsive .main-content,
  html.capture-responsive .app-shell,
  html.capture-responsive .main-content,
  html.capture-responsive .app-shell:has(#moment-view.is-active) {
    overflow: hidden;
    overscroll-behavior: none;
  }
}

.capture-drawer {
  position: fixed;
  z-index: 81;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(660px, 100vw);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-left: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow-raised);
}

.capture-drawer-head {
  padding: 21px 24px 17px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
}
.capture-drawer-kicker { color: var(--quiet); font-size: var(--type-micro-size); line-height: var(--type-micro-line); font-weight: var(--weight-bold); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.capture-drawer-head h1,
.capture-drawer-head #capture-title {
  margin: 6px 0 4px;
  color: var(--ink);
  font-family: var(--font-head);
  font-size: var(--type-panel-size);
  line-height: var(--type-panel-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-panel);
}
.capture-drawer-head p { margin: 0; color: var(--muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.capture-drawer-close { align-self: start; }

.capture-progress {
  grid-column: 1 / -1;
  display: flex;
  gap: 5px;
  margin-top: 2px;
}
.capture-progress span { height: 3px; flex: 1; border-radius: var(--radius-pill); background: var(--line); }
.capture-progress span.is-complete { background: var(--ink); }

.capture-drawer-body { min-height: 0; overflow-y: auto; padding: 22px 24px 30px; }
.capture-drawer-footer {
  min-height: 70px;
  padding: 14px 24px;
  border-top: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}
.capture-drawer-footer > div { display: flex; align-items: center; gap: 8px; }

.capture-intro { max-width: 500px; margin-bottom: 20px; }
.capture-intro h3 { margin: 0 0 8px; color: var(--ink); font-size: var(--type-section-size); line-height: var(--type-section-line); }
.capture-intro p { margin: 0; color: var(--muted); font-size: var(--type-body-size); line-height: var(--type-body-line); }

.capture-choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.capture-choice {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.capture-choice:hover { border-color: var(--ink); background: var(--soft); }
.capture-choice strong { display: block; color: var(--ink); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.capture-choice span { display: block; margin-top: 7px; color: var(--muted); font-size: var(--type-micro-size); line-height: var(--type-micro-line); }

.capture-field { display: grid; gap: 7px; margin-bottom: 16px; }
.capture-field > span,
.capture-field legend { color: var(--quiet); font-size: var(--type-micro-size); line-height: var(--type-micro-line); font-weight: var(--weight-bold); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.capture-field input,
.capture-field textarea,
.capture-field select {
  width: 100%;
  
  
  
  
  
  
  
   
  
}
.capture-field textarea {  resize: vertical;  }


.capture-field-hint { color: var(--muted); font-size: var(--type-micro-size); line-height: var(--type-micro-line); }
.capture-field-error { min-height: 16px; color: var(--color-text-secondary); font-size: var(--type-micro-size); line-height: var(--type-micro-line); }

.capture-search-results { display: grid; gap: 7px; margin-top: 16px; }
.capture-result {
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.capture-result:hover { border-color: var(--ink); background: var(--soft); }
.capture-result strong { display: block; color: var(--ink); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.capture-result span { display: block; margin-top: 4px; color: var(--muted); font-size: var(--type-micro-size); line-height: var(--type-micro-line); }
.capture-result-status { white-space: nowrap; }

.capture-manual-card,
.capture-book-summary,
.capture-success,
.capture-preview {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-field);
  background: var(--soft);
}
.capture-manual-card { margin-top: 14px; }
.capture-book-summary { margin-bottom: 20px; display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: center; }
.capture-book-mark { width: 46px; height: 62px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--quiet); font-size: var(--type-micro-size); text-align: center; }
.capture-book-summary strong { display: block; color: var(--ink); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.capture-book-summary span { display: block; margin-top: 4px; color: var(--muted); font-size: var(--type-micro-size); line-height: var(--type-micro-line); }

.capture-rating {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 4px;
}
.capture-rating button {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--type-caption-size); line-height: var(--type-caption-line);
  cursor: pointer;
}
.capture-rating button.is-selected { border-color: var(--ink); background: var(--ink); color: var(--color-surface); }

.capture-edition { margin: 5px 0 18px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.capture-edition summary { color: var(--text); font-size: var(--type-micro-size); line-height: var(--type-micro-line); font-weight: var(--weight-bold); cursor: pointer; }
.capture-edition-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }

.capture-question-index { color: var(--quiet); font-size: var(--type-micro-size); line-height: var(--type-micro-line); font-weight: var(--weight-bold); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.capture-question { margin: 9px 0 18px; color: var(--ink); font-size: var(--type-panel-size); line-height: var(--type-panel-line); }
.capture-question-note { margin: -7px 0 18px; color: var(--muted); font-size: var(--type-micro-size); line-height: var(--type-micro-line); }

.capture-preview { display: grid; gap: 13px; }
.capture-preview .capture-field { margin: 0; }
.capture-preview textarea { min-height: 82px; background: var(--surface); }

.capture-success { text-align: center; padding: 34px 24px; }
.capture-success-mark { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: var(--radius-round); background: var(--ink); color: var(--color-surface); display: grid; place-items: center; font-size: var(--type-panel-size); }
.capture-success h3 { margin: 0 0 8px; color: var(--ink); font-size: var(--type-section-size); line-height: var(--type-section-line); }
.capture-success p { max-width: 430px; margin: 0 auto; color: var(--muted); font-size: var(--type-body-size); line-height: var(--type-body-line); }

.global-search-manual {
  margin-top: 10px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-field);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.global-search-manual strong { display: block; color: var(--ink); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.global-search-manual span { display: block; margin-top: 4px; color: var(--muted); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.search-result-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.search-result-row .search-result { width: 100%; }
.search-quick-action { min-height: 34px; padding: 6px 9px; font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.global-search-results .q-result { width: 100%; }
.global-search-results .q-result + .q-result { margin-top: 8px; }
.capture-result.q-result,
.capture-result.q-result:hover {
  border: 0;
  border-color: transparent;
}
.global-search-empty { display: grid; gap: 5px; padding: 18px 14px 14px; text-align: center; }
.global-search-empty strong { color: var(--color-text); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.global-search-empty span { color: var(--color-text-secondary); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.global-search-add { width: 100%; margin-top: 8px; }

/* look: controls.css Text Button (.capture-reset) */

@media (max-width: 900px) {
  .topbar-actions .header-search-wrap { min-width: 220px; width: 220px; flex-basis: 220px; }
  .catalog-head,
  .history-head,
  .author-detail-head { align-items: flex-start; gap: 12px; }
}

@media (max-width: 600px) {
  .topbar-actions { gap: 6px; }
  .capture-drawer { width: 100vw; border-left: 0; }
  .capture-drawer-head { padding: 16px 16px 13px; }
  .capture-drawer-body { padding: 18px 16px 24px; }
  .capture-drawer-footer { padding: 12px 16px; }
  .capture-choice-grid { grid-template-columns: 1fr; }
  .capture-choice { min-height: 96px; }
  .capture-rating { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .capture-edition-grid { grid-template-columns: 1fr; }
  .capture-question { font-size: var(--type-section-size); line-height: var(--type-section-line); }
  .capture-drawer-footer { align-items: stretch; }
  .capture-drawer-footer > div { justify-content: flex-end; }
  .global-search-manual { align-items: flex-start; flex-direction: column; }
}

/* Compact search-first capture. */
#capture-drawer .capture-progress[hidden] { display: none; }
#capture-drawer { width: min(620px, 100vw); }
#capture-body { overflow-y: auto; }
.q-input { width: 100%;   box-sizing: border-box;        }

.q-field { display: grid; gap: 5px; margin: 10px 0; }
.q-field > span, .q-search-label { font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--muted); }
.q-search-label { display: block; margin-bottom: 8px; }
.q-hint, .q-result small { font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--muted); }
.q-result { width: 100%; text-align: left; margin: 6px 0; }
.q-result > span:first-child { display: grid; gap: 4px; }
.q-result strong { font-size: var(--type-body-size); line-height: var(--type-body-line); }
#q-results > button:not(.q-result) { margin: 12px 8px 0 0; }
.q-card-head { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 20px; align-items: start; }
.q-cover { aspect-ratio: 2 / 3; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; place-items: center; overflow: hidden; margin-top: 28px; }
.q-cover img { width: 100%; height: 100%; object-fit: contain; }
.q-card-fields { min-width: 0; }
.q-card-fields small { font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--muted); }
.q-personal { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; }
.q-personal h3 { margin: 0 0 12px; font-size: var(--type-body-size); line-height: var(--type-body-line); font-weight: var(--weight-semibold); }
.q-statuses { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.q-statuses .is-selected { color: var(--surface); background: var(--ink); border-color: var(--ink); }
.q-statuses details { font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.q-status-chip {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  min-height: var(--control-height, 36px);
  padding: 6px 14px;
  border: 0;
  border-radius: var(--radius-pill, 999px);
  background: var(--color-surface, #fff);
  color: var(--muted, var(--color-text-secondary));
  box-shadow: var(--shadow-selected);
  font: inherit;
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  font-weight: var(--weight-regular, 400);
  white-space: nowrap;
  cursor: pointer;
}
.q-status-chip:hover:not(.is-selected) {
  color: var(--ink, var(--color-text));
  box-shadow: var(--shadow-card);
}
.q-status-chip.is-selected,
.q-status-chip[aria-pressed="true"] {
  background: var(--ink, #151515);
  color: var(--color-surface, #fff);
  box-shadow: none;
}
.q-details { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.q-details summary { cursor: pointer; font-size: var(--type-body-size); line-height: var(--type-body-line); }
.q-related { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.q-error { color: var(--color-text-secondary); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.q-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 130; max-width: calc(100vw - 48px); box-sizing: border-box; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 18px; border: 1px solid var(--line-strong); border-radius: var(--radius-layer); background: var(--surface); box-shadow: var(--shadow-card); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.q-toast[role="alertdialog"] {
  top: 50%;
  bottom: auto;
  width: min(430px, calc(100vw - 48px));
  max-width: min(430px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 16px;
  padding: 20px;
  transform: translate(-50%, -50%);
}
.q-toast[role="alertdialog"] > span {
  display: block;
  width: 100%;
}
.q-toast[role="alertdialog"] > button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

.q-finish-dialog {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--color-backdrop, rgba(0, 0, 0, 0.25));
}
html:has(#q-discard-dialog:not([hidden])) #capture-drawer,
html:has(#q-discard-dialog:not([hidden])) .capture-backdrop {
  pointer-events: none;
}
html.q-discard-open .capture-backdrop.is-open {
  opacity: 0;
  pointer-events: none;
}
.q-finish-dialog[hidden] { display: none; }
.q-finish-dialog-card {
  width: min(420px, 100%);
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-layer);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  color: var(--color-text);
}
.q-finish-dialog-card h2 {
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-size: var(--type-panel-size);
  line-height: var(--type-panel-line);
  font-weight: var(--weight-medium);
}
.q-finish-dialog-card p {
  margin: 0 0 20px;
  color: var(--color-text-secondary);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}
.q-finish-dialog-actions {
  display: grid;
  gap: 8px;
}
.q-finish-dialog-actions .capture-primary,
.q-finish-dialog-actions .capture-secondary,
.q-finish-dialog-actions .ds-btn-surface {
  width: 100%;
  justify-content: center;
}
.q-finish-dialog-actions .ds-btn-surface {
  border: 0;
  outline: none;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-selected);
}
.q-finish-dialog-actions .ds-btn-surface:hover:not(:disabled),
.q-finish-dialog-actions .ds-btn-surface:focus-visible {
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-control-hover, var(--shadow-selected));
  outline: none;
}
.q-related-links { display: grid; gap: 8px; }
#capture-footer { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
#capture-footer > .capture-primary {
  min-height: 48px;
  height: auto;
  padding: 14px 28px;
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-semibold, 600);
}
#capture-footer .capture-primary.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#capture-footer .q-save-spinner.loading-mark {
  width: 16px;
  height: 16px;
  border-width: 2px;
  flex: none;
}
@media (max-width: 600px) { .q-card-head { grid-template-columns: 64px minmax(0, 1fr); gap: 12px; } }

/* Side panel on desktop. On tablet and phone, a bottom sheet. The phone sheet
   and any expanded tablet sheet use the screen height minus 6px. The idle
   tablet chooser stays at its content height.
   Motion matches home sheet / search sheet: var(--motion-screen) var(--motion-ease-out). */
#capture-drawer.q-modal {
  top: 0; bottom: 0; right: 0; left: auto;
  width: min(920px, 100vw); height: 100dvh; max-height: 100dvh;
  border: 0; border-left: 1px solid var(--line); border-radius: 0; overflow: hidden;
  box-shadow: var(--shadow-raised);
  background: var(--color-surface, #fff);
  transform: translateX(100%);
  transition: transform var(--motion-screen) var(--motion-ease-out);
  will-change: transform;
}
#capture-drawer.q-modal.is-open {
  transform: translateX(0);
}
@media (max-width: 1199px) {
  #capture-drawer.q-modal {
    left: 0; right: 0; top: auto;
    bottom: var(--sheet-bottom, 0px);
    width: 100vw; max-width: none;
    height: auto;
    max-height: calc(var(--sheet-height, 100dvh) - 6px);
    display: flex;
    flex-direction: column;
    border-left: 0;
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.1);
    transform: translateY(100%);
  }
  #capture-drawer.q-modal > .capture-drawer-head,
  #capture-drawer.q-modal > .capture-drawer-footer {
    flex: 0 0 auto;
  }
  #capture-drawer.q-modal > .capture-drawer-body {
    flex: 0 1 auto;
    min-height: 0;
  }
  #capture-drawer.q-modal.is-open {
    transform: translateY(0);
  }
  #capture-drawer.q-chooser-mode .q-sheet-scroll:has(.q-add-other:not([hidden])) {
    padding-bottom: 100px;
  }
  /* Two sheet heights only: initial chooser baseline, or full max. */
  #capture-drawer.q-modal.q-sheet-initial {
    height: var(--capture-sheet-initial, auto);
    min-height: var(--capture-sheet-initial, 0);
  }
  #capture-drawer.q-modal.q-sheet-max,
  #capture-drawer.q-modal.q-form-sheet,
  #capture-drawer.q-modal.q-detail-loading {
    top: max(env(safe-area-inset-top), var(--sheet-top, 6px));
    bottom: var(--sheet-bottom, 0px);
    height: auto;
    max-height: none;
  }
  #capture-drawer.q-modal.q-sheet-max > .capture-drawer-body,
  #capture-drawer.q-modal.q-form-sheet > .capture-drawer-body,
  #capture-drawer.q-modal.q-detail-loading > .capture-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
  }
}
.q-modal .capture-drawer-head { padding: 24px 28px 12px; border-bottom: 0; background: transparent; }
.q-modal.q-chooser-mode .capture-drawer-head { padding-bottom: 0; }
.q-modal .capture-drawer-body { padding: 0 28px 24px; }
.q-modal .capture-drawer-footer { padding: 16px 28px; border-top: 0; background: transparent; }
.q-modal.q-search-mode .capture-drawer-footer,
.q-modal.q-chooser-mode .capture-drawer-footer { display: none; }
.q-modal.q-search-mode .capture-drawer-body,
.q-modal.q-chooser-mode .capture-drawer-body:has(.q-search-row) {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
  min-height: 0;
}
.q-modal.q-chooser-mode .capture-drawer-body > .q-sheet-scroll,
.q-modal.q-search-mode .capture-drawer-body > .q-sheet-scroll,
.q-modal.q-chooser-mode .capture-drawer-body > #q-results,
.q-modal.q-search-mode .capture-drawer-body > #q-results {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.q-modal.q-chooser-mode .capture-drawer-body > .q-search-row,
.q-modal.q-search-mode .capture-drawer-body > .q-search-row {
  flex-shrink: 0;
  margin-top: 0;
  order: -1;
  z-index: 2;
  background: var(--color-surface, #fff);
  padding-top: 0;
  padding-bottom: 8px;
  will-change: transform;
}
html.keyboard-open .q-modal.q-chooser-mode .capture-drawer-body > .q-search-row,
html.keyboard-open .q-modal.q-search-mode .capture-drawer-body > .q-search-row {
  margin-top: auto;
  order: 0;
  position: relative;
  bottom: auto;
  padding-top: 8px;
  padding-bottom: 8px;
}
.q-modal.q-chooser-mode .capture-drawer-body:has(.q-search-row),
.q-modal.q-search-mode .capture-drawer-body {
  padding-top: 10px;
  padding-bottom: 0;
}

/* Entity kind tabs use Nav tab canon (.q-book-tabs / .q-book-tab); placed in head via q-tabs-in-head. */
.q-entity-tabs {
  margin: 0;
}
/* Way cards: same gray as the manual entity tiles below. */
.q-add-ways {
  --q-add-way-bg: var(--color-background, #f5f5f5);
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 14px 0 8px;
}
.q-add-ways[hidden],
.q-add-other[hidden] {
  display: none !important;
}
.q-add-way {
  --q-add-way-inset: 16px;
  --q-add-way-art-size: calc(88px - 2 * var(--q-add-way-inset));
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 88px;
  padding: var(--q-add-way-inset);
  border: 0;
  border-radius: 24px;
  background: var(--q-add-way-bg);
  color: var(--color-text, #111);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.q-add-way:hover:not(:disabled):not(.is-disabled) {
  background: color-mix(in srgb, var(--q-add-way-bg) 88%, var(--ink, #111));
}
.q-add-way:disabled,
.q-add-way.is-disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.q-add-way-copy {
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  align-content: center;
}
.q-add-way-copy strong {
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-bold, 700);
}
.q-add-way-copy > span {
  color: var(--color-text-secondary, #666);
  font-size: var(--type-caption-size, 12px);
  line-height: 1.4;
}
.q-add-way-art {
  flex: 0 0 var(--q-add-way-art-size);
  box-sizing: border-box;
  width: var(--q-add-way-art-size);
  height: var(--q-add-way-art-size);
  margin: 0;
  margin-left: auto;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.q-add-way-art-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
}
/* Phone: 2×2 text tiles, no illustrations. */
@media (max-width: 767px) {
  .q-add-ways {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .q-add-way {
    min-height: 0;
    align-items: flex-start;
  }
  .q-add-way-art {
    display: none;
  }
}
@media (min-width: 768px) {
  .q-add-ways {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1200px) {
  .q-add-way {
    min-height: 100px;
    --q-add-way-art-size: calc(100px - 2 * var(--q-add-way-inset));
  }
}
.q-transfer-sources {
  display: grid;
  gap: 0;
  margin: 0 0 16px;
}
.q-transfer-source {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center;
  column-gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--color-border, #f0f0f0);
  border-radius: 0;
  background: transparent;
  color: var(--color-text, #111);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.q-transfer-source:last-child {
  border-bottom: 0;
}
.q-transfer-source:hover:not(:disabled):not(.is-disabled) {
  background: transparent;
}
.q-transfer-source:disabled,
.q-transfer-source.is-disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}
.q-transfer-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-round, 999px);
  background: var(--color-background, #f5f5f5);
  color: var(--ink, #111);
  font-size: var(--type-caption-size, 12px);
  line-height: 1;
  font-weight: var(--weight-bold, 700);
}
.q-transfer-mark.is-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.q-transfer-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.q-transfer-copy strong {
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-semibold, 600);
}
.q-transfer-copy > span {
  color: var(--color-text-secondary, #666);
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
}
.q-transfer-chevron {
  width: 18px;
  height: 18px;
  color: var(--muted, var(--color-text-secondary));
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.q-transfer-hero {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  width: 100%;
  margin-top: 8px;
  padding: 16px;
  border: 0;
  border-radius: 20px;
  background: var(--home-reads-collection-bg, #ecf3f9);
  color: var(--color-text, #111);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.q-transfer-hero:hover:not(:disabled):not(.is-disabled) {
  background: color-mix(in srgb, var(--home-reads-collection-bg, #ecf3f9) 88%, var(--ink, #111));
}
.q-transfer-hero:disabled,
.q-transfer-hero.is-disabled {
  opacity: 0.65;
  cursor: default;
  pointer-events: none;
}
.q-transfer-hero-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-round, 999px);
  background: var(--color-surface, #fff);
  color: var(--ink, #111);
}
.q-transfer-hero-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.q-interest-section {
  margin: 0 0 22px;
}
.q-interest-heading {
  margin: 0 0 10px;
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  font-weight: var(--weight-semibold, 600);
  color: var(--muted, var(--color-text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.q-interest-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.q-interest-status {
  display: flex;
  width: 100%;
  max-width: 100%;
}
.q-interest-status .ds-segment-bar-item {
  flex: 1 1 0;
}
.q-interest-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 10px;
}
@media (min-width: 768px) {
  .q-interest-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 12px;
  }
}
@media (min-width: 1200px) {
  .q-interest-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
.q-interest-card {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.q-interest-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-background, #f5f5f5);
}
.q-interest-cover-img,
.q-interest-cover-empty {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.q-interest-cover-empty {
  background: linear-gradient(160deg, #d7dde5, #b7c0cc);
}
.q-interest-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-round, 999px);
  border: 1.5px solid rgba(17, 17, 17, 0.28);
  background: rgba(255, 255, 255, 0.92);
  color: transparent;
}
.q-interest-check svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: none;
}
.q-interest-card.is-selected .q-interest-check {
  border-color: var(--ink, #111);
  background: var(--ink, #111);
  color: #fff;
}
.q-interest-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.q-interest-meta strong {
  font-size: var(--type-caption-size, 12px);
  line-height: 1.25;
  font-weight: var(--weight-semibold, 600);
  overflow-wrap: anywhere;
}
.q-interest-meta > span {
  color: var(--color-text-secondary, #666);
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.q-add-other {
  margin-top: 8px;
}
.q-add-other-title {
  margin: 0 0 10px;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--weight-semibold, 600);
  color: var(--muted, var(--color-text-secondary));
  text-transform: none;
  letter-spacing: 0;
}
.q-add-other-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.q-add-other-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 14px;
  border: 0;
  border-radius: 18px;
  background: var(--color-background, #f5f5f5);
  color: var(--color-text, #111);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.q-add-other-row:hover {
  background: color-mix(in srgb, var(--color-background, #f5f5f5) 88%, var(--ink, #111));
}
.q-add-other-icon {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  color: var(--color-text-secondary, #666);
}
.q-add-other-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}
.q-add-other-label {
  min-width: 0;
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  font-weight: var(--weight-medium, 500);
  overflow-wrap: anywhere;
}
@media (max-width: 420px) {
  .q-add-other-row {
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    min-height: 64px;
    padding: 10px 6px;
    text-align: center;
  }
}
.q-add-photo-pick {
  width: 100%;
  margin-top: 4px;
}
.q-add-methods {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px;
}
.q-add-methods.is-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.q-add-method {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto;
  column-gap: 8px; row-gap: 12px; align-items: start;
  min-height: 132px; padding: 18px 16px; border: 1px solid var(--color-border, var(--line));
  border-radius: var(--radius-layer); background: var(--color-surface, #fff);
  text-align: left; cursor: pointer; color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.q-add-method:hover {
  border-color: color-mix(in srgb, var(--ink, #111) 16%, var(--color-border, var(--line)));
  box-shadow: var(--shadow-card);
}
.q-add-method-icon {
  grid-column: 1; grid-row: 1; width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: var(--radius-round); background: var(--color-background, #f5f5f5); color: var(--ink);
}
.q-add-method-icon svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.q-add-method-copy {
  grid-column: 1; grid-row: 2; display: grid; gap: 4px; min-width: 0; align-content: start;
}
.q-add-method-copy strong {
  font-size: var(--type-body-size); line-height: var(--type-body-line); font-weight: var(--weight-semibold);
}
.q-add-method-copy > span {
  color: var(--muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line);
}
.q-add-method-chevron {
  grid-column: 2; grid-row: 1 / span 2; align-self: center;
  width: 18px; height: 18px; color: var(--muted);
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.q-add-methods-stack { display: grid; gap: 12px; }
.q-add-methods-stack .q-add-method {
  display: flex; flex-direction: row; align-items: center; gap: 14px;
  min-height: 72px; padding: 14px 16px; width: 100%;
}
.q-add-methods-stack .q-add-method-copy { flex: 1; min-width: 0; }
.q-add-methods-stack .q-add-method-chevron { flex: none; }

.q-find-section { margin-top: 18px; }
.q-find-section h3 {
  margin: 0 0 10px; font-size: var(--type-caption-size); line-height: var(--type-caption-line);
  font-weight: var(--weight-semibold); color: var(--muted); text-transform: none; letter-spacing: 0;
}
.q-find-row {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 72px; padding: 10px 12px; border: 0; border-radius: var(--radius-field);
  background: var(--surface); box-shadow: var(--shadow-card); text-align: left; cursor: pointer; color: inherit;
}
.q-find-row + .q-find-row { margin-top: 8px; }
.q-file-batch { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 16px; }
.q-file-batch > li { display: grid; gap: 8px; }
.q-file-batch .capture-secondary { justify-self: start; }
.q-find-cover {
  width: 48px; height: 68px; border-radius: 6px; object-fit: cover; background: var(--color-background);
}
.q-find-cover.is-empty { display: grid; place-items: center; color: var(--color-text-secondary, var(--muted)); background: var(--color-background, #f5f5f5); }
.q-find-cover.is-empty svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: none;
}
.q-find-copy { min-width: 0; display: grid; gap: 2px; }
.q-find-copy strong { font-size: var(--type-body-size); line-height: var(--type-body-line); overflow-wrap: anywhere; }
.q-find-copy span { color: var(--muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.q-find-open {
  flex: none; min-height: 36px; padding: 6px 14px; border-radius: var(--radius-pill);
  border: 1px solid var(--color-border); background: var(--color-surface); cursor: pointer;
}
.q-find-error {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 28px 16px 12px;
  text-align: center;
}
.q-find-error h3 { margin: 0; font-size: var(--type-lead-size); line-height: var(--type-lead-line); }
.q-find-error p { margin: 0; max-width: 28rem; color: var(--muted); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.q-find-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 4px;
}
.q-find-status[data-kind="warning"] { color: var(--muted); }
.q-find-empty {
  display: grid; justify-items: center; gap: 12px; padding: 40px 16px 24px; text-align: center;
}
.q-find-empty-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: var(--color-text-secondary, var(--muted));
}
.q-find-empty-icon svg {
  width: 56px;
  height: 56px;
  fill: currentColor;
  stroke: none;
}
.q-find-empty h3 { margin: 0; font-size: var(--type-lead-size); line-height: var(--type-lead-line); }
.q-find-empty h3 + p { margin-top: -4px; }
.q-find-empty p { margin: 0; max-width: 28rem; color: var(--muted); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.q-find-status { margin: 12px 0 0; color: var(--muted); font-size: var(--type-caption-size); }
.q-find-status[data-kind="error"] { color: var(--color-danger, #b42318); }
#q-results:has(> .q-find-status--solo) {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  min-height: min(42vh, 320px);
}
.q-find-status--solo {
  margin: 0;
  padding: 16px;
  text-align: center;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}
.q-extra-body {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.q-extra-body > .q-field-row,
.q-extra-body > .q-tag-field,
.q-extra-body > .q-field {
  margin: 0;
}
.q-duplicate-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 20px;
}
.q-duplicate-actions .capture-primary,
.q-duplicate-actions .capture-secondary {
  width: 100%;
  justify-content: center;
}
.q-duplicate-actions .capture-secondary {
  background: var(--color-surface, #fff);
  color: var(--color-text, #111);
  box-shadow: var(--shadow-selected, var(--ui-control-shadow));
}
.q-for-me {
  margin-top: 16px; padding: 0; border: 0; display: grid; gap: 12px;
}
.q-for-me-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 767px) {
  .q-add-methods { grid-template-columns: 1fr; }
  .q-add-methods .q-add-method {
    display: flex; flex-direction: row; align-items: center; gap: 14px;
    min-height: 72px; padding: 14px 16px;
  }
  .q-add-methods .q-add-method-copy { flex: 1; min-width: 0; }
  .q-add-methods .q-add-method-chevron { flex: none; }
  .q-for-me-row { grid-template-columns: 1fr; }
  .q-book-create-layout { grid-template-columns: 1fr !important; }
  .q-book-create-layout > aside { max-width: 140px; }
}
.q-search-row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  min-width: 0;
  /* Room for the elevated focus shadow inside drawer overflow. */
  padding-block: 10px;
  overflow: visible;
}
/* Capture search: 42px instead of the shared 36px control. */
#capture-drawer .q-capture-search.search {
  --q-capture-search-height: 42px;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: var(--q-capture-search-height);
  min-height: var(--q-capture-search-height);
  max-height: var(--q-capture-search-height);
  overflow: visible;
  background: var(--search-soft-background, var(--color-background, #F5F5F5));
  color: var(--ink, var(--color-text));
  box-shadow: none;
}
#capture-drawer .q-capture-search.search:hover {
  background: var(--search-soft-hover, #EEEEEE);
  color: var(--ink, var(--color-text));
  box-shadow: none;
}
#capture-drawer .q-capture-search.search:focus-within {
  background: var(--search-soft-focus, var(--color-surface, #fff));
  color: var(--ink, var(--color-text));
  outline: none;
  box-shadow: var(--search-soft-focus-shadow, 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05));
}
#capture-drawer .q-capture-search .header-search-input,
#capture-drawer .q-capture-search .header-search-input:focus,
#capture-drawer .q-capture-search .header-search-input:focus-visible {
  appearance: none;
  -webkit-appearance: none;
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  color: var(--ink, var(--color-text));
  line-height: var(--type-body-line, 20px);
}
#capture-drawer .q-capture-search .header-search-input::placeholder {
  color: var(--color-text-secondary);
  opacity: 1;
}
/* Same phone size as #search-view: 16px so iOS does not zoom the focused field. */
@media (max-width: 767px) {
  #capture-drawer .q-capture-search .header-search-input {
    font-size: 16px;
    line-height: 22px;
  }
}
#q-search::-webkit-search-decoration,
#q-search::-webkit-search-cancel-button,
#q-search::-webkit-search-results-button,
#q-search::-webkit-search-results-decoration { display: none; -webkit-appearance: none; }
.q-search-icon {
  position: static; flex: 0 0 18px; width: 18px; height: 18px; color: var(--color-icon-muted, var(--muted));
  pointer-events: none;
}
.q-search-clear {
  position: static; flex: 0 0 24px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 0;
  background: transparent; color: var(--ink, var(--color-text, #111)); cursor: pointer; box-shadow: none;
}
.q-search-clear:hover,
.q-search-clear:focus-visible {
  background: transparent;
  color: var(--ink, var(--color-text, #111));
  box-shadow: none;
}
#capture-drawer .q-search-clear,
#capture-drawer .header-search-clear {
  color: var(--ink, var(--color-text, #111));
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}
#capture-drawer .q-search-clear svg,
#capture-drawer .header-search-clear svg {
  width: 16px;
  height: 16px;
  color: inherit;
  fill: currentColor;
  stroke: none;
}
.q-search-tools {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 0 0 auto;
  min-width: 0;
}
.q-search-tools button {
  flex: 0 0 auto;
  white-space: nowrap;
}
.q-search-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; flex-shrink: 0; }
.q-search-actions[hidden],
.q-search-clear[hidden] {
  display: none !important;
}
.q-search-actions button {      white-space: nowrap;    }

 .q-search-clear:focus-visible { outline: var(--focus-ring); outline-offset: 2px; }
.q-search-mode #q-results { overflow-y: auto; min-height: 0; margin-top: 10px; }
.q-search-mode #q-results:empty { margin-top: 0; }
.q-result { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 16px; min-height: 88px; padding: 14px 16px; border: 0; border-radius: var(--radius-field); background: var(--surface); box-shadow: var(--shadow-card); transition: background-color var(--motion-fast), box-shadow var(--motion-fast); }
.q-result:hover { background: var(--color-surface); box-shadow: var(--shadow-raised); }
.q-result .q-result-icon { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; background: var(--color-background); color: var(--color-text-secondary); }
.q-result .q-result-icon svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.q-result .q-result-copy { min-width: 0; display: grid; gap: 4px; margin: 0; }
.q-result .q-result-author { font-size: var(--type-caption-size); line-height: var(--type-caption-line); color: var(--muted); margin: 0; }
.q-result .q-result-copy strong { font-size: var(--type-lead-size); line-height: var(--type-lead-line); font-weight: var(--weight-semibold); overflow-wrap: anywhere; }
.q-result .q-result-badge { justify-self: end; white-space: nowrap; margin: 0; padding: 7px 12px; border-radius: var(--radius-pill); background: var(--color-background); color: var(--color-text-secondary); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.q-result .q-result-badge.is-read { background: var(--color-background); color: var(--color-text-secondary); }
.q-result .q-result-badge.is-wanted { background: var(--color-background); color: var(--color-text-secondary); }
@media (max-width: 600px) {
  #capture-drawer.q-modal { width: 100vw; border-left: 0; }
  .q-modal .capture-drawer-head { padding: 18px 16px 12px; }
  .q-modal.q-chooser-mode .capture-drawer-head { padding-bottom: 0; }
  .q-modal .capture-drawer-body { padding: 0 16px 16px; }
  .q-modal.q-chooser-mode .capture-drawer-body,
  .q-modal.q-search-mode .capture-drawer-body { padding-top: 10px; padding-inline: 16px; padding-bottom: 0; }
  .q-search-row { flex-wrap: wrap; }
  .q-capture-search { flex: 1 1 100%; }
  .q-add-way { min-height: 0; padding: 14px; }
  .q-search-tools { flex: 1 1 auto; flex-wrap: wrap; }
  .q-search-actions { grid-template-columns: 1fr; gap: 6px; }
  .q-result { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; min-height: 76px; padding: 12px; }
  .q-result .q-result-icon { width: 48px; height: 48px; }
  .q-result .q-result-icon svg { width: 24px; height: 24px; }
  .q-result .q-result-copy strong { font-size: var(--type-body-size); line-height: var(--type-body-line); }
}

@media (prefers-reduced-motion: reduce) {
  .capture-backdrop,
  #capture-drawer.q-modal {
    transition: none;
  }
}

.q-modal .capture-drawer-close {
  border-color: var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
}
/* Center the glyph: compact rules set inline-flex without alignment. */
#capture-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#capture-close > svg {
  display: block;
  margin: 0;
}

/* Manual capture uses the same full-height drawer and type scale. */
.q-modal .capture-drawer-head > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}
.q-modal .q-manual-back {
  display: inline-flex;
  width: fit-content;
  margin: 0 0 12px;
}
.q-modal.q-edit-compact .q-manual-back { margin: 0; }
.q-modal .capture-drawer-kicker { display: block; }
.q-modal.q-edit-compact .capture-drawer-kicker,
.q-modal.q-edit-compact #capture-title,
.q-modal.q-edit-compact #capture-subtitle,
.q-modal.q-edit-compact .capture-drawer-close { display: none; }
.q-modal.q-edit-compact .capture-drawer-head:has(.q-manual-back) { padding-bottom: 12px; }
.q-modal .capture-drawer-head:has(.q-manual-back) { padding-bottom: 18px; }
.q-modal.q-edit-compact .capture-drawer-head:has(.q-manual-back) h1,
.q-modal.q-edit-compact .capture-drawer-head:has(.q-manual-back) #capture-title { margin: 0; }
.q-modal .q-error:empty { display: none; }
/* Тип объекта: пилюли-переключатели, не Secondary и не underline-табы */
.q-manual-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.q-manual-tabs .ds-pill { min-width: 88px; }
.q-personal .is-selected,
.q-review-form .q-statuses .is-selected {
  background: var(--ink);
  color: var(--color-surface);
  border-color: var(--ink);
  box-shadow: none;
}
/* Capture book/author tabs → Nav tab canon in controls.css */
.q-book-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin: 0 0 14px;
  border: 0;
  background: transparent;
}
.q-book-tabs .q-book-tab {
  font-size: 20px;
  line-height: 28px;
}
#capture-drawer.q-modal.q-tabs-in-head .q-manual-back {
  display: none !important;
}
#capture-drawer.q-modal.q-tabs-in-head .capture-drawer-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  padding-bottom: 12px;
}
#capture-drawer.q-modal.q-tabs-in-head .capture-drawer-head > div {
  display: none;
}
#capture-drawer.q-modal.q-tabs-in-head .capture-drawer-head > .q-book-tabs {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 20px;
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#capture-drawer.q-modal.q-tabs-in-head .capture-drawer-head > .q-book-tabs::-webkit-scrollbar {
  display: none;
}
#capture-drawer.q-modal.q-tabs-in-head .capture-drawer-close {
  display: inline-flex !important;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}
#capture-drawer.q-modal.q-tabs-in-head .capture-progress {
  display: none;
}
@media (max-width: 767px) {
  #capture-drawer.q-modal.q-tabs-in-head .capture-drawer-head > .q-book-tabs {
    gap: 14px;
  }
  #capture-drawer.q-modal.q-tabs-in-head .capture-drawer-head > .q-book-tabs .q-book-tab {
    font-size: 17px;
    line-height: 24px;
  }
}
.q-book-card {
  padding: 24px;
  border-radius: var(--radius-layer);
  background: var(--color-surface);
}
.q-book-card:not(.q-author-card):not(.q-series-card):not(.q-collection-card) {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.q-book-layout {
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 28px;
}
.q-book-copy {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}
.q-book-copy > .q-field {
  margin: 0;
  gap: 5px;
}
.q-book-desc-surface {
  min-width: 0;
}
.q-book-desc-surface > .q-field,
.q-book-desc-surface > .q-field-row,
.q-book-desc-surface > .q-tag-field,
.q-book-desc-surface > .q-book-tags-block {
  margin: 0;
}
.q-book-tags-block {
  display: grid;
  gap: 12px;
  margin-top: 8px;
  padding: 16px;
  border-radius: var(--radius-layer, 16px);
  background: var(--color-background, #f5f5f5);
}
.q-book-tags-heading {
  margin: 0;
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-bold, 700);
}
.q-book-tags-hint {
  margin: 0;
}
.q-book-tags-block > .q-tag-field {
  margin: 0;
}
.q-book-identity .q-field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-bottom: 0;
}
.q-book-identity .q-field-row .q-field { margin: 0; }
.q-book-identity .q-field-row--meta {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr);
  align-items: end;
}
.q-book-identity .q-field-row--translation {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
}
.q-book-identity .q-field-row--translation:not(:has(.q-check)) {
  grid-template-columns: minmax(0, 1fr);
}
.q-field.q-check {
  display: grid;
  gap: 5px;
  align-content: end;
}
.q-field.q-check .q-check-spacer {
  display: block;
  min-height: 1em;
  line-height: var(--type-caption-line, 1.2);
  font-size: var(--type-caption-size, 12px);
  visibility: hidden;
}
.q-field.q-check .q-check-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-height, 36px);
  color: var(--ink, #151515);
  font: inherit;
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  cursor: pointer;
}
.q-field.q-check .q-check-line input {
  margin: 0;
  flex: none;
}
.q-book-review {
  min-width: 0;
  max-width: 100%;
}
.q-review-form {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
}
.q-review-form > .q-review-surface {
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
}
.q-review-form .q-statuses,
.q-review-surface .q-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-items: stretch;
  box-sizing: border-box;
}
.q-review-form .q-statuses .q-status-chip,
.q-review-surface .q-statuses .q-status-chip {
  flex: 1 1 8rem;
  min-width: 0;
  padding-inline: 8px;
}
/* Content under status tabs — gray surface; controls stay white + DS shadow */
.q-review-surface {
  display: grid;
  gap: 18px;
  padding: 16px;
  border-radius: var(--radius-field, 12px);
  background: var(--soft, var(--color-background, #F5F5F5));
}
.q-review-form > .q-review-surface:first-child .q-field > span,
.q-review-form > .q-review-surface:first-child .q-review-copy > span {
  color: var(--ink, var(--color-text));
  font-size: calc(var(--type-caption-size, 12px) + 2px);
  line-height: 1.35;
}
.q-review-surface .q-review-fields {
  display: contents;
}
/* статусы отзыва = Secondary Button, без ужатия */
.q-review-fields {
  display: grid;
  gap: 18px;
}
.q-review-fields > .q-field,
.q-review-scales > .q-field,
.q-date-row .q-field,
.q-date-pair .q-field,
.q-date-rating-row > .q-field {
  margin: 0;
  gap: 5px;
}
.q-date-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  max-width: 50%;
}
.q-date-rating-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px 28px;
  width: 100%;
}
.q-date-pair {
  display: flex;
  flex-wrap: nowrap;
  align-items: end;
  gap: 8px;
  flex: 0 0 auto;
}
.q-date-pair .q-date-field {
  flex: 0 0 auto;
  width: max-content;
}
.q-date-rating-row > .q-field {
  flex: 0 1 auto;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  max-width: 100%;
}
.q-date-field .q-date-input,
.q-date-field .q-date-input--display {
  box-sizing: border-box;
  width: calc(10ch + 24px);
  min-width: calc(10ch + 24px);
  max-width: calc(10ch + 24px);
  min-height: var(--control-height);
  padding-inline: 12px;
  text-align: center;
}
.q-date-field input.q-date-input[type="hidden"],
.q-date-field input.flatpickr-input:not(.q-date-input--display) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* Flatpickr · white surface + DS shadow, small radius.
   Keep calendar width/padding aligned with Flatpickr’s fixed day grid
   (307.875px) — extra padding wraps days into “hanging” numbers. */
.flatpickr-calendar {
  width: 307.875px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm, 8px);
  background: var(--color-surface, #fff);
  box-shadow: var(--shadow-raised, 0 6px 20px rgba(0, 0, 0, 0.10));
  font-family: inherit;
  overflow: hidden;
}
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after,
.flatpickr-calendar.arrowBottom:before,
.flatpickr-calendar.arrowBottom:after {
  display: none;
}
.flatpickr-months {
  align-items: center;
  padding: 12px 8px 4px;
}
.flatpickr-months .flatpickr-month {
  height: 44px;
  overflow: visible;
  background: transparent;
  color: var(--ink, #151515);
}
.flatpickr-current-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  /* Leave room for prev/next arrows on both sides */
  width: calc(100% - 72px);
  left: 36px;
  padding-top: 4px;
  font-size: 15px;
  font-weight: 600;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
  margin: 0;
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-xs, 4px);
  background: var(--color-surface, #fff);
  box-shadow: var(--shadow-selected, 0 1px 4px rgba(0, 0, 0, 0.08));
  color: var(--ink, #151515);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}
.flatpickr-current-month .numInputWrapper {
  width: auto;
  min-width: 4.5em;
}
.flatpickr-current-month .flatpickr-monthDropdown-months:hover,
.flatpickr-current-month input.cur-year:hover,
.flatpickr-current-month .flatpickr-monthDropdown-months:focus,
.flatpickr-current-month input.cur-year:focus {
  background: var(--color-surface, #fff);
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
  top: 14px;
  z-index: 2;
  height: 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  fill: var(--ink, #151515);
  color: var(--ink, #151515);
  border-radius: var(--radius-xs, 4px);
  padding: 0;
}
.flatpickr-months .flatpickr-prev-month {
  left: 4px;
}
.flatpickr-months .flatpickr-next-month {
  right: 4px;
}
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
  background: var(--soft, #f5f5f5);
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg {
  width: 14px;
  height: 14px;
}
.flatpickr-innerContainer {
  padding: 0 0 10px;
}
.flatpickr-weekdays {
  height: 28px;
  background: transparent;
}
span.flatpickr-weekday {
  color: var(--muted, #666);
  font-weight: 500;
  font-size: 12px;
}
.flatpickr-days {
  width: 307.875px;
}
.dayContainer {
  width: 307.875px;
  min-width: 307.875px;
  max-width: 307.875px;
}
.flatpickr-day {
  border-radius: 50%;
  border: 0;
  color: var(--ink, #151515);
  max-width: 39px;
  height: 39px;
  line-height: 39px;
}
.flatpickr-day:hover,
.flatpickr-day:focus,
.flatpickr-day.inRange,
.flatpickr-day.prevMonthDay:hover,
.flatpickr-day.nextMonthDay:hover,
.flatpickr-day.today:hover,
.flatpickr-day:focus:not(.selected) {
  background: var(--soft, #f5f5f5);
  border-color: transparent;
  border-radius: 50%;
  color: var(--ink, #151515);
}
.flatpickr-day.today {
  border: 0;
  background: transparent;
  font-weight: 600;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  background: var(--ink, #151515);
  border-color: transparent;
  border-radius: 50%;
  color: #fff;
  box-shadow: var(--shadow-selected, 0 1px 4px rgba(0, 0, 0, 0.08));
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
  color: var(--quiet, #999);
}
.flatpickr-day.flatpickr-disabled:hover {
  background: transparent;
  color: var(--quiet, #999);
}
.numInputWrapper:hover,
.numInputWrapper:focus-within {
  background: transparent;
}
.numInputWrapper span {
  border: 0;
  border-radius: 2px;
}
.numInputWrapper span:hover {
  background: var(--soft, #f5f5f5);
}
.q-rating {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
}
.q-rating--compact {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  grid-template-columns: none;
  width: max-content;
  max-width: 100%;
}
.q-choice-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.q-choice-chip {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 7px 12px;
  min-height: 36px;
  width: auto;
  max-width: none;
  border: 0;
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--muted, #666);
  box-shadow: var(--shadow-selected, 0 1px 2px rgba(0,0,0,.08));
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.q-choice-chip.is-selected,
.q-choice-chip[aria-pressed="true"] {
  background: #151515;
  color: #fff;
}
/* Look: Filter · числовой в controls.css (белая · тень · круг). */
.q-scale-icons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
}
.q-scale-icons--spaced {
  gap: 12px;
  flex-wrap: nowrap;
  width: max-content;
  max-width: 100%;
}
.q-scale-icon {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #B0B0B0;
  cursor: pointer;
}
.q-scale-icon:hover {
  color: #888;
}
.q-scale-icon.is-filled {
  color: var(--ink);
}
.q-scale-icon.is-filled:hover {
  color: var(--ink);
}
.q-scale-svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}
.q-scale-svg--stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.q-scale-svg--pepper,
.q-scale-svg--book {
  overflow: visible;
}
.q-scale-svg--book {
  fill: currentColor;
}
.q-review-panel {
  display: grid;
  gap: 18px;
  padding: 0;
  border-radius: 0;
  background: transparent;
}
.q-review-scales {
  display: grid;
  gap: 18px;
}
.q-review-scales .q-tag-field {
  margin: 0;
}
.q-scale-metric {
  display: grid;
  grid-template-columns: minmax(148px, max-content) minmax(0, 1fr);
  gap: 8px 16px;
  align-items: start;
}
.q-scale-metric-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink, #151515);
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  white-space: nowrap;
}
.q-scale-metric-icon {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--ink, #151515);
}
.q-scale-metric-icon .q-scale-svg {
  width: 18px;
  height: 18px;
}
.q-scale-metric .q-choice-wrap,
.q-scale-metric .q-scale-icons {
  align-self: center;
}
.q-tag-field { position: relative; }
.q-tag-control { position: relative; }
.q-tag-box {
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: var(--control-height);
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill, 999px);
  background: var(--color-surface);
  cursor: text;
}
.q-author-card .q-tag-box {
  border-radius: var(--radius-field);
}
.q-author-card .q-tag-menu .books-option.q-tag-option {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  cursor: pointer;
}
.q-author-card .q-tag-menu .books-option.q-tag-option input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
}
.q-author-card .q-tag-menu .books-option.q-tag-option:hover,
.q-author-card .q-tag-menu .books-option.q-tag-option.is-selected {
  background: var(--color-background);
}
.q-author-card .q-tag-menu .books-option.q-tag-option[hidden] {
  display: none;
}
.q-tag-field.is-open .q-tag-box {
  border-color: var(--ink);
}
.q-tag-chips {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  align-items: center;
}
.q-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-background);
  color: var(--ink);
  font: inherit;
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
  cursor: pointer;
}
.q-tag-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.q-tag-chip svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
}
.q-tag-chip:hover {
  border-color: var(--ink);
}
.q-tag-filter {
  flex: 1 1 96px;
  min-width: 72px;
  margin: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  outline: none;
}
.q-tag-filter::-webkit-search-cancel-button { display: none; }
.q-tag-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 6px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  pointer-events: none;
}
.q-tag-field.is-open .q-tag-chevron { transform: rotate(180deg); }
.q-tag-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  box-shadow: var(--shadow-raised, 0 8px 24px rgba(0,0,0,.08));
}
.q-tag-menu[hidden] { display: none; }
.q-tag-option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  text-align: left;
  cursor: pointer;
}
.q-tag-option:hover { background: var(--color-background); }
.q-tag-option.is-selected {
  background: var(--color-background);
  font-weight: var(--weight-semibold);
}
.q-tag-option[hidden] { display: none; }
.q-book-card .q-input,
.q-series-card .q-input {
  /* Softened again after controls.css load — see my-universe post-controls override.
     Primary/Secondary Button остаются pill; .q-icon-btn — круг. */
  border-radius: 8px;
}
.q-book-card .q-manual-image,
.q-series-card .q-manual-image {
  border-radius: 8px;
}
.q-collection-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.q-collection-cover-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 4px;
}
.q-collection-cover-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
/* Match desktop #collections-results .col-card: fixed wide strip, art always present. */
.q-collection-preview.col-card {
  container-type: inline-size;
  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  height: 140px;
  min-height: 140px;
  margin: 0;
  padding: 20px;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
  pointer-events: none;
  cursor: default;
  transform: none;
}
.q-collection-preview.col-card:hover {
  transform: none;
  box-shadow: var(--shadow-card, 0 4px 16px rgba(0, 0, 0, 0.04));
}
.q-collection-preview.col-card--surface {
  --col-tone: var(--color-surface, #fff);
  background: var(--color-surface, #fff);
}
.q-collection-preview.col-card .col-card-body,
.q-collection-preview.col-card.has-illustration .col-card-body {
  position: relative;
  z-index: 1;
  width: 55%;
  max-width: none;
  gap: 6px;
  justify-content: flex-start;
}
.q-collection-preview.col-card .col-card-title {
  font-family: var(--font-head, Georgia, serif);
  font-size: 18px;
  line-height: 1.18;
  overflow-wrap: anywhere;
}
.q-collection-preview.col-card .col-card-count {
  margin-top: 0;
  align-self: flex-start;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted, #5b5b5b);
  font-size: var(--type-body-size, 15px);
  line-height: var(--type-body-line, 1.35);
  font-weight: var(--weight-regular, 400);
  box-shadow: none;
}
.q-collection-preview.col-card--master .col-card-count {
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
}
.q-collection-preview.col-card .col-card-art {
  position: absolute;
  right: 10px;
  bottom: 0;
  top: auto;
  left: auto;
  width: min(43%, 162.5px);
  height: 130px;
  max-height: 130px;
  aspect-ratio: auto;
  transform: none;
  object-fit: contain;
  object-position: bottom right;
  z-index: 0;
  pointer-events: none;
}
.q-collection-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 10px;
  border-radius: 10px 10px 0 0;
  background: var(--color-background, #f4f4f2);
  color: var(--muted, #5b5b5b);
  text-align: center;
  font-size: var(--type-caption-size, 0.875rem);
  line-height: 1.3;
}
.q-collection-preview-empty > span {
  max-width: 9em;
}
@media (max-width: 1199px) {
  .q-collection-preview.col-card { max-width: 100%; }
}
.q-collection-cover-actions {
  margin-top: 0;
}
.q-tone-swatches {
  display: none;
}
.q-collection-readonly {
  margin: 0;
  color: var(--muted, #5b5b5b);
  font-size: var(--type-body-size, 15px);
  line-height: var(--type-body-line, 1.35);
}
.q-book-card textarea.q-input,
.q-series-card textarea.q-input,
#capture-drawer textarea.q-input {
  display: block;
  width: 100%;
  height: auto !important;
  min-height: 110px;
  max-height: none;
  overflow: hidden;
  resize: vertical;
  field-sizing: content;
  line-height: var(--type-body-line);
  white-space: pre-wrap;
  border-radius: 8px;
}
.q-book-extras { margin-top: 20px; }
.q-manual-layout { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 1199px) {
  .q-manual-layout { grid-template-columns: 1fr; }
  .q-manual-layout aside { max-width: 160px; }
}
.q-manual-image { aspect-ratio: 2 / 3; border: 1px solid var(--color-border); border-radius: var(--radius-field); background: var(--color-background); color: var(--color-text-secondary); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; overflow: hidden; font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.q-manual-image svg { width: 44px; height: 44px; }
.q-manual-image img { width: 100%; height: 100%; object-fit: cover; }
.q-cover-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 10px;
  align-items: stretch;
}
.q-cover-actions:not(:has(.q-icon-btn)) { grid-template-columns: 1fr; }
.q-cover-actions .capture-primary {
  width: 100%;
  margin: 0;
  border-radius: var(--radius-pill);
}
/* Secondary Button · круг + иконка (алиас .ds-icon-btn--secondary) */
.q-icon-btn {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  width: var(--control-height-icon, 36px);
  min-width: var(--control-height-icon, 36px);
  max-width: var(--control-height-icon, 36px);
  height: var(--control-height-icon, 36px);
  min-height: var(--control-height-icon, 36px);
  max-height: var(--control-height-icon, 36px);
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-round);
  flex: 0 0 auto;
  overflow: hidden;
}
.q-icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.q-manual-layout aside .capture-secondary { width: 100%; margin-top: 10px; }
.q-manual-layout aside .q-cover-actions .capture-secondary {
  width: auto;
  margin-top: 0;
}
.q-manual-fields { min-width: 0; }
.q-manual-fields > .q-field:first-child { margin-top: 0; }
.q-manual-fields .q-field { margin-bottom: 18px; gap: 7px; }
.q-manual-fields .q-book-copy > .q-field,
.q-manual-fields .q-book-desc-surface > .q-field,
.q-manual-fields .q-book-desc-surface > .q-tag-field,
.q-manual-fields.q-book-review .q-field { margin: 0; gap: 5px; }

.q-manual-fields .q-personal { padding: 0; border: 0; margin: 0 0 22px; }
.q-book-extras .q-personal { padding: 0; border: 0; margin: 0 0 22px; }
.q-manual-fields h3,
.q-book-extras h3 { margin: 0 0 10px; font-size: var(--type-body-size); line-height: var(--type-body-line); font-weight: var(--weight-semibold); }
.q-manual-fields .q-statuses,
.q-book-extras .q-statuses { gap: 6px; }

.q-link-row { display: flex; gap: 7px; margin: 10px 0; align-items: flex-start; }
.q-link-entry { flex: 1; min-width: 0; }
.q-order { width: 54px; flex-shrink: 0; padding: 9px 5px; }
.q-link-row > button { min-height: var(--control-height); }
.q-link-state, .q-suggestions small { color: var(--muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.q-suggestions { display: grid; gap: 4px; }
.q-suggestions button { text-align: left; padding: 8px; border: 1px solid var(--color-border); border-radius: var(--radius-xs); background: var(--color-surface); color: var(--ink); font: inherit; font-size: var(--type-caption-size); line-height: var(--type-caption-line); cursor: pointer; }
.q-suggestions button:hover { background: var(--color-background); }

.q-author-series { display: grid; gap: 12px; }
.q-author-series-panel { min-width: 0; }
.q-series-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.q-series-row {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.q-series-row.is-editing {
  border-bottom-color: transparent;
  padding-bottom: 4px;
}
.q-series-row-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}
.q-series-row-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--control-height);
}
.q-series-row-head strong {
  flex: 1;
  min-width: 0;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--weight-semibold);
}
.q-series-preview-books {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}
.q-series-preview-books li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  color: var(--muted);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
}
.q-series-preview-index {
  flex: 0 0 auto;
  color: var(--quiet, var(--muted));
  font-variant-numeric: tabular-nums;
}
.q-series-preview-title {
  min-width: 0;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.q-series-preview-empty {
  margin: 0;
  color: var(--muted);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
}
.q-author-series .q-icon-btn {
  margin: 0;
}
.q-author-series .q-icon-btn svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}
.q-series-edit svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.q-series-row.is-editing .q-series-edit {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--color-surface);
}
.q-series-group {
  margin: 0 0 8px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-background);
  display: grid;
  gap: 12px;
}
.q-series-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--control-height);
  gap: 8px;
  align-items: end;
}
.q-series-name-field {
  margin: 0;
  gap: 5px;
}
.q-series-title-wrap {
  min-width: 0;
  display: grid;
  align-content: center;
  min-height: var(--control-height);
}
.q-series-label {
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  color: var(--ink);
  font-weight: var(--weight-semibold);
}
.q-series-books {
  display: grid;
  gap: 8px;
}
.q-series-books .q-link-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) var(--control-height);
  gap: 8px;
  margin: 0;
  align-items: start;
}
.q-series-books .q-order {
  width: 100%;
  min-height: var(--control-height);
}
.q-series-books .q-order:disabled {
  opacity: 0.4;
}
.q-series-books .q-link-entry {
  display: grid;
  gap: 4px;
}
.q-series-books .q-link-entry .q-input {
  min-height: var(--control-height);
}
.q-series-add {
  justify-self: start;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
}
.q-related-picks { display: grid; gap: 10px; }
.q-pick-list { display: grid; gap: 8px; }
.q-pick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.q-pick-row span {
  min-width: 0;
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
}
.q-pick-row small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
}
.q-pick-row.is-selected {
  border-color: var(--ink);
  background: var(--color-background);
}
.q-pick-row.is-selected small { color: var(--ink); }
@media (max-width: 1199px) {
  .q-book-layout { grid-template-columns: 1fr; }
  .q-book-layout > aside { max-width: 160px; }
}
@media (max-width: 480px) {
  .q-manual-layout { grid-template-columns: 96px minmax(0, 1fr); gap: 14px; }
  .q-manual-layout aside { max-width: none; }
  .q-book-layout { grid-template-columns: 112px minmax(0, 1fr); gap: 16px; }
  .q-book-layout > aside { max-width: none; }
  .q-manual-tabs .ds-pill { min-width: 72px; }
  .q-book-identity .q-field-row,
  .q-book-identity .q-field-row--meta,
  .q-book-identity .q-field-row--translation { grid-template-columns: 1fr; }
  .q-date-row { grid-template-columns: 1fr; max-width: 50%; }
  .q-date-rating-row {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .q-date-pair {
    width: 100%;
  }
  .q-scale-metric {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .q-book-card:not(.q-author-card):not(.q-series-card):not(.q-collection-card) {
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  .q-book-card.q-author-card,
  .q-book-card.q-series-card,
  .q-book-card.q-collection-card { padding: 16px; }
}
@media (max-width: 360px) {
  .q-manual-layout { grid-template-columns: 1fr; }
  .q-manual-layout aside { width: 120px; }
}

.q-search-actions button.is-selected {
  color: var(--color-text);
  background: #EBEBEB;
  border-color: transparent;
}
.q-search-guidance { margin: 6px 0 18px; color: var(--muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.q-search-guidance span { white-space: nowrap; }
.q-result-group + .q-result-group { margin-top: 22px; }
.q-result-group h3 { margin: 0 0 10px; color: var(--ink); font-size: var(--type-lead-size); line-height: var(--type-lead-line); font-weight: var(--weight-semibold); }
.q-search-mode #q-results:has(.q-search-empty) { flex: 1; display: flex; }
.q-search-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; padding: 32px 24px; border: 1px solid var(--color-border); border-radius: var(--radius-field); background: var(--color-surface); text-align: center; }
.q-empty-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 20px; border-radius: var(--radius-round); background: var(--color-background); color: var(--color-text-secondary, var(--muted)); }
.q-empty-icon svg { width: 28px; height: 28px; fill: currentColor; stroke: none; }
.q-search-empty h3 { margin: 0 0 12px; font-size: var(--type-section-size); line-height: var(--type-section-line); font-weight: var(--weight-semibold); }
.q-search-empty p { margin: 0; max-width: 380px; color: var(--muted); font-size: var(--type-body-size); line-height: var(--type-body-line); }
.q-search-empty .capture-primary,
.q-search-empty .capture-secondary { margin-top: 20px; }
.q-search-empty small { margin-top: 18px; color: var(--muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }
.q-source-note { margin: 20px 0 0; color: var(--muted); font-size: var(--type-caption-size); line-height: var(--type-caption-line); }

.q-posters-field { gap: 8px; }
.q-characters-field { gap: 10px; }
.q-characters-field > .q-posters-rail { margin-bottom: 6px; }
.q-review-block-title,
.q-characters-field > span,
.q-posters-field > span,
.q-recap-field > span,
.q-scale-profile > .q-review-block-title {
  color: var(--ink, var(--color-text));
  font-size: calc(var(--type-caption-size, 12px) + 4px);
  line-height: 1.35;
  font-weight: var(--weight-bold, 700);
  margin-bottom: 8px;
}
.q-scale-profile > .q-review-block-title {
  display: block;
}
.q-character-notes {
  display: grid;
  gap: 8px;
}
.q-character-note-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}
#capture-drawer .q-character-note-row textarea.q-input {
  height: 60px !important;
  min-height: 60px !important;
  max-height: none;
  padding-top: 12px !important;
  padding-bottom: 12px !important;
  overflow: hidden;
  resize: vertical;
  field-sizing: fixed;
}
.q-character-note-add-row {
  display: flex;
  justify-content: center;
  margin: 0 0 10px;
}
.q-character-note-add-spacer {
  display: none;
}
.q-character-notes .q-character-note-add {
  justify-self: center;
  width: 200px;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  margin: 0;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--ink, var(--color-text));
  background: var(--ink, var(--color-text));
  box-shadow: none;
  color: var(--color-surface, #fff);
  font-size: 20px;
  line-height: 1;
}
.q-character-notes .q-character-note-add:hover:not(:disabled),
.q-character-notes .q-character-note-add:focus-visible {
  filter: brightness(1.08);
}
.q-recap-field {
  margin-top: 4px;
}
.q-recap-field textarea.q-input {
  min-height: 7.5rem;
  resize: vertical;
}
.q-posters-rail {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: stretch;
}
.q-poster-tile {
  position: relative;
  flex: 0 0 140px;
  width: 140px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-background);
  border: 1px solid var(--color-border);
}
.q-poster-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.q-poster-tile .q-icon-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: var(--control-height-icon, 36px);
  height: var(--control-height-icon, 36px);
  min-height: var(--control-height-icon, 36px);
  padding: 0;
  border-radius: var(--radius-round);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
}
.capture-secondary.q-poster-add {
  flex: 0 0 140px;
  width: 140px;
  min-height: 105px;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  text-align: center;
  white-space: normal;
  border: 1px solid var(--color-border, #E0E0E0);
  border-style: solid;
  border-radius: var(--radius-field); /* 12px — прямоугольник с мягким скруглением, не pill */
  background: var(--color-surface, #fff);
  box-shadow: none;
  color: var(--muted, var(--color-text-secondary));
}

.q-collection-members-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.q-collection-members-search,
.q-collection-add-search {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.q-collection-members-search .q-capture-search.search,
.q-collection-add-search .q-capture-search.search {
  width: 100%;
  max-width: 100%;
}
.q-collection-add-toggle {
  flex: 0 0 auto;
}
.q-collection-add-toggle.is-selected {
  background: #111;
  color: #fff;
}
.q-collection-add {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}
.q-collection-add-results {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}
.q-collection-add-option {
  display: grid;
  gap: 2px;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--color-background, #f5f5f5);
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.q-collection-add-option:hover,
.q-collection-add-option:focus-visible {
  background: #eee;
  outline: none;
}
.q-collection-add-option strong {
  font-weight: 600;
}
.q-collection-add-option span,
.q-collection-add-empty {
  color: var(--muted);
  font-size: 0.92rem;
}
.q-collection-add-empty {
  margin: 0;
  padding: 4px 2px;
}
.q-collection-member.is-added strong {
  color: var(--color-text, #111);
}
/* Hide native search cancel; we use the shared clear control. */
.q-collection-members-search .header-search-input::-webkit-search-decoration,
.q-collection-members-search .header-search-input::-webkit-search-cancel-button,
.q-collection-members-search .header-search-input::-webkit-search-results-button,
.q-collection-members-search .header-search-input::-webkit-search-results-decoration,
.q-collection-add-search .header-search-input::-webkit-search-decoration,
.q-collection-add-search .header-search-input::-webkit-search-cancel-button,
.q-collection-add-search .header-search-input::-webkit-search-results-button,
.q-collection-add-search .header-search-input::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}
.q-collection-members { padding:16px 0; }
.q-collection-members > p { color:var(--muted); margin:0 0 16px; }
.q-collection-members-list { margin-top:16px; }
.q-collection-member { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:16px 0; border-bottom:1px solid var(--line); }
.q-collection-member[hidden] { display:none; }
.q-collection-member > div { min-width:0; overflow-wrap:anywhere; }
.q-collection-member p { color:var(--muted); margin:4px 0 0; font-size:var(--type-caption-size); }
.q-collection-member > button { flex-shrink:0; }
.q-collection-member.is-removed strong { color:var(--muted); }

/* The collection editor shows its own error and retry; the recovery panel
   remains available after closing it and must not cover the save footer. */
html.capture-responsive:has(#capture-drawer .q-collection-card, #capture-drawer [data-qcollection-tab]) #book-universe-save-status {
  z-index: 79 !important;
}

/* Add-from-catalog: soft gray sheet for list and entity details
   (author / series / collection / book), white plates sit on top. */
#capture-drawer.q-catalog-head,
#capture-drawer.q-catalog-head > .capture-drawer-head,
#capture-drawer.q-catalog-head > .capture-drawer-body,
#capture-drawer.q-catalog-head > .capture-drawer-footer,
#capture-drawer.q-catalog-detail,
#capture-drawer.q-catalog-detail > .capture-drawer-head,
#capture-drawer.q-catalog-detail > .capture-drawer-body,
#capture-drawer.q-catalog-detail > .capture-drawer-footer {
  background: var(--soft, var(--color-background, #F5F5F5));
}
#capture-drawer.q-catalog-head .capture-drawer-head {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: 0;
}
#capture-drawer.q-catalog-head .capture-drawer-head > div {
  width: 100%;
  max-width: none;
}
#capture-drawer.q-catalog-head.q-catalog-detail .capture-drawer-head {
  padding-bottom: 8px;
}
#capture-drawer.q-catalog-head.q-catalog-detail .q-manual-back {
  margin-bottom: 4px;
}
#capture-drawer.q-catalog-head.q-catalog-detail #capture-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: var(--type-display-size);
  line-height: var(--type-display-line);
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
}
#capture-drawer.q-catalog-head.q-catalog-detail #capture-subtitle.q-catalog-detail-subtitle {
  margin: 6px 0 0;
  color: var(--muted, var(--color-text-secondary));
  font-family: var(--font-body);
  font-size: var(--type-body-size);
  line-height: var(--type-body-line);
  font-weight: var(--weight-regular);
  overflow-wrap: anywhere;
}
@media (max-width: 767px) {
  #capture-drawer.q-catalog-head.q-catalog-detail #capture-title {
    font-size: var(--type-panel-size);
    line-height: var(--type-panel-line);
  }
}
#capture-drawer.q-catalog-head .q-manual-back {
  max-width: calc(100% - 48px);
}
#capture-drawer.q-catalog-head #capture-close {
  position: absolute;
  top: 24px;
  right: 28px;
  z-index: 3;
  background: #fff;
  border-color: transparent;
  box-shadow: none;
}
#capture-drawer.q-catalog-head .q-catalog-head-tools {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  margin-bottom: 12px;
}
#capture-drawer.q-catalog-head .q-catalog-section-tabs {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 20px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#capture-drawer.q-catalog-head .q-catalog-section-tabs.library-tabs {
  display: flex;
}
#capture-drawer.q-catalog-head .q-catalog-section-tabs::-webkit-scrollbar {
  display: none;
}
#capture-drawer.q-catalog-head .q-catalog-section-tabs .library-tab {
  flex: 0 0 auto;
  padding: 0 0 6px;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary, #666);
  font-family: var(--font-head);
  font-size: 24px;
  line-height: 32px;
  font-weight: var(--weight-regular, 400);
  letter-spacing: var(--tracking-page, 0);
  text-decoration: none;
  box-shadow: none;
  cursor: pointer;
  white-space: nowrap;
}
#capture-drawer.q-catalog-head .q-catalog-section-tabs .library-tab[aria-current="page"] {
  color: var(--color-text, #111);
  font-weight: var(--weight-bold, 700);
}
#capture-drawer.q-catalog-head .q-catalog-search.library-search,
#capture-drawer.q-catalog-head .q-catalog-search.books-tab-search,
#capture-drawer.q-catalog-head .q-catalog-search,
#capture-drawer.q-catalog-head .q-catalog-search.ds-field {
  display: flex !important;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  order: 0;
  width: 220px;
  max-width: min(220px, 38vw);
  min-width: 140px;
  height: 36px;
  margin: 0 0 0 auto !important;
  margin-inline-start: auto !important;
  padding: 0 12px 0 14px;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-pill);
  background: #fff !important;
  background-color: #fff !important;
  box-shadow: var(--shadow-selected, 0 1px 4px rgba(0, 0, 0, 0.08));
}
#capture-drawer.q-catalog-head .q-catalog-search > svg.rm-icon,
#capture-drawer.q-catalog-head .q-catalog-search > span > svg.rm-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: var(--color-text, #111);
}
#capture-drawer.q-catalog-head .q-catalog-search input,
#capture-drawer.q-catalog-head .q-catalog-search .books-tab-search-input {
  display: block;
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: none;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  opacity: 1;
  pointer-events: auto;
  background: transparent;
  color: var(--color-text, #111);
  font: var(--type-body-size) / var(--type-body-line) var(--font-body);
  box-shadow: none;
}
#capture-drawer.q-catalog-head .q-catalog-search input::-webkit-search-decoration,
#capture-drawer.q-catalog-head .q-catalog-search input::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}
#capture-drawer.q-catalog-head .q-catalog-search .q-catalog-search-clear,
#capture-drawer .q-catalog-borrow-host .q-public-catalog-toolbar .q-catalog-search-clear,
#capture-drawer .q-catalog-borrow-host .catalog-status-bar .q-catalog-search-clear {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin: 0;
  color: var(--color-text, #111);
}
#capture-drawer.q-catalog-head .q-catalog-search .q-catalog-search-clear svg,
#capture-drawer .q-catalog-borrow-host .q-public-catalog-toolbar .q-catalog-search-clear svg,
#capture-drawer .q-catalog-borrow-host .catalog-status-bar .q-catalog-search-clear svg {
  width: 16px;
  height: 16px;
  color: inherit;
  fill: currentColor;
  stroke: none;
}
#capture-drawer.q-catalog-head .q-catalog-search .q-catalog-search-clear[hidden],
#capture-drawer .q-catalog-borrow-host .q-public-catalog-toolbar .q-catalog-search-clear[hidden],
#capture-drawer .q-catalog-borrow-host .catalog-status-bar .q-catalog-search-clear[hidden] {
  display: none !important;
}
#capture-drawer.q-catalog-head .q-catalog-search:focus-within {
  box-shadow: var(--input-focus-ring);
}
@media (max-width: 1199px) {
  #capture-drawer.q-catalog-head #capture-close {
    top: 18px;
    right: 16px;
  }
}
@media (max-width: 767px) {
  #capture-drawer.q-catalog-head .q-catalog-head-tools {
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
  }
  #capture-drawer.q-catalog-head .q-catalog-section-tabs {
    gap: 14px;
    order: 0;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }
  #capture-drawer.q-catalog-head .q-catalog-section-tabs .library-tab {
    font-size: 20px;
    line-height: 28px;
  }
  /* Search lives in .q-public-catalog-toolbar on the left (see placePublicCatalogSearch). */
  #capture-drawer .q-catalog-borrow-host .catalog-status-bar > .q-catalog-search,
  #capture-drawer .q-catalog-borrow-host .catalog-status-bar > #q-catalog-head-search,
  #capture-drawer .q-catalog-borrow-host .q-public-catalog-toolbar > .q-catalog-search,
  #capture-drawer .q-catalog-borrow-host .q-public-catalog-toolbar > #q-catalog-head-search,
  #capture-drawer .q-catalog-borrow-host .authors-filters > .q-catalog-search,
  #capture-drawer .q-catalog-borrow-host .series-filters > .q-catalog-search {
    display: flex !important;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    order: -1;
    width: auto;
    max-width: none;
    min-width: 0;
    height: 36px;
    margin: 0 !important;
    margin-inline-start: 0 !important;
    padding: 0 12px 0 14px;
    overflow: hidden;
    border: 0;
    border-radius: var(--radius-pill);
    background: #fff !important;
    background-color: #fff !important;
    box-shadow: var(--shadow-selected, 0 1px 4px rgba(0, 0, 0, 0.08));
  }
  #capture-drawer .q-catalog-borrow-host .catalog-status-bar > .q-catalog-search input,
  #capture-drawer .q-catalog-borrow-host .catalog-status-bar > #q-catalog-head-search input,
  #capture-drawer .q-catalog-borrow-host .q-public-catalog-toolbar > .q-catalog-search input,
  #capture-drawer .q-catalog-borrow-host .q-public-catalog-toolbar > #q-catalog-head-search input,
  #capture-drawer .q-catalog-borrow-host .authors-filters > .q-catalog-search input,
  #capture-drawer .q-catalog-borrow-host .series-filters > .q-catalog-search input {
    display: block;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: 36px;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
  }
  #capture-drawer .q-catalog-borrow-host #q-catalog-genre-rail {
    display: none !important;
  }
}

#capture-drawer .q-catalog-borrow-host {
  min-width: 0;
  min-height: 0;
}
#capture-drawer .q-catalog-borrow-host > .screen-view,
#capture-drawer .q-catalog-borrow-host > [id$="-view"] {
  display: block;
  min-width: 0;
}
#capture-drawer .q-catalog-borrow-host :is(h1) {
  display: none;
}
#capture-drawer .q-catalog-borrow-host .library-search:not(.q-catalog-search),
#capture-drawer .q-catalog-borrow-host .books-tab-search:not(.q-catalog-search) {
  display: none !important;
}
#capture-drawer .q-catalog-borrow-host #library-statuses,
#capture-drawer .q-catalog-borrow-host #authors-statuses,
#capture-drawer .q-catalog-borrow-host .series-heading,
#capture-drawer .q-catalog-borrow-host .series-statuses,
#capture-drawer .q-catalog-borrow-host #series-count {
  display: none !important;
}
#capture-drawer .q-catalog-borrow-host .collections-statuses .books-chip[data-value="personal"] {
  display: none !important;
}
#capture-drawer .q-catalog-borrow-host .col-card--master,
#capture-drawer .q-catalog-borrow-host .col-card[data-master="1"] {
  display: none !important;
}
/* Match Authors: 8px from head to first chrome row on every tab. */
#capture-drawer .q-catalog-borrow-host :is(.books-shell, .authors-shell, .series-shell, .collections-shell) {
  padding-top: 8px;
}
#capture-drawer .q-catalog-borrow-host :is(.books-header, .authors-header, .series-header, .collections-header) {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0;
}
#capture-drawer .q-catalog-borrow-host :is(.books-heading, .authors-heading, .series-heading, .collections-heading) {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0;
  gap: 0;
}
#capture-drawer .q-catalog-borrow-host :is(.books-statuses, .authors-statuses, .series-statuses, .collections-statuses) {
  margin-top: 0 !important;
}
#capture-drawer .q-catalog-borrow-host .catalog-status-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  min-width: 0;
}
/* Facets live in «Все фильтры»; hide open facet row on every breakpoint (same gap as tablet). */
#capture-drawer .q-catalog-borrow-host :is(.books-filters, .authors-filters, .series-filters) {
  display: none !important;
}
#capture-drawer .q-catalog-borrow-host :is(.books-selection, .authors-selection, .series-selection) {
  margin-bottom: 14px;
}
#capture-drawer .q-catalog-borrow-host #q-catalog-genre-rail {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  margin-inline: 0;
  padding-inline: 0;
  width: auto;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scroll-padding-inline-start: 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#capture-drawer .q-catalog-borrow-host #q-catalog-genre-rail::-webkit-scrollbar {
  display: none;
}
#capture-drawer .q-catalog-borrow-host #q-catalog-genre-rail .books-chip {
  flex: 0 0 auto;
}
#capture-drawer .q-catalog-borrow-host .catalog-status-bar .books-sort-wrap,
#capture-drawer .q-catalog-borrow-host .catalog-status-bar .authors-sort-wrap,
#capture-drawer .q-catalog-borrow-host .catalog-status-bar .series-sort-wrap,
#capture-drawer .q-catalog-borrow-host .catalog-status-bar #library-all-filters,
#capture-drawer .q-catalog-borrow-host .catalog-status-bar #authors-all-filters,
#capture-drawer .q-catalog-borrow-host .catalog-status-bar #series-all-filters {
  flex: 0 0 auto;
}
#capture-drawer .q-catalog-borrow-host .catalog-toolbar-tools--tablet .library-tabs {
  display: none;
}

#capture-drawer .q-catalog-borrow-host .library-card-menu-toggle,
#capture-drawer .q-catalog-borrow-host .medium-card .cover > .status,
#capture-drawer .q-catalog-borrow-host .medium-card .ds-new-badge,
#capture-drawer .q-catalog-borrow-host .reader-library-badge {
  display: none !important;
}
/* Personal-only author chrome stays hidden; public GR/tags match the library card. */
#capture-drawer .q-catalog-borrow-host .ds-author-card--portrait .ds-author-card-score--rating,
#capture-drawer .q-catalog-borrow-host .ds-author-card--portrait .ds-author-card-score--spicy,
#capture-drawer .q-catalog-borrow-host .ds-author-card--portrait .ds-author-card-footer,
#capture-drawer .q-catalog-borrow-host .ds-author-card--portrait .authors-evidence {
  display: none !important;
}
#capture-drawer .q-catalog-borrow-host .ser-progress,
#capture-drawer .q-catalog-borrow-host .ser-overview-status {
  display: none !important;
}

#capture-drawer .q-catalog-pick {
  position: relative;
}
/* Selection is the check only — no card outline. */
#capture-drawer .q-catalog-pick.is-selected,
#capture-drawer .medium-card.q-catalog-pick.is-selected,
#capture-drawer .medium-card.q-catalog-pick.is-selected:has(.card-open:hover:not(:disabled)) {
  outline: none;
  box-shadow: var(--shadow-card, 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05));
}
#capture-drawer .q-catalog-select {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--color-text);
  color: var(--color-surface);
  box-shadow: none;
  cursor: pointer;
}
#capture-drawer .q-catalog-select .rm-icon,
#capture-drawer .q-catalog-select svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
  paint-order: stroke fill;
}
/* Newly selected: black circle, white check. */
#capture-drawer .q-catalog-pick.is-selected:not(.is-locked) .q-catalog-select,
#capture-drawer .q-catalog-select[aria-pressed="true"]:not(:disabled):not([aria-disabled="true"]) {
  border: 0;
  background: var(--ink, #111);
  color: #fff;
}
/* Already in library: gray circle, black check (unchanged). */
#capture-drawer .q-catalog-select:disabled,
#capture-drawer .q-catalog-pick.is-locked .q-catalog-select,
#capture-drawer .q-catalog-select[aria-disabled="true"] {
  cursor: default;
  opacity: 1;
  border: 0;
  background: #e5e5e5;
  color: #555;
}
#capture-drawer .medium-card.q-catalog-pick > .q-catalog-select {
  top: 8px;
  right: 8px;
}
/* Collections in the sheet: same 2-up rhythm as catalog ≤1100px (drawer is never full desktop width). */
#capture-drawer .q-catalog-borrow-host .col-results {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 720px) {
  #capture-drawer .q-catalog-borrow-host .col-results {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (min-width: 768px) {
  #capture-drawer .q-catalog-borrow-host .catalog-toolbar-tools--tablet {
    display: flex;
  }
  /* Add-from-catalog: five book cards across on tablet + desktop. */
  #capture-drawer .q-catalog-borrow-host .books-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px 12px;
  }
  /* Check circle on tablet/desktop book grid; series/collection stay 28px. */
  #capture-drawer .q-catalog-select {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
  }
  #capture-drawer .q-catalog-select .rm-icon,
  #capture-drawer .q-catalog-select svg {
    width: 17px;
    height: 17px;
  }
  #capture-drawer .q-public-series-card .ser-world-preview-title-row > .q-catalog-select,
  #capture-drawer .q-public-collection-card > .q-catalog-select {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    max-width: 28px;
    max-height: 28px;
  }
  #capture-drawer .q-public-series-card .ser-world-preview-title-row > .q-catalog-select .rm-icon,
  #capture-drawer .q-public-series-card .ser-world-preview-title-row > .q-catalog-select svg,
  #capture-drawer .q-public-collection-card > .q-catalog-select .rm-icon,
  #capture-drawer .q-public-collection-card > .q-catalog-select svg {
    width: 14px;
    height: 14px;
  }
}

.q-progress-form {
  display: grid;
  gap: 16px;
}

.q-progress-period,
.q-progress-metrics,
.q-progress-diary {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-field, 12px);
  background: var(--soft, var(--color-background, #F5F5F5));
}

.q-progress-metrics {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.q-progress-metric {
  display: grid;
  gap: 2px;
}

.q-progress-metric strong {
  font-size: var(--type-title-size, 20px);
  line-height: 1.2;
  font-weight: var(--weight-semibold, 600);
}

.q-progress-metric span {
  color: var(--ds-color-text-secondary);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
}

.q-progress-diary {
  gap: 12px;
}

.q-progress-diary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.q-progress-day-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.q-progress-day {
  margin: 0;
}

.q-progress-day-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}

.q-progress-day-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.q-progress-day-copy strong {
  font-weight: var(--weight-semibold, 600);
}

.q-progress-day-copy span {
  color: var(--ds-color-text-secondary);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-line);
}

.q-progress-day-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}
