#recent-activity,
.activity-list[component="activity-list"],
[component="activity-list"],
[refs="activity-list"] {
  display: none !important;
}

a[href="/login"],
a[href$="/login"],
.header-links a[href*="/login"],
.tri-layout-right a[href*="/login"] {
  display: none !important;
}

button[title*="theme" i],
button[aria-label*="theme" i],
button[title*="dark" i],
button[aria-label*="dark" i],
button[title*="light" i],
button[aria-label*="light" i],
button[title*="тема" i],
button[aria-label*="тема" i],
[data-theme-toggle],
.theme-toggle,
.dark-mode-toggle {
  display: none !important;
}

.tri-layout-right a[href*="view=list"],
.tri-layout-right button[value="list"],
.tri-layout-right [title*="list" i],
.tri-layout-right [aria-label*="list" i],
.tri-layout-right [title*="спис" i],
.tri-layout-right [aria-label*="спис" i],
.actions a[href*="view=list"],
.actions button[value="list"] {
  display: none !important;
}

a,
button,
input,
select,
textarea,
summary,
[role="button"],
[tabindex],
.button,
.card,
.entity-list-item,
.activity-list-item,
.icon-list-item {
  outline: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

a:focus,
a:active,
a:focus-visible,
button:focus,
button:active,
button:focus-visible,
input:focus,
input:active,
input:focus-visible,
select:focus,
select:active,
select:focus-visible,
textarea:focus,
textarea:active,
textarea:focus-visible,
summary:focus,
summary:active,
summary:focus-visible,
[role="button"]:focus,
[role="button"]:active,
[role="button"]:focus-visible,
[tabindex]:focus,
[tabindex]:active,
[tabindex]:focus-visible {
  outline: none !important;
}

header.primary-background,
.primary-background {
  background: linear-gradient(90deg, #3C9BFF 0%, #0E77E5 100%) !important;
  background-color: #2388e8 !important;
  background-image: linear-gradient(90deg, #3C9BFF 0%, #0E77E5 100%) !important;
  border-bottom: none !important;
  box-shadow: 0 8px 18px -16px rgba(15, 23, 42, 0.55) !important;
}

header,
header *,
.primary-background,
.primary-background *,
nav,
nav * {
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

header a[href="/"],
header a[href$="/"],
header .logo,
header .logo *,
header .logo-text,
header .logo-text *,
header .brand,
header .brand *,
.primary-background a[href="/"],
.primary-background a[href$="/"],
.primary-background .logo,
.primary-background .logo *,
.primary-background .logo-text,
.primary-background .logo-text *,
.primary-background .brand,
.primary-background .brand * {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  outline: none !important;
  transform: none !important;
  opacity: 1 !important;
  text-decoration: none !important;
  cursor: pointer !important;
}

header nav a,
header .header-links a,
header .links a,
.primary-background nav a,
.primary-background .header-links a,
.primary-background .links a {
  border-radius: 14px !important;
  color: rgba(255, 255, 255, 0.96) !important;
  transition: background-color 0.10s ease, color 0.10s ease !important;
}

header nav a:hover,
header .header-links a:hover,
header .links a:hover,
.primary-background nav a:hover,
.primary-background .header-links a:hover,
.primary-background .links a:hover {
  background: rgba(255, 255, 255, 0.20) !important;
  color: #ffffff !important;
}

main .entity-list-item,
main .activity-list-item {
  border: 1px solid rgba(15, 23, 42, 0.09) !important;
  border-radius: 12px !important;
  background-clip: padding-box !important;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease !important;
}

main .entity-list-item:hover,
main .activity-list-item:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(14, 119, 229, 0.28) !important;
  box-shadow: 0 12px 22px -18px rgba(15, 23, 42, 0.42) !important;
  background-color: rgba(255, 255, 255, 0.96) !important;
}

main .card:has(a[href*="/shelves/"]),
main .card:has(a[href*="/books/"]),
main .card:has(a[href*="/pages/"]),
main .card:has(a[href*="/chapters/"]),
main .card:has(a[href*="/page/"]),
main .card:has(a[href*="/chapter/"]),
main .grid-card,
main .entity-card,
main .shelf-card,
main .book-card,
main .page-card,
main .chapter-card,
.bs-entity-card {
  border: 1px solid rgba(15, 23, 42, 0.10) !important;
  border-radius: 16px !important;
  background-clip: padding-box !important;
  background-color: rgba(255, 255, 255, 0.96) !important;
  box-shadow:
    0 8px 20px -18px rgba(15, 23, 42, 0.40),
    inset 0 0 0 1px rgba(255, 255, 255, 0.45) !important;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    filter 0.18s ease !important;
}

main .card:has(a[href*="/shelves/"]):hover,
main .card:has(a[href*="/books/"]):hover,
main .card:has(a[href*="/pages/"]):hover,
main .card:has(a[href*="/chapters/"]):hover,
main .card:has(a[href*="/page/"]):hover,
main .card:has(a[href*="/chapter/"]):hover,
main .grid-card:hover,
main .entity-card:hover,
main .shelf-card:hover,
main .book-card:hover,
main .page-card:hover,
main .chapter-card:hover,
.bs-entity-card:hover {
  transform: translateY(-4px) !important;
  border-color: rgba(14, 119, 229, 0.30) !important;
  box-shadow:
    0 16px 26px -20px rgba(15, 23, 42, 0.48),
    0 0 0 3px rgba(14, 119, 229, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55) !important;
  background-color: rgba(255, 255, 255, 0.98) !important;
}

.page-editor main .card,
.page-editor .card,
.editor .card,
.editor-content .card,
.editor-container .card,
.ProseMirror,
[contenteditable="true"] {
  transform: none !important;
  background: #ffffff !important;
}

.shelf-color-marker,
.book-color-marker,
.bs-color-hidden-marker {
  display: none !important;
}

.bs-entity-color-panel {
  margin: 18px 0 20px 0;
  padding: 18px;
  border-radius: 18px;
  background: #f6f8fb;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.bs-entity-color-panel label {
  display: block;
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 15px;
}

.bs-entity-color-row {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.bs-entity-color-circle-wrap {
  width: 76px;
  height: 76px;
  border-radius: 999px;
  padding: 5px;
  background:
    conic-gradient(
      from 0deg,
      #ff004c,
      #ff9900,
      #fff200,
      #22c55e,
      #00c8ff,
      #3C9BFF,
      #944AF9,
      #ff004c
    );
  box-shadow:
    0 10px 22px -14px rgba(15, 23, 42, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  flex: 0 0 auto;
}

.bs-entity-color-panel input[type="color"] {
  width: 66px;
  height: 66px;
  padding: 0;
  border: 4px solid #ffffff;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(15, 23, 42, 0.12),
    0 4px 10px -8px rgba(15, 23, 42, 0.55);
}

.bs-entity-color-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 260px;
  flex: 1 1 260px;
}

.bs-entity-color-preview-text {
  font-size: 14px;
  opacity: 0.78;
}

.bs-entity-section-title {
  font-size: 13px;
  opacity: 0.68;
  margin-bottom: 6px;
}

.bs-entity-preset-row,
.bs-entity-recent-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-height: 34px;
}

.bs-entity-color-preset,
.bs-entity-color-recent {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 3px 8px -5px rgba(15, 23, 42, 0.55),
    0 0 0 1px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease !important;
}

.bs-entity-color-preset:hover,
.bs-entity-color-recent:hover {
  transform: scale(1.12);
  box-shadow:
    0 6px 14px -8px rgba(15, 23, 42, 0.65),
    0 0 0 3px rgba(60, 155, 255, 0.18);
}

.bs-entity-color-preset.is-selected {
  box-shadow:
    0 6px 14px -8px rgba(15, 23, 42, 0.65),
    0 0 0 3px rgba(14, 119, 229, 0.36) !important;
  transform: scale(1.08);
}

.bs-entity-color-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.bs-entity-color-action {
  border: none;
  border-radius: 10px;
  padding: 7px 10px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 5px 12px -10px rgba(15, 23, 42, 0.5);
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    background-color 0.12s ease !important;
}

.bs-entity-color-action:hover {
  transform: translateY(-1px);
  background: #eef6ff;
}

.bs-entity-color-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.bs-entity-color-action.bs-delete-action {
  color: #b91c1c;
}

.bs-entity-color-status {
  font-size: 12px;
  opacity: 0.72;
  min-height: 16px;
  margin-top: 4px;
}

.bs-entity-color-note {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.65;
}

/* Цветные карточки: форма такая же, как у обычных */
main .bs-colored-entity {
  position: relative !important;
  overflow: hidden !important;
  --bs-entity-color: #3C9BFF;
  --bs-entity-color-soft: rgba(60, 155, 255, 0.22);
  border-radius: 16px !important;
  border-color: rgba(15, 23, 42, 0.10) !important;
  background-clip: padding-box !important;
}

main .bs-colored-entity::after {
  content: "";
  position: absolute;
  top: 0;
  right: 18px;
  width: 32px;
  height: 48px;
  z-index: 20;
  pointer-events: none;
  background: var(--bs-entity-color);
  border-radius: 0 0 8px 8px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  box-shadow: 0 8px 16px -10px rgba(15, 23, 42, 0.45);
  transform-origin: top center;
  transition:
    height 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    filter 0.18s ease !important;
}

main .bs-colored-entity:hover {
  border-color: var(--bs-entity-color) !important;
  box-shadow:
    0 16px 26px -20px rgba(15, 23, 42, 0.48),
    0 0 0 3px var(--bs-entity-color-soft),
    inset 0 0 0 1px rgba(255, 255, 255, 0.55) !important;
}

main .bs-colored-entity:hover::after {
  height: 54px;
  transform: translateY(-1px) scale(1.03) rotate(1deg);
  filter: brightness(1.06) saturate(1.08);
}

main .bs-colored-entity .icon,
main .bs-colored-entity svg {
  color: var(--bs-entity-color) !important;
}

main .bs-colored-entity:hover a,
main .bs-colored-entity:hover .icon,
main .bs-colored-entity:hover svg {
  color: var(--bs-entity-color) !important;
}

form.bs-colored-entity::after,
form .bs-colored-entity::after,
.editor .bs-colored-entity::after,
.page-editor .bs-colored-entity::after,
.editor-content .bs-colored-entity::after,
.editor-container .bs-colored-entity::after,
[contenteditable="true"] .bs-colored-entity::after {
  display: none !important;
  content: none !important;
}

#bsBottomSearchButton,
#bsBottomSearchPanel {
  display: none;
}

@media (max-width: 900px) {
  main,
  .content-wrap,
  .page-content,
  .tri-layout-container {
    padding-top: 4px !important;
    margin-top: 0 !important;
  }

  .bs-mobile-page-title,
  main h1:first-child,
  .page-content h1:first-child {
    font-size: 23px !important;
    line-height: 1.16 !important;
    font-weight: 700 !important;
    margin-top: 0 !important;
    margin-bottom: 9px !important;
  }

  .bs-mobile-sort-spacing {
    margin-bottom: 20px !important;
    padding-bottom: 5px !important;
  }

  .bs-mobile-hidden-side-heading {
    display: none !important;
  }

  .bs-mobile-empty-side-space {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }

  .bs-mobile-compact-card {
    padding: 6px 8px !important;
    min-height: 0 !important;
    border-radius: 11px !important;
  }

  .bs-mobile-compact-card h1,
  .bs-mobile-compact-card h2,
  .bs-mobile-compact-card h3,
  .bs-mobile-compact-card h4,
  .bs-mobile-compact-card .title,
  .bs-mobile-compact-card .entity-title,
  .bs-mobile-compact-card a[href*="/shelves/"],
  .bs-mobile-compact-card a[href*="/books/"],
  .bs-mobile-compact-card a[href*="/pages/"],
  .bs-mobile-compact-card a[href*="/chapters/"],
  .bs-mobile-compact-card a[href*="/page/"],
  .bs-mobile-compact-card a[href*="/chapter/"] {
    font-size: 14px !important;
    line-height: 1.16 !important;
    font-weight: 700 !important;
    margin-top: 0 !important;
    margin-bottom: 2px !important;
  }

  .bs-mobile-compact-card p,
  .bs-mobile-compact-card .text-muted,
  .bs-mobile-compact-card .entity-meta,
  .bs-mobile-compact-card .entity-description {
    font-size: 11px !important;
    line-height: 1.18 !important;
    margin-top: 1px !important;
    margin-bottom: 1px !important;
  }

  main .bs-mobile-compact-card.bs-colored-entity {
    overflow: hidden !important;
    border-radius: 11px !important;
  }

  main .bs-mobile-compact-card.bs-colored-entity::after {
    right: 8px !important;
    width: 18px !important;
    height: 29px !important;
    border-radius: 0 0 6px 6px !important;
  }

  #bsBottomSearchButton {
    position: fixed !important;
    right: 18px !important;
    bottom: 18px !important;
    top: auto !important;
    left: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 56px !important;
    height: 56px !important;
    z-index: 2147483647 !important;
    border: none !important;
    border-radius: 999px !important;
    background: linear-gradient(135deg, #3C9BFF 0%, #0E77E5 100%) !important;
    color: #ffffff !important;
    box-shadow:
      0 16px 30px -14px rgba(15, 23, 42, 0.65),
      0 0 0 1px rgba(255, 255, 255, 0.22) !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  #bsBottomSearchButton svg {
    width: 25px !important;
    height: 25px !important;
    stroke-width: 2.6 !important;
  }

  #bsBottomSearchPanel {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    top: 10px !important;
    z-index: 2147483646 !important;
    display: none !important;
    padding: 12px !important;
    border-radius: 18px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid rgba(15, 23, 42, 0.12) !important;
    box-shadow:
      0 18px 36px -20px rgba(15, 23, 42, 0.45),
      0 0 0 1px rgba(255, 255, 255, 0.55) !important;
    max-height: calc(100vh - 22px) !important;
    overflow: hidden !important;
  }

  #bsBottomSearchPanel.is-open {
    display: block !important;
  }

  .bs-bottom-search-form {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 8px !important;
    margin: 0 !important;
    align-items: center !important;
  }

  .bs-bottom-search-input {
    width: 100% !important;
    height: 44px !important;
    border-radius: 14px !important;
    border: 1px solid rgba(15, 23, 42, 0.16) !important;
    padding: 0 13px !important;
    font-size: 15px !important;
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .bs-bottom-search-submit {
    display: none !important;
  }

  .bs-bottom-search-close {
    width: 44px !important;
    height: 44px !important;
    border: none !important;
    border-radius: 14px !important;
    background: #eef2f7 !important;
    color: #0f172a !important;
    font-size: 24px !important;
    cursor: pointer !important;
  }

  .bs-live-search-results {
    margin-top: 10px !important;
    padding-top: 8px !important;
    border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    max-height: calc(100vh - 94px) !important;
    overflow-y: auto !important;
  }

  .bs-live-search-item {
    display: block !important;
    padding: 10px !important;
    border-radius: 13px !important;
    text-decoration: none !important;
    color: #0f172a !important;
    background: #ffffff !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    margin-bottom: 8px !important;
  }

  .bs-live-search-title {
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #0E77E5 !important;
  }

  .bs-live-search-url {
    font-size: 12px !important;
    color: rgba(15, 23, 42, 0.54) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .bs-force-hide-mobile-burger {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}
