/* === Private reading room — premium bookish Operate UI === */
:root {
  --bg: #14110e;
  --bg-side: #12100d;
  --surface: #1a1612;
  --surface-hover: #241f19;
  --border: rgba(196, 163, 90, 0.12);
  --text: #f2ebe0;
  --muted: #a89884;
  --accent: #c4a35a;
  --accent-hover: #d4b56e;
  --link: #d4b06a;
  --link-hover: #e8c984;
  --danger: #d6453d;
  --shell-bg: #16130f;
  --sidebar-bg: #12100d;
  --sidebar-brand-border: rgba(196, 163, 90, 0.10);
  --topbar-bg: rgba(18, 16, 13, 0.82);
  --topbar-border: rgba(196, 163, 90, 0.10);
  --field-bg: rgba(196, 163, 90, 0.05);
  --button-bg: rgba(196, 163, 90, 0.08);
  --button-bg-hover: rgba(196, 163, 90, 0.16);
  --button-border-hover: rgba(196, 163, 90, 0.28);
  --card-cover-bg: linear-gradient(145deg, #1e1a15 0%, #12100d 100%);
  --card-cover-fallback-bg: linear-gradient(180deg, #1a1612 0%, #0e0c0a 100%);
  --card-cover-border: rgba(196, 163, 90, 0.12);
  --card-cover-shadow:
    0 1px 2px rgba(0, 0, 0, 0.45),
    0 8px 20px -6px rgba(0, 0, 0, 0.55),
    0 22px 40px -12px rgba(0, 0, 0, 0.45);
  --card-cover-shadow-hover:
    0 2px 4px rgba(0, 0, 0, 0.5),
    0 14px 28px -8px rgba(0, 0, 0, 0.6),
    0 36px 56px -16px rgba(0, 0, 0, 0.5);
  --panel-soft-bg: rgba(196, 163, 90, 0.07);
  --flash-bg: rgba(16, 185, 129, 0.08);
  --flash-border: rgba(16, 185, 129, 0.2);
  --login-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.65);
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  /* Match theme-engine RADIUS_PRESETS.rounded (pill = 999px only when admin chooses it) */
  --radius-button: 10px;
  --radius-card: 6px;
  --select-list-bg: #221c16;
  --select-list-bg-active: #2e261e;
  --font-size-sm: 12px;
  --font-size-base: 14.5px;
  --font-size-lg: 16px;
  --font-size-xl: 21px;
  --font-size-2xl: 28px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 36px;
  --sidenav-w: 232px;
  --topbar-h: 64px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 48px -16px rgba(0, 0, 0, 0.55);
  --card-bg: rgba(196, 163, 90, 0.03);
  --card-bg-hover: rgba(196, 163, 90, 0.07);
  --display-font: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --ease-premium: cubic-bezier(0.32, 0.72, 0, 1);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px color-mix(in srgb, var(--accent) 65%, transparent);
}

html[data-theme="light"] {
  --bg: #f3ebe0;
  --bg-side: #ebe1d2;
  --surface: #fff9f0;
  --surface-hover: #f5ebdc;
  --border: rgba(55, 40, 24, 0.12);
  --text: #1f1810;
  --muted: #6b5a48;
  --accent: #8a6230;
  --accent-hover: #6e4c24;
  --link: #7a5218;
  --link-hover: #5c3c10;
  --danger: #b53848;
  --shell-bg: #efe6d8;
  --sidebar-bg: #e8dccb;
  --sidebar-brand-border: rgba(55, 40, 24, 0.10);
  --topbar-bg: rgba(255, 249, 240, 0.78);
  --topbar-border: rgba(55, 40, 24, 0.10);
  --field-bg: rgba(255, 255, 255, 0.88);
  --button-bg: rgba(255, 255, 255, 0.88);
  --button-bg-hover: rgba(245, 235, 220, 0.98);
  --button-border-hover: rgba(55, 40, 24, 0.18);
  --card-cover-bg: linear-gradient(145deg, #e8dcc7 0%, #d4c4ab 100%);
  --card-cover-fallback-bg: linear-gradient(180deg, #efe5d5 0%, #dccdb6 100%);
  --card-cover-border: rgba(55, 40, 24, 0.10);
  --card-cover-shadow:
    0 1px 2px rgba(32, 24, 14, 0.12),
    0 10px 24px -10px rgba(32, 24, 14, 0.22),
    0 24px 40px -18px rgba(32, 24, 14, 0.16);
  --card-cover-shadow-hover:
    0 2px 4px rgba(32, 24, 14, 0.14),
    0 16px 32px -12px rgba(32, 24, 14, 0.28),
    0 36px 56px -20px rgba(32, 24, 14, 0.2);
  --panel-soft-bg: rgba(255, 255, 255, 0.55);
  --flash-bg: rgba(16, 185, 129, 0.05);
  --flash-border: rgba(16, 185, 129, 0.15);
  --login-shadow: 0 28px 56px -20px rgba(32, 24, 14, 0.28);
  --shadow-sm: 0 1px 2px rgba(32, 24, 14, 0.06);
  --shadow-md: 0 10px 28px -12px rgba(32, 24, 14, 0.14);
  --shadow-lg: 0 24px 48px -20px rgba(32, 24, 14, 0.2);
  --card-bg: rgba(255, 255, 255, 0.45);
  --card-bg-hover: rgba(255, 255, 255, 0.78);
  --select-list-bg: var(--surface);
  --select-list-bg-active: var(--surface-hover);
}

* {
  box-sizing: border-box;
  margin: 0;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 70%, transparent);
  background-clip: padding-box;
  border: 2px solid transparent;
}

html {
  overflow-x: clip;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--ui-font-family, 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-size-base);
  line-height: 1.55;
  letter-spacing: 0.005em;
}

/* ?? ????????? ?????? (???? ????, ??? ????) ?? */
a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s var(--ease-premium), text-decoration-color 0.2s var(--ease-premium);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
  text-underline-offset: 0.28em;
}

a:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 4px;
}

a.button {
  text-decoration: none;
  color: var(--text);
}

a.button:hover {
  color: var(--text);
  text-decoration: none;
}

label.button {
  text-decoration: none;
  color: var(--text);
}

/* ??????? ???????? ? ??? ????????????? */
a.cover {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.cover:hover {
  color: inherit;
  text-decoration: none;
}

a.cover:active {
  transform: scale(0.98);
}

/* ?????? ??????? ? ??????? ???????? ????????? */
a.table-row-link {
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, background 0.12s, border-color 0.15s;
}

a.table-row-link:hover {
  color: inherit;
  text-decoration: none;
}

a.table-row-link:active {
  transform: scale(0.99);
}

/* ?? Shell: sidenav + main area ?? */
.shell {
  display: flex;
  min-height: 100vh;
  background: var(--shell-bg);
}

/* ?? Side navigation ?? */
.sidebar {
  width: var(--sidenav-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 14px 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.sidebar .brand {
  padding: 4px 18px 18px;
  border-bottom: 1px solid var(--sidebar-brand-border);
}

.sidebar .brand-home-link {
  text-align: center;
}

.sidebar .brand-logo {
  display: block;
  max-width: 100%;
  max-height: 48px;
  margin: 0 auto 10px;
  object-fit: contain;
  transition: transform 0.28s var(--ease-premium);
}

.sidebar .brand-home-link:hover .brand-logo {
  transform: scale(1.03);
}

.sidebar .brand h1,
.sidebar .brand h2 {
  font-family: var(--display-font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  text-align: center;
}

.sidebar .brand p {
  display: none;
}

.sidebar.sidebar-admin {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-admin-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 0;
}

.admin-sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--sidebar-brand-border);
}

.admin-sidebar-version {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--radius);
  background: var(--button-bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.admin-sidebar-version:hover {
  color: var(--link-hover);
}

.sidebar.sidebar-user {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.sidebar-user-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--sidebar-brand-border);
  display: flex;
  justify-content: center;
}

.sidebar-app-pair-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.sidebar-app-pair-btn:hover {
  border-color: var(--accent-hover, #a1671b);
  transform: scale(1.04);
}

.sidebar-app-pair-qr,
.app-pair-qr-wrap {
  display: block;
  line-height: 0;
}

.sidebar-app-pair-qr svg,
.app-pair-qr-wrap svg,
.app-pair-modal-qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.sidebar-app-pair-qr {
  width: 48px;
  height: 48px;
}

.app-pair-hint {
  margin: 4px 0 8px;
  font-size: 12px;
}

.app-pair-app-link {
  margin: 0 0 12px;
  font-size: 13px;
}

.app-pair-app-link a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-pair-app-link a:hover {
  color: var(--link-hover);
}

.app-pair-body {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.app-pair-qr-wrap {
  width: 180px;
  max-width: 100%;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.app-pair-meta {
  flex: 1;
  min-width: 180px;
}

.app-pair-meta-row {
  margin: 0 0 6px;
  font-size: 13px;
  word-break: break-all;
}

.app-pair-expires {
  margin: 8px 0;
  font-size: 12px;
}

.app-pair-error {
  margin: 0 0 8px;
  color: var(--danger, #c0392b);
  font-size: 12px;
}

.app-pair-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.app-pair-modal[hidden] {
  display: none !important;
}

.app-pair-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.app-pair-modal-card {
  position: relative;
  z-index: 1;
  width: min(360px, 100%);
  background: var(--panel-bg, var(--sidebar-bg));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.app-pair-modal-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.app-pair-modal-qr {
  width: min(256px, 100%);
  margin: 12px auto;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.app-pair-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.sidenav-links {
  padding: 12px 10px;
  display: grid;
  gap: 3px;
}

.sidenav-links a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.22s var(--ease-premium), color 0.22s var(--ease-premium), transform 0.18s var(--ease-premium);
}

.sidenav-links a:hover {
  background: var(--button-bg);
  color: var(--text);
}

.sidenav-links a:active {
  transform: scale(0.98);
}

.sidenav-links a.active {
  background: color-mix(in srgb, var(--accent) 14%, var(--button-bg));
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent);
}

.sidenav-section {
  padding: 18px 16px 8px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.72;
}

/* ?? Admin panel design system ?? */
.topbar-admin {
  background: rgba(14, 12, 10, 0.88);
}

html[data-theme="light"] .topbar-admin {
  background: rgba(232, 222, 206, 0.88);
}

.admin-sidebar-badge {
  display: block !important;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  opacity: 0.8;
  margin-top: 4px;
}

.admin-card {
  padding: 18px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-soft-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-card:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--muted));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.admin-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-card-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 14px;
  line-height: 1.45;
}

.admin-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-soft-bg);
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--muted);
}

.admin-status-bar .admin-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.admin-status-bar .admin-chip strong {
  color: var(--text);
  font-weight: 600;
}

.admin-status-bar .admin-chip--warn {
  color: var(--danger, #b45309);
  font-weight: 600;
}

.admin-status-bar .admin-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

/* ?? ????? �?????????? ????????????� (admin/sources) ?? */
.scan-schedule-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
  margin-top: 12px;
}

.scan-schedule-fields .admin-field-group {
  margin-bottom: 0;
  /* gap ? ???????? ??? ???? ?????????? */
}

.scan-schedule-fields .admin-inline-row {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.scan-schedule-fields select,
.scan-schedule-fields input[type="number"],
.scan-schedule-fields input[type="time"] {
  max-width: 220px;
}

.scan-schedule-next {
  margin-top: 14px;
  padding: 8px 12px;
  background: var(--panel-soft-bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

.scan-schedule-log-wrap {
  margin-top: 10px;
}

.scan-schedule-log-wrap summary {
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
}

.scan-schedule-log-wrap summary:hover {
  color: var(--text);
}

.scan-schedule-log-wrap table {
  margin-top: 8px;
  width: 100%;
  font-size: 13px;
}

/* ??? ?????? ? ????? ?????????? ???????????? ? ?????????? �pill�-????????. */
.admin-dow-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.admin-dow-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--button-bg);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, border-color 0.15s;
}

.admin-dow-chip:hover {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
}

.admin-dow-chip input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: var(--accent-hover);
}

.admin-dow-chip:has(input:checked) {
  background: var(--button-bg-hover);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  color: var(--text);
}

.admin-grid-2col {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.admin-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

/* HTML-??????? [hidden] ????? user-agent-????? display:none, ?? ????? ?????
   ? display:flex/grid ??? ?????????? ?? ?????????????. ?????????? ?????????
   ????????? ??? ????????? ????? ?????. */
.admin-field-group[hidden] {
  display: none;
}

.admin-field-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-field-group input,
.admin-field-group select,
.admin-field-group textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.admin-field-group input:focus,
.admin-field-group select:focus {
  border-color: var(--accent);
}

.admin-field-group input[type="color"] {
  width: 56px;
  height: 40px;
  min-width: 56px;
  padding: 2px;
  cursor: pointer;
}

.admin-field-group .admin-field-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

.admin-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* ???????: ????? ???? (??????? ????? ????????????, ??? inline grid) */
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.admin-form-grid--align-start {
  align-items: start;
}

.admin-form-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-form-grid--gap-12 {
  gap: 12px;
}

.admin-action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.admin-action-item:last-child {
  border-bottom: none;
}

.admin-action-item-info {
  flex: 1;
  min-width: 0;
}

.admin-action-item>.admin-actions-row {
  flex-shrink: 0;
  min-width: 260px;
  justify-content: flex-start;
}

.admin-action-item-info strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: block;
  overflow-wrap: break-word;
  word-break: break-word;
}

.admin-action-item-info .muted {
  font-size: 12px;
  line-height: 1.4;
  margin-top: 2px;
}

.monitor-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.monitor-item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
}

.monitor-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.monitor-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.monitor-value {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.monitor-meter {
  margin-top: 8px;
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 25%, transparent);
  overflow: hidden;
}

.monitor-meter>span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #3fb95e 0%, #7ec56b 100%);
  transition: width .35s ease, background .25s ease;
}

.monitor-spark {
  margin-top: 8px;
  width: 100%;
  height: 24px;
  display: block;
  border-radius: 4px;
  background: color-mix(in srgb, var(--muted) 10%, transparent);
}

/* ??????? ????????? ??? CPU / ?????? ? ?????? ?????? ????? ????? ??? ??????????
   ????????? ????????? ??? ????????. */
.monitor-spark--lg {
  height: 72px;
  flex: 1;
}

/* ??????? ??????? + ????? ?????. */
.monitor-graph-wrap {
  display: flex;
  gap: 6px;
  align-items: stretch;
  margin-top: 8px;
}

.monitor-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text);
  opacity: 0.75;
  text-align: right;
  width: 36px;
  line-height: 1;
  padding: 2px 6px 2px 0;
  border-right: 1px dashed color-mix(in srgb, var(--muted) 40%, transparent);
}

.monitor-scale span {
  display: block;
}

/* ???????? ????????? ??? ?????? ?????? ? ?????????, ??? ??????? ?????? ? ??? ?????
   ???????. ????? ??? hover, ????? ????? ????? ?? ?????, ??? ????? �event-loop lag�. */
.monitor-hint {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  opacity: 0.85;
}

/* ???? �???? ??????�: ??????? ???????? ??? ?? ?????????? + ????????? ???????.
   ?????? ?????? = ?????? ?? (100%), ???????? ? ????????????? ???? ?????????. */
.db-stacked-bar {
  display: flex;
  margin-top: 8px;
  height: 8px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--muted) 18%, transparent);
}

.db-stacked-bar>.db-seg {
  display: block;
  height: 100%;
  min-width: 0;
  transition: width .3s ease;
}

.db-legend {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 11px;
  line-height: 1.5;
}

.db-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.db-seg-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.db-legend-label {
  color: var(--text);
}

.db-legend-size {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ????? ????????? ? ????????? ???????, ????????? ??? admins ??? ?????????? ??????. */
.db-seg-books {
  background: #5b9bd5;
}

/* ????????? ????? */
.db-seg-catalogs {
  background: #70c08a;
}

/* ??????? */
.db-seg-covers {
  background: #e8a648;
}

/* ?????? ????????? */
.db-seg-sidecar {
  background: #b487d5;
}

/* ??????? */
.db-seg-activity {
  background: #e07a7a;
}

/* ??????-??????? */
.db-seg-other {
  background: #909090;
}

/* ??????????? ????? */

/* ?? ???? �????�: ??????? ?????? ????????????? ? ?????????? ???????
   ?? 75% / 90% ? ??????? ??????????? (???????????? / ???????? / ?????) ?? */
.monitor-item--disk .disk-bar-track {
  position: relative;
  margin-top: 10px;
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 22%, transparent);
  overflow: hidden;
}

.disk-bar-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width .35s ease, background .25s ease;
}

.disk-bar-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  border-radius: 1px;
  pointer-events: none;
}

.disk-bar-tick--warn {
  background: color-mix(in srgb, #e2bb4f 50%, transparent);
}

.disk-bar-tick--alert {
  background: color-mix(in srgb, #d95050 60%, transparent);
}

.disk-bar-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.4;
}

.disk-bar-stat {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.disk-bar-stat .muted {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.disk-bar-stat strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}

.monitor-spark text.spark-label {
  fill: var(--muted);
  font-size: 8px;
  font-family: sans-serif;
  text-anchor: end;
}

.monitor-spark path.spark-line {
  fill: none;
  stroke: #3fb95e;
  /* ??????? severity-good, ?? ??????? ?? ???? (????????? ??????? ?? ?????? ? ???????) */
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.monitor-spark path.spark-fill {
  fill: color-mix(in srgb, #3fb95e 12%, transparent);
}

/* ?????? ????? ?? 25 / 50 / 75 % ??? ?????????? ?????. */
.monitor-spark line.spark-grid {
  stroke: color-mix(in srgb, var(--muted) 30%, transparent);
  stroke-width: 0.6;
  stroke-dasharray: 2 3;
  vector-effect: non-scaling-stroke;
}

.monitor-spark line.spark-grid-mid {
  stroke: color-mix(in srgb, var(--muted) 50%, transparent);
}

/* ?????????????? ????? ????? ?????? ? ????????. */
.monitor-spark line.spark-axis {
  stroke: color-mix(in srgb, var(--muted) 40%, transparent);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

/* ??? ?????????? ??? ????????: �?????? X% � min Y% � max Z%�. */
.spark-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.spark-stats .spark-stat-now {
  color: var(--text);
  font-weight: 600;
}

.monitor-foot {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

/* ?? Admin utility classes ?? */
.admin-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

.admin-inline-form {
  margin: 0;
}

.admin-compact-btn {
  font-size: .85em;
}

.admin-inline-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-input-sm {
  width: 80px;
}

.admin-input-xs {
  width: 64px;
}

.admin-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
}

/* --- Unsaved-changes indicator --- */
form.is-dirty button[type="submit"] {
  box-shadow: 0 0 0 2px var(--accent, #4a90d9);
  position: relative;
}

form.is-dirty button[type="submit"]::after {
  content: '*';
  color: var(--accent, #4a90d9);
  margin-left: 4px;
  font-weight: bold;
}

.admin-section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.admin-sidecar-diagnostics {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.admin-sidecar-diag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-sidecar-diag-row input {
  flex: 1 1 280px;
  min-width: 0;
}

.admin-sidecar-diag-output {
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--field-bg);
  color: var(--text);
}

.admin-table {
  border-collapse: collapse;
  font-size: .9em;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.admin-table thead th {
  font-weight: 600;
  font-size: .85em;
  color: var(--muted);
  white-space: nowrap;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

.admin-table tbody tr {
  transition: background 0.12s;
}

.admin-table tbody tr:hover {
  background: var(--surface-hover);
}

.admin-table tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface) 60%, var(--panel-soft-bg));
}

.admin-table tbody tr:nth-child(even):hover {
  background: var(--surface-hover);
}

/* ?? Main content area ?? */
.main-wrap {
  margin-left: var(--sidenav-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

/* ?? Top bar ?? */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(18px) saturate(1.15);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
}

.topbar-admin {
  border-bottom-color: color-mix(in srgb, var(--accent) 28%, transparent);
}

.topbar .brand {
  display: none;
}

/* Global search in topbar */
.topbar-search {
  flex: 1;
  max-width: 520px;
  display: flex;
  gap: 8px;
  opacity: 1;
}

.topbar-search input {
  flex: 1;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
  height: 42px;
  transition: border-color 0.22s var(--ease-premium), box-shadow 0.22s var(--ease-premium);
}

.topbar-search input::placeholder {
  color: var(--muted);
}

.topbar-search input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.topbar-search select {
  width: auto;
  min-width: 100px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--field-bg);
  color: var(--muted);
  font-size: 13px;
  height: 42px;
}

.topbar-search select option {
  background-color: var(--select-list-bg);
  color: var(--text);
}


.topbar-search select:hover {
  color: var(--text);
}

.search-suggest-wrap {
  position: relative;
  flex: 1;
}

.search-suggest-wrap input {
  width: 100%;
}

.search-suggest-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--ui-glass-menu-bg, var(--ui-glass-panel-bg, var(--surface)));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 420px;
  overflow-y: auto;
  padding: 8px 0;
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  animation: popover-enter 0.2s var(--ease-premium);
}

.suggest-group-title {
  padding: 8px 16px 6px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.suggest-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-right: 10px;
}

.suggest-history-header .suggest-group-title {
  flex: 1;
  min-width: 0;
}

.suggest-history-clear {
  border: 0;
  background: transparent;
  color: var(--link);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius);
}

.suggest-history-clear:hover {
  color: var(--link-hover);
  background: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 12%, transparent));
}

.suggest-history-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}

