/* Shared interactive controls. Edit here — design-system page and prototype both load this file. */
/* Tokens: typography.css + color aliases --ink/--muted/--line/--surface/--soft. */

:root {
  --ds-control-radius-pill: var(--radius-pill);
  --ds-control-radius-field: var(--radius-field);
  --ds-control-radius-segment: var(--radius-field);
  --ds-control-radius-segment-item: var(--radius-sm);
  --ds-control-height: var(--control-height);
  --ds-control-height-sm: var(--control-height-compact);
  --ds-control-height-lg: var(--field-height);
  --ds-icon-size: var(--control-height-icon);
  /* Glyph inside round chrome buttons (⋯ / ✕ / surface icon-btn). */
  --ds-icon-glyph-size: 22px;
  /* Compact round icon: book-card pencil and search-sheet arrows. */
  --ds-icon-size-sm: 28px;
  --ds-icon-glyph-size-sm: 14px;
  --ds-focus-ring: var(--focus-ring);
  --ds-focus-offset: var(--focus-offset);
  --ds-line-strong: var(--color-border);
}

/* —— Base reset for control families —— */
.ds-btn,
.ds-btn-secondary,
.ds-btn-surface,
.ds-btn-text,
.ds-icon-btn,
.ds-pill,
.ds-segment-item,
.ds-search-trigger,
.ds-field,
.ds-search-field,
.start-reading,
.intent-submit,
.capture-trigger,
.capture-primary,
.quiet-action,
.text-action,
.capture-secondary,
.favorites-all,
.filter-reset-link,
.catalog-clear,
.capture-text,
.capture-reset,
.advanced-inline,
.books-clear,
.books-all-filters,
.authors-clear,
.history-back,
.q-manual-back,
.icon-button,
.favorite-toggle,
.drawer-close,
.carousel-arrow,
.filter-chip,
.quick-filter,
.browse-filter,
.intent-option,
.drawer-options button,
.scope-option,
.drawer-segmented button,
.search,
.catalog-search,
.catalog-select {
  box-sizing: border-box;
  font-family: var(--font-body, inherit);
  cursor: pointer;
}

.ds-btn:focus-visible,
.ds-btn-secondary:focus-visible,
.ds-btn-surface:focus-visible,
.ds-btn-text:focus-visible,
.ds-icon-btn:focus-visible,
.ds-pill:focus-visible,
.ds-segment-item:focus-visible,
.ds-search-trigger:focus-visible,
.ds-field:not(select):focus-visible,
.ds-search-field:focus-within,
.start-reading:focus-visible,
.intent-submit:focus-visible,
.capture-trigger:focus-visible,
.capture-primary:focus-visible,
.quiet-action:focus-visible,
.text-action:focus-visible,
.capture-secondary:focus-visible,
.favorites-all:focus-visible,
.filter-reset-link:focus-visible,
.catalog-clear:focus-visible,
.capture-text:focus-visible,
.capture-reset:focus-visible,
.advanced-inline:focus-visible,
.books-clear:focus-visible,
.books-all-filters:focus-visible,
.authors-clear:focus-visible,
.history-back:focus-visible,
.q-manual-back:focus-visible,
.icon-button:focus-visible,
.favorite-toggle:focus-visible,
.drawer-close:focus-visible,
.carousel-arrow:focus-visible,
.filter-chip:focus-visible,
.quick-filter:focus-visible,
.browse-filter:focus-visible,
.intent-option:focus-visible,
.home-favorite-filter:focus-visible,
.drawer-options button:focus-visible,
.books-heat-chip:focus-visible,
.authors-heat-chip:focus-visible,
.q-rating-tab:focus-visible,
.scope-option:focus-visible,
.drawer-segmented button:focus-visible,
.search:focus-visible,
.catalog-search:focus-visible {
  outline: var(--ds-focus-ring);
  outline-offset: var(--ds-focus-offset);
}

.ds-btn:disabled,
.ds-btn-secondary:disabled,
.ds-btn-surface:disabled,
.ds-btn-text:disabled,
.ds-icon-btn:disabled,
.ds-pill:disabled,
.start-reading:disabled,
.intent-submit:disabled,
.quiet-action:disabled,
.text-action:disabled,
.icon-button:disabled,
.books-all-filters:disabled,
.filter-chip:disabled,
.quick-filter:disabled,
.browse-filter:disabled,
.intent-option:disabled {
  opacity: .48;
  cursor: not-allowed;
}

/* —— Primary Button ——
   Канон: заливка ink, hover #303030.
   Формы:
   - pill + текст: padding 8×16, caption, weight 500 (default / --block)
   - круг + иконка: .ds-icon-btn (например «⋯» на карточке книги) */
.ds-btn,
.start-reading,
.intent-submit,
.capture-trigger,
.capture-primary,
.text-action.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: var(--ds-control-height);
  height: auto;
  padding: 8px 16px;
  border: 1px solid var(--ink, var(--color-text));
  border-radius: var(--ds-control-radius-pill);
  background: var(--ink, var(--color-text));
  color: var(--surface, var(--color-surface));
  font-family: var(--font-body, inherit);
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.ds-btn:hover:not(:disabled),
.start-reading:hover:not(:disabled),
.intent-submit:hover:not(:disabled),
.capture-trigger:hover:not(:disabled),
.capture-primary:hover:not(:disabled),
.text-action.primary:hover:not(:disabled) {
  background: #303030;
  border-color: #303030;
  color: var(--surface, var(--color-surface));
  opacity: 1;
}

.ds-btn--block,
.capture-primary.ds-btn--block {
  width: 100%;
}

.ds-btn svg,
.ds-btn-secondary svg,
.start-reading svg,
.capture-primary svg,
.capture-secondary svg,
.quiet-action svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* —— Secondary Button ——
   Те же размеры и формы, что Primary Button.
   Заливка / текст как soft gray (эталон .home-reads-link):
   background --color-background · color --color-text-secondary · без обводки.
   Hover: #EBEBEB · ink. Selected: #EBEBEB · ink (остаётся Secondary, не Primary).
   Формы: pill + текст · круг + иконка (.ds-icon-btn--secondary).
   Размер small (home-reads) — тот же стиль, компактные отступы. */
.ds-btn-secondary,
.quiet-action,
.text-action:not(.primary),
.capture-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: var(--ds-control-height);
  height: auto;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--ds-control-radius-pill);
  background: var(--color-background, var(--soft, #F5F5F5));
  color: var(--color-text-secondary, var(--muted));
  font-family: var(--font-body, inherit);
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.ds-btn-secondary:hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]),
.quiet-action:hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]),
.text-action:not(.primary):hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]),
.capture-secondary:hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]) {
  background: #EBEBEB;
  color: var(--ink, var(--color-text));
  opacity: 1;
}

.ds-btn-secondary.is-selected,
.ds-btn-secondary[aria-pressed="true"],
.quiet-action.is-selected,
.quiet-action[aria-pressed="true"],
.text-action:not(.primary).is-selected,
.text-action:not(.primary)[aria-pressed="true"],
.capture-secondary.is-selected,
.capture-secondary[aria-pressed="true"] {
  background: #EBEBEB;
  color: var(--ink, var(--color-text));
}

.ds-btn-secondary.is-selected:hover:not(:disabled),
.ds-btn-secondary[aria-pressed="true"]:hover:not(:disabled),
.quiet-action.is-selected:hover:not(:disabled),
.quiet-action[aria-pressed="true"]:hover:not(:disabled),
.text-action:not(.primary).is-selected:hover:not(:disabled),
.text-action:not(.primary)[aria-pressed="true"]:hover:not(:disabled),
.capture-secondary.is-selected:hover:not(:disabled),
.capture-secondary[aria-pressed="true"]:hover:not(:disabled) {
  background: #EBEBEB;
  color: var(--ink, var(--color-text));
  opacity: 1;
}

.ds-btn-secondary.ds-btn--block,
.capture-secondary.ds-btn--block {
  width: 100%;
}

/* —— Surface Button ——
   Третий вид кнопки: белая подложка + тень (как белая выпадашка / пилюля на сером).
   Формы: pill + текст · pill + иконка+текст · круг + только иконка (.ds-icon-btn--surface).
   Цвет ink · без обводки · hover — общая мягкая тень без смены фона. Пример круга: «Все фильтры». */
.ds-btn-surface {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: var(--ds-control-height);
  height: auto;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--ds-control-radius-pill);
  background: var(--surface, var(--color-surface, #fff));
  color: var(--ink, var(--color-text));
  box-shadow: var(--shadow-selected);
  font-family: var(--font-body, inherit);
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
}

.ds-btn-surface:hover:not(:disabled) {
  background: var(--color-surface);
  box-shadow: var(--shadow-control-hover);
  color: var(--ink, var(--color-text));
  opacity: 1;
}

.ds-btn-surface.ds-btn--block {
  width: 100%;
}

.ds-btn-surface svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* —— Text Button ——
   Кегль body (на пару пунктов крупнее caption кнопок); жирность 500 как у Primary/Secondary.
   Цвет muted; стрелка — шеврон; gap иконка→текст 2px.
   Hover: только цвет → ink, без подложки и без underline. */
.ds-btn-text,
.favorites-all,
.filter-reset-link,
.catalog-clear,
.capture-text,
.capture-reset,
.books-clear,
.authors-clear,
.history-back,
.q-manual-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  box-sizing: border-box;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted, var(--color-text-secondary));
  font-family: var(--font-body, inherit);
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.ds-btn-text:hover:not(:disabled),
.favorites-all:hover:not(:disabled),
.filter-reset-link:hover:not(:disabled),
.catalog-clear:hover:not(:disabled),
.capture-text:hover:not(:disabled),
.capture-reset:hover:not(:disabled),
.books-clear:hover:not(:disabled),
.authors-clear:hover:not(:disabled),
.history-back:hover:not(:disabled),
.q-manual-back:hover:not(:disabled) {
  color: var(--ink, var(--color-text));
  background: transparent;
  text-decoration: none;
}

.ds-btn-text svg,
.favorites-all svg,
.capture-text svg,
.history-back svg,
.q-manual-back svg {
  flex: none;
  width: var(--ds-icon-glyph-size, 22px);
  height: var(--ds-icon-glyph-size, 22px);
  fill: currentColor;
}

.q-manual-back {
  width: fit-content;
  margin: 8px 0 16px;
}

.advanced-inline {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid var(--line, var(--color-border));
  border-radius: 0;
  background: transparent;
  color: var(--ink, var(--color-text));
  font-size: var(--type-micro-size, 10px);
  line-height: var(--type-micro-line, 14px);
  font-weight: var(--weight-bold, 700);
  text-align: left;
  cursor: pointer;
}

.advanced-inline:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* —— Round icon shape (Primary / Secondary / Surface) ——
   Не отдельная семья: круглый вариант Primary (.ds-icon-btn),
   Secondary (.ds-icon-btn--secondary) или Surface (.ds-icon-btn--surface).
   Иконка SVG 20×20, stroke 2.
   Пример Primary: «⋯» меню на карточке книги.
   Пример Surface: «Все фильтры» (.books-all-filters). */
.ds-icon-btn,
.icon-button,
.favorite-toggle,
.drawer-close,
.books-all-filters {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: var(--ds-icon-size);
  min-width: var(--ds-icon-size);
  max-width: var(--ds-icon-size);
  height: var(--ds-icon-size);
  min-height: var(--ds-icon-size);
  max-height: var(--ds-icon-size);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: var(--ink, var(--color-text));
  color: var(--surface, var(--color-surface));
  font-size: var(--type-section-size, 20px);
  line-height: var(--type-section-line, 26px);
  flex: 0 0 auto;
  overflow: hidden;
}

.ds-icon-btn--secondary,
.icon-button--secondary,
.favorite-toggle,
.drawer-close {
  border: 0;
  background: var(--color-background, var(--soft, #F5F5F5));
  color: var(--color-text-secondary, var(--muted));
  box-shadow: none;
}

.ds-icon-btn--surface,
.books-all-filters {
  border: 0;
  background: var(--surface, var(--color-surface, #fff));
  /* Control icons on white surface — shared graphite. */
  color: var(--color-icon-control, #454545);
  box-shadow: var(--shadow-selected);
}

.favorite-toggle,
.drawer-close {
  color: var(--color-text-secondary, var(--muted));
}

/* Карусель: Secondary-действие, но без подложки в покое; soft circle только на hover */
.carousel-arrow {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: var(--ds-icon-size);
  min-width: var(--ds-icon-size);
  max-width: var(--ds-icon-size);
  height: var(--ds-icon-size);
  min-height: var(--ds-icon-size);
  max-height: var(--ds-icon-size);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: transparent;
  color: var(--ink, var(--color-text));
  flex: 0 0 auto;
  overflow: hidden;
  cursor: pointer;
}

.carousel-arrow:hover:not(:disabled) {
  background: #ededed;
  color: var(--ink, var(--color-text));
  opacity: 1;
}

.ds-icon-btn:not(.ds-icon-btn--secondary):not(.ds-icon-btn--surface):not(.ds-icon-btn--on-dark-primary):not(.ds-icon-btn--on-dark-secondary):not(.books-all-filters):hover:not(:disabled),
.icon-button:not(.icon-button--secondary):not(.icon-button--surface):hover:not(:disabled) {
  background: #303030;
  color: var(--surface, var(--color-surface));
  opacity: 1;
}

.ds-icon-btn--secondary:hover:not(:disabled),
.icon-button--secondary:hover:not(:disabled) {
  background: #EBEBEB;
  color: var(--ink, var(--color-text));
  opacity: 1;
}

.ds-icon-btn--surface:hover:not(:disabled),
.books-all-filters:hover:not(:disabled),
.icon-button--surface:hover:not(:disabled) {
  background: var(--color-surface);
  box-shadow: var(--shadow-control-hover);
  color: var(--color-icon-control, #454545);
  opacity: 1;
}

/* Lucide imgs use baked black stroke — invert on filled primary. */
.ds-icon-btn:not(.ds-icon-btn--secondary):not(.ds-icon-btn--surface):not(.books-all-filters):not(.ds-icon-btn--on-dark-primary) > img,
.ds-icon-btn:not(.ds-icon-btn--secondary):not(.ds-icon-btn--surface):not(.books-all-filters):not(.ds-icon-btn--on-dark-primary) .bd-icon,
.icon-button:not(.icon-button--secondary):not(.icon-button--surface) > img {
  filter: brightness(0) invert(1);
}

.favorite-toggle:hover:not(:disabled),
.drawer-close:hover:not(:disabled) {
  background: #EBEBEB;
  color: var(--ink, var(--color-text));
  opacity: 1;
}

.favorite-toggle[aria-pressed="true"] {
  border-color: var(--ink, var(--color-text));
  background: var(--ink, var(--color-text));
  color: var(--surface, var(--color-surface));
}

.ds-icon-btn .icon,
.icon-button .icon,
.header-add-button .icon,
.q-icon-btn .icon,
.drawer-close .icon,
.carousel-arrow .icon {
  width: var(--ds-icon-glyph-size, 22px);
  height: var(--ds-icon-glyph-size, 22px);
  fill: currentColor;
}

/* Round buttons: Phosphor currentColor glyphs (Bold for ⋯ / ✕) */
:is(.ds-icon-btn,.icon-button,.favorite-toggle,.drawer-close,.carousel-arrow,.q-search-clear,.q-icon-btn,.header-add-button,.books-all-filters) > svg,
:is(.ds-icon-btn,.icon-button,.favorite-toggle,.drawer-close,.carousel-arrow,.q-icon-btn,.header-add-button,.books-all-filters) > img.bd-icon,
:is(.ds-icon-btn,.icon-button,.header-add-button,.books-all-filters) .icon {
  display: block;
  width: var(--ds-icon-glyph-size, 22px);
  height: var(--ds-icon-glyph-size, 22px);
  fill: currentColor;
  flex: 0 0 auto;
}

.ds-icon-btn.is-hover,
.icon-button.is-hover {
  transform: translateY(-1px);
}

.ds-icon-btn.is-focus,
.icon-button.is-focus {
  outline: var(--ds-focus-ring);
  outline-offset: var(--ds-focus-offset);
}

/* —— Cover mark (passive badge on cover) ——
   Не кнопка: нет hover-подложки. Действие на обложке → Primary/Secondary круг.
   Канон: стекло с мягким бликом без обводки + белая иконка (cover-status.css).
   Размеры: 28/14 (компактный) · 36/16 (detail / reading) · 40/20 (только Книги). */
.ds-status-mark,
.status,
.ds-card-mark,
.reading-status,
.favorite-mark {
  box-sizing: border-box;
  position: absolute;
  z-index: 1;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: var(--color-status-surface, #FFFFFF);
  color: var(--color-status-icon, #fff);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  opacity: 1;
}

.ds-status-mark .icon,
.ds-status-mark > svg,
.ds-status-mark > img,
.status .icon,
.ds-card-mark .icon,
.ds-card-mark > svg,
.reading-status .icon,
.reading-status > svg,
.favorite-mark .icon,
.favorite-mark > svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: currentColor;
}

/* Large cover mark · detail / reading / feature */
.ds-status-mark--lg,
.reading-status {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
}

.ds-status-mark--lg .icon,
.ds-status-mark--lg > svg,
.ds-status-mark--lg > img,
.reading-status .icon,
.reading-status > svg {
  width: 16px;
  height: 16px;
}

button.ds-status-mark,
.favorite-toggle.ds-status-mark {
  cursor: pointer;
  font: inherit;
}

button.ds-status-mark:hover:not(:disabled),
.favorite-toggle.ds-status-mark:hover:not(:disabled) {
  border-color: rgba(0, 0, 0, 0.16);
  opacity: 1;
}

/* Pressed wishlist uses the same glass surface; final styling in cover-status.css. */
.favorite-toggle.ds-status-mark[aria-pressed="true"],
button.ds-status-mark[aria-pressed="true"] {
  border-color: rgba(0, 0, 0, 0.08);
  background: var(--color-status-surface, #FFFFFF);
  color: var(--color-status-icon, #fff);
}

.favorite-toggle.ds-status-mark[aria-pressed="true"] > svg path[fill],
button.ds-status-mark[aria-pressed="true"] > svg path[fill] {
  fill: currentColor;
}

.ds-status-mark:focus-visible,
.favorite-toggle.ds-status-mark:focus-visible {
  outline: var(--ds-focus-ring);
  outline-offset: var(--ds-focus-offset);
}

/* Soft text button used on feature cards in the book-card reference */
.text-button {
  box-sizing: border-box;
  border: 1px solid var(--line, var(--color-border));
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--soft, var(--color-background));
  color: var(--ink, var(--color-text));
  cursor: pointer;
  font-family: var(--font-body, inherit);
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-semibold, 600);
}

.text-button:focus-visible {
  outline: var(--ds-focus-ring);
  outline-offset: var(--ds-focus-offset);
}

.text-button:hover:not(:disabled) {
  border-color: var(--ink, var(--color-text));
}

.text-button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

/* —— Selectable pill · переключатель ——
   Канон: белая · без обводки · тень. Selected: ink · без тени.
   Эталон — месяцы истории. Не называть табами. */
.ds-pill,
.filter-chip,
.quick-filter,
.browse-filter,
.intent-option,
.drawer-options button,
.ds-segment-item,
.scope-option,
.drawer-segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--ds-control-height-sm);
  padding: 5px 10px;
  border: 0;
  border-color: transparent;
  border-radius: var(--ds-control-radius-pill);
  background: var(--surface, var(--color-surface));
  color: var(--muted, var(--color-text-secondary));
  box-shadow: var(--shadow-selected);
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  font-weight: var(--weight-regular, 400);
  white-space: nowrap;
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}

.browse-filter {
  padding: 5px 9px;
}

/* —— Filter · числовая ячейка ——
   Та же поверхность, что у переключателей-пилюль: белая · тень · selected ink.
   Шкальный / множественный выбор (rating 1–10, heat). Всегда круг, не soft gray. */
.q-rating-tab,
.books-heat-chip,
.authors-heat-chip {
  box-sizing: border-box;
  display: inline-grid;
  place-items: center;
  margin: 0;
  padding: 0;
  width: var(--control-height, 36px);
  min-width: var(--control-height, 36px);
  max-width: var(--control-height, 36px);
  height: var(--control-height, 36px);
  min-height: var(--control-height, 36px);
  aspect-ratio: 1;
  border: 0;
  border-radius: var(--radius-round, 50%);
  background: var(--surface, var(--color-surface));
  color: var(--muted, var(--color-text-secondary));
  box-shadow: var(--shadow-selected);
  font-family: var(--font-body, inherit);
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  font-weight: var(--weight-medium, 500);
  cursor: pointer;
  transition: color .15s ease, background .15s ease, box-shadow .15s ease;
}

.q-rating-tab:hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]),
.books-heat-chip:hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]),
.authors-heat-chip:hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]) {
  color: var(--ink, var(--color-text));
  background: var(--surface, var(--color-surface));
  box-shadow: var(--shadow-control-hover);
}

.q-rating-tab.is-selected,
.q-rating-tab[aria-pressed="true"],
.books-heat-chip.is-selected,
.books-heat-chip[aria-pressed="true"],
.authors-heat-chip.is-selected,
.authors-heat-chip[aria-pressed="true"] {
  background: var(--ink, var(--color-text));
  border-color: transparent;
  color: var(--surface, var(--color-surface));
  box-shadow: none;
}

.q-rating-tab.is-selected:hover:not(:disabled),
.q-rating-tab[aria-pressed="true"]:hover:not(:disabled),
.books-heat-chip.is-selected:hover:not(:disabled),
.books-heat-chip[aria-pressed="true"]:hover:not(:disabled),
.authors-heat-chip.is-selected:hover:not(:disabled),
.authors-heat-chip[aria-pressed="true"]:hover:not(:disabled) {
  background: #303030;
  color: var(--surface, var(--color-surface));
}

/* Home favorite filters → Status tab (текст + опциональный счётчик). */

.drawer-options button {
  min-height: var(--ds-control-height);
  padding: 6px 10px;
}

.drawer-options.compact button {
  min-width: 48px;
}

.ds-pill:hover:not(:disabled):not(.is-selected):not(.is-active):not([aria-pressed="true"]):not([aria-current]),
.filter-chip:hover:not(:disabled):not(.is-selected):not(.is-active),
.quick-filter:hover:not(:disabled):not(.is-selected):not(.is-active),
.browse-filter:hover:not(:disabled):not(.is-selected):not(.is-active),
.intent-option:hover:not(:disabled):not(.is-selected):not(.is-active),
.drawer-options button:hover:not(:disabled):not(.is-selected):not(.is-active),
.ds-segment-item:hover:not(:disabled):not(.is-selected):not(.is-active):not([aria-pressed="true"]),
.scope-option:hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]),
.drawer-segmented button:hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]) {
  border-color: transparent;
  background: var(--surface, var(--color-surface));
  color: var(--ink, var(--color-text));
  box-shadow: var(--shadow-control-hover);
}

.ds-pill.is-selected,
.ds-pill.is-active,
.ds-pill[aria-pressed="true"],
.ds-pill[aria-current],
.filter-chip.is-selected,
.filter-chip.is-active,
.quick-filter.is-selected,
.browse-filter.is-selected,
.intent-option.is-selected,
.drawer-options button.is-selected,
.ds-segment-item.is-selected,
.ds-segment-item.is-active,
.ds-segment-item[aria-pressed="true"],
.scope-option.is-selected,
.scope-option[aria-pressed="true"],
.drawer-segmented button.is-selected,
.drawer-segmented button[aria-pressed="true"] {
  border: 0;
  border-color: transparent;
  background: var(--ink, var(--color-text));
  color: var(--surface, var(--color-surface));
  box-shadow: none;
}

.ds-pill.is-selected:hover:not(:disabled),
.ds-pill.is-active:hover:not(:disabled),
.ds-pill[aria-pressed="true"]:hover:not(:disabled),
.ds-pill[aria-current]:hover:not(:disabled),
.filter-chip.is-selected:hover:not(:disabled),
.quick-filter.is-selected:hover:not(:disabled),
.browse-filter.is-selected:hover:not(:disabled),
.intent-option.is-selected:hover:not(:disabled),
.drawer-options button.is-selected:hover:not(:disabled),
.ds-segment-item.is-selected:hover:not(:disabled),
.ds-segment-item.is-active:hover:not(:disabled),
.ds-segment-item[aria-pressed="true"]:hover:not(:disabled),
.scope-option.is-selected:hover:not(:disabled),
.drawer-segmented button.is-selected:hover:not(:disabled),
.drawer-segmented button[aria-pressed="true"]:hover:not(:disabled) {
  background: #303030;
  border-color: transparent;
  color: var(--surface, var(--color-surface));
  box-shadow: none;
  opacity: 1;
}

.favorite-filter-count,
.home-favorite-filter .favorite-filter-count,
.section-head .favorite-filter-count {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  display: inline;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  font-variant-numeric: tabular-nums;
}

/* —— Soft fill tag · compact 24 ——
   Caption 12 · weight 500 · icon 12 outline (опционально).
   Цвет текста: ink или muted. Soft gray; белая — на тоне. */
.ds-author-card-score,
.ds-author-card-tags li,
.author-series-badge,
.ser-progress,
.bd-series-progress,
.home-reads-badge {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  min-width: 0;
  height: 24px;
  min-height: 24px;
  max-height: 24px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-pill, 999px);
  background: var(--soft, var(--color-background));
  font-family: var(--font-body);
  font-size: var(--type-caption-size, 12px);
  line-height: 1;
  font-weight: var(--weight-medium, 500);
  white-space: nowrap;
}

.ds-author-card-score,
.ser-progress,
.bd-series-progress {
  color: var(--ink, var(--color-text));
}

.ds-author-card-tags li,
.author-series-badge,
.home-reads-badge {
  color: var(--muted, var(--color-text-secondary));
}

.ds-author-card-tags li {
  border: 1px solid var(--color-tag-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-tag);
  white-space: normal;
  overflow-wrap: anywhere;
  height: auto;
  max-height: none;
  min-height: 24px;
  padding: 4px 10px;
  line-height: var(--type-caption-line, 16px);
}

.ds-author-card-score svg,
.ser-progress svg,
.home-reads-badge svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  fill: currentColor;
  filter: none;
}

/* Soft circle · same 24 rhythm (icon-only) */
.ds-author-card-favorite {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  min-width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round, 999px);
  background: var(--soft, var(--color-background));
  color: var(--ink, var(--color-text));
}