.suggest-history-row .suggest-item {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  text-align: left;
  width: 100%;
  font: inherit;
}

.suggest-history-remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  min-width: 44px;
  font-size: 18px;
  line-height: 1;
  padding: 0 10px;
}

.suggest-history-remove:hover {
  color: var(--text);
  background: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 12%, transparent));
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.1s;
  text-decoration: none;
  color: var(--link);
  min-height: 44px;
}

.suggest-item:hover,
.suggest-item.suggest-active {
  background: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface)));
  box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
  color: var(--link-hover);
}

.suggest-item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggest-item-sub {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.suggest-empty {
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-logout-form {
  display: contents;
}

.topbar-brand {
  display: none;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.topbar-brand-logo {
  display: block;
  width: auto;
  height: 28px;
  max-width: 36px;
  object-fit: contain;
}

.topbar-search-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.topbar-search-toggle:hover {
  background: var(--button-bg-hover);
}

.topbar-search-toggle[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.topbar-desktop-tools {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.sidebar-tools {
  display: none;
}

.topbar-right a {
  font-size: 12px;
  padding: 5px 10px;
}

.topbar-lang {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 2px;
  font-size: 12px;
}

.topbar-lang-link {
  color: var(--link);
  text-decoration: none;
  opacity: 0.85;
  padding: 6px 8px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  transition: opacity 0.15s, transform 0.15s;
}

.topbar-lang-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.topbar-lang-link:active {
  transform: scale(0.95);
}

.topbar-lang-link.is-active {
  font-weight: 700;
  opacity: 1;
}

.brand-home-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.brand-home-link:hover {
  opacity: 0.92;
}

.brand-home-link:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
  border-radius: 4px;
}

.theme-toggle {
  min-width: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text);
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s ease;
}

.theme-toggle:hover {
  background: color-mix(in srgb, var(--button-bg-hover) 85%, transparent);
  border-color: var(--button-border-hover);
  color: var(--link-hover);
}

.theme-toggle:active {
  transform: scale(0.94);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 50%;
}

.theme-toggle span {
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-search input,
.topbar-search select {
  height: 36px;
}

.topbar-search button {
  height: 36px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.topbar-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.topbar-context {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.7;
}

/* Hidden old nav (replaced by sidenav) */
.nav {
  display: none;
}

/* ?? Content panel ?? */
.panel {
  padding: 28px 32px 48px;
  flex: 1;
  width: 100%;
  min-width: 0;
  overflow-x: clip;
}

/* Layout compatibility: hide old two-column layout structure */
.layout {
  display: contents;
}

/* ?? Buttons ?? */
.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid var(--border);
  border-radius: var(--radius-button, 999px);
  background: var(--button-bg);
  color: var(--text);
  cursor: pointer;
  transition: background 0.22s var(--ease-premium), border-color 0.22s var(--ease-premium), box-shadow 0.22s var(--ease-premium), transform 0.18s var(--ease-premium);
}

.button:hover,
button:hover {
  background: color-mix(in srgb, var(--button-bg-hover) 90%, transparent);
  border-color: var(--button-border-hover);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.button:active,
button:active {
  transform: scale(0.98);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.button:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@keyframes fav-pulse {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.12);
  }

  100% {
    transform: scale(1);
  }
}

.button.is-active,
button.is-active,
.button[data-active-favorite="true"],
button[data-active-favorite="true"] {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  color: var(--text);
  animation: fav-pulse 0.35s ease;
}

.button.is-active:active,
button.is-active:active,
.button[data-active-favorite="true"]:active,
button[data-active-favorite="true"]:active {
  animation: none;
  transform: scale(0.97);
}

.button.is-active:hover,
button.is-active:hover,
.button[data-active-favorite="true"]:hover,
button[data-active-favorite="true"]:hover {
  background: color-mix(in srgb, var(--accent) 24%, var(--surface-hover));
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
}

/* ?? Forms ?? */
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-form select {
  background: var(--field-bg);
}

.search-form label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 4px;
}

.vertical-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
}

.vertical-form label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: block;
  margin-bottom: 4px;
}

.vertical-form input,
.vertical-form select {
  width: 100%;
}

.vertical-form>button {
  width: 100%;
  margin-top: 4px;
  min-height: 40px;
}

input,
select,
textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s ease;
}

select {
  accent-color: var(--accent-hover);
}

select option,
select optgroup {
  background-color: var(--select-list-bg);
  color: var(--text);
}

select option:hover {
  background-color: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface)));
  box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
}

select option:checked {
  background-color: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface)));
  box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
  color: var(--text);
}

html[data-ui-sliders="1"] select option:not(:hover):not(:checked):not(:focus):not(:focus-visible),
html[data-ui-sliders="1"] select optgroup {
  background-color: transparent;
}

/* Chrome/Edge 135+: web-rendered picker ? ?????? ???????? hover/focus */
@supports (appearance: base-select) {

  select,
  select::picker(select) {
    appearance: base-select;
  }

  select::picker(select) {
    background: var(--ui-glass-menu-bg, var(--ui-glass-panel-bg, var(--select-list-bg)));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    color-scheme: dark;
    backdrop-filter: blur(var(--ui-surface-blur, 0px));
    -webkit-backdrop-filter: blur(var(--ui-surface-blur, 0px));
  }

  html[data-theme="light"] select::picker(select) {
    color-scheme: light;
  }

  select option {
    padding: 8px 10px;
    border-radius: calc(var(--radius) - 2px);
  }

  select option:hover,
  select option:focus,
  select option:focus-visible {
    background-color: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface)));
    box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
    color: var(--text);
    outline: none;
  }

  select option::checkmark {
    color: var(--link);
  }
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

/* ?? Section titles ?? */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-title h2 {
  font-family: var(--display-font);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.page-intro-home {
  margin-bottom: 12px;
}

.page-intro-slim {
  margin-bottom: 14px;
}

.page-intro-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.page-intro-copy h1 {
  font-family: var(--display-font);
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.page-intro-copy p {
  max-width: 72ch;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.page-intro-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.page-intro-actions .download-menu-popover {
  left: auto;
  right: 0;
}

.page-intro-actions .download-menu-popover--batch {
  min-width: 248px;
}

.page-intro-actions .download-menu {
  display: inline-flex;
  align-items: stretch;
}

.page-intro-actions .download-menu > .button {
  min-height: 0;
}

/* ?? Home page title + subtitle (persists above quote / hero card) ?? */
.home-page-intro {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.home-page-subtitle {
  margin: 0;
  max-width: 78ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* ?? Home reveal animation ?? */
.home-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.home-reveal.home-reveal-active {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .home-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ?? Welcome hero banner + premium hero card (shared surface) ?? */
.welcome-hero-banner,
.premium-hero-card {
  position: relative;
  margin-bottom: 28px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  --hero-card-bg:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 86%, var(--accent) 14%) 0%, var(--surface) 52%, color-mix(in srgb, var(--bg) 90%, #000 10%) 100%);
  background: var(--hero-card-bg);
  box-shadow: var(--shadow-md);
}

.welcome-hero-banner::before,
.premium-hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}

html[data-theme="light"] .welcome-hero-banner::before,
html[data-theme="light"] .premium-hero-card::before {
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.welcome-hero-banner {
  padding: 48px 40px;
}

.welcome-hero-overlay,
.premium-hero-card::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, color-mix(in srgb, var(--link) 10%, transparent) 0%, transparent 70%),
    linear-gradient(180deg, transparent 60%, color-mix(in srgb, var(--bg) 25%, transparent) 100%);
}

html[data-theme="light"] .welcome-hero-overlay,
html[data-theme="light"] .premium-hero-card::after {
  background:
    radial-gradient(ellipse 70% 55% at 12% 18%, color-mix(in srgb, var(--link) 6%, transparent) 0%, transparent 68%),
    linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--bg) 12%, transparent) 100%);
}

.welcome-hero-content {
  position: relative;
  z-index: 1;
  max-width: 62ch;
}

.welcome-hero-quote {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(22px, 2.6vw, 30px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.42;
  color: var(--text);
  letter-spacing: -0.015em;
}

.welcome-hero-author {
  display: block;
  margin-top: 16px;
  font-family: var(--display-font);
  font-size: 15px;
  font-style: normal;
  font-weight: 600;
  color: var(--link);
  letter-spacing: 0.03em;
}

.welcome-hero-author a {
  color: inherit;
  text-decoration: none;
}

.welcome-hero-author a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ?? Premium hero card (continue reading) ?? */
.premium-hero-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  align-items: center;
  padding: 32px 36px;
  transition: box-shadow 0.4s var(--ease-premium), transform 0.4s var(--ease-premium);
}

.premium-hero-card::after {
  content: '';
  z-index: 0;
}

.premium-hero-card:hover {
  box-shadow: var(--shadow-lg);
}

.hero-card-cover-side,
.hero-card-info-side {
  position: relative;
  z-index: 1;
}

.hero-card-cover-side {
  display: flex;
  justify-content: center;
}

.hero-cover-link {
  display: block;
  position: relative;
  width: 100%;
  max-width: 200px;
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.4s ease;
  text-decoration: none;
}

.hero-cover-link::before {
  content: '';
  position: absolute;
  top: 4px;
  left: -8px;
  width: 10px;
  height: calc(100% - 8px);
  border-radius: 2px 0 0 2px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--bg) 70%, #000 30%) 0%, color-mix(in srgb, var(--surface) 60%, #000 40%) 100%);
  transform: translateZ(-6px) rotateY(12deg);
  box-shadow: inset -1px 0 2px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.hero-cover-link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1px 4px 4px 1px;
  background: linear-gradient(125deg, rgba(255, 255, 255, 0.18) 0%, transparent 42%, transparent 78%, rgba(255, 255, 255, 0.06) 100%);
  box-shadow: inset -3px 0 6px rgba(0, 0, 0, 0.12);
  pointer-events: none;
}

.premium-hero-card:hover .hero-cover-link {
  transform: translateY(-6px) rotateY(-5deg) scale(1.02);
}

.hero-cover-image,
.hero-cover-link .cover-image {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 1px 4px 4px 1px;
  border: 1px solid var(--card-cover-border);
  box-shadow: var(--card-cover-shadow);
  background: var(--card-cover-bg);
}

.hero-card-info-side {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.hero-card-kicker {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-card-title {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(26px, 3.1vw, 36px);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.025em;
}

.hero-card-author {
  font-size: 15px;
  color: var(--muted);
}

.hero-card-author a {
  color: var(--link);
}

.hero-card-author a:hover {
  color: var(--link-hover);
}

.hero-card-annotation {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.hero-card-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--border) 80%, transparent);
  overflow: hidden;
}

.hero-card-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.35s ease;
}

.hero-card-progress-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--link);
  white-space: nowrap;
  flex-shrink: 0;
}

.hero-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.premium-hero-card .button-primary {
  background: var(--link);
  border-color: var(--link);
  color: #1a1612;
  font-weight: 600;
}

.premium-hero-card .button-primary:hover {
  background: var(--link-hover);
  border-color: var(--link-hover);
  color: #1a1612;
}

html[data-theme="light"] .premium-hero-card .button-primary {
  color: #fffdf8;
}

html[data-theme="light"] .premium-hero-card .button-primary:hover {
  color: #fffdf8;
}

.premium-hero-card .button-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.premium-hero-card .button-secondary:hover {
  background: var(--ui-glass-active-bg, var(--button-bg-hover));
  border-color: var(--button-border-hover);
}

.library-shelf .section-title h2,
.library-shelf-secondary .section-title h2 {
  letter-spacing: 0.01em;
}

.section-intro {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-soft-bg);
}

.section-intro h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.section-intro p {
  color: var(--muted);
  max-width: 760px;
}

.browse-filter {
  gap: 10px;
}

.browse-filter .actions {
  margin-top: 0;
}

.browse-filter .button,
.browse-filter button {
  padding: 6px 12px;
}

.section-title .search-form {
  gap: 0;
}

.section-title .search-form select {
  min-width: 180px;
  height: 34px;
  padding: 6px 10px;
  color: var(--muted);
}

.section-title .search-form select:focus {
  color: var(--text);
}

/* ?? Breadcrumbs ?? */
.breadcrumbs {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--link);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 45%, transparent);
}

/* ?? Book cover grid ?? */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 32px 22px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  height: 100%;
  align-self: stretch;
  position: relative;
  z-index: 0;
  background: transparent;
  padding: 0;
  overflow: visible;
  border: none;
}

.card:hover {
  background: transparent;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover .cover {
    transform: translateY(-8px);
    box-shadow: var(--card-cover-shadow-hover);
  }
}

.card:active .cover {
  transform: translateY(-1px) scale(0.99);
}

.card:hover,
.card:focus-within {
  z-index: 5;
}

.card:has(.download-menu[open]) {
  z-index: 12;
}

.book-detail-shell:has(.download-menu[open]) {
  position: relative;
  z-index: 12;
}

.card:has(.author-popover:popover-open) {
  z-index: 12;
}

.card:has(.series-popover:popover-open) {
  z-index: 12;
}

.cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--card-cover-bg);
  position: relative;
  /* Корешок слева — лёгкое скругление; справа — чуть мягче обреза */
  border-radius: 1px 4px 4px 1px;
  display: block;
  isolation: isolate;
  container-type: inline-size;
  box-shadow: var(--card-cover-shadow);
  transition: transform 0.35s var(--ease-premium), box-shadow 0.35s var(--ease-premium);
  /* Long-press on the cover toggles "read" ? suppress native callout/selection/drag
     so iOS/Android Chrome don't hijack the gesture with image preview menus. */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.cover img {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* Indeterminate progress bar for indexing phases without measurable progress
   (e.g., post-index ANALYZE / cache warmup). Slides a translucent highlight
   across the filled bar so users see the pipeline is still working. */
@keyframes indexBarIndeterminate {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.progress-indeterminate {
  background-image: linear-gradient(90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.55) 50%,
      transparent 100%);
  background-size: 50% 100%;
  background-repeat: no-repeat;
  animation: indexBarIndeterminate 1.4s linear infinite;
}

/* Long-press visual feedback ? replaces unreliable Android haptics with a guaranteed
   visual cue at the moment the "mark as read" toggle fires. */
@keyframes coverLongPressFlash {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }

  35% {
    transform: scale(0.95);
    filter: brightness(1.25);
  }

  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.cover.cover-longpress-flash {
  animation: coverLongPressFlash 280ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .cover.cover-longpress-flash {
    animation: none;
  }
}

html[data-theme="light"] .cover {
  box-shadow: var(--card-cover-shadow);
}

.cover-inner {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  z-index: 1;
}

/* Spine highlight + cover lighting overlay - sits on top of image */
.cover::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  background:
    /* Subtle top sheen */
    linear-gradient(to bottom,
      rgba(255, 255, 255, 0.05) 0%,
      rgba(255, 255, 255, 0) 25%,
      rgba(0, 0, 0, 0) 75%,
      rgba(0, 0, 0, 0.06) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

/* Spine groove on left edge - imitates the binding fold */
.cover::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 8px;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(to right,
      rgba(0, 0, 0, 0.18) 0%,
      rgba(0, 0, 0, 0.05) 25%,
      rgba(255, 255, 255, 0.08) 50%,
      rgba(0, 0, 0, 0.10) 75%,
      rgba(255, 255, 255, 0.04) 100%);
}

/* ???????? ????????? ????: ??? absolute flex ?????? ???? ??????? ?????? ? img ?? ?????????. */
@keyframes cover-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.cover-image {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: transparent;
  opacity: 0;
  visibility: visible;
  border-radius: inherit;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.cover:active .cover-image {
  transform: scale(1.02);
}

.cover-image.is-loaded {
  opacity: 1;
}

/*
 * Two-state cover model:
 *   - .cover-fallback is ALWAYS rendered visible (z-index:1, beneath the img).
 *   - .cover-image starts with opacity:0; once it loads, JS adds .is-loaded
 *     and the picture fades in on top (z-index:2), occluding the fallback.
 *   - On error, .is-loaded never gets added ? fallback simply stays visible.
 */

.cover-fallback {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  border-radius: inherit;
  overflow: hidden;
}

.cover-fallback-image,
.cover-fallback-overlay {
  position: absolute;
  inset: 0;
}

.cover-fallback-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-fallback-overlay {
  background: linear-gradient(180deg, rgba(13, 13, 20, 0.18) 0%, rgba(13, 13, 20, 0.48) 100%);
}

html[data-theme="light"] .cover-fallback-overlay {
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.06) 0%, rgba(109, 79, 42, 0.18) 100%);
}

.cover-fallback-copy {
  position: absolute;
  /* ?????????? ???? ?????? ????????? book-fallback.png */
  inset: 11% 15% 30%;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.42em;
  padding: 0.15em 0 0;
  text-align: center;
  box-sizing: border-box;
  overflow: hidden;
}

.cover-fallback-title,
.cover-fallback-author {
  width: 100%;
  max-width: 100%;
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  text-wrap: balance;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cover-fallback-title {
  font-family: var(--ui-font-family, 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  font-size: clamp(11px, 7cqi, 20px);
  line-height: 1.14;
  font-weight: 700;
  letter-spacing: 0.015em;
  color: #f6f1e6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65), 0 0 1px rgba(0, 0, 0, 0.4);
  -webkit-line-clamp: 7;
  line-clamp: 7;
}

.cover-fallback-author {
  font-family: var(--ui-font-family, 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  font-size: clamp(8px, 4.2cqi, 13px);
  line-height: 1.22;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.02em;
  color: rgba(246, 241, 230, 0.78);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  margin-top: 0.15em;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* ???????? ???????? ? ???? ??????????, ?? ??????? */
.card .cover-fallback-copy {
  inset: 12% 15% 32%;
}

.card .cover-fallback-title {
  font-size: clamp(10px, 6.5cqi, 16px);
  -webkit-line-clamp: 8;
  line-clamp: 8;
}

.card .cover-fallback-author {
  font-size: clamp(7px, 3.8cqi, 11px);
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

/* ???????? ????? ? ??????? �?????????� ??????? */
.book-detail-cover .cover-fallback-copy {
  inset: 10% 13% 32%;
  gap: 0.55em;
  padding-top: 0.1em;
}

.book-detail-cover .cover-fallback-title {
  font-size: clamp(16px, 7.2cqi, 26px);
  line-height: 1.12;
  -webkit-line-clamp: 9;
  line-clamp: 9;
}

.book-detail-cover .cover-fallback-author {
  font-size: clamp(10px, 4.2cqi, 15px);
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

.hero-cover-link .cover-fallback-copy {
  inset: 13% 12% 20%;
}

.hero-cover-link .cover-fallback-title {
  font-size: clamp(12px, 5.5cqi, 20px);
}

.meta {
  display: grid;
  gap: 6px;
  padding: 0 2px;
}

.meta h3 {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0;
  line-height: 1.34;
  letter-spacing: -0.01em;
  min-height: 0;
  max-height: calc(1.34em * 3);
  overflow: hidden;
}

.meta h3 a {
  color: var(--link);
  text-decoration: none;
}

.meta h3 a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
}

.meta .author {
  color: var(--text);
  font-size: 12px;
  margin: 0;
  min-height: 0;
  max-height: calc(1.35em * 2);
  overflow: hidden;
  line-height: 1.38;
  opacity: 0.78;
}

.meta .author a {
  color: var(--link);
  text-decoration: none;
  opacity: 1;
}

.meta .author a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
}

.meta .annotation {
  display: none;
}

.meta h3 a,
.meta .author a,
.meta .author,
.card-series a,
.card-series {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.meta h3 a {
  line-clamp: 3;
  -webkit-line-clamp: 3;
}

.meta .author a,
.meta .author {
  line-clamp: 2;
  -webkit-line-clamp: 2;
}

.card .meta h3,
.card .meta .author,
.card .card-series {
  padding: 0 2px;
}

/* ????????? ??????? ??????? ???? ? �???????� ?? ????? ????? ? ???? ???????? */
.card .meta {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 5px;
  padding: 0 2px;
}

.card .meta .card-actions {
  margin-top: auto;
  padding-top: 6px;
}

.card-series {
  font-size: 11px;
  color: var(--muted);
  min-height: 0;
  line-height: 1.34;
  opacity: 0.84;
  line-clamp: 2;
  -webkit-line-clamp: 2;
}

.card-series a {
  color: var(--link);
  text-decoration: none;
}

.card-series a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
}

.card-series a:active,
.meta h3 a:active,
.meta .author a:active {
  opacity: 0.8;
}

.author-visible {
  display: inline;
}

.author-popover-trigger {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  margin-left: 2px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  font-family: inherit;
}

.author-popover-trigger:hover {
  color: var(--text);
}

.author-inline {
  display: inline;
  cursor: pointer;
}

.author-inline-check {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.author-inline-trigger {
  display: inline;
  color: var(--muted);
  font-size: inherit;
  user-select: none;
}

.author-inline:hover .author-inline-trigger {
  color: var(--text);
}

.author-inline:has(.author-inline-check:checked) .author-inline-trigger {
  color: var(--link);
  font-weight: 500;
}

.author-inline-trigger .author-inline-arrow::after {
  content: ' \25bc';
  font-size: 10px;
}

.author-inline:has(.author-inline-check:checked) .author-inline-trigger .author-inline-arrow::after {
  content: ' \25b2';
}

.author-inline-rest {
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
}

.author-inline:has(.author-inline-check:checked) .author-inline-rest {
  max-height: 1200px;
  opacity: 1;
}

.author-popover {
  background: var(--ui-glass-menu-bg, var(--ui-glass-panel-bg, var(--surface)));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  max-width: min(90vw, 640px);
  position-area: bottom span-right;
  margin-top: 4px;
  backdrop-filter: blur(var(--ui-surface-blur, 0px));
  -webkit-backdrop-filter: blur(var(--ui-surface-blur, 0px));
}

.author-popover-inner {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
}

.author-popover-inner a {
  display: inline;
  padding: 4px 8px;
  margin: 0 -2px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--link);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.author-popover-inner a:hover {
  color: var(--link-hover);
  background: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface)));
  box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
}

.series-visible {
  display: inline;
}

.series-popover-trigger {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  margin-left: 2px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  font-family: inherit;
}

.series-popover-trigger:hover {
  color: var(--text);
}

.series-popover {
  background: var(--ui-glass-menu-bg, var(--ui-glass-panel-bg, var(--surface)));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  max-width: min(90vw, 640px);
  position-area: bottom span-right;
  margin-top: 4px;
  backdrop-filter: blur(var(--ui-surface-blur, 0px));
  -webkit-backdrop-filter: blur(var(--ui-surface-blur, 0px));
}

.series-popover-inner {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
}

.series-popover-inner a {
  display: inline;
  padding: 4px 8px;
  margin: 0 -2px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--link);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.series-popover-inner a:hover {
  color: var(--link-hover);
  background: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface)));
  box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
}

.card-read-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.read-progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}

.read-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent, #3b82f6);
  transition: width 0.3s ease;
}

.read-progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--link);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ?? Cover rating badge (bookmark ribbon, fixed height, bottom-up stars) ?? */
.cover-rating-wrapper {
  position: absolute;
  top: 0;
  left: 5px;
  /* ???? 6px, ???????? */
  z-index: 4;
  pointer-events: none;
  filter:
    drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.55)) drop-shadow(2px 5px 6px rgba(0, 0, 0, 0.35)) drop-shadow(0 8px 14px rgba(0, 0, 0, 0.2));
}

.cover-rating-badge {
  width: 17px;
  /* ???? 20px (20 � 0.85 = 17) */
  height: 75px;
  /* ???? 88px (88 � 0.85 = 74.8 ? 75) */
  padding: 3px 2px 14px;
  /* ???? 4px 2px 16px */
  font-size: 10px;
  /* ???? 12px (12 � 0.85 = 10.2 ? 10) */
  font-weight: 800;
  line-height: 1;
  color: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  border-radius: 0 0 2px 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: flex-start;
  gap: 1px;
  /* ???? 2px */
  position: relative;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.25),
    inset 0 -2px 3px rgba(0, 0, 0, 0.12),
    0 2px 3px rgba(0, 0, 0, 0.18);
}

/* ???? ????????? ?????? ??????????? */
.cover-rating-badge::before {
  content: '';
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  pointer-events: none;
  z-index: 2;
}

/* ???????????? ????????? */
.cover-rating-badge::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-left: 0.5px dashed rgba(255, 255, 255, 0.45);
  border-right: 0.5px dashed rgba(255, 255, 255, 0.45);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
  pointer-events: none;
}

.cover-rating-badge>span {
  height: 10px;
  /* ???? 12px (12 � 0.85 = 10.2 ? 10) */
  line-height: 10px;
  /* ???? 12px */
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffe14d;
}

.cover-rating-badge .star-active {
  color: #ffe14d;
}

.cover-rating-badge .star-inactive {
  visibility: hidden;
}

/* ????? ????? ???????? ???? ? ??? ????????? */
.cover-rating-1,
.cover-rating-2,
.cover-rating-3,
.cover-rating-4,
.cover-rating-5 {
  background-size: cover;
  background-repeat: no-repeat;
}

/* 5 ????? */
.cover-rating-5 {
  background:
    repeating-linear-gradient(-30deg, rgba(255, 255, 255, 0.04) 0px, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 0.3px),
    repeating-linear-gradient(60deg, rgba(0, 0, 0, 0.03) 0px, rgba(0, 0, 0, 0.03) 1px, transparent 1px, transparent 0.3px),
    linear-gradient(180deg, #1bc459 0%, #0a6327 100%);
}

.cover-rating-5::before {
  /* ??????? ???? ? ?????? ?????? ?????? ??????? ~???????? ?????? ?????? ?
     ????????? ?????????????? ??? �????? ?????????? ? ???????�. ?????????
     ???????? ?????: ???? 25% ? 8%, ?????? ?????? 6px ? 2px. */
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 2px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 8%, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.45) 100%);
}

/* 4 ?????? */
.cover-rating-4 {
  background:
    repeating-linear-gradient(-30deg, rgba(255, 255, 255, 0.04) 0px, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 0.3px),
    repeating-linear-gradient(60deg, rgba(0, 0, 0, 0.03) 0px, rgba(0, 0, 0, 0.03) 1px, transparent 1px, transparent 0.3px),
    linear-gradient(180deg, #ff9500 0%, #a84200 100%);
}

.cover-rating-4::before {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 2px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0) 8%, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.45) 100%);
}

/* 3 ?????? */
.cover-rating-3 {
  background:
    repeating-linear-gradient(-30deg, rgba(255, 255, 255, 0.04) 0px, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 0.3px),
    repeating-linear-gradient(60deg, rgba(0, 0, 0, 0.03) 0px, rgba(0, 0, 0, 0.03) 1px, transparent 1px, transparent 0.3px),
    linear-gradient(180deg, #b83030 0%, #661212 100%);
}

.cover-rating-3::before {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 2px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 7%, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.45) 100%);
}

/* 2 ?????? */
.cover-rating-2 {
  background:
    repeating-linear-gradient(-30deg, rgba(255, 255, 255, 0.04) 0px, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 0.3px),
    repeating-linear-gradient(60deg, rgba(0, 0, 0, 0.03) 0px, rgba(0, 0, 0, 0.03) 1px, transparent 1px, transparent 0.3px),
    linear-gradient(180deg, #822f08 0%, #391002 100%);
}

.cover-rating-2::before {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 2px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 7%, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.45) 100%);
}

/* 1 ?????? */
.cover-rating-1 {
  background:
    repeating-linear-gradient(-30deg, rgba(255, 255, 255, 0.04) 0px, rgba(255, 255, 255, 0.04) 1px, transparent 1px, transparent 0.3px),
    repeating-linear-gradient(60deg, rgba(0, 0, 0, 0.03) 0px, rgba(0, 0, 0, 0.03) 1px, transparent 1px, transparent 0.3px),
    linear-gradient(180deg, #241410 0%, #0d0503 100%);
}

.cover-rating-1::before {
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0) 2px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0) 7%, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.45) 100%);
}


/* Deleted (INPX DEL) badge on covers / titles */
.deleted-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 6;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(120, 40, 40, 0.92);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  pointer-events: none;
  text-transform: uppercase;
}

.deleted-badge--inline {
  position: static;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
  pointer-events: auto;
  text-transform: none;
  font-size: 12px;
  font-weight: 600;
}

.book-deleted-note {
  margin: 0 0 8px;
  font-size: 13px;
}

/* ?? Read badge (large checkmark stamp on covers) ?? */
.read-badge {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  pointer-events: none;
}

.read-badge svg {
  width: 42%;
  aspect-ratio: 1;
  padding: 10%;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Read indicator in entity lists (series, etc.) */
.read-series-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(34, 160, 100, 0.88);
  vertical-align: middle;
  margin-left: 6px;
  flex-shrink: 0;
}

.read-series-badge svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card-actions {
  display: flex;
  align-items: center;
  margin-top: 2px;
  padding: 0 2px;
}

.card-actions-favorites {
  gap: 8px;
  flex-wrap: wrap;
}

.card-remove-favorite-action {
  font-size: 11px;
  padding: 4px 10px;
}

.download-menu {
  position: relative;
  display: inline-block;
}

.download-menu summary {
  list-style: none;
}

.download-menu summary::-webkit-details-marker {
  display: none;
}

.download-menu-trigger {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
  user-select: none;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.download-menu-trigger:hover {
  background: color-mix(in srgb, var(--button-bg-hover) 85%, transparent);
}

.download-menu-trigger:active {
  transform: scale(0.96);
}

.download-menu-trigger-compact {
  min-height: 32px;
  padding: 0 12px;
  font-size: 11px;
}

.download-menu-compact .download-menu-popover {
  left: auto;
  right: 0;
}

@keyframes popover-enter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.download-menu-popover {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 40;
  min-width: 108px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--ui-glass-menu-bg, var(--ui-glass-panel-bg, var(--surface)));
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(var(--ui-surface-blur, 0px));
  -webkit-backdrop-filter: blur(var(--ui-surface-blur, 0px));
  animation: popover-enter 0.15s ease-out;
}

.download-format-link {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--link);
  font-size: 13px;
  text-decoration: none;
}

.download-format-link:hover {
  color: var(--link-hover);
  background: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface)));
  box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
}

button.download-format-link {
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
}

.batch-select-scope {
  display: block;
  width: 100%;
}

/* ?????? ??????: ? ?????? ????????; ?????? ??? ? ?????????? UI, ???? ?????? */
.batch-download-bar {
  width: 100%;
  box-sizing: border-box;
  margin: 0 0 14px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--border);
}

.batch-download-bar .batch-download-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
  max-width: 100%;
}

.batch-download-bar .batch-download-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  gap: 8px 10px;
  flex: 0 1 auto;
  min-width: 0;
}

.batch-download-bar button {
  white-space: nowrap;
}

/* ??? ?????????? ???? ? ?????? ?????? (??????? / ?? email) ? ??????? ? ??????? ???? ?????? */
.batch-download-bar .download-menu-popover {
  left: auto;
  right: 0;
}

/* ???? �???????�: ????? ZIP + ?????? ???????? */
.batch-download-bar .download-menu-popover--batch {
  min-width: 148px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px;
}

/* Floating batch actions — appear when books are checked (above mobile bottom-nav) */
.batch-fab {
  position: fixed;
  z-index: 960;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s ease, opacity 0.18s ease;
  width: min(520px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
}

.batch-fab.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

body:has(.bottom-nav) .batch-fab {
  bottom: calc(66px + env(safe-area-inset-bottom, 0px));
}

.batch-fab-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.28),
    0 2px 8px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.batch-fab-count {
  flex: 1 1 auto;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 40px;
  white-space: nowrap;
  color: var(--text);
  min-width: 0;
}

/* One size for clear / download / email — overrides .download-menu-trigger compact styles */
.batch-fab .batch-fab-btn,
.batch-fab .download-menu-trigger.batch-fab-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  height: 40px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.batch-fab-clear,
.batch-fab-select-all {
  flex: 0 0 auto;
}

.batch-fab .download-menu {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  vertical-align: middle;
}

.batch-fab .download-menu>.batch-fab-btn {
  width: 100%;
}

.batch-fab .download-menu-popover {
  left: 50%;
  right: auto;
  bottom: calc(100% + 8px);
  top: auto;
  transform: translateX(-50%);
  min-width: 168px;
  max-width: min(280px, calc(100vw - 32px));
}

.batch-fab .download-menu-popover--batch {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px;
}

.batch-fab .batch-email-menu .download-menu-popover {
  left: auto;
  right: 0;
  transform: none;
}

.batch-per-book-zip-option {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px 10px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.3;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.batch-per-book-zip-option:hover {
  background: var(--button-bg);
  border-color: var(--border);
}

.batch-per-book-zip-option:has(input:focus-visible) {
  outline: none;
  border-color: var(--button-border-hover);
  background: var(--button-bg-hover);
}

.batch-per-book-zip-option input {
  width: 15px;
  height: 15px;
  margin: 0;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--link);
}

.batch-per-book-zip-option span {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-weight: 500;
}

.batch-per-book-zip-option:has(input:checked) span {
  color: var(--text);
}

.batch-download-format-list {
  display: grid;
  gap: 2px;
  padding: 4px 0 2px;
  margin: 0;
  border-top: 1px solid var(--border);
}

.batch-selected-count {
  font-size: 11px;
  white-space: nowrap;
  opacity: 0.92;
}

.batch-select-hit {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 2px solid color-mix(in srgb, var(--text) 30%, transparent);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

@media (hover: none),
(pointer: coarse) {
  .batch-select-hit {
    opacity: 0.75;
    pointer-events: auto;
  }
}

.batch-select-hit input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.batch-select-hit::after {
  content: '';
  box-sizing: border-box;
  width: 6px;
  height: 12px;
  border: 2px solid #fff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg) scale(0.5);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  margin-top: -3px;
}

.card:hover .batch-select-hit,
.batch-select-hit:has(input:checked),
.batch-select-hit:has(input:focus-visible) {
  opacity: 1;
  pointer-events: auto;
}

.batch-select-hit:hover {
  transform: scale(1.05);
}

.batch-select-hit:active {
  transform: scale(0.95);
}

.batch-select-hit:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
}

.batch-select-hit:has(input:checked)::after {
  opacity: 1;
  transform: rotate(45deg) scale(1);
}

.batch-select-hit:has(input:focus-visible) {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
}

/* Tags */
.tags {
  display: none;
}

.tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(74, 198, 148, 0.1);
  color: var(--accent);
  font-size: 10px;
  border: 1px solid rgba(74, 198, 148, 0.2);
}

.table-row-clickable {
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.table-row-clickable:hover {
  background: var(--surface-hover);
}

/* Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.actions a,
.actions button {
  font-size: 12px;
  padding: 5px 10px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s ease;
}

.actions a:active,
.actions button:active {
  transform: scale(0.96);
}

.actions-primary {
  margin-top: 10px;
}

.actions-secondary {
  display: none;
}

.card .actions-primary,
.card .actions-secondary {
  display: none;
}


.stat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 20px;
  align-items: center;
  justify-content: center;
}

.page-link {
  color: var(--text);
  padding: 6px 12px;
  min-height: 32px;
  border-radius: var(--radius-button, 999px);
  background: var(--button-bg);
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}

.page-link:hover {
  background: color-mix(in srgb, var(--button-bg-hover) 85%, transparent);
  border-color: var(--button-border-hover);
  color: var(--text);
}

.page-link:active {
  transform: scale(0.97);
}

.page-link-active {
  background: var(--accent);
  color: #fff !important;
  border-color: var(--accent);
  font-weight: 600;
}

.page-link-prev,
.page-link-next {
  font-weight: 500;
  padding: 6px 16px;
}

.page-link-prev:hover,
.page-link-next:hover {
  background: var(--button-bg-hover);
}

.page-ellipsis {
  padding: 2px 4px;
  user-select: none;
}

/* ?? Card detail page (book page uses wider card) ?? */
.card-detail {
  grid-template-columns: 200px 1fr;
  display: grid;
  gap: 20px;
  padding: 16px;
}

.card-detail .cover {
  aspect-ratio: auto;
  height: auto;
  min-height: 280px;
}

/* ?? Table lists (authors, series, genres, bookmarks) ?? */
.table-list {
  display: grid;
  gap: 4px;
}

.stats-ribbon-item,
.facet-hero-stat {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: var(--panel-soft-bg);
  border: 1px solid var(--border);
  min-width: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.stats-ribbon-item:hover,
.facet-hero-stat:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--border) 60%, var(--muted));
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.table-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--panel-soft-bg);
  border: 1px solid var(--border);
}

.table-row:not(.table-row-stack):not(.profile-form-row) {
  transition: background 0.12s, border-color 0.15s;
}

.table-row:hover:not(.table-row-stack):not(.profile-form-row) {
  background: var(--surface-hover);
  border-color: var(--button-border-hover);
}

.profile-form-row:hover {
  background: var(--panel-soft-bg) !important;
}

.profile-view-prefs {
  display: grid;
  gap: 10px;
  margin: 0 0 10px;
}

.profile-view-pref {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.profile-view-pref select {
  max-width: 280px;
}

.table-row strong a {
  color: var(--link);
  text-decoration: none;
}

.table-row strong a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
}

.profile-reading-all-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.9em;
}

/* ???????: ??????? �??????????� / �?????????� */
.profile-shell {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.profile-settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.profile-settings-tab {
  font-size: 13px;
  padding: 6px 12px;
  min-height: 0;
}

.profile-settings-tab.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.profile-tab-panel {
  min-width: 0;
}

/* ??? min-width:0 grid-???????? (.table-row ? ??? ??????) ??????????? ??
   min-content ??????????? (???????? ???????? ?????? ???????) ? ????????
   ?????????????? ???????????? ???????? ???????. */
.profile-tab-panel .table-list {
  grid-template-columns: minmax(0, 1fr);
}

.profile-tab-panel .table-row {
  min-width: 0;
}

.profile-tab-panel .table-row>* {
  min-width: 0;
}

/* ?? Profile: identity hero ?? */
.profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 16px;
  background: var(--panel-soft-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.profile-avatar {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--link);
  background: color-mix(in srgb, var(--link) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--link) 30%, transparent);
}