.ds-author-card-favorite svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

/* White soft on tonal surface (home reads) */
.home-reads-badge {
  background: rgba(255, 255, 255, 0.72);
}

.ser-progress.is-complete {
  gap: 4px;
}

/* —— Passive chip / tag (not a control, but paired with pills) —— */
.ds-chip,
.chip:not(button):not(.books-chip):not(.authors-chip):not(.books-facet-chip):not(.authors-facet-chip):not(.books-selected-chip):not(.authors-selected-chip):not(.books-heat-chip):not(.authors-heat-chip),
.desire-chip,
.feature-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border: 1px solid var(--color-tag-border);
  border-radius: var(--ds-control-radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-tag);
  color: var(--muted, var(--color-text-secondary));
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  flex: 0 0 auto;
  white-space: nowrap;
}

.desire-chip {
  border-color: var(--ds-line-strong);
  background: var(--surface, var(--color-surface));
  color: var(--text, var(--ink, var(--color-text)));
  padding: 5px 9px;
}

.feature-tag {
  padding: 8px 13px;
  color: var(--ink, var(--color-text));
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* —— Segmented → стандартные пилюли (нет отдельного track) ——
   Оболочка только раскладка; пункты = .ds-pill. */
.ds-segment,
.scope-control,
.drawer-segmented {
  box-sizing: border-box;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* Пункты сегмента — алиасы .ds-pill (стили в блоке Selectable pill выше и compact ниже). */

/* Segment-bar / status tabs: канон underline — ниже (§ Nav tab / Status tab).
   Filled `.ds-segment-bar` shell оставлен только как legacy вне `.series-statuses`. */

/* Drawer options use pill-selected look, not segment surface */
.drawer-options button.is-selected {
  box-shadow: none;
  border-color: var(--ink, var(--color-text));
  background: var(--ink, var(--color-text));
  color: var(--surface, var(--color-surface));
}

.drawer-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* —— Search · два типа подложки, без обводки, высота 36 ——
   Idle: светло-серый #F5F5F5 (--color-background).
   Focus: белый + тень как у medium-card, без тёмного кольца.
   Surface (--on-soft) — белый на сером фоне страницы.
   Clear и input — как на главной в прототипе. */
.ds-search,
.ds-search-trigger,
.search,
.ds-search-field,
.books-search,
.authors-search,
.q-search-wrap,
.books-option-search-wrap,
.authors-option-search-wrap {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--control-height, var(--ds-control-height, 36px));
  min-height: var(--control-height, var(--ds-control-height, 36px));
  max-height: var(--control-height, var(--ds-control-height, 36px));
  min-width: 0;
  padding: 0 12px 0 14px;
  border: 0;
  border-radius: var(--radius-pill, var(--ds-control-radius-pill, 999px));
  background: var(--search-soft-background, var(--color-background, #F5F5F5));
  color: var(--muted, var(--color-text-secondary));
  box-shadow: none;
  text-align: left;
  font-family: var(--font-body, inherit);
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-regular, 400);
  transition: background-color .15s ease, box-shadow .15s ease, color .15s ease;
}

.ds-search--on-soft,
.search--on-soft,
.ds-search-field--on-soft,
.q-search-wrap--on-soft,
.books-search--on-soft,
.authors-search--on-soft {
  background: var(--surface, var(--color-surface, #fff));
}

.ds-search:hover,
.ds-search-trigger:hover,
.search:hover,
.ds-search-field:hover,
.books-search:hover,
.authors-search:hover,
.q-search-wrap:hover,
.books-option-search-wrap:hover,
.authors-option-search-wrap:hover {
  background: var(--search-soft-hover, #EEEEEE);
  color: var(--ink, var(--color-text));
  box-shadow: none;
}

:is(.ds-search--on-soft, .search--on-soft, .ds-search-field--on-soft, .q-search-wrap--on-soft, .books-search--on-soft, .authors-search--on-soft):hover {
  background: var(--color-surface);
  box-shadow: var(--shadow-control-hover);
}

.ds-search:focus-within,
.ds-search-trigger:focus-within,
.search:focus-within,
.ds-search-field:focus-within,
.books-search:focus-within,
.authors-search:focus-within,
.q-search-wrap:focus-within,
.books-option-search-wrap:focus-within,
.authors-option-search-wrap:focus-within,
:is(.ds-search--on-soft, .search--on-soft, .ds-search-field--on-soft, .q-search-wrap--on-soft, .books-search--on-soft, .authors-search--on-soft):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));
}

.search > span:last-child {
  white-space: nowrap;
}

.search-icon {
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-radius: var(--radius-round);
  position: relative;
  flex: 0 0 auto;
}

.search-icon::after {
  content: "";
  width: 6px;
  height: 1.5px;
  background: currentColor;
  position: absolute;
  right: -5px;
  bottom: -2px;
  transform: rotate(45deg);
}

.ds-search svg,
.ds-search-field svg,
.books-search svg,
.authors-search svg,
.search > svg.rm-icon,
.library-search > svg.rm-icon,
.q-search-wrap .q-search-icon,
.books-option-search-wrap svg,
.authors-option-search-wrap svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  /* Same graphite as white control icons / card «⋯». */
  color: var(--color-icon-control, #454545);
}
.ds-search svg:not(.rm-icon),
.ds-search-field svg:not(.rm-icon),
.books-search svg:not(.rm-icon),
.authors-search svg:not(.rm-icon),
.q-search-wrap .q-search-icon:not(.rm-icon),
.books-option-search-wrap svg:not(.rm-icon),
.authors-option-search-wrap svg:not(.rm-icon) {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.search > svg.rm-icon,
.library-search > svg.rm-icon,
.q-search-wrap .q-search-icon.rm-icon,
.books-option-search-wrap svg.rm-icon,
.authors-option-search-wrap svg.rm-icon {
  fill: currentColor;
  stroke: none;
}

.ds-search input,
.ds-search-field input,
.books-search input,
.authors-search input,
.header-search-input,
.q-search-wrap .q-input,
.q-search-wrap #q-search,
.books-option-search-wrap input,
.authors-option-search-wrap input {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink, var(--color-text));
  font-family: inherit;
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-regular, 400);
  outline: none;
  box-shadow: none;
  cursor: text;
  appearance: none;
  -webkit-appearance: none;
}

.header-search-input::placeholder,
.ds-search input::placeholder,
.ds-search-field input::placeholder,
.books-search input::placeholder,
.authors-search input::placeholder,
.q-search-wrap .q-input::placeholder,
.q-search-wrap #q-search::placeholder {
  color: var(--color-text-secondary);
  opacity: 1;
}

.header-search-input::-webkit-search-cancel-button,
.ds-search input::-webkit-search-cancel-button,
.ds-search-field input::-webkit-search-cancel-button,
.books-search input::-webkit-search-cancel-button,
.authors-search input::-webkit-search-cancel-button,
.q-search-wrap input::-webkit-search-cancel-button {
  display: none;
}

.ds-search-clear,
.header-search-clear,
.q-search-clear {
  display: none;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-right: -4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink, var(--color-text, #111));
  cursor: pointer;
  box-shadow: none;
}

.ds-search-clear:not([hidden]),
.header-search-clear:not([hidden]),
.q-search-clear:not([hidden]) {
  display: grid;
}

.ds-search-clear:hover,
.header-search-clear:hover,
.q-search-clear:hover {
  color: var(--ink, var(--color-text));
  background: transparent;
  box-shadow: none;
}

.ds-search--on-soft .ds-search-clear:hover,
.search--on-soft .header-search-clear:hover,
.q-search-wrap--on-soft .q-search-clear:hover {
  background: transparent;
}

.ds-search-clear:focus-visible,
.header-search-clear:focus-visible,
.q-search-clear:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 1px;
}

.ds-search-clear svg,
.header-search-clear svg,
.q-search-clear svg {
  width: 16px;
  height: 16px;
  color: inherit;
  fill: currentColor;
  stroke: none;
}

.ds-search-clear[hidden],
.header-search-clear[hidden],
.q-search-clear[hidden] {
  display: none !important;
}

.header-search-wrap {
  position: relative;
  min-width: 0;
}

.header-search-wrap .search {
  width: 100%;
  cursor: text;
}

.global-search-head input {
  min-height: 0;
  height: 100%;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink, var(--color-text));
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  outline: none;
  cursor: text;
}

/* —— Soft fill · общие токены для полей и выпадашек —— */
:root {
  --ds-soft-fill: #EEEEEE;
  --ds-soft-surface: #fff;
  --ds-soft-focus-border: var(--color-input-focus);
  --ds-soft-focus-border-width: 0.5px;
  --ds-dropdown-soft: var(--ds-soft-fill);
  --ds-dropdown-surface: var(--ds-soft-surface);
  --ds-dropdown-focus-border: var(--ds-soft-focus-border);
  --ds-dropdown-hover-shadow: var(--shadow-control-hover);
  --ds-field-soft: var(--ds-soft-fill);
  --ds-field-surface: var(--ds-soft-surface);
  --ds-field-focus-border: var(--ds-soft-focus-border);
  --ds-field-radius-tall: 12px; /* proposal · высокие формы, не pill */
}

/* —— Text fields · тот же soft/white, что у выпадашек ——
   h=36 → pill. Высокие (textarea) → --ds-field-radius-tall. */
.ds-field:not(select),
.catalog-search,
.q-input:not(select):not([type="search"]),
.capture-field input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="search"]),
.capture-field textarea,
.books-option-search,
.authors-option-search {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--control-height, 36px);
  height: var(--control-height, 36px);
  padding: 0 14px;
  border: var(--ds-soft-focus-border-width, 0.5px) solid transparent;
  border-radius: var(--radius-pill, 999px);
  background-color: var(--ds-field-soft);
  color: var(--ink, var(--color-text));
  box-shadow: none;
  font-family: var(--font-body, inherit);
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-regular, 400);
  cursor: text;
  appearance: none;
  -webkit-appearance: none;
}

.ds-field--on-soft:not(select),
.q-input--on-soft:not(select),
.catalog-search--on-soft {
  background-color: var(--ds-field-surface);
}

.ds-field:not(select):focus,
.ds-field:not(select):focus-visible,
.catalog-search:focus,
.catalog-search:focus-visible,
.q-input:not(select):not([type="search"]):focus,
.q-input:not(select):not([type="search"]):focus-visible,
.capture-field input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="search"]):focus,
.capture-field input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="search"]):focus-visible,
.capture-field textarea:focus,
.capture-field textarea:focus-visible,
.books-option-search:focus,
.books-option-search:focus-visible,
.authors-option-search:focus,
.authors-option-search:focus-visible {
  outline: none;
  box-shadow: none;
  border-color: var(--ds-field-focus-border);
  background-color: var(--ds-field-soft);
}

.ds-field--on-soft:not(select):focus,
.ds-field--on-soft:not(select):focus-visible,
.q-input--on-soft:not(select):focus,
.q-input--on-soft:not(select):focus-visible,
.catalog-search--on-soft:focus,
.catalog-search--on-soft:focus-visible {
  background-color: var(--ds-field-surface);
}

/* Высокая форма · аккуратнее pill */
textarea.ds-field,
textarea.q-input,
.capture-field textarea,
.ds-field--tall:not(select),
.q-input--tall:not(select) {
  height: auto;
  min-height: 120px;
  padding: 12px 14px;
  border-radius: var(--ds-field-radius-tall);
  resize: vertical;
  line-height: var(--type-body-line, 20px);
}