.profile-identity-info {
  min-width: 0;
}

.profile-identity-name {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.15;
}

.profile-identity-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.profile-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--button-bg);
  border: 1px solid var(--border);
}

.profile-role-badge.is-admin {
  color: var(--link);
  background: color-mix(in srgb, var(--link) 10%, transparent);
  border-color: color-mix(in srgb, var(--link) 35%, transparent);
}

/* ?? Profile: activity layout (activity lists) ?? */
.profile-activity {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.profile-activity-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.profile-section-wide {
  grid-column: 1 / -1;
}

.profile-section {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--panel-soft-bg);
  border: 1px solid var(--border);
  min-width: 0;
}

.profile-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.profile-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.profile-section-count {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85em;
}

.profile-section-link {
  font-size: 13px;
  white-space: nowrap;
}

.profile-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2px;
}

.profile-empty {
  color: var(--muted);
  padding: 6px 0;
  font-size: 13px;
}

/* ?? Profile: rich list item with cover ?? */
.profile-litem,
.profile-list-item.profile-litem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  min-width: 0;
}

.profile-litem-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.profile-cover {
  flex-shrink: 0;
  width: 36px;
  height: 50px;
  border-radius: var(--radius-card, 4px);
  overflow: hidden;
  display: block;
  background: var(--card-cover-bg, linear-gradient(135deg, #2a241d, #15120e));
  border: 1px solid var(--card-cover-border, var(--border));
}

.profile-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.profile-litem-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.profile-litem-title {
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-litem-link:hover .profile-litem-title {
  color: var(--link);
}

.profile-litem-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-litem-sub:empty {
  display: none;
}

@media (max-width: 720px) {
  .profile-activity-grid {
    grid-template-columns: 1fr;
  }

  .profile-section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .profile-section-link {
    white-space: normal;
    line-height: 1.35;
  }

  .profile-form-row {
    padding: 12px;
  }

  .profile-form-row .vertical-form .actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .profile-form-row .vertical-form .actions button {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
  }
}

@media (max-width: 560px) {
  .profile-identity {
    padding: 14px;
    gap: 12px;
  }

  .profile-avatar {
    width: 52px;
    height: 52px;
    font-size: 19px;
  }

  .profile-identity-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .profile-litem,
  .profile-list-item.profile-litem {
    padding: 8px 0;
    gap: 8px;
  }

  .profile-list-item.profile-litem .profile-remove-btn {
    opacity: 1;
  }
}

/* ???????: ?????????????? ????? (???? ???-?? ????????? ? ????????) */
.profile-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.profile-page-layout>* {
  min-width: 0;
}

.profile-list-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}

.profile-list-link {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ????? ??????? ????? ???? ??????? ? ?????? ??? ? ???? ?????? ? ??????????? ??
   ???? ??????? (??????? ?? flex/grid), ????? ?? ????????? ?? ???????????? ?
   �????? ??????�. ?????????? ????????????? ??????????? ??????? ? ?????????
   ??????? .profile-list-link. */
.profile-list-item .profile-note-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  overflow-wrap: normal;
}

.profile-list-meta {
  flex-shrink: 0;
  font-size: 0.85em;
  max-width: 42%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-list-meta:empty {
  display: none;
}

/* ??????? ???? ??????? (???????), ? ??? ??????????: ?????????? ?????? ??? ? .button */
.profile-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 2.5rem;
  min-height: 2.5rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 500;
  color: var(--muted);
  opacity: 0;
  transition: opacity .15s, color .15s, background-color .15s;
}

.profile-list-item:hover .profile-remove-btn {
  opacity: 1;
}

.profile-remove-btn:hover {
  color: var(--danger, #c44);
  background-color: var(--button-bg-hover);
}

.profile-remove-btn:focus-visible {
  opacity: 1;
  outline: 2px solid color-mix(in srgb, var(--link) 45%, transparent);
  outline-offset: 2px;
}

.table-row-stack {
  grid-template-columns: 1fr;
}

.table-row-link {
  color: inherit;
  text-decoration: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.15s ease, background 0.12s, border-color 0.15s;
  display: block;
}

.table-row-link strong {
  color: var(--link);
}

.table-row-link:hover strong {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
}

.table-row-link:active {
  transform: scale(0.99);
}

.table-row-link .actions {
  position: relative;
  z-index: 1;
}

.favorites-section {
  min-width: 0;
  max-width: 100%;
}

[data-favorites-view] {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
}

.favorites-section .section-title {
  margin-bottom: 10px;
}

.favorites-row {
  min-height: 68px;
}

.favorites-entity-link {
  min-width: 0;
}

.favorites-entity-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.favorites-entity-text .muted {
  font-size: 12px;
}

.favorites-author-avatar {
  position: relative;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-hover);
  border: 1px solid var(--border);
}

.favorites-author-portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
  background: var(--surface-hover);
}

.favorites-author-initial {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.favorites-author-avatar:not(.is-fallback) .favorites-author-initial {
  opacity: 0;
}

.favorites-list .shelf-covers-preview {
  margin-top: 8px;
}

/* ?????? ??????? ????????: ???????? ?????, �׻ ?????? (??? ?????? ??????). */
.account-list-row {
  align-items: center;
  min-width: 0;
}

.account-list-row-main {
  min-width: 0;
  color: inherit;
  text-decoration: none;
  display: block;
}

.account-list-row-main.favorites-entity-link {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-list-row-main:hover strong {
  color: var(--link);
}

.account-list-row-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.account-list-row .account-list-remove {
  opacity: 1;
  position: relative;
  z-index: 1;
}

.favorites-row-main {
  min-width: 0;
}

.favorites-row-main strong {
  display: block;
  margin-bottom: 2px;
}

.favorites-row-main strong a {
  color: var(--link);
  text-decoration: none;
}

.favorites-row-main strong a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
}

.favorites-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.favorites-row-actions .download-menu {
  flex: 0 0 auto;
}

.favorites-row-actions .entity-link {
  flex: 0 0 auto;
}

.table-row.event-error {
  border-color: rgba(232, 93, 117, 0.3);
  background: rgba(232, 93, 117, 0.06);
}

.table-row.event-fresh {
  border-color: rgba(74, 198, 148, 0.3);
}

.list-context-hint {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  opacity: 0.88;
}

.list-context-hint-spacious {
  margin-bottom: 16px;
}

.list-context-hint strong {
  color: var(--text);
}

.catalog-search-hints {
  margin: 16px 0 8px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft-bg);
}

.catalog-search-hints-block+.catalog-search-hints-block {
  margin-top: 12px;
}

.catalog-search-hints-list {
  margin: 8px 0 0;
  padding-left: 1.2em;
}

.catalog-search-hints-list li {
  margin: 4px 0;
}

.catalog-search-hints-typos {
  margin-top: 8px;
}

.search-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 4px 0 14px;
  align-items: baseline;
}

.search-nav-link {
  text-decoration: none;
  color: var(--muted, var(--text-muted, #6b7280));
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.search-nav-link:hover {
  color: var(--text);
}

.search-nav-link.is-active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent, #3b82f6);
}

.search-nav-count {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.search-overview-list {
  list-style: none;
  margin: 12px 0 16px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.search-overview-item {
  margin: 0;
}

.search-overview-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft-bg);
  text-decoration: none;
  color: var(--text);
}

.search-overview-item.is-preferred .search-overview-link {
  border-color: color-mix(in srgb, var(--accent, #3b82f6) 55%, transparent);
}

.search-overview-preferred {
  margin-left: 0.4em;
  font-size: 0.85em;
  font-weight: 500;
}

.search-overview-link:hover {
  background: var(--surface-hover);
  border-color: var(--button-border-hover);
}

.search-overview-label {
  font-weight: 600;
}

.search-overview-count {
  font-variant-numeric: tabular-nums;
}


/* ?? reCAPTCHA keys (collapsible) ?? */
.admin-recaptcha-disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-soft-bg);
  margin-top: 6px;
}

.admin-recaptcha-disclosure-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  user-select: none;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-recaptcha-disclosure-summary::-webkit-details-marker {
  display: none;
}

.admin-recaptcha-disclosure-summary::after {
  content: '\25BE';
  color: var(--muted);
  transform: rotate(-90deg);
  transition: transform 0.18s ease;
}

.admin-recaptcha-disclosure[open]>.admin-recaptcha-disclosure-summary::after {
  transform: rotate(0deg);
}

.admin-recaptcha-disclosure[open]>.admin-recaptcha-disclosure-summary {
  color: var(--text);
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.admin-recaptcha-disclosure-body {
  padding: 14px;
}

/* ?? Admin user management ?? */
.role-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  color: var(--muted);
}

.role-badge-admin {
  color: #e0d0a0;
  border-color: rgba(180, 145, 80, 0.28);
  background: rgba(180, 145, 80, 0.10);
}

.role-badge-user {
  color: #b7d7ff;
  border-color: rgba(74, 198, 148, 0.18);
  background: rgba(74, 198, 148, 0.08);
}

.admin-users-list {
  gap: 6px;
}

.admin-users-list .table-row {
  padding: 10px 14px;
  background: var(--panel-soft-bg);
  border-color: var(--border);
  box-shadow: none;
}

.admin-users-list .table-row .muted {
  line-height: 1.45;
}

.admin-user-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: var(--panel-soft-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-user-row:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--muted));
}

.admin-user-row-blocked {
  border-color: rgba(232, 93, 117, 0.25);
}

.admin-user-row-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  border-radius: var(--radius);
}

.admin-user-row-summary::-webkit-details-marker {
  display: none;
}

.admin-user-row[open]>.admin-user-row-summary {
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.admin-user-row-summary::after {
  content: '\25BE';
  margin-left: auto;
  color: var(--muted);
  transform: rotate(-90deg);
  transition: transform 0.18s ease;
}

.admin-user-row[open]>.admin-user-row-summary::after {
  transform: rotate(0deg);
}

.admin-user-row-summary strong {
  font-size: 14px;
}

.admin-user-row-date {
  margin-left: auto;
  font-size: 12px;
}

.admin-user-row-summary:hover {
  background: var(--button-bg);
  border-radius: var(--radius);
}

.admin-user-row[open]>.admin-user-row-summary {
  border-bottom: 1px solid var(--border);
}

.admin-user-row-body {
  padding: 14px;
}

.badge-blocked {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #e85d75;
  border: 1px solid rgba(232, 93, 117, 0.25);
  background: rgba(232, 93, 117, 0.08);
}

.badge-self {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid rgba(180, 145, 80, 0.25);
  background: rgba(180, 145, 80, 0.08);
}

.user-admin-form {
  display: grid;
  gap: 8px;
}

.user-admin-form label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.user-admin-form input,
.user-admin-form select {
  font-size: 13px;
}

.button-danger {
  border-color: rgba(232, 93, 117, 0.16);
  color: var(--danger);
  background: rgba(232, 93, 117, 0.05);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.button-danger:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 15%, transparent);
}

.button-danger:active {
  transform: scale(0.97);
}

/* ?? Admin events ?? */
.admin-events-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.admin-events-bar .admin-events-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
}

.admin-events-bar .admin-events-presets a {
  font-size: 12px;
  padding: 4px 10px;
}

.admin-events-bar select {
  font-size: 12px;
  padding: 4px 8px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  outline: none;
}

.admin-events-bar select:focus {
  border-color: var(--accent);
}

.admin-events-bar-spacer {
  flex: 1;
}

.admin-events-bar .admin-events-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-events-clear-form {
  margin: 0;
}

.event-level-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.6;
}

.event-level-info {
  color: #5ab893;
  background: rgba(74, 198, 148, 0.10);
  border: 1px solid rgba(74, 198, 148, 0.25);
}

.event-level-warn {
  color: #d4a944;
  background: rgba(212, 169, 68, 0.10);
  border: 1px solid rgba(212, 169, 68, 0.25);
}

.event-level-error {
  color: #e05d75;
  background: rgba(232, 93, 117, 0.10);
  border: 1px solid rgba(232, 93, 117, 0.25);
}

.admin-event-category {
  margin-left: 8px;
  color: var(--muted);
  font-size: 11px;
}

/* ?????? ???????: ???? ?????????????? ???????, ?????? ? ???????? */
.admin-events-scroll {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: min(520px, 60vh);
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  background: var(--field-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.admin-events-scroll .admin-events-row.table-row {
  padding: 10px 12px;
  margin: 0;
  background: var(--panel-soft-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: start;
}

.admin-events-scroll .admin-events-row.event-error {
  border-color: rgba(232, 93, 117, 0.25);
  background: rgba(232, 93, 117, 0.04);
}

.admin-events-scroll .admin-events-empty {
  padding: 14px 10px;
}

.admin-events-message {
  margin-left: 6px;
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}

.admin-event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 6px;
  font-size: 12px;
  max-width: 100%;
}

.admin-event-meta .muted {
  line-height: 1.45;
  word-break: break-word;
}

.facet-summary-group {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.facet-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}

.facet-view-tabs .button {
  padding: 6px 14px;
  font-size: 13px;
}

.facet-view-tabs .button.is-active {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: var(--link-hover);
  pointer-events: none;
}

.facet-summary-block {
  padding: 0;
  background: transparent;
  border: none;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.facet-summary-label {
  color: var(--muted);
  font-weight: 500;
}

.facet-summary-link {
  color: var(--link);
  opacity: 0.95;
  text-decoration: none;
}

.facet-summary-link:hover {
  color: var(--link-hover);
  opacity: 1;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 42%, transparent);
}

.facet-summary-sep {
  margin-right: 4px;
}

/* ?? Index banner ?? */
#sources-index-progress.alert {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.index-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.index-banner {
  opacity: 0.92;
}

.index-banner-stats {
  display: flex;
  gap: 14px;
  white-space: nowrap;
}

.index-banner-stats strong {
  font-weight: 600;
  color: var(--text);
  margin-right: 3px;
}

/* ?? Hero ?? */
.hero {
  margin-bottom: 16px;
}

.hero p {
  color: var(--muted);
  max-width: 600px;
}

.hero-home,
.facet-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding: 10px 0 4px;
  border: none;
  border-radius: 0;
  background: transparent;
}

.hero-home {
  margin-bottom: 24px;
}

.home-inline-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  opacity: 0.92;
}

.home-inline-note a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.home-inline-note a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 45%, transparent);
}

.hero-library-view {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.hero-home-copy,
.hero-home-side,
.facet-hero-stats {
  min-width: 0;
}

.stats-ribbon,
.facet-hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.stats-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel-soft-bg);
}

.stats-chip strong {
  font-size: 18px;
  color: var(--text);
}



/* ?? Genre groups ?? */
.genre-grouped-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.genre-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.genre-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  background: var(--surface);
  user-select: none;
}

.genre-group-header:hover {
  background: var(--surface-hover);
}

.genre-group-count {
  font-weight: 400;
  font-size: 13px;
}

.genre-group-items {
  border-top: 1px solid var(--border);
}

/* Admin content ? genre groups */
.acg[data-open="1"]>.acg-body {
  display: block;
}

.acg .acg-body {
  display: none;
}

.acg[data-open="1"] .acg-arrow {
  transform: rotate(90deg);
}

.acg-table {
  width: 100%;
  table-layout: fixed;
  display: table !important;
}

.acg-table tbody {
  display: table-row-group !important;
}

.acg-table tr {
  display: table-row !important;
}

.acg-table td {
  display: table-cell !important;
}

.acg-table tr:last-child td {
  border-bottom: none;
}

.discovery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.discovery-tile {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--panel-soft-bg);
  color: var(--text);
  min-height: 120px;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.discovery-tile:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-soft-bg));
}

.discovery-tile strong {
  font-size: 16px;
  color: var(--text);
}

.compact-list .compact-row {
  padding: 10px 12px;
}

.compact-list .compact-row strong {
  font-size: 13px;
}

.library-shelf {
  margin-bottom: 30px;
}

.library-shelf .section-title {
  align-items: baseline;
  margin-bottom: 10px;
}

.library-shelf .section-title h2 {
  font-size: 18px;
  font-weight: 620;
}

.library-shelf .section-title .muted,
.section-title .muted {
  opacity: 0.85;
}

.library-shelf-primary {
  margin-bottom: 22px;
}

.library-shelf-secondary {
  opacity: 1;
}

.library-shelf-secondary .section-title h2 {
  font-size: 16px;
}

.shelf-link {
  color: var(--link);
  font-size: 11px;
  opacity: 0.92;
  text-decoration: none;
}

.shelf-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
}

.library-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.library-columns-secondary {
  margin-top: 18px;
  margin-bottom: 0;
}

.library-columns-tight {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.entity-list .table-row {
  min-height: 72px;
}

.library-columns .entity-list .table-row {
  min-height: 64px;
  padding: 8px 12px;
}

.entity-list .table-row strong {
  font-size: 14px;
  font-weight: 600;
}

.entity-list .table-row .muted {
  font-size: 12px;
}

.entity-link {
  color: var(--link);
  font-size: 12px;
  text-decoration: none;
}

.entity-link:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 40%, transparent);
}



.view-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* ?????? ???????: ??????? ? ???????-??????; ?900px ? ?????????? ?????? (??? sidebar) */
.account-nav-shell {
  margin-bottom: 16px;
  min-width: 0;
  max-width: 100%;
}

.account-nav-shell .account-nav-tabs.view-switcher {
  margin-bottom: 0;
}

.account-nav-shell .account-nav-select {
  display: none;
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 10px 44px 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--ui-glass-panel-bg, var(--field-bg));
  backdrop-filter: blur(var(--ui-surface-blur, 0px));
  -webkit-backdrop-filter: blur(var(--ui-surface-blur, 0px));
  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='%239a8e7e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}

.account-nav-shell .account-nav-select:focus {
  outline: none;
  border-color: var(--accent);
}

.account-nav-shell .account-nav-select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .account-nav-shell .account-nav-select {
    display: block;
  }

  .account-nav-shell .account-nav-tabs {
    display: none !important;
  }
}

.view-switcher-link {
  font-size: 12px;
  padding: 5px 12px;
}

.account-nav-tabs .button {
  background: var(--ui-glass-panel-bg, var(--button-bg));
  backdrop-filter: blur(var(--ui-surface-blur, 0px));
  -webkit-backdrop-filter: blur(var(--ui-surface-blur, 0px));
  color: var(--muted);
}

.account-nav-tabs .button:hover {
  background: var(--ui-glass-hover-bg, color-mix(in srgb, var(--button-bg-hover) 85%, transparent));
  border-color: var(--button-border-hover);
  color: var(--text);
}

.account-nav-tabs .button.is-active {
  background: var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface)));
  border-color: var(--ui-glass-active-border, color-mix(in srgb, var(--accent) 48%, transparent));
  color: var(--text);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
}

.account-nav-tabs .button.is-active:hover {
  background: var(--ui-glass-active-hover-bg, color-mix(in srgb, var(--accent) 24%, var(--surface-hover)));
  border-color: var(--ui-glass-active-border, color-mix(in srgb, var(--accent) 60%, transparent));
  color: var(--text);
}

.view-switcher-count {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: var(--radius-md);
  background: var(--muted-bg);
  color: var(--muted-color);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
}

.book-detail-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.book-detail-main {
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: var(--radius-xl);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow-md);
}

/* ??????? ????????: ????????? / ????????? / ?? ????? ? ? ?????? ??????? ??? ??????????,
   ????? ??????? ???????? ?? ???????? ?? ??????. ?? ????????? ? ? ????? ?????? ??? ????????. */
.book-detail-corner-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  z-index: 2;
}

.book-detail-corner-actions .button {
  font-size: 12px;
  padding: 5px 10px;
  white-space: nowrap;
}

.card-detail-panel {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 24px;
  padding: 24px;
  border-radius: var(--radius-xl);
  border: none;
  background: transparent;
}