/* —— Date · native calendar popup ——
   Chrome/Edge: accent-color → выбран и ссылки. Ячейки popup почти не стилизуются. */
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"],
.q-date-input {
  accent-color: var(--ink, var(--color-text, #111111));
  color-scheme: light;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator,
.q-date-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.55;
  margin-left: 4px;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="month"]::-webkit-calendar-picker-indicator:hover,
.q-date-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

input[type="date"]::-webkit-datetime-edit,
input[type="datetime-local"]::-webkit-datetime-edit,
.q-date-input::-webkit-datetime-edit {
  padding: 0;
  color: var(--ink, var(--color-text));
}

input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.q-date-input::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

/* —— Dropdown · soft / white, без обводки; focus = мягкая рамка, фон тот же ——
   Soft (#EEEEEE) на белом. --on-soft (белый) на сером.
   Hover: фон тот же, мягкая тень.
   Focus / open: фон не меняется, border чуть темнее (#C4C4C4), не ink. */
.ds-dropdown,
.books-facet-chip,
.authors-facet-chip,
.series-facet-chip,
.collections-facet-chip,
.books-sort,
.authors-sort,
.series-sort,
.collections-sort,
.author-series-sort select,
select.ds-field,
.catalog-select,
select.catalog-select,
select.q-input,
.capture-field select {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--control-height, 36px);
  height: var(--control-height, 36px);
  padding: 0 14px;
  border: var(--ds-soft-focus-border-width, 0.5px) solid transparent;
  border-radius: var(--radius-pill, 999px);
  background-color: var(--ds-dropdown-soft);
  color: var(--color-text-secondary, var(--muted, #666));
  box-shadow: none;
  font-family: var(--font-body, inherit);
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  font-weight: var(--weight-medium, 500);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* Nested trigger/select inherit caption; beat page-level button/select body rules. */
:is(.books-facet-chip, .authors-facet-chip, .series-facet-chip, .collections-facet-chip)
  :is(.books-facet-trigger, .authors-facet-trigger, .series-facet-trigger, .collections-facet-trigger),
:is(.books-sort, .authors-sort, .series-sort, .collections-sort) select,
.author-series-sort select {
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
  color: inherit;
}

/* На сером фоне страницы — белая подложка */
.ds-dropdown--on-soft,
.books-facet-chip,
.authors-facet-chip,
.series-facet-chip,
.collections-facet-chip,
.books-sort,
.authors-sort,
.series-sort,
.collections-sort,
.author-series-sort select,
select.ds-field--on-soft,
.catalog-select--on-soft,
.hist-controls select.ds-field {
  background-color: var(--ds-dropdown-surface);
}

.author-series-sort select {
  box-shadow: var(--shadow-selected);
}

.author-series-sort select:hover:not(:disabled):not(:focus) {
  box-shadow: var(--shadow-control-hover);
}

.ds-dropdown:hover:not(:disabled):not(:focus):not(:focus-within),
.books-facet-chip:hover,
.authors-facet-chip:hover,
.collections-facet-chip:hover,
.books-sort:hover,
.authors-sort:hover,
.series-sort:hover,
.collections-sort:hover,
select.ds-field:hover:not(:disabled):not(:focus),
.catalog-select:hover:not(:disabled):not(:focus),
select.q-input:hover:not(:disabled):not(:focus),
.capture-field select:hover:not(:disabled):not(:focus),
.author-series-sort select:hover:not(:disabled):not(:focus) {
  /* Hover сохраняет заливку; focus/open ниже оставляют мягкую рамку. */
  filter: none;
  box-shadow: var(--ds-dropdown-hover-shadow);
}

.ds-dropdown:focus,
.ds-dropdown:focus-visible,
.ds-dropdown:focus-within,
.books-facet-chip:focus-visible,
.authors-facet-chip:focus-visible,
.books-sort:focus-within,
.authors-sort:focus-within,
.series-sort:focus-within,
select.ds-field:focus,
select.ds-field:focus-visible,
.catalog-select:focus,
.catalog-select:focus-visible,
select.q-input:focus,
select.q-input:focus-visible,
.capture-field select:focus,
.capture-field select:focus-visible,
.author-series-sort select:focus,
.author-series-sort select:focus-visible,
.books-facet:has([aria-expanded="true"]) .books-facet-chip,
.authors-facet:has([aria-expanded="true"]) .authors-facet-chip,
.series-facet:has([aria-expanded="true"]) .series-facet-chip {
  outline: none;
  box-shadow: none;
  filter: none;
  border-color: var(--ds-dropdown-focus-border);
  background-color: var(--ds-dropdown-soft);
}

.ds-dropdown--on-soft:focus,
.ds-dropdown--on-soft:focus-visible,
.ds-dropdown--on-soft:focus-within,
.books-facet-chip:focus-visible,
.authors-facet-chip:focus-visible,
.books-sort:focus-within,
.authors-sort:focus-within,
.series-sort:focus-within,
.hist-controls select.ds-field:focus,
.hist-controls select.ds-field:focus-visible,
select.ds-field--on-soft:focus,
select.ds-field--on-soft:focus-visible,
.author-series-sort select:focus,
.author-series-sort select:focus-visible,
.books-facet:has([aria-expanded="true"]) .books-facet-chip,
.authors-facet:has([aria-expanded="true"]) .authors-facet-chip,
.series-facet:has([aria-expanded="true"]) .series-facet-chip {
  background-color: var(--ds-dropdown-surface);
}

select.ds-field,
.catalog-select,
select.q-input,
.capture-field select,
.author-series-sort select {
  width: auto;
  min-width: 100px;
  max-width: 100%;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px 16px;
  text-overflow: ellipsis;
}

.catalog-select[multiple] {
  min-height: 86px;
  height: auto;
  padding: 5px;
  background-image: none;
  border-radius: var(--radius-field);
}

.catalog-select[multiple] option {
  padding: 5px 7px;
  border-radius: var(--radius-sm);
}

.books-facet-trigger,
.authors-facet-trigger,
.series-facet-trigger,
.collections-facet-trigger {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
  height: 100%;
  min-height: var(--control-height, 36px);
  margin: 0 -14px;
  padding: 0 14px;
  text-align: left;
  overflow-wrap: anywhere;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  cursor: pointer;
  /* Same as sort: padding lived on the chip, so edge clicks missed the button. */
  user-select: none;
  -webkit-user-select: none;
}

.books-facet-trigger:hover,
.authors-facet-trigger:hover,
.series-facet-trigger:hover,
.collections-facet-trigger:hover {
  background: transparent;
}

.books-sort select,
.authors-sort select,
.series-sort select,
.books-sort #library-sort,
.authors-sort #authors-sort,
.series-sort #series-sort {
  min-width: 0;
  width: auto;
  max-width: 100%;
  height: auto;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.books-sort select:focus,
.books-sort select:focus-visible,
.authors-sort select:focus,
.authors-sort select:focus-visible,
.series-sort select:focus,
.series-sort select:focus-visible {
  outline: none;
  box-shadow: none;
  border: 0;
}

/* Select fills the pill. A click on the icon or the padding used to hit the
   shell and only focus the control; the menu opened on the next click. */
:is(.books-sort, .authors-sort, .series-sort) select {
  position: relative;
  z-index: 1;
  align-self: stretch;
  box-sizing: content-box;
  height: auto;
  margin: 0 -14px;
  padding: 0 14px;
}
:is(.books-sort, .authors-sort, .series-sort):has(.rm-icon, svg) select {
  margin-left: -38px;
  padding-left: 38px;
}
:is(.books-sort, .authors-sort, .series-sort) :is(.rm-icon, svg) {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

/* —— Nav tab · текст без счётчика (topbar, capture) ——
   Active: ink + короткая чёрная черта по центру текста. */
.ds-nav-item,
.nav-item,
.q-book-tab {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin: 0;
  padding: 0 0 6px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted, var(--color-text-secondary));
  text-decoration: none;
  font-family: inherit;
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-medium, 500);
  cursor: pointer;
  box-shadow: none;
}

.ds-nav-item:hover,
.nav-item:hover,
.q-book-tab:hover:not(:disabled) {
  color: var(--ink, var(--color-text));
}

.ds-nav-item[aria-current="page"],
.nav-item[aria-current="page"],
.q-book-tab.is-selected,
.q-book-tab[aria-selected="true"] {
  color: var(--ink, var(--color-text));
  font-weight: var(--weight-semibold, 600);
}

.ds-nav-item[aria-current="page"]::after,
.nav-item[aria-current="page"]::after,
.q-book-tab.is-selected::after,
.q-book-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 20px;
  height: 2px;
  background: var(--ink, var(--color-text));
  transform: translateX(-50%);
}

.q-book-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  margin: 0 0 14px;
  border: 0;
  background: transparent;
}

/* —— Status tab · текст + опциональный счётчик (каталог) ——
   Та же черта, но под подписью (первый span), не под цифрой.
   Алиасы: .books-chip / .authors-chip / .collections-chip / .series-status-tab / .home-favorite-filter */
.books-statuses,
.authors-statuses,
.series-statuses,
.collections-statuses,
.home-favorite-filters {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  margin-top: 10px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.home-favorite-filters {
  margin-top: 0;
}

.books-statuses .books-chip,
.authors-statuses .authors-chip,
.collections-statuses .collections-chip,
.series-statuses .ds-segment-bar-item,
.series-statuses .series-status-tab,
.home-favorite-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
  height: auto;
  padding: 0 0 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted, var(--color-text-secondary));
  box-shadow: none;
  font-family: var(--font-body, inherit);
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
  font-weight: var(--weight-medium, 500);
  white-space: nowrap;
  cursor: pointer;
}

.books-statuses .books-chip + .books-chip,
.authors-statuses .authors-chip + .authors-chip,
.collections-statuses .collections-chip + .collections-chip,
.series-statuses .ds-segment-bar-item + .ds-segment-bar-item {
  border-left: 0;
}

.books-statuses .books-chip:hover:not(:disabled):not([aria-pressed="true"]),
.authors-statuses .authors-chip:hover:not(:disabled):not([aria-pressed="true"]),
.collections-statuses .collections-chip:hover:not(:disabled):not([aria-pressed="true"]),
.series-statuses .ds-segment-bar-item:hover:not(:disabled):not([aria-pressed="true"]),
.home-favorite-filter:hover:not(:disabled):not(.is-active) {
  background: transparent;
  color: var(--ink, var(--color-text));
}

.books-statuses .books-chip[aria-pressed="true"],
.books-statuses .books-chip[aria-pressed="true"]:hover,
.authors-statuses .authors-chip[aria-pressed="true"],
.authors-statuses .authors-chip[aria-pressed="true"]:hover,
.collections-statuses .collections-chip[aria-pressed="true"],
.collections-statuses .collections-chip[aria-pressed="true"]:hover,
.series-statuses .ds-segment-bar-item[aria-pressed="true"],
.series-statuses .ds-segment-bar-item[aria-pressed="true"]:hover,
.home-favorite-filter.is-active,
.home-favorite-filter.is-active:hover:not(:disabled) {
  background: transparent;
  color: var(--ink, var(--color-text));
  font-weight: var(--weight-semibold, 600);
  opacity: 1;
  box-shadow: none;
}

/* Черта под подписью (первый span), не под счётчиком */
.books-statuses .books-chip[aria-pressed="true"] > span:first-child,
.authors-statuses .authors-chip[aria-pressed="true"] > span:first-child,
.collections-statuses .collections-chip[aria-pressed="true"] > span:first-child,
.series-statuses .ds-segment-bar-item[aria-pressed="true"] > span:first-child,
.home-favorite-filter.is-active > span:first-child {
  position: relative;
}

.books-statuses .books-chip[aria-pressed="true"] > span:first-child::after,
.authors-statuses .authors-chip[aria-pressed="true"] > span:first-child::after,
.collections-statuses .collections-chip[aria-pressed="true"] > span:first-child::after,
.series-statuses .ds-segment-bar-item[aria-pressed="true"] > span:first-child::after,
.home-favorite-filter.is-active > span:first-child::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 20px;
  height: 2px;
  background: var(--ink, var(--color-text));
  transform: translateX(-50%);
}

/* Без счётчика — черта по центру самого таба (как Nav) */
.books-statuses .books-chip[aria-pressed="true"]:not(:has(> span))::after,
.authors-statuses .authors-chip[aria-pressed="true"]:not(:has(> span))::after,
.collections-statuses .collections-chip[aria-pressed="true"]:not(:has(> span))::after,
.series-statuses .ds-segment-bar-item[aria-pressed="true"]:not(:has(> span))::after,
.home-favorite-filter.is-active:not(:has(> span))::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 20px;
  height: 2px;
  background: var(--ink, var(--color-text));
  transform: translateX(-50%);
}

.books-statuses .books-badge,
.authors-statuses .authors-badge,
.collections-statuses .collections-badge,
.series-statuses .ds-segment-bar-badge,
.home-favorite-filter .favorite-filter-count,
.favorite-filter-count,
#library-view .books-statuses .books-badge,
#authors-view .authors-statuses .authors-badge,
#collections-view .collections-statuses .collections-badge {
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-icon-muted, var(--muted));
  font-size: inherit;
  line-height: inherit;
  font-weight: var(--weight-regular, 400);
  font-variant-numeric: tabular-nums;
}

.books-statuses .books-chip[aria-pressed="true"] .books-badge,
.authors-statuses .authors-chip[aria-pressed="true"] .authors-badge,
.collections-statuses .collections-chip[aria-pressed="true"] .collections-badge,
.series-statuses .ds-segment-bar-item[aria-pressed="true"] .ds-segment-bar-badge,
.home-favorite-filter.is-active .favorite-filter-count {
  color: var(--muted, var(--color-text-secondary));
}

/* Legacy segment-bar shell — в каталоге заменён status-tab; оставляем для старых эталонов */
.ds-segment-bar {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line, var(--color-border));
  border-radius: var(--radius-layer);
  background: var(--surface, var(--color-surface));
}

.ds-segment-bar-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--ds-control-height);
  padding: 8px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted, var(--color-text-secondary));
  cursor: pointer;
  font: inherit;
}

.ds-segment-bar-item + .ds-segment-bar-item {
  border-left: 1px solid var(--line, var(--color-border));
}

.ds-segment-bar-item.is-selected,
.ds-segment-bar-item[aria-pressed="true"] {
  background: var(--ink, var(--color-text));
  color: var(--surface, var(--color-surface));
}

/* —— Search result row —— */
.ds-search-result,
.search-result {
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text, var(--ink, var(--color-text)));
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-family: inherit;
}

.ds-search-result:hover,
.ds-search-result:focus-visible,
.search-result:hover,
.search-result:focus-visible {
  background: var(--soft, var(--color-background));
  outline: none;
}

.ds-search-result strong,
.search-result strong {
  color: var(--ink, var(--color-text));
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
}