.book-detail-cover {
  grid-column: 1;
  grid-row: 1 / -1;
  min-width: 0;
  align-self: start;
}

.book-detail-cover .cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--card-cover-bg);
  box-shadow: var(--card-cover-shadow);
}

.book-detail-content {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.book-detail-main:has(.book-detail-corner-actions) .book-detail-content {
  grid-row: 2;
}

.book-detail-title {
  margin: 0 0 12px;
  font-family: var(--display-font);
  font-size: clamp(26px, 2.8vw, 34px);
  font-weight: 600;
  line-height: 1.22;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
  letter-spacing: -0.025em;
}

.book-detail-content>.author a {
  color: var(--link);
  text-decoration: none;
}

.book-detail-content>.author a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 42%, transparent);
}

.book-detail-annotation {
  margin-top: 14px;
  color: var(--text);
  line-height: 1.75;
  max-width: 72ch;
}

.book-detail-annotation--html p {
  margin: 0.6em 0;
}

.book-detail-annotation--html p:first-child {
  margin-top: 0;
}

/* Keep illustration colors original in dark theme. */
.book-detail-annotation--html img,
.book-detail-illustrations-strip img,
.illustration-lightbox-image {
  filter: none !important;
  mix-blend-mode: normal !important;
  opacity: 1 !important;
}

.book-detail-side-block {
  margin-top: 20px;
  max-width: 72ch;
}

.book-detail-side-block h3 {
  font-size: 15px;
  margin: 0 0 8px;
  color: var(--text);
}

.book-detail-review {
  color: var(--text);
  line-height: 1.65;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.book-detail-review p {
  margin: 0.5em 0;
}

.book-detail-disclosure {
  border: 1px solid color-mix(in srgb, var(--border) 76%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 98%, transparent);
  overflow: hidden;
}

.book-detail-disclosure>summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
  border-radius: var(--radius-lg);
}

.book-detail-disclosure[open]>summary {
  border-bottom: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.book-detail-disclosure>summary::-webkit-details-marker {
  display: none;
}

.book-detail-disclosure>summary::after {
  content: '\25BE';
  color: var(--muted);
  transform: rotate(-90deg);
  transition: transform 0.16s ease;
}

.book-detail-disclosure[open]>summary::after {
  transform: rotate(0deg);
}

.book-detail-disclosure-title {
  color: inherit;
}

.book-detail-disclosure-note {
  color: var(--muted);
  font-weight: 400;
  font-size: 11px;
}

.book-detail-author {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.book-detail-author-photo {
  flex-shrink: 0;
  max-width: 140px;
  height: auto;
  border-radius: 6px;
}

.book-detail-author-bio {
  flex: 1;
  min-width: 0;
  line-height: 1.65;
}

.book-detail-author-bio p {
  margin: 0.5em 0;
}

.book-detail-illustrations-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 10px 12px 12px;
}

.book-detail-illustrations-strip a {
  display: block;
  line-height: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border) 86%, transparent);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.book-detail-illustrations-strip img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.illustration-lightbox-panel {
  width: min(980px, 96vw);
  max-width: 96vw;
}

.illustration-lightbox-body {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 0;
}

.illustration-lightbox-stage {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  border-radius: 10px;
  min-height: min(70vh, 680px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.illustration-lightbox-image {
  max-width: 100%;
  max-height: min(68vh, 660px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
}

.illustration-lightbox-nav {
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  font-size: 20px;
  line-height: 1;
}

.illustration-lightbox-meta {
  padding: 10px 14px 14px;
  text-align: center;
  font-size: 12px;
}

.author-facet-hero {
  margin-bottom: 20px;
}

.author-facet-hero .book-detail-cover img.author-facet-portrait {
  object-fit: cover;
}

.author-facet-count-line {
  margin: 0 0 12px;
  font-size: 14px;
}

.author-facet-bio-block {
  max-width: none;
}

.book-detail-author-bio--facet {
  max-width: 72ch;
}

.author-facet-controls {
  justify-content: flex-end;
}

.author-facet-controls .page-intro-actions {
  margin-left: auto;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.author-facet-series-block+.author-facet-series-block,
.author-facet-series-block+.author-facet-standalone-block {
  margin-top: 8px;
}

.author-facet-series-entity-list {
  margin-top: 0;
}

.author-facet-view-tabs {
  margin: 0;
}

.author-facet-list-block {
  margin-top: 8px;
}

.author-flibusta-list {
  display: grid;
  gap: 18px;
}

.author-flibusta-group {
  margin: 0;
  padding: 14px 16px 12px;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--panel-soft-bg, var(--surface)) 88%, transparent);
  box-shadow: var(--shadow-sm);
}

.author-flibusta-series-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-family: var(--display-font);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.author-flibusta-series-batch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin: 0;
  padding: 4px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  cursor: pointer;
  user-select: none;
}

.author-flibusta-series-batch:hover {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
}

.author-flibusta-series-batch:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 28%, var(--surface));
}

.author-flibusta-series-batch input.author-flibusta-series-cb {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.author-flibusta-series-title a,
.author-flibusta-series-title>span {
  color: inherit;
  text-decoration: none;
}

.author-flibusta-series-title a:hover {
  color: var(--link);
  text-decoration: underline;
}

.author-flibusta-books {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.author-flibusta-book {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 8px 4px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  line-height: 1.45;
  border-radius: var(--radius-sm);
  transition: background 0.18s var(--ease-premium);
}

.author-flibusta-book:hover {
  background: color-mix(in srgb, var(--button-bg) 70%, transparent);
}

.author-flibusta-book:last-child {
  border-bottom: none;
}

/* Plain book checkbox — visually quieter than series control. */
.author-flibusta-batch {
  position: relative;
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.author-flibusta-batch input.batch-select-cb {
  position: static;
  opacity: 1;
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--muted, #9a8e7e);
}

.author-flibusta-no {
  min-width: 1.6em;
  color: var(--muted, #6b7280);
  font-variant-numeric: tabular-nums;
}

.catalog-book-list-ul {
  padding-left: 0;
  border-left: none;
}

.catalog-book-list-group {
  padding-top: 6px;
}

.author-flibusta-author {
  font-size: 0.92em;
}

.author-flibusta-author a {
  color: inherit;
  text-decoration: none;
}

.author-flibusta-author a:hover {
  color: var(--link);
  text-decoration: underline;
}

.browse-view-tabs {
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 auto;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-button, var(--radius));
  background: color-mix(in srgb, var(--field-bg) 90%, transparent);
  gap: 2px;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 4%, transparent);
}

.browse-view-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 14px;
  border: none;
  border-radius: calc(var(--radius-button, var(--radius)) - 3px);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: color 0.2s var(--ease-premium), background 0.2s var(--ease-premium), box-shadow 0.2s var(--ease-premium);
}

.browse-view-tab:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface-hover, var(--button-bg-hover)) 70%, transparent);
}

.browse-view-tab.is-active {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.section-title .actions,
.page-intro .actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.section-title .actions .search-form,
.page-intro .actions .search-form {
  max-width: 260px;
}

.author-flibusta-title {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.author-flibusta-title:hover {
  color: var(--link);
  text-decoration: underline;
}

.author-flibusta-rating {
  display: inline;
  font-size: 0.85em;
  letter-spacing: 0.02em;
  color: #c9a227;
  white-space: nowrap;
}

.author-flibusta-meta {
  font-size: 0.85em;
}

.author-flibusta-actions {
  margin-left: auto;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Equal compact chips — must beat .button / .download-menu-trigger(-compact) */
.author-flibusta-actions .button,
.author-flibusta-actions button,
.author-flibusta-actions .download-menu-trigger,
.author-flibusta-dl .button,
.author-flibusta-dl .download-menu-trigger,
.author-flibusta-read,
.author-flibusta-email {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  height: 28px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-button, var(--radius));
}

.author-facet-standalone-books {
  margin-top: 4px;
}

.author-facet-standalone-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--panel-soft-bg);
  border: 1px solid var(--border);
  transition: background 0.12s;
}

.author-facet-standalone-row:hover {
  background: var(--surface-hover);
}

.author-facet-standalone-row .batch-select-hit {
  position: static;
  align-self: center;
  flex-shrink: 0;
  width: 28px;
  min-height: 32px;
}

.author-facet-standalone-link {
  flex: 1;
  min-width: 0;
}

.author-facet-standalone-block .section-title-plain h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.book-detail-summary {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.92;
}

.book-detail-summary a {
  color: var(--link);
  text-decoration: none;
}

.book-detail-summary a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 42%, transparent);
}

/* ?? Star rating ?? */
.book-detail-rating {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 2px;
}

.detail-rating-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 38px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  border-radius: 4px 4px 3px 3px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 88%, 0 100%);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.35),
    0 6px 10px rgba(0, 0, 0, 0.2),
    inset 1px 0 2px rgba(255, 255, 255, 0.25),
    inset -1px 0 2px rgba(0, 0, 0, 0.35),
    inset 0 2px 3px rgba(255, 255, 255, 0.15),
    inset 0 -2px 3px rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.detail-rating-5 {
  background: linear-gradient(180deg, #43a047 0%, #2e7d32 100%);
}

.detail-rating-4 {
  background: linear-gradient(180deg, #9ccc65 0%, #7cb342 100%);
}

.detail-rating-3 {
  background: linear-gradient(180deg, #ffca28 0%, #f9a825 100%);
}

.detail-rating-2 {
  background: linear-gradient(180deg, #ef5350 0%, #e53935 100%);
}

.detail-rating-1 {
  background: linear-gradient(180deg, #a0522d 0%, #8b2500 100%);
}

.rating-info {
  font-size: 13px;
  color: var(--muted);
  user-select: none;
}

.rating-avg {
  font-weight: 600;
  color: var(--text);
}

.rating-count {
  opacity: .7;
}

.rating-empty {
  font-style: italic;
}

.detail-meta-list .detail-meta-genres a {
  color: var(--link);
  font-weight: 500;
  text-decoration: none;
}

.detail-meta-list .detail-meta-genres a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 45%, transparent);
}

.book-detail-sep {
  margin: 0 8px;
  opacity: 0.65;
}

.book-detail-links {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  opacity: 0.92;
}

.book-detail-links a {
  color: var(--link);
  opacity: 1;
  text-decoration: none;
}

.book-detail-links a:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 42%, transparent);
}

.book-detail-shell .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.book-detail-shell .actions-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}


.book-detail-shell .actions-primary .download-menu-popover {
  left: 0;
}

.book-detail-bookmark-action {
  padding: 6px 12px;
}

.book-detail-bookmark-action.is-active,
.book-detail-bookmark-action[data-active-favorite="true"] {
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
}

.book-detail-read-action {
  padding: 6px 12px;
}

.book-detail-read-action.is-active {
  background: color-mix(in srgb, #4ac694 20%, var(--surface));
  border-color: color-mix(in srgb, #4ac694 50%, transparent);
  color: #4ac694;
}


.book-detail-related-shelf {
  margin-top: 2px;
}

.book-detail-related-shelf .section-title {
  margin-bottom: 12px;
}

/* ?? Empty state ?? */
.empty-state {
  padding: 40px 32px;
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-soft-bg);
  transition: border-color 0.2s;
}

.empty-state:hover {
  border-color: color-mix(in srgb, var(--border) 60%, var(--muted));
}

.empty-state strong {
  display: block;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 16px;
}

.empty-state-icon {
  display: block;
  margin: 0 auto 14px;
  width: 48px;
  height: 48px;
  color: var(--muted);
  opacity: 0.45;
}

.empty-state-icon svg {
  width: 100%;
  height: 100%;
}

/* ?? Flash / alerts ?? */
@keyframes alert-enter {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.flash,
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--flash-bg);
  border: 1px solid var(--flash-border);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
  animation: alert-enter 0.25s ease-out;
}

.alert-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  opacity: 0.82;
}

.alert-icon svg {
  width: 100%;
  height: 100%;
}

.alert-content {
  flex: 1;
  min-width: 0;
}

.alert-error {
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.22);
  color: var(--text);
}

.alert-error .alert-icon {
  color: #e85d75;
  opacity: 1;
}

.alert-info {
  background: rgba(96, 165, 250, 0.08);
  border-color: rgba(96, 165, 250, 0.22);
  color: var(--text);
}

.alert-info .alert-icon {
  color: #60a5fa;
  opacity: 1;
}

html[data-theme="light"] .alert-error {
  background: rgba(200, 77, 104, 0.07);
  border-color: rgba(200, 77, 104, 0.2);
}

html[data-theme="light"] .alert-info {
  background: rgba(59, 130, 246, 0.07);
  border-color: rgba(59, 130, 246, 0.2);
}

/* ?? Skeleton cards ?? */
@keyframes skeleton-shimmer {
  0% {
    background-position: -400px 0;
  }

  100% {
    background-position: 400px 0;
  }
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.2s infinite linear;
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.2s infinite linear;
}

.skeleton-line-short {
  width: 60%;
}

/* ?? Load more ?? */
.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.load-more-button {
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s ease;
}

.load-more-button:active:not(:disabled) {
  transform: scale(0.96);
}

.load-more-button:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ?? Toasts ?? */
@keyframes toast-enter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 1000;
}

.toast {
  min-width: 200px;
  max-width: 340px;
  padding: 10px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: toast-enter 0.3s ease-out;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-action {
  background: none;
  border: none;
  color: var(--link);
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  padding: 0 4px;
  text-decoration: underline;
  flex-shrink: 0;
  text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
  transition: color 0.15s, text-decoration-color 0.15s, opacity 0.15s, transform 0.15s ease;
}

.toast-action:hover {
  color: var(--link-hover);
  opacity: 0.95;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 45%, transparent);
}

.toast-action:active {
  transform: scale(0.96);
}

.toast-success {
  border-color: rgba(74, 198, 148, 0.4);
}

.toast-error {
  border-color: rgba(232, 93, 117, 0.4);
}

.toast-hide {
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: 0.25s ease;
}

.toast-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: toast-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes toast-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ?? Login ?? */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(380px, 100%);
  padding: 32px;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.login-card .brand h2 {
  color: var(--accent);
}

.login-card .brand p {
  color: var(--muted);
  margin-top: 6px;
}

.login-footer-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  text-decoration: none;
  font-weight: 600;
}

.login-footer-link:hover {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link-hover) 48%, transparent);
}

.login-sso-block {
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-sso-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-decoration: none;
  text-align: center;
}

.login-sso-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  text-align: center;
}

.login-sso-divider::before,
.login-sso-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  font-size: 13px;
}

/* ?? Browse page filter form ?? */
.browse-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  max-width: 400px;
}

.browse-filter input {
  flex: 1;
}

/* ?? Sidebar-specific elements (alphabet, old search) ? hidden in new layout ?? */
.sidebar-block {
  padding: 12px 8px 0;
}

.sidebar-title {
  margin-bottom: 0;
}

.sidebar-title h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 8px;
}

.sidebar-actions {
  display: flex;
  gap: 6px;
}

.kpi {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-soft-bg);
}

.kpi strong {
  display: block;
  font-size: 18px;
  margin-top: 4px;
  color: var(--accent);
}

.sidebar .kpi {
  background: var(--panel-soft-bg);
}

.admin-dup-group {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
}

.admin-dup-group-summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  list-style: none;
  border-radius: var(--radius-lg);
}

.admin-dup-group-summary::-webkit-details-marker {
  display: none;
}

.admin-dup-group-summary::after {
  content: '\25BE';
  margin-left: auto;
  color: var(--muted);
  transform: rotate(-90deg);
  transition: transform 0.18s ease;
}

.admin-dup-group[open]>.admin-dup-group-summary::after {
  transform: rotate(0deg);
}

.admin-dup-group[open]>.admin-dup-group-summary {
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.admin-dup-group-title {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.admin-dup-group-author {
  min-width: 0;
  overflow-wrap: break-word;
}

.admin-dup-table-wrap {
  overflow-x: auto;
  padding: 0 14px 14px;
}

.admin-dup-table td {
  vertical-align: middle;
}

.admin-dup-set {
  padding: 10px 0 0;
}

.admin-dup-set+.admin-dup-set {
  border-top: 1px dashed var(--border);
  margin-top: 10px;
}

.admin-dup-set-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  overflow-wrap: anywhere;
}


/* Inline button spinner */
.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

/* Language filter admin page */
.lang-row-disabled {
  opacity: 0.45;
}

.lang-row-disabled td {
  text-decoration: line-through;
}

/* Book metadata edit form (admin only) */
.book-edit-section {
  max-width: 800px;
  margin: 24px auto 0;
}

.book-edit-disclosure {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.book-edit-summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--accent);
  border-radius: var(--radius-lg);
}

.book-edit-summary::-webkit-details-marker {
  display: none;
}

.book-edit-disclosure[open]>.book-edit-summary {
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* ?? �?????????????? ??????????�: ???? ???????? ??? ??????? ? ?????
   ???????? ????? (cover + content), ?? ???? ???? ????????? ????? ????????
   ?????? ?????? ????????, ? ?? ???????? ? ????? ?????? ???????.
   ???????? ????????? ? ?????? ??????? ? ?????????? ??????? ??????;
   ???????? ? ?????????????? ?????? ? ????? ? ??????. */
.book-edit-disclosure--inline {
  grid-column: 1 / -1;
  border: none;
  background: transparent;
  border-radius: var(--radius-lg);
}

.book-edit-summary--inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
  /* ????????? ?????? ? ??????? ???? ????? details ??????: <details>
     ???????, summary ?????? ?? ????????? ?????? ? ??????? ??? ???
     inline-flex ? margin-left:auto ? flex-????????. */
}

.book-edit-summary--inline:hover {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: var(--text);
}

.book-edit-summary--inline svg {
  flex-shrink: 0;
  opacity: 0.75;
}

.book-edit-summary--inline:hover svg {
  opacity: 1;
}

/* ???????? ?????????: <details> ???????? flex-???????????, ????? summary
   ????????? ?????????? ? ??????? ???? ????? margin-left:auto. */
.book-edit-disclosure--inline:not([open]) {
  display: flex;
  justify-content: flex-end;
}

/* ???????? ?????????: ?????????? ?????? ?? ??? ?????? ????????. */
.book-edit-disclosure--inline[open] {
  background: var(--surface);
  border: 1px solid var(--border);
}

.book-edit-disclosure--inline[open] .book-edit-summary--inline {
  display: flex;
  margin-left: 0;
  border: none;
  background: transparent;
  color: var(--accent);
  padding: 10px 14px;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: 1px solid var(--border);
}

.book-edit-disclosure--inline[open] .book-edit-summary--inline:hover {
  background: var(--button-bg);
}

.book-edit-disclosure--inline[open]>.book-edit-form {
  padding: 16px;
}

.book-edit-form {
  padding: 16px;
}

.book-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 600px) {
  .book-edit-grid {
    grid-template-columns: 1fr;
  }
}

.book-edit-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.book-edit-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.book-edit-field input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
}

.book-edit-field input:focus {
  outline: none;
  border-color: var(--accent);
}

.book-edit-hint {
  font-size: 11px;
  color: var(--muted);
}

.book-edit-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}

.book-edit-field input[type="number"] {
  max-width: 100px;
}

.book-edit-short {
  max-width: 120px;
}

.muted {
  color: var(--muted);
}

.table-row .muted {
  line-height: 1.4;
}

.table-row .muted {
  opacity: 0.9;
}

[data-operations-field="serviceValidationOk"] {
  letter-spacing: 0.04em;
}

/* ?? Light theme: remaining overrides for hardcoded dark-only values ?? */

html[data-theme="light"] .topbar-admin {
  border-bottom-color: rgba(97, 78, 55, 0.18);
}

html[data-theme="light"] .role-badge-admin {
  color: #6b5530;
  border-color: rgba(140, 110, 50, 0.2);
  background: rgba(140, 110, 50, 0.08);
}

html[data-theme="light"] .role-badge-user {
  color: #2f7a5d;
  border-color: rgba(47, 122, 93, 0.2);
  background: rgba(47, 122, 93, 0.08);
}

html[data-theme="light"] .table-row.event-error {
  border-color: rgba(200, 77, 104, 0.25);
  background: rgba(200, 77, 104, 0.05);
}

/* ?? Scroll to top ?? */
.scroll-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: none;
  background: var(--surface);
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s, background 0.15s;
  box-shadow: var(--shadow-md);
}

.scroll-to-top.scroll-to-top-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-to-top:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* ?? Skip to content ?? */
.skip-to-content {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  border-radius: 0 0 var(--radius) var(--radius);
}

.skip-to-content:focus {
  left: 50%;
  transform: translateX(-50%);
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ?? Sidebar toggle (hamburger) ?? */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--button-bg-hover);
}

/* ?? Sidebar overlay ?? */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

html[data-theme="light"] .sidebar-overlay {
  background: rgba(0, 0, 0, 0.25);
}

/* ?? Light theme fallback cover text ?? */
html[data-theme="light"] .cover-fallback-title {
  color: #2a2014;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

html[data-theme="light"] .cover-fallback-author {
  color: rgba(42, 32, 20, 0.72);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

html[data-theme="light"] .cover-fallback-overlay {
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.12) 0%, rgba(239, 229, 213, 0.55) 100%);
}

/* ?? Responsive ?? */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-overlay.sidebar-overlay-visible {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  .main-wrap {
    margin-left: 0;
    padding-top: 48px;
  }

  /* ?????????? ?????? ??? ~48px: ? + ???? + ?????; ????????? ? ???????? */
  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    padding: 0 10px;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
    transition: transform 0.22s ease;
    will-change: transform;
  }

  .topbar.topbar-hidden {
    transform: translateY(-100%);
    pointer-events: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .topbar {
      transition: none;
    }
  }

  .topbar.topbar-search-expanded {
    max-height: none;
    height: auto;
    flex-wrap: wrap;
    align-content: flex-start;
    padding-bottom: 0;
  }

  .topbar.topbar-search-expanded.topbar-hidden {
    transform: translateY(-100%);
    pointer-events: none;
  }

  .topbar-brand {
    display: inline-flex;
  }

  .topbar-search-toggle {
    display: inline-flex;
  }

  .topbar-desktop-tools {
    display: none !important;
  }

  .topbar-main {
    display: none;
    order: 20;
    flex: 0 0 100%;
    width: 100%;
    padding: 8px 0 10px;
    border-top: 1px solid var(--border);
  }

  .topbar.topbar-search-expanded .topbar-main {
    display: block;
  }

  .topbar-search {
    max-width: none;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .topbar-search .search-suggest-wrap {
    min-width: 0;
  }

  .topbar-search select {
    min-width: 0;
    width: 100%;
  }

  .topbar-search input,
  .topbar-search select {
    height: 40px;
    font-size: 16px;
  }

  .topbar-right {
    margin-left: auto;
    flex-wrap: nowrap;
    gap: 4px;
  }

  .sidebar-tools {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin: 12px 12px 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }

  .sidebar-tools .topbar-lang {
    justify-content: center;
    margin: 0;
  }

  .sidebar-tools .theme-toggle {
    align-self: center;
  }

  .sidebar-tools .button,
  .sidebar-tools a.button,
  .sidebar-tools button.button {
    width: 100%;
    justify-content: center;
    text-align: center;
    min-height: 44px;
  }

  .admin-sidebar-footer .sidebar-tools {
    margin: 0 0 12px;
    padding-top: 0;
    border-top: none;
  }

  .topbar .brand {
    display: block;
  }

  .panel {
    padding: 18px 16px 24px;
  }

  .section-title {
    flex-wrap: wrap;
    align-items: baseline;
  }

  .page-intro {
    align-items: start;
    gap: 14px;
  }

  .page-intro-copy h1 {
    font-size: 26px;
  }

  .page-intro-copy p {
    font-size: 13px;
  }

  .home-page-subtitle {
    font-size: 13px;
  }

  .welcome-hero-banner {
    padding: 32px 24px;
  }

  .welcome-hero-quote {
    font-size: 20px;
  }

  .premium-hero-card {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 20px;
    text-align: center;
  }

  .hero-card-info-side {
    justify-items: center;
  }

  .hero-card-author .author-popover-trigger {
    margin-inline: auto;
  }

  .hero-card-annotation {
    max-width: 36ch;
    text-align: center;
  }

  .hero-card-progress {
    width: 100%;
    max-width: 320px;
  }

  .hero-card-actions {
    width: 100%;
    flex-direction: column;
  }

  .premium-hero-card .hero-card-actions .button {
    width: 100%;
    justify-content: center;
  }

  .hero-cover-link {
    max-width: 180px;
    margin-inline: auto;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 18px 12px;
  }

  .card-detail-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    gap: 18px;
  }

  .book-detail-corner-actions {
    grid-column: auto;
    grid-row: auto;
    justify-content: flex-start;
  }

  .book-detail-cover {
    grid-column: auto;
    grid-row: auto;
  }

  .book-detail-content {
    grid-column: auto;
    grid-row: auto;
  }

  .book-detail-cover {
    max-width: none;
    width: 100%;
  }

  .book-detail-cover .cover {
    max-width: 320px;
    margin-inline: auto;
  }

  .book-detail-title {
    font-size: 24px;
  }

  .profile-page-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .admin-form-grid,
  .admin-form-grid--3 {
    grid-template-columns: 1fr;
  }

  .profile-list-item .profile-remove-btn,
  .profile-list-item .account-list-remove {
    opacity: 0.55;
  }

  .profile-list-item:hover .profile-remove-btn,
  .profile-list-item:focus-within .profile-remove-btn,
  .profile-list-item:hover .account-list-remove,
  .profile-list-item:focus-within .account-list-remove {
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .page-intro {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
  }

  .page-intro-copy h1 {
    font-size: 20px;
  }

  .page-intro-copy p {
    font-size: 12px;
    line-height: 1.5;
  }

  .page-intro-actions {
    justify-content: flex-start;
  }

  /* ?? Book grid: 3 columns on phones ?? */
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    gap: 12px 8px;
  }

  /* ?? Card covers: compact ?? */
  .cover {
    border-radius: 1px 3px 3px 1px;
  }

  /* ?? Card metadata: compact ?? */
  .meta h3 {
    font-size: 12px;
    min-height: 0;
    max-height: calc(1.34em * 3);
    line-height: 1.3;
  }

  .meta .author {
    font-size: 11px;
    min-height: 0;
    max-height: calc(1.35em * 2);
  }

  .card-series {
    font-size: 9px;
    min-height: 0;
  }

  .card .meta {
    gap: 2px;
  }

  .card .meta .card-actions {
    padding-top: 4px;
  }

  /* ?? Download button: compact on cards ?? */
  .download-menu-trigger-compact {
    min-height: 30px;
    padding: 0 8px;
    font-size: 11px;
  }

  .download-menu-popover {
    min-width: 96px;
    max-width: calc(100vw - 24px);
  }

  .download-format-link {
    min-height: 36px;
    padding: 0 8px;
    font-size: 12px;
  }

  /* ?? Book detail page ?? */
  .card-detail-panel {
    grid-template-columns: 1fr;
    padding: 14px;
    gap: 14px;
  }

  /* ?? ????????? ??????-???????? ? ??????? flex-??? ??? ????????. */
  .book-detail-corner-actions {
    grid-column: auto;
    grid-row: auto;
    max-width: none;
    margin-bottom: 4px;
    justify-content: flex-start;
  }

  .book-detail-cover {
    grid-column: auto;
    grid-row: auto;
  }

  .book-detail-content {
    grid-column: auto;
    grid-row: auto;
  }

  .book-detail-corner-actions .button {
    font-size: 13px;
    padding: 6px 12px;
  }

  .book-detail-cover {
    max-width: none;
    width: 100%;
    margin-inline: 0;
  }

  .book-detail-cover .cover {
    max-width: 280px;
    margin-inline: auto;
  }

  .book-detail-title {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .book-detail-content>.author {
    font-size: 14px;
  }

  .book-detail-annotation {
    margin-top: 10px;
    line-height: 1.65;
    font-size: 14px;
  }

  .book-detail-side-block {
    margin-top: 14px;
  }

  .book-detail-side-block h3 {
    font-size: 14px;
  }

  .book-detail-links,
  .book-detail-summary {
    line-height: 1.6;
    font-size: 13px;
  }

  .book-detail-main {
    border-radius: var(--radius);
  }

  .book-detail-disclosure {
    font-size: 13px;
  }

  /* ?? Related books: smaller cards ?? */
  .book-detail-related-shelf .grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px 6px;
  }

  /* ?? View switcher (???????; ?? ????? ??????? ???????) ?? */
  .view-switcher:not(.account-nav) .view-switcher-link {
    min-height: 36px;
    padding: 0 10px;
    font-size: 11px;
  }

  .view-switcher:not(.account-nav) {
    gap: 6px;
  }

  /* ?? Section titles ?? */
  .section-title {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .section-title h2 {
    font-size: 18px;
  }

  /* ?? Browse/filter ?? */
  .browse-filter {
    flex-direction: column;
    max-width: none;
  }

  /* ?? Panel ?? */
  .panel {
    padding: 12px 10px 18px;
  }

  /* ?? Breadcrumbs ?? */
  .breadcrumbs {
    font-size: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
  }

  /* ?? Toast ?? */
  .toast-host {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  /* ?? Profile list (legacy rows without cover) ?? */
  .profile-list-item:not(.profile-litem) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "plink pbtn"
      "pmeta pmeta";
    align-items: center;
    column-gap: 8px;
    row-gap: 4px;
    padding: 6px 0;
  }

  .profile-list-item:not(.profile-litem) .profile-list-link {
    grid-area: plink;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
    min-width: 0;
  }

  .profile-list-item:not(.profile-litem) .profile-list-meta {
    grid-area: pmeta;
    max-width: none;
    white-space: normal;
    word-break: break-word;
  }

  .profile-list-item:not(.profile-litem) .profile-remove-btn {
    grid-area: pbtn;
    opacity: 1;
    align-self: center;
  }

  /* ?? Profile list (cover rows) ?? */
  .profile-list-item.profile-litem {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    min-width: 0;
  }

  .profile-litem-link {
    flex: 1;
    min-width: 0;
  }

  .profile-list-item.profile-litem .profile-remove-btn {
    opacity: 1;
    flex-shrink: 0;
  }

  /* ?? Admin items in library context ?? */
  .admin-action-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .admin-action-item>.admin-actions-row,
  .admin-action-item .admin-actions-row {
    min-width: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .admin-user-row-date {
    margin-left: 0;
    flex-basis: 100%;
  }

  /* ?? Shelves ?? */
  .shelf-create-form {
    flex-direction: column;
    align-items: stretch;
    max-width: none;
  }

  .shelf-create-form button {
    width: 100%;
  }

  .shelf-covers-preview {
    flex-wrap: wrap;
  }

  /* ?? Batch download ?? */
  .batch-download-bar .batch-download-cluster {
    justify-content: stretch;
    flex-direction: column;
    align-items: stretch;
  }

  .batch-download-bar .batch-download-toolbar {
    justify-content: flex-start;
  }

  .batch-fab {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
    transform: translateY(calc(100% + 24px));
  }

  body:has(.bottom-nav) .batch-fab {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }

  .batch-fab.is-visible {
    transform: translateY(0);
  }

  .batch-fab-inner {
    justify-content: stretch;
    align-items: stretch;
    gap: 8px;
    padding: 10px;
  }

  .batch-fab-count {
    flex: 1 1 100%;
    text-align: center;
    line-height: 1.3;
    padding-bottom: 2px;
  }

  /* Equal-width action row (2 or 3 buttons) — avoid orphan half-width third button */
  .batch-fab-clear,
  .batch-fab-select-all,
  .batch-fab .download-menu,
  .batch-fab .batch-email-menu {
    flex: 1 1 0;
    min-width: 0;
  }

  .batch-fab .batch-fab-btn,
  .batch-fab .download-menu-trigger,
  .batch-fab-download,
  .batch-fab-clear,
  .batch-fab-select-all {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    height: 40px;
    padding: 0 10px;
    font-size: 13px;
  }

  .batch-fab .download-menu-popover {
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    max-width: none;
  }

  .batch-fab .batch-email-menu .download-menu-popover {
    left: 0;
    right: 0;
  }

  /* ?? Touch-friendly targets ?? */
  .button,
  button {
    min-height: 40px;
    padding: 8px 14px;
  }

  /* List row actions stay equal compact chips (do not inherit 40px/.button padding) */
  .author-flibusta-actions .button,
  .author-flibusta-actions button,
  .author-flibusta-actions .download-menu-trigger,
  .author-flibusta-dl .button,
  .author-flibusta-dl .download-menu-trigger,
  .author-flibusta-read,
  .author-flibusta-email {
    min-height: 32px;
    height: 32px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .page-link {
    padding: 8px 14px;
    min-height: 40px;
  }

  .page-link-prev,
  .page-link-next {
    padding: 8px 16px;
    min-height: 40px;
  }

  .pagination {
    gap: 4px;
    flex-wrap: wrap;
  }

  .topbar-lang-link {
    min-height: 40px;
    padding: 8px 10px;
  }

  .download-menu-trigger {
    min-height: 40px;
  }

  .modal-list-item {
    min-height: 44px;
    padding: 12px 18px;
  }

  /* ?? Prevent iOS auto-zoom ?? */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .topbar-search input,
  .topbar-search select {
    font-size: 16px;
  }

  /* ?? Dropdown overflow guard ?? */
  .download-menu-popover {
    max-width: calc(100vw - 24px);
  }

  .author-popover {
    max-width: calc(100vw - 24px);
  }

  .series-popover {
    max-width: calc(100vw - 24px);
  }

  .search-suggest-dropdown {
    max-height: 60vh;
  }

  /* ?? Suggest items: compact ?? */
  .suggest-item {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 40px;
  }

  .suggest-group-title {
    padding: 5px 12px 3px;
    font-size: 10px;
  }

  /* ?? Empty states ?? */
  .empty-state {
    padding: 28px 14px;
  }

  .empty-state strong {
    font-size: 15px;
  }
}

/* ?? Ultra-small devices ?? */
@media (max-width: 360px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 10px 6px;
  }

  .panel {
    padding: 10px 8px 14px;
  }

  .page-intro-copy h1 {
    font-size: 18px;
  }

  .book-detail-cover .cover {
    max-width: 240px;
  }

  .book-detail-related-shelf .grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px 5px;
  }

  .card-detail {
    grid-template-columns: 1fr;
  }

  .card-detail-panel {
    padding: 10px;
  }

  .meta h3 {
    font-size: 11px;
  }

  .meta .author {
    font-size: 10px;
  }

  .cover {
    border-radius: 1px 2px 2px 1px;
  }

  .download-menu-trigger-compact {
    min-height: 28px;
    padding: 0 6px;
    font-size: 10px;
  }

  .section-title h2 {
    font-size: 16px;
  }

  .breadcrumbs {
    font-size: 11px;
  }
}

/* Modal overlay (shared by shelf picker & ereader send) */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modal-fade-in 0.2s ease;
}

@keyframes modal-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-panel {
  background: var(--surface);
  border: none;
  border-radius: var(--radius-xl);
  width: 380px;
  max-width: 92vw;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-slide-in 0.2s ease;
}

@keyframes modal-slide-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 15px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  padding: 0 8px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  transition: color 0.15s, transform 0.15s ease;
}

.modal-close:hover {
  color: var(--text);
}

.modal-close:active {
  transform: scale(0.9);
}

.modal-close:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent);
  outline-offset: 2px;
  border-radius: 8px;
}

.empty-state-inline {
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.empty-state-inline p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* Modal: shelf picker list */
.modal-list {
  overflow-y: auto;
  max-height: 300px;
}

.modal-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 14px;
}

.modal-list-item-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.15s ease;
  min-width: 0;
}

.modal-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-list-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.modal-list-item:hover {
  background: var(--surface-hover);
}

.modal-list-item:active .modal-list-item-content {
  transform: scale(0.98);
}