.ds-search-result span,
.search-result span {
  color: var(--muted, var(--color-text-secondary));
  font-size: var(--type-body-size, 14px);
  line-height: var(--type-body-line, 20px);
}
:is(.ds-btn,.start-reading,.intent-submit,.capture-trigger,.capture-primary,.text-action.primary) {
  box-sizing: border-box;
  display: inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:var(--control-height); height:auto; padding:8px 16px;
  border:1px solid var(--color-text); border-radius:var(--radius-pill);
  background:var(--color-text); color:var(--color-surface);
  font-family:var(--font-body); font-size:var(--type-caption-size); line-height:var(--type-caption-line); font-weight:500;
  cursor:pointer;
}
:is(.ds-btn-secondary,.quiet-action,.capture-secondary,.text-button,.text-action:not(.primary),.books-more,.authors-more) {
  box-sizing: border-box;
  display: inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:var(--control-height); height:auto; padding:8px 16px;
  border:0; border-radius:var(--radius-pill);
  background:var(--color-background); color:var(--color-text-secondary);
  font-family:var(--font-body); font-size:var(--type-caption-size); line-height:var(--type-caption-line); font-weight:500;
  cursor:pointer;
}
:is(.ds-btn-secondary,.quiet-action,.capture-secondary,.text-button,.text-action:not(.primary),.books-more,.authors-more):hover:not(:disabled):not(.is-selected):not([aria-pressed="true"]) {
  background:#EBEBEB; color:var(--color-text); opacity:1;
}
:is(.ds-btn-secondary,.quiet-action,.capture-secondary,.text-action:not(.primary),.books-more,.authors-more):is(.is-selected,[aria-pressed="true"]) {
  background:#EBEBEB; color:var(--color-text);
}
:is(.ds-btn-secondary,.quiet-action,.capture-secondary,.text-action:not(.primary),.books-more,.authors-more):is(.is-selected,[aria-pressed="true"]):hover:not(:disabled) {
  background:#EBEBEB; color:var(--color-text); opacity:1;
}
:is(.ds-btn-surface) {
  box-sizing: border-box;
  display: inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:var(--control-height); height:auto; padding:8px 16px;
  border:0; border-radius:var(--radius-pill);
  background:var(--color-surface); color:var(--color-text);
  box-shadow:var(--shadow-selected);
  font-family:var(--font-body); font-size:var(--type-caption-size); line-height:var(--type-caption-line); font-weight:500;
  cursor:pointer;
}
:is(.ds-btn-surface):hover:not(:disabled) {
  background:var(--color-surface); box-shadow:var(--shadow-control-hover); color:var(--color-text); opacity:1;
}
:is(.ds-btn,.start-reading,.intent-submit,.capture-trigger,.capture-primary,.text-action.primary):hover:not(:disabled) {
  background:#303030; color:var(--color-surface); opacity:1;
}
:is(.ds-btn-text,.favorites-all,.filter-reset-link,.catalog-clear,.capture-text,.capture-reset,.books-clear,.authors-clear,.history-back,.q-manual-back) {
  min-height:0; height:auto; padding:0; gap:2px;
  border:0; border-radius:0; background:transparent; color:var(--color-text-secondary);
  font-family:var(--font-body); font-size:var(--type-body-size); line-height:var(--type-body-line); font-weight:500;
  text-decoration:none;
}
:is(.ds-btn-text,.favorites-all,.filter-reset-link,.catalog-clear,.capture-text,.capture-reset,.books-clear,.authors-clear,.history-back,.q-manual-back):hover:not(:disabled) {
  color:var(--color-text); background:transparent; text-decoration:none;
}
:is(.ds-icon-btn,.icon-button,.favorite-toggle,.drawer-close,.carousel-arrow,.books-all-filters) {
  box-sizing:border-box;
  width:var(--control-height-icon); min-width:var(--control-height-icon); max-width:var(--control-height-icon);
  height:var(--control-height-icon); min-height:var(--control-height-icon); max-height:var(--control-height-icon);
  aspect-ratio:1; padding:0; border-radius:var(--radius-round); flex:0 0 auto;
}
/* Smaller circle. Same families (secondary = gray, surface = white). */
.ds-icon-btn--sm {
  --ds-icon-glyph-size: var(--ds-icon-glyph-size-sm);
  width: var(--ds-icon-size-sm);
  min-width: var(--ds-icon-size-sm);
  max-width: var(--ds-icon-size-sm);
  height: var(--ds-icon-size-sm);
  min-height: var(--ds-icon-size-sm);
  max-height: var(--ds-icon-size-sm);
}
:is(.ds-icon-btn--secondary,.icon-button--secondary,.favorite-toggle,.drawer-close) { border:0; background:var(--color-background); color:var(--color-text-secondary); box-shadow:none; }
:is(.ds-icon-btn--surface,.books-all-filters,.icon-button--surface) { border:0; background:var(--color-surface); color:var(--color-icon-control, #454545); box-shadow:var(--shadow-selected); }
.favorite-toggle[aria-pressed="true"] { background:var(--color-text); border-color:var(--color-text); color:var(--color-surface); }
/* The hero's text-action markup is an icon action, not a second button size. */
:is(.focus-actions,.feature-actions) :is(.text-action,.capture-primary,.capture-secondary),
:is(.focus-actions,.feature-actions) summary.text-action {
  box-sizing:border-box;
  width:var(--control-height-icon); min-width:var(--control-height-icon); max-width:var(--control-height-icon);
  height:var(--control-height-icon); min-height:var(--control-height-icon); max-height:var(--control-height-icon);
  aspect-ratio:1; padding:0; gap:0; border-radius:var(--radius-round); flex:0 0 auto;
  display:grid; place-items:center; overflow:hidden;
}
:is(.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button) {
  box-sizing:border-box; min-height:var(--control-height-compact); height:auto; padding:6px 12px; gap:8px;
  border:0; border-color:transparent; border-radius:var(--radius-pill);
  background:var(--color-surface); color:var(--color-text-secondary);
  box-shadow:var(--shadow-selected);
  font-family:var(--font-body); font-size:var(--type-caption-size); line-height:var(--type-caption-line); font-weight:var(--weight-regular);
}
:is(.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button):is(.is-selected,.is-active,[aria-pressed="true"],[aria-current]) {
  background:var(--color-text); border-color:transparent; color:var(--color-surface); box-shadow:none;
}
/* Segment shell = только раскладка пилюль */
:is(.ds-segment,.scope-control,.drawer-segmented) {
  box-sizing:border-box; display:inline-flex; flex-wrap:wrap; align-items:center; gap:8px;
  height:auto; min-height:0; padding:0; border:0; border-radius:0; background:transparent; box-shadow:none;
}
/* Legacy filled segment-bar only — status tabs live above as underline. */
.ds-segment-bar { border-radius:var(--radius-field); }
.ds-segment-bar > .ds-segment-bar-item { min-height:calc(var(--control-height) - 2px); padding:8px 16px; }
/* Status tabs / home-favorite: keep underline canon from above; do not re-apply pill/field sizing. */
/* Plain text fields — soft/white canon выше; здесь только tall override. */
textarea:is(.ds-field,.q-input),.capture-field textarea {
  height:auto; min-height:120px; padding:12px 14px;
  border-radius:var(--ds-field-radius-tall, 12px); resize:vertical;
}
.catalog-select[multiple] { height:auto; min-height:88px; border-radius:var(--ds-field-radius-tall, 12px); }
:is(input,textarea)::placeholder { color:var(--color-text-secondary); opacity:1; }
/* Search shells: soft/white canon выше — не возвращать border/field-radius. */
.q-search-wrap .q-input,
.q-search-wrap #q-search { padding:0; border:0; background:transparent; box-shadow:none; height:100%; min-height:0; }
/* Dropdown canon уже выше — не возвращать field-border на facet/sort/select */
/* Keep trigger filling the chip (negative margin + padding); do not collapse hit area. */
:is(.books-facet-trigger,.authors-facet-trigger,.series-facet-trigger,.collections-facet-trigger) {
  box-sizing: border-box;
  min-height: var(--control-height, 36px);
  margin: 0 -14px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--type-caption-size, 12px);
  line-height: var(--type-caption-line, 16px);
}
:is(.books-selected-chip,.authors-selected-chip) { min-height:var(--control-height-compact); padding:6px 12px; border-radius:var(--radius-pill); }
/* Both carousel implementations now share one control contract.
   Оболочка = surface-кнопка: белая · без обводки · shadow-selected · ритм 36.
   Hover стрелки: фон прежний, общая мягкая тень на белой оболочке.
   Счётчик: тот же текст, что у Primary/Secondary (caption · 500). */
:is(.feature-carousel,.carousel-rail) {
  box-sizing:border-box;
  display:inline-flex; align-items:center; justify-content:center; gap:2px;
  width:max-content; max-width:100%;
  height:var(--control-height); min-height:var(--control-height); max-height:var(--control-height);
  padding:2px; border:0; border-radius:var(--radius-pill); background:var(--color-surface);
  box-shadow:var(--shadow-selected);
}
:is(.feature-carousel,.carousel-rail) button,
:is(.feature-carousel,.carousel-rail) .carousel-arrow {
  --carousel-arrow-size: calc(var(--control-height) - 6px);
  display:grid; place-items:center; flex:0 0 auto;
  width:var(--carousel-arrow-size); min-width:var(--carousel-arrow-size); max-width:var(--carousel-arrow-size);
  height:var(--carousel-arrow-size); min-height:var(--carousel-arrow-size); max-height:var(--carousel-arrow-size);
  aspect-ratio:1; padding:0; border:0; border-radius:var(--radius-round);
  background:transparent; color:var(--color-text); cursor:pointer; overflow:hidden;
}
:is(.feature-carousel,.carousel-rail) button:hover:not(:disabled),
:is(.feature-carousel,.carousel-rail) .carousel-arrow:hover:not(:disabled) {
  background:#ededed; color:var(--color-text); opacity:1;
}
:is(.feature-count,.carousel-count) {
  min-width:40px; color:var(--color-text); text-align:center;
  font-family:var(--font-body); font-size:var(--type-caption-size); line-height:var(--type-caption-line);
  font-weight:500; font-variant-numeric:tabular-nums;
}
:is(.feature-carousel,.carousel-rail) button svg,
:is(.feature-carousel,.carousel-rail) .carousel-arrow svg {
  width:18px; height:18px;
}
:is(.feature-carousel,.carousel-rail) button:focus-visible { outline:var(--focus-ring); outline-offset:var(--focus-offset); }

/* Controls on dark surfaces: explicit contrast variants, not local card overrides. */
.ds-icon-btn.ds-icon-btn--on-dark-primary,
.text-action.ds-icon-btn.ds-icon-btn--on-dark-primary {
  border:1px solid var(--color-surface);
  background:var(--color-surface);
  color:var(--color-text);
}
.ds-icon-btn.ds-icon-btn--on-dark-primary:hover:not(:disabled),
.text-action.ds-icon-btn.ds-icon-btn--on-dark-primary:hover:not(:disabled) {
  border-color:var(--color-surface);
  background:var(--color-surface);
  box-shadow:var(--shadow-control-hover);
  color:var(--color-text);
  opacity:1;
}
.ds-icon-btn.ds-icon-btn--on-dark-secondary,
.text-action.ds-icon-btn.ds-icon-btn--on-dark-secondary {
  border:1px solid color-mix(in srgb,var(--color-surface) 34%,transparent);
  background:color-mix(in srgb,var(--color-surface) 14%,transparent);
  color:var(--color-surface);
}
.ds-icon-btn.ds-icon-btn--on-dark-secondary:hover:not(:disabled),
.text-action.ds-icon-btn.ds-icon-btn--on-dark-secondary:hover:not(:disabled) {
  border-color:color-mix(in srgb,var(--color-surface) 48%,transparent);
  background:color-mix(in srgb,var(--color-surface) 18%,transparent);
  color:var(--color-surface);
  opacity:1;
}
.ds-carousel--on-dark {
  border:0;
  background:color-mix(in srgb,var(--color-surface) 4%,transparent);
}
.ds-carousel--on-dark button {
  border:0;
  background:transparent;
  color:var(--color-surface);
}
.ds-carousel--on-dark button:hover:not(:disabled) {
  background:color-mix(in srgb,var(--color-surface) 16%,transparent);
  color:var(--color-surface);
}
.ds-carousel--on-dark :is(.feature-count,.carousel-count) { color:var(--color-surface); }
/* Compact numeric choice retains its grid; it is not a primary action. */
.capture-rating button { min-height:var(--control-height-compact); padding:6px; border:1px solid var(--color-border); border-radius:var(--radius-sm); background:var(--color-surface); color:var(--color-text); }
.capture-rating button.is-selected { background:var(--color-text); color:var(--color-surface); border-color:var(--color-text); }
:is(.ds-btn,.ds-btn-secondary,.ds-btn-surface,.ds-btn-text,.ds-icon-btn,.ds-pill,.capture-primary,.capture-secondary,.capture-text,.text-action,.text-button,.ds-segment-item,.ds-segment-bar-item,.q-input,.ds-field,.books-more,.authors-more,.books-all-filters):disabled { opacity:.48; cursor:not-allowed; }
:is(.ds-btn,.ds-btn-secondary,.ds-btn-surface,.ds-btn-text,.ds-icon-btn,.ds-pill,.capture-primary,.capture-secondary,.capture-text,.text-action,.text-button,.books-more,.authors-more,.books-all-filters):focus-visible { outline:var(--focus-ring); outline-offset:var(--focus-offset); }
/* Facet/sort/select → dropdown canon выше. */
:is(.books-facet-trigger,.authors-facet-trigger,.series-facet-trigger) { border:0; background:transparent; color:inherit; }
:is(.books-selected-chip,.authors-selected-chip) { border:0; background:var(--ds-soft-fill); color:var(--color-text); }
.q-search-icon { position:static; top:auto; width:18px; height:18px; transform:none; }
.q-search-clear { position:static; top:auto; transform:none; }

/* Standard controls · coss ui visual direction. Special cards are excluded. */
:root {
 --ui-control-radius:var(--radius-pill);
 --ui-control-border:#d4d4d4;
 --ui-control-hover:#ededed;
 --ui-control-ring: color-mix(in srgb, var(--color-accent-lime) 55%, transparent);
 --ui-control-shadow:0 1px 2px rgba(0,0,0,.04);
 --ui-popup-shadow:0 4px 6px -2px rgba(0,0,0,.06),0 12px 24px -8px rgba(0,0,0,.14);
}

/* —— Popup · белая панель без обводки, аккуратная холодная тень ——
   Меню карточки, facet popover, sort picker, suggestions. Не путать с soft/white триггерами. */
.ds-popup,
.books-popover,
.authors-popover,
.author-profile-menu-list,
.capture-menu-list,
.bd-menu-list,
.ds-book-detail .bd-menu-list,
.ser-detail-menu-list,
.books-advanced-dropdown-panel,
.q-suggestions {
  border: 0;
  border-color: transparent;
  border-radius: var(--radius-field);
  background: var(--color-surface);
  box-shadow: var(--ui-popup-shadow);
}
:is(body,#library-view,#authors-view) :is(.ds-btn,.ds-btn-secondary,.capture-primary,.capture-secondary,.capture-trigger,.start-reading,.intent-submit,.quiet-action,.books-more,.authors-more,.ds-icon-btn,.drawer-close,.capture-close,.q-search-clear,.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button,.ds-segment-bar-item,.books-statuses .books-chip,.authors-statuses .authors-chip,.ds-btn-text,.capture-text,.books-clear,.authors-clear,.catalog-clear,.filter-reset-link,.ds-field,.catalog-search,.catalog-select,.q-input,.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.capture-field select,.global-search-head input,#library-sort,#authors-sort,.books-option-search,.authors-option-search,.books-facet-trigger,.authors-facet-trigger,.ds-search-trigger,.search,.ds-nav-item,.nav-item,.q-suggestions button,.search-result,.ds-search-result,input[type=checkbox],input[type=radio],input[type=range]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { transition:background-color .15s,border-color .15s,box-shadow .15s,color .15s; -webkit-tap-highlight-color:transparent; }
:is(body,#library-view,#authors-view) :is(.ds-btn,.ds-btn-secondary,.ds-btn-surface,.capture-primary,.capture-secondary,.capture-trigger,.start-reading,.intent-submit,.quiet-action,.books-more,.authors-more):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { border-radius:var(--ui-control-radius);box-shadow:var(--ui-control-shadow);font-weight:500; }
:is(body,#library-view,#authors-view) :is(.ds-btn-surface):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { border:0; background:var(--color-surface); color:var(--color-text); box-shadow:var(--shadow-selected); }
:is(body,#library-view,#authors-view) :is(.ds-btn-surface):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) { background:var(--color-surface); box-shadow:var(--shadow-control-hover);color:var(--color-text);opacity:1; }
:is(body,#library-view,#authors-view) :is(.ds-btn,.capture-primary,.capture-trigger,.start-reading,.intent-submit):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) { background:#303030;border-color:#303030;color:var(--color-surface);opacity:1; }
:is(body,#library-view,#authors-view) :is(.ds-btn-secondary,.capture-secondary,.quiet-action,.books-more,.authors-more):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):not(.is-selected):not([aria-pressed="true"]) { border:0; background:var(--color-background); color:var(--color-text-secondary); box-shadow:none; }
:is(body,#library-view,#authors-view) :is(.ds-btn-secondary,.capture-secondary,.quiet-action,.books-more,.authors-more):is(.is-selected,[aria-pressed="true"]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { border:0; background:#EBEBEB; color:var(--color-text); box-shadow:none; }
:is(body,#library-view,#authors-view) :is(.ds-btn-secondary,.capture-secondary,.quiet-action,.books-more,.authors-more):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled):not(.is-selected):not([aria-pressed=true]) { background:#EBEBEB;color:var(--color-text);opacity:1; }
:is(body,#library-view,#authors-view) :is(.ds-btn-secondary,.capture-secondary,.quiet-action,.books-more,.authors-more):is(.is-selected,[aria-pressed=true]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) { background:#EBEBEB;color:var(--color-text);opacity:1; }
:is(body,#library-view,#authors-view) :is(.ds-icon-btn,.drawer-close,.capture-close,.books-all-filters):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { border-radius:var(--radius-round); }
:is(body,#library-view,#authors-view) :is(.ds-icon-btn--secondary,.drawer-close,.capture-close):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { background:var(--color-background);border:0;color:var(--color-text-secondary); box-shadow:none; }
:is(body,#library-view,#authors-view) :is(.ds-icon-btn--secondary,.drawer-close,.capture-close):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) { background:#EBEBEB;color:var(--color-text);opacity:1; }
:is(body,#library-view,#authors-view) :is(.ds-icon-btn--surface,.books-all-filters):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { background:var(--color-surface);border:0;color:var(--color-icon-control, #454545); box-shadow:var(--shadow-selected); }
:is(body,#library-view,#authors-view) :is(.ds-icon-btn--surface,.books-all-filters):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) { background:var(--color-surface); box-shadow:var(--shadow-control-hover);color:var(--color-icon-control, #454545);opacity:1; }
:is(body,#library-view,#authors-view) :is(.ds-btn-text,.favorites-all,.capture-text,.capture-reset,.books-clear,.authors-clear,.catalog-clear,.filter-reset-link,.history-back,.q-manual-back):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *, .ds-book-detail *)) { border-radius:0;background:transparent;text-decoration:none; }
:is(body,#library-view,#authors-view) :is(.ds-btn-text,.favorites-all,.capture-text,.capture-reset,.books-clear,.authors-clear,.catalog-clear,.filter-reset-link,.history-back,.q-manual-back):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *, .ds-book-detail *)):hover:not(:disabled) { color:var(--color-text);background:transparent;text-decoration:none; }
/* Fields: soft/white как dropdown; h=36 pill · tall = 12 */
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field:not(select),.catalog-search,.q-input:not(select),.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.books-option-search,.authors-option-search):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  border:var(--ds-soft-focus-border-width, 0.5px) solid transparent; box-shadow:none;
  background-color:var(--ds-field-soft, #EEEEEE); color:var(--color-text);
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field:not(select):not(textarea),.catalog-search,.q-input:not(select):not(textarea),.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.books-option-search,.authors-option-search):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  border-radius:var(--radius-pill); min-height:var(--control-height); height:var(--control-height);
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(textarea.ds-field,textarea.q-input,.capture-field textarea,.ds-field--tall,.q-input--tall):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  border-radius:var(--ds-field-radius-tall, 12px); height:auto; min-height:120px;
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field:not(select),.catalog-search,.q-input:not(select),.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.books-option-search,.authors-option-search):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):is(:focus,:focus-visible) {
  outline:none; box-shadow:none;
  border-color:var(--ds-field-focus-border, #C4C4C4);
  background-color:var(--ds-field-soft, #EEEEEE);
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field--on-soft:not(select),.q-input--on-soft:not(select),.catalog-search--on-soft):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  background-color:var(--ds-field-surface, #fff);
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field--on-soft:not(select),.q-input--on-soft:not(select),.catalog-search--on-soft):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):is(:focus,:focus-visible) {
  background-color:var(--ds-field-surface, #fff);
}
/* Dropdown: soft на белом / white на сером; focus = мягкая рамка, фон тот же */
:is(body,#library-view,#authors-view,#history-view,#series-view) :is(.books-facet-chip,.authors-facet-chip,.series-facet-chip,.books-sort,.authors-sort,.series-sort,select.ds-field--on-soft,.catalog-select--on-soft,.hist-controls select.ds-field):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  border:var(--ds-soft-focus-border-width, 0.5px) solid transparent; border-radius:var(--radius-pill); box-shadow:none;
  min-height:var(--control-height); height:var(--control-height);
  background-color:var(--ds-dropdown-surface, #fff); color:var(--color-text-secondary, var(--muted, #666));
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(select.ds-field:not(.ds-field--on-soft),.catalog-select:not(.catalog-select--on-soft),select.q-input,.capture-field select):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  border:var(--ds-soft-focus-border-width, 0.5px) solid transparent; box-shadow:none;
  min-height:var(--control-height); height:var(--control-height);
  background-color:var(--ds-dropdown-soft, #EEEEEE); color:var(--color-text);
}
/* Shared dropdown hover also overrides page-specific base styles. */
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-dropdown,.books-facet-chip,.authors-facet-chip,.books-sort,.authors-sort,.series-sort,select.ds-field,.catalog-select,select.q-input,.capture-field select):hover:not(:disabled):not(:focus):not(:focus-within) {
  filter:none;
  box-shadow:var(--ds-dropdown-hover-shadow);
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(select.ds-field:not(.ds-field--on-soft),.catalog-select:not(.catalog-select--on-soft),select.q-input,.capture-field select):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):is(:focus,:focus-visible) {
  outline:none; box-shadow:none; filter:none;
  border-color:var(--ds-dropdown-focus-border, #C4C4C4);
  background-color:var(--ds-dropdown-soft, #EEEEEE);
}
:is(body,#library-view,#authors-view,#history-view,#series-view) :is(.books-facet-chip,.authors-facet-chip,.books-sort,.authors-sort,.series-sort,select.ds-field--on-soft,.catalog-select--on-soft,.hist-controls select.ds-field):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):is(:focus,:focus-visible,:focus-within),
:is(body,#library-view,#authors-view,#series-view) :is(.books-facet,.authors-facet):has([aria-expanded=true]) :is(.books-facet-chip,.authors-facet-chip) {
  outline:none; box-shadow:none; filter:none;
  border-color:var(--ds-dropdown-focus-border, #C4C4C4);
  background-color:var(--ds-dropdown-surface, #fff);
}
/* Search: soft/white без обводки — перебивает ID-слой со border */
:is(body,#library-view,#authors-view) :is(.ds-search,.ds-search-trigger,.search,.ds-search-field,.books-search,.authors-search,.q-search-wrap,.books-option-search-wrap,.authors-option-search-wrap):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  border:0; border-color:transparent; border-radius:var(--radius-pill); background:var(--search-soft-background, var(--color-background, #F5F5F5)); box-shadow:none;
  height:var(--control-height); min-height:var(--control-height); max-height:var(--control-height);
}
:is(body,#library-view,#authors-view) :is(.ds-search--on-soft,.search--on-soft,.ds-search-field--on-soft,.q-search-wrap--on-soft,.books-search--on-soft,.authors-search--on-soft):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  background:var(--color-surface);
}
:is(body,#library-view,#authors-view) :is(.ds-search,.ds-search-trigger,.search,.ds-search-field,.books-search,.authors-search,.q-search-wrap,.books-option-search-wrap,.authors-option-search-wrap):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover {
  background:var(--search-soft-hover, #EEEEEE); border-color:transparent; box-shadow:none; color:var(--color-text);
}
:is(body,#library-view,#authors-view) :is(.ds-search--on-soft,.search--on-soft,.ds-search-field--on-soft,.q-search-wrap--on-soft,.books-search--on-soft,.authors-search--on-soft):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover {
  background:var(--color-surface); box-shadow:var(--shadow-control-hover);
}
:is(body,#library-view,#authors-view) :is(.ds-search,.ds-search-trigger,.search,.ds-search-field,.books-search,.authors-search,.q-search-wrap,.books-option-search-wrap,.authors-option-search-wrap,.ds-search--on-soft,.search--on-soft,.ds-search-field--on-soft,.q-search-wrap--on-soft,.books-search--on-soft,.authors-search--on-soft):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):focus-within {
  background:var(--search-soft-focus, var(--color-surface, #fff)); border-color:transparent; 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));
}
:is(body,#library-view,#authors-view) :is(.ds-search input,.ds-search-field input,.books-search input,.authors-search input,.books-option-search-wrap input,.authors-option-search-wrap input,.header-search-input,.q-search-wrap .q-input,.q-search-wrap #q-search):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)),
:is(body,#library-view,#authors-view) :is(.ds-search input,.ds-search-field input,.books-search input,.authors-search input,.books-option-search-wrap input,.authors-option-search-wrap input,.header-search-input,.q-search-wrap .q-input,.q-search-wrap #q-search):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):focus-visible {
  width:100%; height:100%; min-height:0; padding:0; border:0; border-radius:0; background:transparent; outline:none; box-shadow:none;
}
:is(body,#library-view,#authors-view) :is(.ds-btn,.ds-btn-secondary,.capture-primary,.capture-secondary,.capture-trigger,.start-reading,.intent-submit,.quiet-action,.books-more,.authors-more,.ds-icon-btn,.drawer-close,.capture-close,.q-search-clear,.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button,.ds-segment-bar-item,.books-statuses .books-chip,.authors-statuses .authors-chip,.ds-btn-text,.capture-text,.books-clear,.authors-clear,.catalog-clear,.filter-reset-link,.ds-field,.catalog-search,.catalog-select,.q-input,.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.capture-field select,.global-search-head input,#library-sort,#authors-sort,.books-option-search,.authors-option-search,.books-facet-trigger,.authors-facet-trigger,.ds-search-trigger,.search,.ds-nav-item,.nav-item,.q-suggestions button,.search-result,.ds-search-result,input[type=checkbox],input[type=radio],input[type=range]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):focus-visible { outline:2px solid transparent;outline-offset:2px;box-shadow:0 0 0 3px var(--ui-control-ring); }
/* Field + dropdown focus: без ring — только мягкая рамка */
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field:not(select),.catalog-search,.q-input:not(select),.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.books-option-search,.authors-option-search,.books-facet-chip,.authors-facet-chip,.books-sort,.authors-sort,.series-sort,select.ds-field,.catalog-select,select.q-input,.capture-field select,.books-facet-trigger,.authors-facet-trigger):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):is(:focus,:focus-visible,:focus-within) {
  outline:none; box-shadow:none; border-color:var(--ds-soft-focus-border, #C4C4C4);
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(select.ds-field:not(.ds-field--on-soft),.catalog-select:not(.catalog-select--on-soft),select.q-input,.capture-field select):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):is(:focus,:focus-visible) {
  background-color:var(--ds-dropdown-soft, #EEEEEE);
}
:is(body,#library-view,#authors-view,#history-view,#series-view) :is(.books-facet-chip,.authors-facet-chip,.books-sort,.authors-sort,.series-sort,select.ds-field--on-soft,.catalog-select--on-soft,.hist-controls select.ds-field):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):is(:focus,:focus-visible,:focus-within) {
  background-color:var(--ds-dropdown-surface, #fff);
}
/* Author sort: same shadow as ⋯ menu; excluded from soft-focus shadow:none above */
#author-view #author-series-sort {
  box-shadow: var(--shadow-selected);
}
#author-view #author-series-sort:hover:not(:disabled) {
  box-shadow: var(--shadow-control-hover);
}
#author-view #author-series-sort:is(:focus, :focus-visible) {
  outline: none;
  border-color: var(--ds-dropdown-focus-border, #C4C4C4);
  box-shadow: var(--shadow-selected);
}
:is(body,#library-view,#authors-view,#series-view) :is(.books-facet-trigger,.authors-facet-trigger):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):is(:focus,:focus-visible) {
  border-color:transparent; background:transparent;
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field:not(select),.catalog-search,.q-input:not(select),.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.books-option-search,.authors-option-search):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):focus-visible {
  border-color:var(--ds-field-focus-border, #C4C4C4); outline:none; box-shadow:none;
}
:is(body,#library-view,#authors-view) :is(.ds-btn,.ds-btn-secondary,.capture-primary,.capture-secondary,.capture-trigger,.start-reading,.intent-submit,.quiet-action,.books-more,.authors-more,.ds-icon-btn,.drawer-close,.capture-close,.q-search-clear,.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button,.ds-segment-bar-item,.books-statuses .books-chip,.authors-statuses .authors-chip,.ds-btn-text,.capture-text,.books-clear,.authors-clear,.catalog-clear,.filter-reset-link,.ds-field,.catalog-search,.catalog-select,.q-input,.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.capture-field select,.global-search-head input,#library-sort,#authors-sort,.books-option-search,.authors-option-search,.books-facet-trigger,.authors-facet-trigger,.ds-search-trigger,.search,.ds-nav-item,.nav-item,.q-suggestions button,.search-result,.ds-search-result,input[type=checkbox],input[type=radio],input[type=range]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):disabled { opacity:.45;cursor:not-allowed; }
:is(body,#library-view,#authors-view) :is(.ds-field:not(select),.catalog-search,.q-input:not(select),.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.global-search-head input,.books-option-search,.authors-option-search):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *))[aria-invalid=true] { border-color:#b42318;box-shadow:0 0 0 3px rgba(180,35,24,.12); }
/* facet/sort/select focus — канон dropdown выше */
:is(body,#library-view,#authors-view) :is(.books-facet-trigger svg,.authors-facet-trigger svg):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { width:16px;height:16px;flex:0 0 16px;margin-left:0;color:var(--color-icon-control, #454545);transition:transform .15s; }
:is(body,#library-view,#authors-view) :is(.books-facet-trigger[aria-expanded=true] svg,.authors-facet-trigger[aria-expanded=true] svg):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { transform:rotate(180deg); }
:is(body,#library-view,#authors-view) :is(.books-popover,.authors-popover,.q-suggestions,.author-profile-menu-list,.capture-menu-list,.bd-menu-list,.ser-detail-menu-list,.books-advanced-dropdown-panel,.ds-popup):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { border:0;border-color:transparent;border-radius:var(--radius-field);background:var(--color-surface);box-shadow:var(--ui-popup-shadow); }
:is(body,#library-view,#authors-view) :is(.books-popover,.authors-popover):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { padding:12px; }
:is(body,#library-view,#authors-view) :is(.q-suggestions button,.ds-search-result,.search-result):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { border-radius:6px; }
:is(body,#library-view,#authors-view) :is(.q-suggestions button,.ds-search-result,.search-result):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:has(input:disabled)) { background:var(--ui-control-hover); }
:is(body,#library-view,#authors-view,#history-view) :is(.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { border:0; border-color:transparent; border-radius:var(--radius-pill); background:var(--color-surface); color:var(--color-text-secondary); box-shadow:var(--shadow-selected); }
:is(body,#library-view,#authors-view,#history-view) :is(.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled):not(.is-selected):not(.is-active):not([aria-pressed=true]):not([aria-current]) { border-color:transparent; background:var(--color-surface); color:var(--color-text); box-shadow:var(--shadow-control-hover); }
:is(body,#library-view,#authors-view,#history-view) :is(.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button):is(.is-selected,.is-active,[aria-pressed=true],[aria-current]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { background:var(--color-text); border-color:transparent; color:var(--color-surface); box-shadow:none; }
:is(body,#library-view,#authors-view,#history-view) :is(.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button):is(.is-selected,.is-active,[aria-pressed=true],[aria-current]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) { background:#303030; border-color:transparent; color:var(--color-surface); box-shadow:none; opacity:1; }
/* Filter · числовые: та же поверхность, всегда круг */
:is(body,#library-view,#authors-view,#capture-drawer) :is(.q-rating-tab,.books-heat-chip,.authors-heat-chip):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  border:0; border-radius:var(--radius-round); background:var(--color-surface); color:var(--color-text-secondary); box-shadow:var(--shadow-selected);
  width:var(--control-height); min-width:var(--control-height); max-width:var(--control-height);
  height:var(--control-height); min-height:var(--control-height); padding:0; aspect-ratio:1;
}
:is(body,#library-view,#authors-view,#capture-drawer) :is(.q-rating-tab,.books-heat-chip,.authors-heat-chip):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled):not(.is-selected):not([aria-pressed=true]) {
  background:var(--color-surface); color:var(--color-text); box-shadow:var(--shadow-control-hover);
}
:is(body,#library-view,#authors-view,#capture-drawer) :is(.q-rating-tab,.books-heat-chip,.authors-heat-chip):is(.is-selected,[aria-pressed=true]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  background:var(--color-text); color:var(--color-surface); box-shadow:none;
}
:is(body,#library-view,#authors-view,#capture-drawer) :is(.q-rating-tab,.books-heat-chip,.authors-heat-chip):is(.is-selected,[aria-pressed=true]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) {
  background:#303030; color:var(--color-surface); box-shadow:none; opacity:1;
}
:is(body,#library-view,#authors-view,#history-view) :is(.ds-segment,.scope-control,.drawer-segmented):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  display:inline-flex; flex-wrap:wrap; align-items:center; gap:8px; height:auto; min-height:0; padding:0; border:0; border-radius:0; background:transparent; box-shadow:none;
}
:is(body,#library-view,#authors-view) :is(.ds-segment-bar):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { border-radius:var(--ui-control-radius); }
/* Status tabs: не заливка segment-bar — канон underline выше */
:is(body,#library-view,#authors-view) :is(.books-statuses,.authors-statuses,.series-statuses,.home-favorite-filters):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  border:0; border-radius:0; background:transparent; box-shadow:none; overflow:visible;
}
:is(body,#library-view,#authors-view) :is(.books-statuses .books-chip,.authors-statuses .authors-chip,.series-statuses .ds-segment-bar-item,.home-favorite-filter):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  min-height:0; height:auto; padding:0 0 6px; border:0; border-radius:0; background:transparent; box-shadow:none;
  color:var(--color-text-secondary); font-weight:var(--weight-medium, 500);
}
:is(body,#library-view,#authors-view) :is(.books-statuses .books-chip,.authors-statuses .authors-chip,.series-statuses .ds-segment-bar-item,.home-favorite-filter):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled):not(.is-selected):not(.is-active):not([aria-pressed=true]) {
  background:transparent; color:var(--color-text);
}
:is(body,#library-view,#authors-view) :is(.books-statuses .books-chip,.authors-statuses .authors-chip,.series-statuses .ds-segment-bar-item):is(.is-selected,[aria-pressed=true]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)),
:is(body,#library-view,#authors-view) .home-favorite-filter.is-active:not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  background:transparent; color:var(--color-text); font-weight:var(--weight-semibold, 600); opacity:1; box-shadow:none;
}
:is(body,#library-view,#authors-view) :is(.books-statuses .books-chip,.authors-statuses .authors-chip,.series-statuses .ds-segment-bar-item):is(.is-selected,[aria-pressed=true]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled),
:is(body,#library-view,#authors-view) .home-favorite-filter.is-active:not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) {
  background:transparent; color:var(--color-text); opacity:1;
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(input[type=checkbox],input[type=radio],input[type=range],input[type=date],input[type=datetime-local],input[type=month],input[type=week],input[type=time],.q-date-input):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { accent-color:var(--color-text); color-scheme:light; }
:is(body,#library-view,#authors-view) :is(input[type=checkbox],input[type=radio]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { width:var(--ds-checkbox-size, 16px);height:var(--ds-checkbox-size, 16px);flex-shrink:0;cursor:pointer; }
:is(body,#library-view,#authors-view) :is(.ds-nav-item,.nav-item):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover { color:var(--color-text); }
@media (prefers-reduced-motion:reduce) { :is(body,#library-view,#authors-view) :is(.ds-btn,.ds-btn-secondary,.capture-primary,.capture-secondary,.capture-trigger,.start-reading,.intent-submit,.quiet-action,.books-more,.authors-more,.ds-icon-btn,.drawer-close,.capture-close,.q-search-clear,.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button,.ds-segment-bar-item,.books-statuses .books-chip,.authors-statuses .authors-chip,.ds-btn-text,.capture-text,.books-clear,.authors-clear,.catalog-clear,.filter-reset-link,.ds-field,.catalog-search,.catalog-select,.q-input,.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.capture-field select,.global-search-head input,#library-sort,#authors-sort,.books-option-search,.authors-option-search,.books-facet-trigger,.authors-facet-trigger,.ds-search-trigger,.search,.ds-nav-item,.nav-item,.q-suggestions button,.search-result,.ds-search-result,input[type=checkbox],input[type=radio],input[type=range]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { transition:none; } }
@media (forced-colors:active) { :is(body,#library-view,#authors-view) :is(.ds-btn,.ds-btn-secondary,.capture-primary,.capture-secondary,.capture-trigger,.start-reading,.intent-submit,.quiet-action,.books-more,.authors-more,.ds-icon-btn,.drawer-close,.capture-close,.q-search-clear,.ds-pill,.filter-chip,.quick-filter,.browse-filter,.intent-option,.drawer-options button,.ds-segment-item,.scope-option,.drawer-segmented button,.ds-segment-bar-item,.books-statuses .books-chip,.authors-statuses .authors-chip,.ds-btn-text,.capture-text,.books-clear,.authors-clear,.catalog-clear,.filter-reset-link,.ds-field,.catalog-search,.catalog-select,.q-input,.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range]),.capture-field textarea,.capture-field select,.global-search-head input,#library-sort,#authors-sort,.books-option-search,.authors-option-search,.books-facet-trigger,.authors-facet-trigger,.ds-search-trigger,.search,.ds-nav-item,.nav-item,.q-suggestions button,.search-result,.ds-search-result,input[type=checkbox],input[type=radio],input[type=range]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):focus-visible { outline:2px solid Highlight;box-shadow:none; } :is(body,#library-view,#authors-view) :is(select):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { appearance:auto;background-image:none; } }
@supports (appearance:base-select) {
:is(body,#library-view,#authors-view) :is(select:not([multiple]):not([size]),select[size="1"]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) { appearance:base-select;align-items:center; }
:is(body,#library-view,#authors-view) :is(select):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *))::picker(select) { appearance:base-select;border:0;border-color:transparent;border-radius:var(--radius-field);padding:4px;background:var(--color-surface);color:var(--color-text);box-shadow:var(--ui-popup-shadow);margin-block:4px; }
:is(body,#library-view,#authors-view) :is(select):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *))::picker-icon { display:none; }
:is(body,#library-view,#authors-view) :is(select:not([multiple]):not([size])):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) option { padding:8px 10px;border-radius:4px;gap:12px;font:14px/20px var(--font-body); }
:is(body,#library-view,#authors-view) :is(select:not([multiple]):not([size])):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) option:is(:hover,:focus) { background:var(--ui-control-hover);outline:none; }
}

/* Search clear внутри оболочки — крестик цвета текста, без круглой подложки */
:is(body,#library-view,#authors-view,#capture-drawer) :is(.ds-search-clear,.header-search-clear,.q-search-clear):not([hidden]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  display:grid; place-items:center;
  flex:0 0 24px; width:24px; height:24px; min-height:0; max-height:none; margin-right:-4px; padding:0;
  border:0; border-radius:0; background:transparent; box-shadow:none; color:var(--ink, var(--color-text, #111));
}
:is(body,#library-view,#authors-view,#capture-drawer) :is(.ds-search-clear,.header-search-clear,.q-search-clear)[hidden]:not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)) {
  display:none !important;
}
:is(body,#library-view,#authors-view,#capture-drawer) :is(.ds-search-clear,.header-search-clear,.q-search-clear):not([hidden]):not(:where(.book-card *, .small-card *, .medium-card *, .feature-card *, .moment-focus *, .ds-author-card *, .entity-card *, .feature-carousel *, .carousel-rail *, .book-status *, .card-meta *)):hover:not(:disabled) {
  background:transparent; color:var(--ink, var(--color-text, #111)); opacity:1; box-shadow:none;
}
:is(body,#library-view,#authors-view,#capture-drawer) :is(.ds-search-clear,.header-search-clear,.q-search-clear) svg {
  width:16px; height:16px; color:inherit; fill:currentColor; stroke:none;
}

/* White controls: one hover contract across the gallery and application.
   Selected dark controls retain their selected-state rules. */
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-search--on-soft,.search--on-soft,.ds-search-field--on-soft,.q-search-wrap--on-soft,.books-search--on-soft,.authors-search--on-soft):hover:not(:focus-within) {
  background:var(--color-surface);
  box-shadow:var(--shadow-control-hover);
}
/* Explicit white field variant must outrank the general soft-field layer. */
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field:not(select),.q-input:not(select),.catalog-search,.capture-field input:not([type=checkbox]):not([type=radio]):not([type=range])):is(.ds-field--on-soft,.q-input--on-soft,.catalog-search--on-soft) {
  background-color:var(--color-surface);
}
:is(body,#library-view,#authors-view,#history-view,#series-view,#capture-drawer) :is(.ds-field--on-soft:not(select),.q-input--on-soft:not(select),.catalog-search--on-soft):hover:not(:disabled):not(:focus):not(:focus-within) {
  background-color:var(--color-surface);
  box-shadow:var(--shadow-control-hover);
}
@media (forced-colors:active) {
  :is(.ds-btn-surface,.ds-icon-btn--surface,.icon-button--surface,.books-all-filters):hover:not(:disabled) { outline:1px solid Highlight; }
}

/* The white carousel shell follows the same surface rule. */
:is(.feature-carousel,.carousel-rail):not(.ds-carousel--on-dark):has(button:hover:not(:disabled),.carousel-arrow:hover:not(:disabled)) {
  box-shadow:var(--shadow-control-hover);
}
:is(.feature-carousel,.carousel-rail):not(.ds-carousel--on-dark) :is(button,.carousel-arrow):hover:not(:disabled) {
  background:transparent;
}

/* Selected filter values: grey bubbles with a single leading reset action. */
:is(#library-view,#authors-view) :is(.books-selected-chip,.authors-selected-chip) {
  min-height:var(--control-height); padding:8px 14px;
  border:0; border-radius:var(--radius-pill);
  background:var(--ds-soft-fill); color:var(--color-text);
  font-family:var(--font-body); font-size:var(--type-body-size); line-height:var(--type-body-line);
  cursor:pointer; transition:box-shadow .15s;
}
:is(#library-view,#authors-view) :is(.books-selected-chip,.authors-selected-chip):hover:not(:disabled) {
  background:var(--ds-soft-fill); box-shadow:var(--shadow-control-hover);
}
:is(#library-view,#authors-view) .ds-filter-reset {
  flex:0 0 auto; align-self:flex-start;
  width:var(--control-height); min-width:var(--control-height); height:var(--control-height);
  padding:0; border:0; border-radius:var(--radius-round);
  background:var(--color-text); color:var(--color-surface);
}
:is(#library-view,#authors-view) .ds-filter-reset:hover:not(:disabled) { background:#303030; }
.ds-filter-reset svg,
.ds-filter-reset .rm-icon {
  width: 16px;
  height: 16px;
  color: var(--color-surface, #fff);
  fill: currentColor;
  stroke: none;
}

/* A selected facet is indicated by its count, without a persistent border. */
:is(body,#library-view,#authors-view,#series-view) :is(.books-facet,.authors-facet).has-selection :is(.books-facet-chip,.authors-facet-chip) {
  border-color:transparent !important;
}
:is(body,#library-view,#authors-view,#series-view) :is(.books-facet,.authors-facet).has-selection:has(:focus-visible) :is(.books-facet-chip,.authors-facet-chip) {
  outline:var(--focus-ring); outline-offset:var(--focus-offset);
}

/* App notifications share one dismissible stack above drawers. */
.ds-toast-region { position:fixed; top:24px; right:24px; z-index:10000; display:flex; flex-direction:column; align-items:flex-end; gap:12px; width:min(252px,calc(100vw - 48px)); max-height:calc(100dvh - 48px); overflow:auto; pointer-events:none; }
.ds-toast-region > .ds-toast { position:relative; inset:auto; transform:none; width:100%; max-width:100%; box-sizing:border-box; display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:16px 48px 16px 18px; border:0; border-radius:var(--radius-layer); background:var(--color-surface); color:var(--color-text); box-shadow:var(--ui-popup-shadow); font:var(--type-body-size)/var(--type-body-line) var(--font-body); pointer-events:auto; overflow-wrap:anywhere; }
.ds-toast-region > .ds-toast[hidden] { display:none; }
.ds-toast-close { position:absolute; top:10px; right:10px; display:grid; place-items:center; width:28px; height:28px; padding:0; border:0; border-radius:var(--radius-round); background:transparent; color:var(--color-text-secondary); cursor:pointer; }
.ds-toast-close:hover { background:var(--color-background); color:var(--color-text); }
.ds-toast-close:focus-visible { outline:var(--focus-ring); outline-offset:var(--focus-offset); }
.ds-toast-close svg { width:18px; height:18px; }
.ds-toast-close svg.rm-icon,
.ds-toast-close svg.rm-icon path {
  fill: currentColor !important;
  stroke: none !important;
}
.ds-toast-close svg:not(.rm-icon) { fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; }
@media (max-width:720px) { .ds-toast-region { top:16px; right:16px; width:min(252px,calc(100vw - 32px)); max-height:calc(100dvh - 32px); } }

/* Facet popovers use the header search surface and book-menu hover. */
:is(#library-view,#authors-view) :is(.books-option-search-wrap,.authors-option-search-wrap) {
  background:var(--ds-field-soft); color:var(--color-text); border:0;
}
:is(#library-view,#authors-view) :is(.books-option-search-wrap,.authors-option-search-wrap):is(:hover,:focus-within) {
  background:#E8E8E8;
}
:is(#library-view,#authors-view) :is(.books-option,.authors-option):hover:not(:has(input:disabled)),
:is(#library-view,#authors-view) :is(.books-option,.authors-option):focus-within {
  background:var(--status-glass-highlight), rgba(28,28,32,.06);
  -webkit-backdrop-filter:blur(var(--status-glass-blur)) saturate(var(--status-glass-saturation));
  backdrop-filter:blur(var(--status-glass-blur)) saturate(var(--status-glass-saturation));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9), inset 0 -1px 0 rgba(255,255,255,.32);
}

/* Toasts: dark surface; action priority runs from right to left below text. */
.ds-toast-region > .ds-toast {
  display:flex; flex-direction:column; align-items:stretch;
  background:var(--color-text); color:var(--color-surface);
}
.ds-toast .session-toast-text { flex:0 0 auto; }
.ds-toast-actions { display:flex; flex-direction:row-reverse; justify-content:flex-start; flex-wrap:wrap; gap:8px; width:100%; }
.ds-toast-region .ds-toast-actions button { background:var(--color-surface); color:var(--color-text); }
.ds-toast-region .ds-toast-actions button:hover:not(:disabled) { background:var(--color-surface); box-shadow:var(--shadow-control-hover); }
.ds-toast-region .ds-toast-close { color:#fff; }
.ds-toast-region .ds-toast-close:hover { background:rgba(255,255,255,.12); color:#fff; }
.ds-toast-region .ds-toast-close svg.rm-icon,
.ds-toast-region .ds-toast-close svg.rm-icon path {
  fill: #fff !important;
  stroke: none !important;
  color: #fff;
}
#book-universe-save-status.save-retry .ds-toast-actions { flex-direction:column; }
#book-universe-save-status.save-retry .ds-toast-actions button { width:100%; }
@media (min-width:768px) and (max-width:1199px) {
  .ds-toast-region:has(> .save-retry) { width:min(277px,calc(100vw - 48px)); }
}

/* Shared soft search: gray idle, white + book-card shadow on focus. */
:root {
  --search-soft-background: var(--color-background, #F5F5F5);
  --search-soft-hover: #EEEEEE;
  --search-soft-focus: var(--color-surface, #fff);
  --search-soft-focus-shadow: 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.05);
  --search-muted-color: var(--color-icon-muted);
  --search-content-gap: 14px;
  --home-reads-collection-bg: #ecf3f9;
}
:is(body, #library-view, #authors-view, #series-view) :is(.ds-search, .ds-search-trigger, .search, .ds-search-field, .books-search, .authors-search, .q-search-wrap, .books-option-search-wrap, .authors-option-search-wrap) {
  gap: var(--search-content-gap);
  color: var(--color-icon-control, #454545);
}
:is(body, #library-view, #authors-view, #series-view) :is(.ds-search, .ds-search-trigger, .search, .ds-search-field, .books-search, .authors-search, .q-search-wrap, .books-option-search-wrap, .authors-option-search-wrap):not(:is(.ds-search--on-soft, .search--on-soft, .ds-search-field--on-soft, .q-search-wrap--on-soft, .books-search--on-soft, .authors-search--on-soft)) {
  background: var(--search-soft-background);
}
:is(body, #library-view, #authors-view, #series-view) :is(.ds-search, .ds-search-trigger, .search, .ds-search-field, .books-search, .authors-search, .q-search-wrap, .books-option-search-wrap, .authors-option-search-wrap):not(:is(.ds-search--on-soft, .search--on-soft, .ds-search-field--on-soft, .q-search-wrap--on-soft, .books-search--on-soft, .authors-search--on-soft)):hover {
  background: var(--search-soft-hover);
}
:is(body, #library-view, #authors-view, #series-view) :is(.ds-search, .ds-search-trigger, .search, .ds-search-field, .books-search, .authors-search, .q-search-wrap, .books-option-search-wrap, .authors-option-search-wrap):not(:is(.ds-search--on-soft, .search--on-soft, .ds-search-field--on-soft, .q-search-wrap--on-soft, .books-search--on-soft, .authors-search--on-soft)):focus-within {
  background: var(--search-soft-focus);
  box-shadow: var(--search-soft-focus-shadow);
}

:is(body, #library-view, #authors-view, #series-view) :is(.ds-search, .search, .ds-search-field, .books-search, .authors-search, .q-search-wrap, .books-option-search-wrap, .authors-option-search-wrap) :is(input, textarea) {
  color: var(--color-text, var(--ink));
}
:is(body, #library-view, #authors-view, #series-view) :is(.ds-search, .search, .ds-search-field, .books-search, .authors-search, .q-search-wrap, .books-option-search-wrap, .authors-option-search-wrap) :is(svg, .search-icon):not(.ds-search-clear svg, .header-search-clear svg, .q-search-clear svg) {
  /* Leading glyphs in fields: same graphite as white control icons. */
  color: var(--color-icon-control, #454545);
}
:is(body, #library-view, #authors-view, #series-view, #capture-drawer) :is(.ds-search, .search, .ds-search-field, .books-search, .authors-search, .q-search-wrap) :is(.ds-search-clear, .header-search-clear, .q-search-clear) svg {
  color: var(--color-icon-control, #454545);
}
:is(body, #library-view, #authors-view, #series-view) :is(.ds-search, .search, .ds-search-field, .books-search, .authors-search, .q-search-wrap, .books-option-search-wrap, .authors-option-search-wrap) input::placeholder {
  color: var(--search-muted-color);
  opacity: 1;
}
:is(body, #library-view, #authors-view, #series-view) :is(.books-option-search-wrap, .authors-option-search-wrap) svg {
  stroke: currentColor;
}
.ds-filter-selection {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  border-radius: var(--radius-sm, 8px);
  background: var(--color-background);
  color: var(--color-text);
  font: var(--type-body-size) / var(--type-body-line) var(--font-body);
}
.ds-filter-selection-reset {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--color-icon-muted);
  border-radius: 4px;
  background: transparent;
  color: var(--color-text);
  font: 500 18px / 1 var(--font-body);
  cursor: pointer;
}
.ds-filter-selection-reset:disabled { cursor: default; opacity: 1; }
.ds-filter-selection-reset:focus-visible { outline: var(--focus-ring); outline-offset: 3px; }