.modal-list-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.modal-list-empty {
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Modal: inline create form */
.modal-inline-form {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
}

.modal-inline-form input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.modal-inline-form input:focus {
  border-color: var(--accent);
}

.modal-inline-form button {
  padding: 6px 14px;
  white-space: nowrap;
}

.modal-shelf-hint {
  margin: 0;
  padding: 4px 18px 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.modal-shelf-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.modal-shelf-cancel {
  opacity: 0.88;
}

.modal-shelf-done {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.modal-shelf-done:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000);
  border-color: color-mix(in srgb, var(--accent) 88%, #000);
  color: #fff;
}

/* Modal: ereader send form */
.modal-form {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-form label {
  font-size: 13px;
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-weight: 500;
}

.modal-form input,
.modal-form select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.modal-form input:focus,
.modal-form select:focus {
  border-color: var(--accent);
}

.modal-form select option {
  background-color: var(--select-list-bg);
  color: var(--text);
}

.modal-form-submit {
  align-self: flex-start;
  padding: 8px 20px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s ease;
}

.modal-form-submit:hover:not(:disabled) {
  opacity: 0.85;
}

.modal-form-submit:active:not(:disabled) {
  transform: scale(0.96);
}

.modal-form-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-form-hint {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.confirm-modal-cancel {
  opacity: 0.7;
}

.confirm-modal-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.confirm-modal-ok {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Shelves page: create form */
.shelf-create-form {
  display: flex;
  gap: 10px;
  max-width: 500px;
  margin-bottom: 20px;
}

.shelf-create-form input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.shelf-create-form input:focus {
  border-color: var(--accent);
}

.shelf-create-form button {
  padding: 8px 18px;
}

/* Shelf cover previews */
.shelf-covers-preview {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-top: 6px;
}

.shelf-cover-thumb {
  width: 36px;
  height: 52px;
  object-fit: cover;
  border-radius: 3px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
}

.shelf-row-info {
  min-width: 0;
}

/* ?? Admin responsive (tablet) ?? */
@media (max-width: 768px) {
  .admin-grid-2col {
    grid-template-columns: 1fr;
  }

  .admin-status-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .admin-status-bar .admin-sep {
    display: none;
  }

  .monitor-grid {
    grid-template-columns: 1fr;
  }

  .admin-card {
    padding: 14px;
  }

  /* Index banner ? stack vertically */
  .index-banner-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .index-banner-stats {
    flex-wrap: wrap;
    gap: 8px;
  }

  #sources-progress-archive {
    font-size: 12px;
  }

  /* Admin user rows ? stack date below name */
  .admin-user-row-summary {
    position: relative;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 12px;
    padding-right: 32px;
  }

  .admin-user-row-summary::after {
    position: absolute;
    right: 12px;
    top: 14px;
  }

  .admin-user-row-date {
    margin-left: 0;
    font-size: 11px;
  }

  .admin-user-row-body {
    padding: 12px;
  }

  /* Events bar ? stack vertically */
  .admin-events-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .admin-events-bar-spacer {
    display: none;
  }

  .admin-events-bar .admin-events-presets {
    flex-wrap: wrap;
  }

  .admin-events-bar .admin-events-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .admin-events-bar select {
    width: auto;
    flex: 1;
    min-width: 0;
  }

  .admin-events-bar form[style*="display:contents"] {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
  }

  .admin-events-row .admin-event-meta {
    gap: 4px 10px;
  }

  /* Generic table card-view mixin */
  .sources-table thead,
  .admin-dup-table thead,
  .admin-lang-table thead {
    display: none;
  }

  .sources-table,
  .sources-table tbody,
  .sources-table tr,
  .sources-table td,
  .admin-dup-table,
  .admin-dup-table tbody,
  .admin-dup-table tr,
  .admin-dup-table td,
  .admin-lang-table,
  .admin-lang-table tbody,
  .admin-lang-table tr,
  .admin-lang-table td {
    display: block;
    width: 100%;
  }

  .sources-table tr,
  .admin-dup-table tr,
  .admin-lang-table tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }

  .sources-table tr:last-child,
  .admin-dup-table tr:last-child,
  .admin-lang-table tr:last-child {
    border-bottom: none;
  }

  .sources-table td,
  .admin-dup-table td,
  .admin-lang-table td {
    padding: 3px 0;
    border-bottom: none;
    text-align: left !important;
  }

  .sources-table td[data-label]:not([data-label=""])::before,
  .admin-dup-table td[data-label]:not([data-label=""])::before,
  .admin-lang-table td[data-label]:not([data-label=""])::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    font-size: .85em;
    color: var(--muted);
  }

  /* Duplicates group summary ? stack on tablet */
  .admin-dup-group-summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px 12px;
  }

  .admin-dup-group-author {
    margin-left: 0 !important;
  }

  .admin-dup-table-wrap {
    padding: 0 10px 10px;
    overflow-x: visible;
  }

  .admin-dup-table {
    font-size: .85em;
  }

  .admin-dup-table td {
    white-space: normal !important;
  }

  /* Language table ? checkbox alignment */
  .admin-lang-table td:first-child {
    display: inline-block;
    width: auto;
  }

  /* Inputs ? prevent tiny fixed-width inputs */
  .admin-input-sm,
  .admin-input-xs {
    width: auto;
    min-width: 56px;
    flex: 1 1 auto;
    max-width: 100px;
  }

  /* Inline rows ? allow wrapping */
  .admin-inline-row {
    gap: 6px;
  }

  /* Disclosure details (reCaptcha etc.) */
  .admin-recaptcha-disclosure-summary {
    padding: 10px 12px;
  }

  /* Login ? compact on tablet */
  .login-shell {
    padding: 16px;
  }

  .login-card {
    padding: 22px;
  }
}

/* ?? Admin responsive (phone) ?? */
@media (max-width: 480px) {

  /* Cards ? minimal padding */
  .admin-card {
    padding: 12px;
  }

  .admin-card-title {
    font-size: 13px;
    gap: 6px;
    margin-bottom: 10px;
  }

  .admin-card-subtitle {
    font-size: 11px;
    margin-bottom: 10px;
  }

  /* Alerts ? compact */
  .flash,
  .alert {
    padding: 10px 12px;
    font-size: 12px;
    gap: 8px;
  }

  .alert-icon {
    width: 16px;
    height: 16px;
  }

  /* Action items ? stack vertically, full-width buttons */
  .admin-action-item {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 10px 0;
  }

  .admin-action-item>.admin-actions-row,
  .admin-action-item .admin-actions-row {
    flex-direction: column;
    min-width: 0;
    width: 100%;
  }

  .admin-action-item .admin-actions-row button,
  .admin-action-item .admin-actions-row .button {
    width: 100%;
    text-align: center;
  }

  /* Status bar ? smaller text */
  .admin-status-bar {
    padding: 10px 12px;
    font-size: 12px;
    gap: 4px;
  }

  .admin-status-bar .admin-chip {
    font-size: 12px;
  }

  /* Index progress ? compact */
  #sources-index-progress.alert {
    padding: 10px 12px;
  }

  #sources-index-progress .admin-actions-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  #sources-index-progress .admin-actions-row button {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* User row body ? tighter */
  .admin-user-row-summary {
    padding: 10px;
    padding-right: 28px;
  }

  .admin-user-row-body {
    padding: 10px;
  }

  .admin-user-row-body .admin-action-item {
    font-size: 12px;
  }

  .admin-user-row-body .admin-inline-row {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-user-row-body .admin-inline-row form {
    width: 100%;
  }

  .admin-user-row-body .admin-inline-row button {
    width: 100%;
    text-align: center;
  }

  /* Events ? compact */
  .admin-events-bar .admin-events-presets a {
    padding: 6px 10px;
    min-height: 36px;
  }

  .admin-events-bar select {
    height: 36px;
    font-size: 14px;
  }

  .admin-events-bar .admin-events-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-events-bar .admin-events-actions>* {
    width: 100%;
    text-align: center;
  }

  .admin-events-bar .admin-events-actions button,
  .admin-events-bar .admin-events-actions .button {
    width: 100%;
  }

  .admin-events-clear-form {
    width: 100%;
  }

  .admin-events-clear-form button {
    width: 100%;
    text-align: center;
  }

  .admin-events-scroll {
    max-height: 60vh;
  }

  .admin-events-row .admin-events-message {
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }

  .admin-event-category {
    display: block;
    margin-left: 0;
    margin-top: 2px;
  }

  /* Duplicates ? compact */
  .admin-dup-group-summary {
    padding: 10px;
    font-size: 13px;
  }

  .admin-dup-group-title {
    font-size: 13px;
  }

  .admin-dup-table-wrap {
    padding: 0 8px 8px;
  }

  .admin-dup-auto-clean {
    padding: 12px !important;
  }

  /* Languages table ? touch-friendly checkboxes */
  .admin-lang-table td:first-child {
    padding: 6px 0;
  }

  .admin-lang-table input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }

  /* Divider spacing */
  .admin-divider {
    margin: 10px 0;
  }

  /* Checkbox labels ? allow wrap */
  .admin-checkbox-label {
    font-size: 12px;
  }

  /* Section labels */
  .admin-section-label {
    font-size: 11px;
  }

  /* Utility overrides */
  .admin-compact-btn {
    font-size: .8em;
  }

  /* Monitor ? compact */
  .monitor-item {
    padding: 8px;
  }

  .monitor-label {
    font-size: 10px;
  }

  .monitor-value {
    font-size: 12px;
  }

  .monitor-foot {
    gap: 6px 10px;
    font-size: 12px;
    flex-direction: column;
  }

  /* Login ? phone */
  .login-shell {
    padding: 12px;
  }

  .login-card {
    padding: 18px;
    width: 100%;
  }

  .login-card .brand h2 {
    font-size: 18px;
  }

  .login-card input {
    font-size: 16px;
  }

  /* Empty state ? compact */
  .empty-state {
    padding: 28px 16px;
  }

  .empty-state-icon {
    width: 40px;
    height: 40px;
  }

  .empty-state strong {
    font-size: 14px;
  }

  /* Global word-break safety */
  .admin-card,
  .admin-action-item-info,
  .admin-field-hint,
  .admin-events-message,
  .admin-event-meta .muted {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Touch target minimums */
  .admin-actions-row button,
  .admin-actions-row .button,
  .admin-inline-row button {
    min-height: 40px;
    padding: 8px 14px;
  }

  /* Update page */
  .admin-card>div[style*="display:flex"] {
    flex-direction: column;
    align-items: stretch !important;
  }
}

/* ?? Modern fluid MPA View Transitions (Chrome 118+) ?? */
@view-transition {
  navigation: auto;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

/* General page fade transition */
::view-transition-old(root) {
  animation: 160ms cubic-bezier(0.4, 0, 1, 1) both global-fade-out;
}

::view-transition-new(root) {
  animation: 380ms cubic-bezier(0.16, 1, 0.3, 1) both global-fade-in;
}

@keyframes global-fade-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes global-fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Elegant Book Cover Morph Animation */
::view-transition-group(vt-cover-selected) {
  animation-duration: 380ms;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

::view-transition-old(vt-cover-selected),
::view-transition-new(vt-cover-selected) {
  animation-duration: 380ms;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  mix-blend-mode: normal;
  height: 100%;
}

/* Book page details text and controls slide & fade-in reveal */
.book-detail-content {
  animation: 500ms cubic-bezier(0.16, 1, 0.3, 1) 100ms both details-content-reveal;
}

@keyframes details-content-reveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ?? UI customization (admin appearance) ?? */
html[data-ui-bg="1"] {
  --shell-bg: transparent;
  --bg: transparent;
}

html[data-ui-bg="1"] body {
  position: relative;
}

html[data-ui-bg="1"] body::before {
  content: '';
  position: fixed;
  inset: -24px;
  z-index: -2;
  background-image: var(--ui-bg-image);
  background-size: var(--ui-bg-size, cover);
  background-position: var(--ui-bg-position, center);
  background-repeat: var(--ui-bg-repeat, no-repeat);
  filter: blur(var(--ui-bg-blur, 0px));
  transform: var(--ui-bg-transform, scale(1.06));
  pointer-events: none;
}

html[data-ui-bg="1"] body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

html[data-ui-bg="1"][data-theme="dark"] body::after {
  /* Overlay strength (--ui-bg-overlay 0?80) is independent of panel glass; tint comes from theme. */
  background: color-mix(in srgb, var(--ui-theme-dark-bg-overlay-color, #1a1612) calc(min(100, var(--ui-bg-overlay, 0) * 100 / 80) * 1%), transparent);
}

html[data-ui-bg="1"][data-theme="light"] body::after {
  background: color-mix(in srgb, var(--ui-theme-light-bg-overlay-color, #fffdf8) calc(min(100, var(--ui-bg-overlay, 0) * 100 / 80) * 1%), transparent);
}

html[data-ui-theme="1"][data-theme="dark"] {
  --ui-glass-bg: var(--ui-theme-dark-surface, #141210);
  --text: var(--ui-theme-dark-text, #ece6dc);
  --muted: var(--ui-theme-dark-muted, #a89888);
  --accent: var(--ui-theme-dark-accent, #9a8e7e);
  --accent-hover: var(--ui-theme-dark-accent-hover, #a1671b);
  --link: var(--ui-theme-dark-link, #d4ac5c);
  --link-hover: var(--ui-theme-dark-link-hover, #efc06f);
  --surface: var(--ui-theme-dark-surface, #141210);
  --surface-hover: var(--ui-theme-dark-surface-hover, #231f1a);
  --bg: var(--ui-theme-dark-shell-bg, #1c1814);
  --bg-side: var(--ui-theme-dark-sidebar-bg, #141210);
  --shell-bg: var(--ui-theme-dark-shell-bg, #1c1814);
  --sidebar-bg: var(--ui-theme-dark-sidebar-bg, #141210);
  --topbar-bg: var(--ui-theme-dark-topbar-bg, #141210);
  --border: var(--ui-theme-dark-border, rgba(255, 255, 255, 0.11));
  --sidebar-brand-border: var(--ui-theme-dark-sidebar-brand-border, rgba(255, 255, 255, 0.11));
  --topbar-border: var(--ui-theme-dark-topbar-border, rgba(255, 255, 255, 0.11));
  --field-bg: var(--ui-theme-dark-field-bg, rgba(255, 255, 255, 0.07));
  --panel-soft-bg: var(--ui-theme-dark-panel-soft-bg, rgba(255, 255, 255, 0.09));
  --button-bg: var(--ui-theme-dark-button-bg, rgba(255, 255, 255, 0.08));
  --button-bg-hover: var(--ui-theme-dark-button-bg-hover, rgba(255, 255, 255, 0.14));
  --button-border-hover: var(--ui-theme-dark-button-border-hover, rgba(255, 255, 255, 0.16));
  --card-bg: var(--ui-theme-dark-card-bg, rgba(255, 255, 255, 0.04));
  --card-bg-hover: var(--ui-theme-dark-card-bg-hover, rgba(255, 255, 255, 0.08));
  --card-cover-bg: var(--ui-theme-dark-card-cover-bg);
  --card-cover-fallback-bg: var(--ui-theme-dark-card-cover-fallback-bg);
  --card-cover-border: var(--ui-theme-dark-card-cover-border, rgba(255, 255, 255, 0.1));
  --select-list-bg: var(--ui-glass-bg);
  --select-list-bg-active: var(--surface-hover);
}

html[data-ui-theme="1"][data-theme="light"] {
  --ui-glass-bg: var(--ui-theme-light-surface, #f7f4ef);
  --text: var(--ui-theme-light-text, #2a2218);
  --muted: var(--ui-theme-light-muted, #6e5e4c);
  --accent: var(--ui-theme-light-accent, #7a6a58);
  --accent-hover: var(--ui-theme-light-accent-hover, #a1671b);
  --link: var(--ui-theme-light-link, #8b5a12);
  --link-hover: var(--ui-theme-light-link-hover, #a86a0a);
  --surface: var(--ui-theme-light-surface, #f7f4ef);
  --surface-hover: var(--ui-theme-light-surface-hover, #f4ecdf);
  --bg: var(--ui-theme-light-shell-bg, #f5f0e8);
  --bg-side: var(--ui-theme-light-sidebar-bg, #f7f4ef);
  --shell-bg: var(--ui-theme-light-shell-bg, #f5f0e8);
  --sidebar-bg: var(--ui-theme-light-sidebar-bg, #f7f4ef);
  --topbar-bg: var(--ui-theme-light-topbar-bg, #f7f4ef);
  --border: var(--ui-theme-light-border, rgba(42, 34, 24, 0.12));
  --sidebar-brand-border: var(--ui-theme-light-sidebar-brand-border, rgba(42, 34, 24, 0.12));
  --topbar-border: var(--ui-theme-light-topbar-border, rgba(42, 34, 24, 0.12));
  --field-bg: var(--ui-theme-light-field-bg, rgba(255, 255, 255, 0.72));
  --panel-soft-bg: var(--ui-theme-light-panel-soft-bg, rgba(255, 255, 255, 0.52));
  --button-bg: var(--ui-theme-light-button-bg, rgba(255, 255, 255, 0.58));
  --button-bg-hover: var(--ui-theme-light-button-bg-hover, rgba(255, 255, 255, 0.78));
  --button-border-hover: var(--ui-theme-light-button-border-hover, rgba(42, 34, 24, 0.18));
  --card-bg: var(--ui-theme-light-card-bg, rgba(255, 255, 255, 0.5));
  --card-bg-hover: var(--ui-theme-light-card-bg-hover, rgba(255, 255, 255, 0.75));
  --card-cover-bg: var(--ui-theme-light-card-cover-bg);
  --card-cover-fallback-bg: var(--ui-theme-light-card-cover-fallback-bg);
  --card-cover-border: var(--ui-theme-light-card-cover-border, rgba(42, 34, 24, 0.12));
  --select-list-bg: var(--ui-glass-bg);
  --select-list-bg-active: var(--surface-hover);
}

html[data-ui-bg="1"][data-ui-theme="1"][data-theme="dark"],
html[data-ui-bg="1"][data-ui-theme="1"][data-theme="light"] {
  --shell-bg: transparent;
  --bg: transparent;
  --bg-side: transparent;
}

html[data-ui-sliders="1"] {
  --ui-glass-fill-opacity: var(--ui-surface-opacity, 88);
  --ui-glass-menu-fill-opacity: min(100, calc(var(--ui-glass-fill-opacity) + 12));
  --ui-glass-panel-bg: color-mix(in srgb, var(--ui-glass-bg, var(--surface)) calc(var(--ui-glass-fill-opacity) * 1%), transparent);
  --ui-glass-menu-bg: color-mix(in srgb, var(--ui-glass-bg, var(--surface)) calc(var(--ui-glass-menu-fill-opacity) * 1%), transparent);
  --ui-glass-hover-bg: color-mix(in srgb, var(--ui-glass-bg, var(--surface-hover)) calc(var(--ui-glass-fill-opacity) * 1%), transparent);
  --ui-glass-active-bg: color-mix(in srgb, var(--accent) 38%, var(--ui-glass-panel-bg));
  --ui-glass-menu-active-bg: color-mix(in srgb, var(--accent) 38%, var(--ui-glass-menu-bg));
  --ui-glass-active-hover-bg: color-mix(in srgb, var(--accent) 46%, var(--ui-glass-hover-bg));
  --ui-glass-active-border: color-mix(in srgb, var(--accent) 64%, transparent);
  --ui-glass-highlight-inset: color-mix(in srgb, var(--accent) 24%, transparent);
  --ui-glass-accent-bg: color-mix(in srgb, var(--link) calc(var(--ui-glass-fill-opacity) * 1%), transparent);
  --ui-glass-accent-border: color-mix(in srgb, var(--link) calc(var(--ui-glass-fill-opacity) * 1%), transparent);
  --ui-glass-accent-hover-bg: color-mix(in srgb, var(--link-hover) calc(var(--ui-glass-fill-opacity) * 1%), transparent);
}

html[data-ui-sliders="1"] .search-suggest-dropdown .suggest-item:hover,
html[data-ui-sliders="1"] .search-suggest-dropdown .suggest-item.suggest-active,
html[data-ui-sliders="1"] .download-menu-popover .download-format-link:hover,
html[data-ui-sliders="1"] .author-popover-inner a:hover,
html[data-ui-sliders="1"] .series-popover-inner a:hover,
html[data-ui-sliders="1"] select option:hover,
html[data-ui-sliders="1"] select option:checked,
html[data-ui-sliders="1"] select option:focus,
html[data-ui-sliders="1"] select option:focus-visible {
  background-color: var(--ui-glass-menu-active-bg, var(--ui-glass-active-bg, color-mix(in srgb, var(--accent) 18%, var(--surface))));
  box-shadow: inset 0 0 0 1px var(--ui-glass-highlight-inset, color-mix(in srgb, var(--accent) 24%, transparent));
}

html[data-ui-sliders="1"] .sidebar,
html[data-ui-sliders="1"] .topbar,
html[data-ui-sliders="1"] .topbar.topbar-admin,
html[data-ui-sliders="1"] .login-card,
html[data-ui-sliders="1"] .admin-card {
  background: var(--ui-glass-panel-bg);
  backdrop-filter: blur(var(--ui-surface-blur, 0px));
  -webkit-backdrop-filter: blur(var(--ui-surface-blur, 0px));
}

.login-brand-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.login-logo-img {
  max-width: 140px;
  max-height: 72px;
  object-fit: contain;
}

.ui-asset-block {
  padding: 12px 0;
}

.ui-asset-block-meta strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.ui-asset-block-meta .muted {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
}

.ui-asset-block-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 20px;
  align-items: start;
  margin-top: 10px;
}

.ui-asset-block-preview {
  min-height: 132px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.ui-asset-block-preview .muted {
  font-size: 12px;
  line-height: 1.4;
}

.ui-asset-block-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  width: min(100%, 220px);
  align-items: stretch;
  justify-self: end;
}

.ui-asset-block-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.ui-asset-pick-btn {
  cursor: pointer;
  flex-shrink: 0;
  width: 100%;
  justify-content: center;
  box-sizing: border-box;
}

.ui-asset-remove-form {
  display: flex;
  margin: 0;
  flex-shrink: 0;
  width: 100%;
}

.ui-asset-remove-form button {
  width: 100%;
  justify-content: center;
}

.ui-asset-remove-form[hidden] {
  display: none;
}

.ui-asset-block-status {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  min-height: 2.8em;
  max-width: 36em;
}

.ui-asset-block-extra {
  margin-top: 2px;
}

.ui-asset-checkbox {
  text-transform: none;
  letter-spacing: 0;
}

.ui-asset-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.ui-asset-preview {
  display: block;
  max-width: 180px;
  max-height: 72px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--field-bg);
  padding: 6px;
}

.ui-asset-preview--favicon {
  max-width: 48px;
  max-height: 48px;
  padding: 4px;
}

.ui-asset-preview--bg {
  max-width: 280px;
  max-height: 120px;
}

@media (max-width: 720px) {
  .ui-asset-block-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .ui-asset-block-preview {
    min-height: 0;
  }

  .ui-asset-block-controls {
    width: 100%;
    justify-self: stretch;
  }
}

.ui-glass-theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.ui-glass-theme-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-soft-bg);
}

.ui-glass-theme-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.ui-glass-preview {
  min-height: 72px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ui-glass-preview-main {
  font-weight: 600;
}

.ui-glass-preview-pick {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  padding: 2px 8px;
  transition: background 0.12s ease;
}

.ui-glass-preview-pick:hover {
  background: color-mix(in srgb, currentColor 12%, transparent);
}

.ui-glass-preview-pick:focus-within {
  outline: 2px solid color-mix(in srgb, var(--link) 45%, transparent);
  outline-offset: 2px;
}

.ui-glass-preview-color-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  margin: 0;
}

.ui-glass-preview-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  font-weight: 500;
}

.ui-color-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.ui-color-field-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ui-color-field-row input[type="color"] {
  width: 56px;
  height: 40px;
  min-width: 56px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  cursor: pointer;
}

.ui-color-field-row code {
  font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  color: var(--text);
  letter-spacing: 0.02em;
}

.ui-glass-auto-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}

.ui-glass-auto-label input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.ui-font-preview {
  display: flex;
  align-items: center;
  min-height: 72px;
  padding: var(--space-md, 14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel-soft-bg);
  font-size: var(--font-size-lg, 16px);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.admin-typography-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ui-font-upload-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ui-font-upload-btn {
  flex: 1 1 auto;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.2;
  justify-content: center;
  box-sizing: border-box;
}

.ui-font-upload-preview {
  display: flex;
  align-items: center;
  min-height: 0;
}

.ui-font-upload-preview .ui-font-preview {
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
}

.ui-font-upload-preview>.muted {
  font-size: 12px;
  line-height: 1.4;
}

.ui-font-upload-toolbar+.ui-font-upload-preview {
  margin-top: 2px;
}

.ui-font-upload-toolbar~.ui-asset-block-status {
  min-height: 0;
  margin: 0;
}

@media (max-width: 720px) {
  .ui-glass-theme-grid {
    grid-template-columns: 1fr;
  }
}

/* ?? ??????????????? ????? ??? ??????? ???? ??? ????????? ????? ?? */
html[data-ui-shape="1"][data-theme="light"] {
  --shadow-sm: var(--shadow-light-sm, 0 1px 2px rgba(32, 24, 14, 0.08));
  --shadow-md: var(--shadow-light-md, 0 6px 18px -4px rgba(32, 24, 14, 0.16));
  --shadow-lg: var(--shadow-light-lg, 0 16px 36px -12px rgba(32, 24, 14, 0.24));
  --card-cover-shadow: var(--shadow-light-card-cover-shadow, 0 1px 1px rgba(32, 24, 14, 0.35), 2px 3px 3px rgba(32, 24, 14, 0.22), 5px 8px 12px rgba(32, 24, 14, 0.18), 10px 18px 24px rgba(32, 24, 14, 0.14));
  --card-cover-shadow-hover: var(--shadow-light-card-cover-shadow-hover, 0 2px 2px rgba(32, 24, 14, 0.42), 4px 6px 6px rgba(32, 24, 14, 0.28), 12px 18px 24px rgba(32, 24, 14, 0.24), 24px 38px 48px rgba(32, 24, 14, 0.18));
}

/* ?? ??????????? ? ????????? (????????? ?? ???????) ?? */
html[data-ui-typography="1"] .shell {
  font-size: var(--font-size-base);
}

html[data-ui-typography="1"] .shell :is(input, select, textarea, .button, button,
  .admin-card, .panel, .login-card,
  .topbar-search input, .topbar-search select,
  .suggest-item, .suggest-empty, .download-format-link,
  .table-row, .meta h3, .book-detail-shell) {
  font-size: var(--font-size-base);
}

html[data-ui-typography="1"] .shell :is(.muted, .admin-field-hint, .admin-card-subtitle,
  .topbar-right a, .topbar-lang, .suggest-item-sub,
  .meta .author, .card-series, .sidenav-section,
  .admin-sidebar-badge, .role-badge-admin, .role-badge-user) {
  font-size: var(--font-size-sm);
}

html[data-ui-typography="1"] .shell :is(.admin-card-title, .sidebar .brand h1, .sidebar .brand h2,
  .welcome-hero-title, .book-detail-shell h1) {
  font-size: var(--font-size-lg);
}

html[data-ui-typography="1"] .shell :is(.welcome-hero-banner h1, .premium-hero-card .hero-card-title) {
  font-size: var(--font-size-xl);
}

html[data-ui-typography="1"] .shell .admin-card {
  padding: var(--space-md) var(--space-lg);
}

html[data-ui-typography="1"] .shell .admin-card-title {
  margin-bottom: var(--space-sm);
  gap: var(--space-xs);
}

html[data-ui-typography="1"] .shell .admin-card-subtitle {
  margin-bottom: var(--space-md);
}

html[data-ui-typography="1"] .admin-appearance-layout {
  gap: var(--space-lg);
}

html[data-ui-typography="1"] .shell .admin-form-grid {
  gap: var(--space-md);
}

html[data-ui-typography="1"] .shell .panel {
  padding: var(--space-lg) var(--space-xl) var(--space-xl);
}

html[data-ui-typography="1"] .shell .grid {
  gap: var(--space-xl) var(--space-lg);
}

html[data-ui-typography="1"] .shell .card {
  gap: var(--space-sm);
}

html[data-ui-typography="1"] .shell .sidenav-links {
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-sm);
}

html[data-ui-typography="1"] .shell .sidenav a {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-base);
}

html[data-ui-typography="1"] .shell .topbar {
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
}

html[data-ui-typography="1"] .shell .topbar-search {
  gap: var(--space-sm);
}

html[data-ui-typography="1"] .login-card {
  font-size: var(--font-size-base);
  padding: var(--space-xl) var(--space-lg);
}

/* ?? ???????? ??????????: ?????? ????? ?????? ?? */
.admin-appearance-layout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.admin-appearance-layout>.admin-card {
  margin: 0;
}

.ui-shape-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}

.ui-shape-preview-label {
  font-size: 12px;
  color: var(--muted);
}

.ui-shape-preview-chip {
  width: 72px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--ui-glass-panel-bg, var(--surface));
  box-shadow: var(--shadow-md);
}

.ui-shape-preview-chip--soft {
  width: 54px;
  box-shadow: var(--shadow-sm);
}

/* Live preview status bar */
.admin-appearance-preview-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 8px;
  z-index: 5;
}

.admin-appearance-preview-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent);
  animation: ui-preview-pulse 1.8s ease-out infinite;
  flex: none;
}

@keyframes ui-preview-pulse {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  }

  100% {
    box-shadow: 0 0 0 8px transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .admin-appearance-preview-dot {
    animation: none;
  }
}

/* Theme presets */
.ui-preset-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px;
  margin: 4px 0 8px;
}

.ui-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 8px;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: var(--radius-button);
  background: var(--button-bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}

.ui-preset-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  background: var(--button-bg-hover);
}

.ui-preset-btn:active {
  transform: translateY(1px);
}

.ui-preset-btn.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.ui-preset-swatch {
  width: 100%;
  height: 28px;
  border-radius: 6px;
  flex: none;
  background: linear-gradient(135deg, var(--preset-dark, #222) 0 50%, var(--preset-light, #eee) 50% 100%);
  box-shadow: inset 0 0 0 2px var(--preset-accent, transparent), inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.ui-preset-name {
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.ui-color-field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.ui-accent-auto-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  margin-bottom: 6px;
}

/* ????? ???????? ? ??????? ?????? ? ?????? ???????????? ?? ???? ??????? */
.ui-color-field input[type="color"]:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.admin-card-reset {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}

.admin-card-reset--inline {
  margin-top: 10px;
  padding-top: 0;
  border-top: 0;
  justify-content: flex-start;
}

/* ?????? ??? ?????????? ????? ???????? ?????????? */
.admin-appearance-save {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 2px;
  padding: 14px 0;
  background: linear-gradient(to top, var(--shell-bg) 60%, transparent);
}

.admin-appearance-save-btn {
  font-size: 15px;
  padding: 11px 32px;
}

.admin-appearance-save-btn.button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffdf8;
}

.admin-appearance-save-btn.button-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fffdf8;
}

@media (max-width: 720px) {
  .admin-appearance-save-btn {
    width: auto;
    max-width: calc(100% - 64px);
  }
}

/* ?? E-Ink mode (cookie eink=1 ? html[data-eink="1"]) ?? */
html[data-eink="1"] {
  color-scheme: light;
  scroll-behavior: auto;
  --bg: #ffffff;
  --bg-side: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f4f4f4;
  --shell-bg: #ffffff;
  --sidebar-bg: #ffffff;
  --topbar-bg: #ffffff;
  --text: #000000;
  --muted: #222222;
  --link: #000000;
  --link-hover: #000000;
  --accent: #000000;
  --accent-hover: #000000;
  --border: #000000;
  --ui-surface-blur: 0px;
  --ui-bg-blur: 0px;
  --ui-bg-overlay: 0;
  --card-cover-shadow: none;
  --card-cover-shadow-hover: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
}

html[data-eink="1"] body {
  background: #ffffff !important;
  color: #000000 !important;
}

html[data-eink="1"] body::before,
html[data-eink="1"] body::after {
  display: none !important;
}

html[data-eink="1"] *,
html[data-eink="1"] *::before,
html[data-eink="1"] *::after {
  animation: none !important;
  transition: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-eink="1"] .welcome-hero-banner,
html[data-eink="1"] .nav-progress {
  display: none !important;
}

html[data-eink="1"] .sidebar,
html[data-eink="1"] .topbar,
html[data-eink="1"] .panel,
html[data-eink="1"] .book-detail-main,
html[data-eink="1"] .login-card,
html[data-eink="1"] .card,
html[data-eink="1"] .admin-card {
  background: #ffffff !important;
  border-color: #000000 !important;
  box-shadow: none !important;
}

html[data-eink="1"] a {
  color: #000000 !important;
  text-decoration: underline;
  text-underline-offset: 2px;
}

html[data-eink="1"] .sidenav-links a {
  color: #000000 !important;
  text-decoration: none !important;
  border: 1px solid transparent;
  border-radius: 0;
}

html[data-eink="1"] .sidenav-links a:hover {
  background: #eeeeee !important;
  color: #000000 !important;
  border-color: #000000;
}

html[data-eink="1"] .sidenav-links a.active {
  background: #000000 !important;
  color: #ffffff !important;
  font-weight: 700;
  border-color: #000000;
  text-decoration: none !important;
}

html[data-eink="1"] .sidebar .brand-home-link,
html[data-eink="1"] .sidebar .brand-home-link h1,
html[data-eink="1"] .sidebar .brand-home-link h2 {
  text-decoration: none !important;
}

html[data-eink="1"] .sidenav-section {
  color: #000000 !important;
  opacity: 1;
}

html[data-eink="1"] a.button,
html[data-eink="1"] .button,
html[data-eink="1"] button,
html[data-eink="1"] input,
html[data-eink="1"] select,
html[data-eink="1"] textarea {
  background: #ffffff !important;
  color: #000000 !important;
  border: 2px solid #000000 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-height: 44px;
}

html[data-eink="1"] .theme-toggle,
html[data-eink="1"] .eink-toggle {
  min-height: 36px;
  min-width: 36px;
  border-width: 2px !important;
}

html[data-eink="1"] .eink-toggle.is-active {
  background: #000000 !important;
  color: #ffffff !important;
}

html[data-eink="1"] .eink-toggle.is-active span {
  color: #ffffff !important;
}

html[data-eink="1"] .cover {
  background: #ffffff !important;
  border: 1px solid #000000;
  box-shadow: none !important;
}

html[data-eink="1"] .cover img,
html[data-eink="1"] .brand-logo,
html[data-eink="1"] .login-logo-img {
  filter: grayscale(100%) contrast(115%);
}

html[data-eink="1"] .cover-fallback-overlay {
  background: rgba(255, 255, 255, 0.5) !important;
}

html[data-eink="1"] .cover-fallback-title,
html[data-eink="1"] .cover-fallback-author {
  color: #000000 !important;
}

html[data-eink="1"] .cover-image.is-loaded {
  opacity: 1 !important;
}

html[data-eink="1"] .cover-rating-wrapper {
  filter: none;
}

html[data-eink="1"] .read-badge {
  inset: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: auto;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.45) !important;
  border: none !important;
  box-shadow: none !important;
}

html[data-eink="1"] .read-badge svg {
  width: 42%;
  aspect-ratio: 1;
  height: auto;
  padding: 10%;
  border-radius: 50%;
  background: #ffffff !important;
  border: 2px solid #000000;
  box-shadow: none !important;
  stroke: #000000 !important;
}

html[data-eink="1"] .read-series-badge {
  background: #ffffff !important;
  border: 2px solid #000000;
}

html[data-eink="1"] .read-series-badge svg {
  stroke: #000000 !important;
}

html[data-eink="1"] .cover-rating-badge,
html[data-eink="1"] .cover-rating-1,
html[data-eink="1"] .cover-rating-2,
html[data-eink="1"] .cover-rating-3,
html[data-eink="1"] .cover-rating-4,
html[data-eink="1"] .cover-rating-5,
html[data-eink="1"] .detail-rating-badge,
html[data-eink="1"] .detail-rating-1,
html[data-eink="1"] .detail-rating-2,
html[data-eink="1"] .detail-rating-3,
html[data-eink="1"] .detail-rating-4,
html[data-eink="1"] .detail-rating-5 {
  background: #ffffff !important;
  background-image: none !important;
  color: #000000 !important;
  border: 1px solid #000000;
  box-shadow: none !important;
  text-shadow: none !important;
}

html[data-eink="1"] .cover-rating-badge::before,
html[data-eink="1"] .cover-rating-badge::after {
  display: none !important;
}

html[data-eink="1"] .cover-rating-badge>span,
html[data-eink="1"] .cover-rating-badge .star-active {
  color: #000000 !important;
}

html[data-eink="1"] .spinner {
  border-color: rgba(0, 0, 0, 0.15) !important;
  border-top-color: #000000 !important;
}

html[data-eink="1"] .topbar-lang-link.is-active {
  font-weight: 700;
  text-decoration: underline;
}

/* Catalog multi-filter panel — collapsed by default */
.catalog-filter-panel {
  margin: 8px 0 14px;
  padding: 0;
  border: none;
  background: transparent;
}

.catalog-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.catalog-filter-shell {
  margin: 0;
  min-width: 0;
}

.catalog-filter-shell>.catalog-filter-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-button, var(--radius));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}

.catalog-filter-shell>.catalog-filter-summary::-webkit-details-marker {
  display: none;
}

.catalog-filter-shell>.catalog-filter-summary::after {
  content: '';
  width: 0.45em;
  height: 0.45em;
  margin-top: -0.15em;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.7;
}

.catalog-filter-shell[open]>.catalog-filter-summary::after {
  margin-top: 0.15em;
  transform: rotate(-135deg);
}

.catalog-filter-shell>.catalog-filter-summary:hover {
  background: var(--surface-hover);
  border-color: var(--button-border-hover, var(--border));
}

.catalog-filter-shell[open] {
  flex: 1 1 100%;
  order: 3;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.catalog-filter-shell[open]>.catalog-filter-summary {
  margin-bottom: 10px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
}

.catalog-filter-body {
  display: grid;
  gap: 10px;
}

.catalog-filter-reset {
  color: var(--link);
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.catalog-filter-reset:hover {
  color: var(--link-hover);
}

.catalog-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.catalog-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--button-bg);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}

.catalog-filter-chip:hover {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
}

.catalog-filter-details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}

.catalog-filter-details>summary {
  cursor: pointer;
  font-weight: 600;
}

.catalog-genre-panel {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.catalog-genre-search {
  width: 100%;
  max-width: none;
}

.catalog-genre-list {
  display: flex;
  flex-direction: column;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--field-bg);
}

.catalog-genre-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 9px 12px;
  min-height: 40px;
  font-size: 13px;
  line-height: 1.35;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.catalog-genre-option:last-child {
  border-bottom: none;
}

.catalog-genre-option:hover {
  background: var(--surface-hover);
}

.catalog-genre-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.catalog-genre-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-genre-count {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  white-space: nowrap;
}

.catalog-genre-option[hidden] {
  display: none !important;
}

.catalog-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  align-items: end;
}

.catalog-filter-row-inline .catalog-filter-field {
  flex: 1 1 110px;
  min-width: 100px;
}

.catalog-filter-row-inline .catalog-filter-field-narrow {
  flex: 1 1 90px;
  min-width: 84px;
}

.catalog-filter-field {
  display: grid;
  gap: 4px;
  min-width: 120px;
  flex: 1 1 140px;
  margin: 0;
}

.catalog-filter-field-narrow {
  flex: 0 1 110px;
  min-width: 90px;
}

.catalog-filter-field select,
.catalog-filter-field input {
  width: 100%;
}

.catalog-filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  flex: 0 0 auto;
}

.empty-state-actions {
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

/* —— Card annotation hover preview (over cover only; never covers .card-actions) —— */
.card-annotation-preview {
  display: none;
}

@media (hover: hover) and (min-width: 901px) {

  /* Hover only for pointer; :focus-visible (not :focus-within) so long-press /
     click "Прочитано" focus on the cover link does not pin the overlay open. */
  .card.has-annotation-preview:hover .cover .card-annotation-preview,
  .card.has-annotation-preview:has(:focus-visible) .cover .card-annotation-preview {
    display: -webkit-box !important;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    max-height: 62%;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 9;
    line-clamp: 9;
    padding: 28px 8px 8px;
    border: 0;
    /* Совпадает с нижними углами .cover (1px 4px 4px 1px) */
    border-radius: 0 0 4px 1px;
    background: linear-gradient(to top,
        color-mix(in srgb, #0c0a08 92%, transparent) 0%,
        color-mix(in srgb, #0c0a08 88%, transparent) 45%,
        color-mix(in srgb, #0c0a08 72%, transparent) 72%,
        color-mix(in srgb, #0c0a08 42%, transparent) 90%,
        transparent 100%);
    color: rgba(255, 248, 238, 0.92);
    font-size: 11px;
    line-height: 1.35;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    box-shadow: none;
    pointer-events: none;
    animation: annotation-preview-in .14s ease-out;
  }

  html[data-theme="light"] .card.has-annotation-preview:hover .cover .card-annotation-preview,
  html[data-theme="light"] .card.has-annotation-preview:has(:focus-visible) .cover .card-annotation-preview {
    background: linear-gradient(to top,
        color-mix(in srgb, #f7f1e6 94%, transparent) 0%,
        color-mix(in srgb, #f7f1e6 90%, transparent) 45%,
        color-mix(in srgb, #f7f1e6 74%, transparent) 72%,
        color-mix(in srgb, #f7f1e6 44%, transparent) 90%,
        transparent 100%);
    color: color-mix(in srgb, var(--text) 88%, #000 12%);
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.55);
  }
}

@keyframes annotation-preview-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {

  .card.has-annotation-preview:hover .cover .card-annotation-preview,
  .card.has-annotation-preview:has(:focus-visible) .cover .card-annotation-preview {
    animation: none;
  }
}

/* ?? Micro-feedback ?? */
@keyframes ui-feedback-pulse {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.06);
  }

  100% {
    transform: scale(1);
  }
}

.ui-feedback-pulse {
  animation: ui-feedback-pulse .32s ease;
}

@keyframes progress-pulse-kf {

  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.25);
  }
}

.progress-pulse {
  animation: progress-pulse-kf .45s ease;
}

@media (prefers-reduced-motion: reduce) {

  .ui-feedback-pulse,
  .progress-pulse {
    animation: none;
  }
}

/* ?? Mobile bottom nav ?? */
.bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--topbar-bg, var(--surface));
    border-top: 1px solid var(--topbar-border, var(--border));
    backdrop-filter: blur(10px);
  }

  .bottom-nav-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 4px 2px;
    color: var(--muted);
    text-decoration: none;
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
  }

  .bottom-nav-item.is-active {
    color: var(--link);
    font-weight: 600;
  }

  body:has(.bottom-nav) .shell {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  body:has(.bottom-nav) .toast-host {
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
  }

  body:has(.bottom-nav) .scroll-to-top {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .bottom-nav:has(.bottom-nav-item:nth-child(3):last-child) {
    grid-template-columns: repeat(3, 1fr);
  }
}
