@import url("./core/tokens.css");
@import url("./core/layout.css");

.library-stack {
  display: grid;
  gap: 18px;
}

.topbar,
.brand,
.toolbar,
.nav,
.hero-actions,
.library-toolbar,
.status-list,
.book-meta,
.settings-grid,
.form-grid,
.report-row {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  padding: 8px 4px 24px;
}

.brand { gap: 14px; }
.brand-home {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
}
.brand-header h1 {
  font-size: 2rem;
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand h1,
.hero-copy h2,
.section-title,
.book-hero-copy h3 {
  margin: 0;
  font-family: "Literata", serif;
}

.nav { gap: 8px; flex-wrap: wrap; justify-content: center; }
.nav-header {
  justify-content: center;
  gap: 28px;
  min-width: 0;
}

.ghost-button,
.primary-button,
.secondary-button,
.status-pill {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
}

.ghost-button,
.primary-button,
.secondary-button {
  padding: 10px 16px;
  cursor: pointer;
}

.nav-button {
  position: relative;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.nav-button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -9px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(200, 155, 60, 0), rgba(200, 155, 60, 0.95), rgba(200, 155, 60, 0));
  transform: scaleX(0);
  transition: transform 160ms ease;
}

.nav-button:hover,
.nav-button.active {
  color: var(--text);
}

.nav-button.active::after {
  transform: scaleX(1);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-text);
  font-weight: 800;
  border: 0;
  background-clip: padding-box;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.primary-button:hover,
.primary-button:focus-visible,
.auth-cta:hover,
.auth-cta:focus-visible {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-strong-hover));
}

.stats-glowing-active {
  color: var(--accent-text) !important;
  border-color: transparent !important;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)) !important;
  box-shadow:
    0 10px 24px color-mix(in srgb, var(--accent) 28%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent) !important;
}

.stats-glowing-active:hover,
.stats-glowing-active:focus-visible {
  color: var(--accent-text) !important;
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-strong-hover)) !important;
  box-shadow:
    0 12px 28px color-mix(in srgb, var(--accent) 32%, transparent),
    0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent) !important;
}

.toolbar-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.profile-badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(200,155,60,0.26), rgba(139,111,61,0.16));
}

.header-utility {
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: var(--surface-control);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease;
}

.header-utility:hover,
.header-profile-link:hover,
.brand-home:hover h1,
.brand-home:hover .eyebrow {
  color: var(--text);
}

.header-utility:hover,
.header-utility:focus-visible {
  border-color: var(--accent-strong);
  background: var(--surface-control-hover);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
  transform: translateY(-1px);
  outline: none;
}

.header-theme-toggle {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.header-theme-toggle.header-utility,
#theme-toggle {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.header-theme-toggle:hover,
.header-theme-toggle:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  outline: none;
}

#theme-toggle:hover,
#theme-toggle:focus-visible,
#theme-toggle:active {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  transform: none;
  outline: none;
}

.header-profile-menu {
  position: relative;
}

.lang-menu {
  position: relative;
}

.lang-toggle-button {
  min-width: 98px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.lang-toggle-button:hover,
.lang-toggle-button:focus-visible {
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: none;
  outline: none;
}

.lang-toggle-flag {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.08),
    0 4px 12px rgba(0,0,0,0.16);
  flex: 0 0 auto;
}

.lang-toggle-shell,
.lang-option-copy {
  display: inline-flex;
  align-items: center;
}

.lang-toggle-shell {
  width: 100%;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 6px;
}

.lang-toggle-copy {
  display: grid;
  justify-items: start;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.lang-toggle-code {
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  font-weight: 800;
}

.lang-toggle-caret {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--muted);
  transition: transform 180ms ease, color 180ms ease, background 180ms ease;
}

.lang-toggle-caret svg {
  width: 14px;
  height: 14px;
}

.lang-toggle-button[data-open="true"] .lang-toggle-caret {
  transform: rotate(180deg);
  color: var(--text);
  background: var(--hover-surface);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  display: grid;
  gap: 4px;
  min-width: 190px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: var(--surface-control);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
  z-index: 30;
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.lang-dropdown[hidden] {
  display: none;
}

.lang-dropdown.lang-dropdown-ready {
  display: grid;
}

.lang-dropdown[data-open="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, color 160ms ease;
}

.lang-option:hover,
.lang-option.active {
  background: var(--hover-surface);
  transform: translateX(2px);
}

.lang-option-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.lang-option-copy {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.lang-option-label {
  color: var(--muted);
  font-size: 0.84rem;
}

.lang-option.active .lang-option-label {
  color: var(--text);
}

.lang-option-check {
  width: 18px;
  text-align: center;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
}

.lang-flag-ru {
  background:
    radial-gradient(circle at 35% 30%, rgba(255,255,255,0.9), rgba(255,255,255,0.2) 36%, transparent 37%),
    linear-gradient(180deg, #ffffff 0 33.33%, #2557c7 33.33% 66.66%, #c63a32 66.66% 100%);
}

.lang-flag-en {
  background:
    linear-gradient(90deg, transparent 42%, #ffffff 42% 58%, transparent 58%),
    linear-gradient(180deg, transparent 38%, #ffffff 38% 62%, transparent 62%),
    linear-gradient(90deg, transparent 46%, #d43f3f 46% 54%, transparent 54%),
    linear-gradient(180deg, transparent 42%, #d43f3f 42% 58%, transparent 58%),
    #18326e;
}

.lang-flag-de {
  background:
    radial-gradient(circle at 30% 28%, rgba(255,255,255,0.12), transparent 36%),
    linear-gradient(180deg, #121212 0 33.33%, #c7342f 33.33% 66.66%, #d8b342 66.66% 100%);
}

.lang-flag-uk {
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.16), transparent 38%),
    linear-gradient(180deg, #2d71dc 0 50%, #e1b64a 50% 100%);
}

.theme-toggle-switch {
  display: inline-flex;
  align-items: center;
}

.theme-toggle-track {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 72px;
  height: 40px;
  padding: 4px;
  border: 1px solid color-mix(in srgb, var(--panel-border) 82%, rgba(255,255,255,0.08));
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(34, 33, 37, 0.92), rgba(25, 24, 28, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), inset 0 -1px 0 rgba(0,0,0,0.12);
  overflow: hidden;
  transition: background 260ms ease, border-color 180ms ease, box-shadow 260ms ease, transform 420ms cubic-bezier(.2,.9,.2,1);
}

#theme-toggle:hover .theme-toggle-track {
  border-color: color-mix(in srgb, var(--accent) 24%, var(--panel-border) 76%);
  background: linear-gradient(180deg, rgba(40, 39, 44, 0.96), rgba(28, 27, 32, 1));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -1px 0 rgba(0,0,0,0.1);
}

.theme-toggle-thumb {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.theme-toggle-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(180deg, #F1C979, #D7A653);
  box-shadow: 0 4px 10px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,0.22);
  transform: translateX(0) scale(1);
  transition: transform 460ms cubic-bezier(.2,.9,.2,1), background 220ms ease, color 220ms ease, box-shadow 260ms ease;
}

.theme-toggle-switch.is-dark .theme-toggle-thumb {
  transform: translateX(32px) scale(1);
  background: linear-gradient(180deg, #F1C979, #D7A653);
  box-shadow: 0 6px 14px rgba(185, 120, 36, 0.18), 0 4px 10px rgba(0,0,0,0.16);
}

body[data-theme="light"] .theme-toggle-thumb {
  background: linear-gradient(180deg, #F1C979, #D7A653);
  box-shadow: 0 6px 14px rgba(185, 120, 36, 0.18), 0 4px 10px rgba(84, 64, 40, 0.12);
}

#theme-toggle[data-animating="true"][data-direction="to-dark"] .theme-toggle-thumb {
  transform: translateX(32px) scale(1);
}

#theme-toggle[data-animating="true"][data-direction="to-light"] .theme-toggle-thumb {
  transform: translateX(0) scale(1);
}

#theme-toggle:active .theme-toggle-thumb {
  transform: translateX(0) scaleX(1.08) scaleY(0.94);
}

#theme-toggle:active .theme-toggle-switch.is-dark .theme-toggle-thumb {
  transform: translateX(32px) scaleX(1.08) scaleY(0.94);
}

.theme-toggle-thumb img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
  transition: transform 420ms cubic-bezier(.2,.9,.2,1), opacity 220ms ease, filter 220ms ease;
}

.theme-toggle-thumb-night img {
  width: 26px;
  height: 26px;
}

#theme-toggle[data-animating="true"] .theme-toggle-thumb img,
#theme-toggle:hover .theme-toggle-thumb img {
  transform: scale(1.04);
}


.auth-slot,
.header-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-cta,
.header-profile-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-text);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  background-clip: padding-box;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.header-profile-link {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
}

.header-profile-link:hover,
.header-profile-link:focus-visible {
  background: transparent;
  box-shadow: none;
  transform: none;
  outline: none;
}

.header-profile-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(217,164,65,0.24), rgba(239,216,165,0.18));
  color: var(--text);
  font-size: 0.85rem;
}

.header-profile-caret {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 180ms ease, color 180ms ease;
}

.header-profile-caret svg {
  width: 14px;
  height: 14px;
}

.header-profile-link[data-open="true"] .header-profile-caret {
  transform: rotate(180deg);
  color: var(--text);
}

.header-profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  gap: 4px;
  min-width: 164px;
  padding: 8px;
  border-radius: 16px;
  background: var(--surface-control);
  box-shadow: 0 18px 36px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 30;
}

.header-profile-dropdown[hidden] {
  display: none;
}

.header-profile-dropdown[data-open="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.header-profile-option {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.header-profile-option:hover,
.header-profile-option:focus-visible {
  background: var(--hover-surface);
  outline: none;
}

.header-profile-option-danger {
  color: #d96b4a;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero,
.panel,
.book-hero,
.admin-table,
.settings-panel {
  border: 1px solid var(--panel-border);
  background: var(--surface-panel);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 22px;
  padding: 32px;
}

.hero-landing {
  min-height: 420px;
}

body[data-page="landing"] .hero-landing {
  min-height: calc(100vh - 144px);
  padding: 8px 0 0;
  display: flex;
  justify-content: center;
  width: 100%;
  background:
    url('/assets/nestory-logo.jpg') center center / cover no-repeat;
  border: 0;
  box-shadow: none;
  align-items: center;
}

.landing-copy {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 32px 40px;
  border: 0;
  border-radius: 28px;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg-elevated) 100%);
  box-shadow: none;
  text-align: center;
}

.hero-actions-centered {
  justify-content: center;
}

.join-cta {
  min-height: 54px;
  padding: 0 10px 0 24px;
  border-radius: 18px;
  gap: 18px;
  font-size: 1.02rem;
}

.join-cta-arrow {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.74);
  color: #3b6ef2;
}

.join-cta-arrow svg {
  width: 18px;
  height: 18px;
}

.hero-copy h2 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
  margin-bottom: 14px;
}

.hero-copy p,
.muted,
.small { color: var(--muted); }

.hero-actions { gap: 12px; margin: 22px 0 28px; }

.hero-stats,
.dashboard-grid,
.library-grid,
.admin-grid,
.quick-grid {
  display: grid;
  gap: 18px;
}

.hero-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat-card,
.panel,
.book-card,
.report-card,
.setting-card {
  border: 1px solid var(--panel-border);
  background: var(--surface-panel);
  border-radius: var(--radius-lg);
}

.stat-card,
.panel,
.setting-card,
.report-card,
.book-card,
.admin-table {
  padding: 18px;
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  margin-top: 10px;
}

.hero-visual { position: relative; min-height: 380px; }

.floating-book {
  position: absolute;
  border-radius: 22px;
  border: 1px solid var(--panel-border);
  overflow: hidden;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.35);
}

.floating-book img,
.book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.floating-book.one { width: 180px; height: 260px; top: 10px; right: 40px; transform: rotate(6deg); }
.floating-book.two { width: 160px; height: 230px; bottom: 20px; left: 20px; transform: rotate(-8deg); }
.floating-book.three { width: 130px; height: 190px; bottom: 80px; right: 10px; }

.dashboard-grid { grid-template-columns: 1.5fr 1fr; margin-top: 22px; }
.stack,
.reading-list,
.finished-list,
.report-list,
.book-side-panel { display: grid; gap: 14px; }

.panel-title,
.section-title { margin: 0 0 16px; font-size: 1.35rem; }

.mini-book,
.finished-book { display: flex; gap: 12px; }

.mini-book img,
.finished-book img {
  width: 46px;
  height: 68px;
  border-radius: 10px;
  object-fit: cover;
}

.progress-bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--hover-surface);
  overflow: hidden;
}

.progress-bar > span {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: 999px;
  background: var(--progress-fill);
}

.stats-table { display: grid; gap: 10px; }
.stats-row,
.metadata-row {
  display: grid;
  gap: 10px;
}

.stats-row { grid-template-columns: 1.2fr 0.3fr; }
.metadata-row { grid-template-columns: 160px 1fr; }

.pill-row,
.status-list { gap: 8px; flex-wrap: wrap; }

.status-pill,
.tag {
  padding: 7px 12px;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 0.9rem;
}

.status-pill-success {
  background: rgba(116, 198, 157, 0.16);
}

.status-pill-warning {
  background: rgba(217, 170, 75, 0.2);
}

.library-toolbar {
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 16px;
  flex-wrap: wrap;
}

.filters,
.library-search { display: flex; gap: 10px; flex-wrap: wrap; }

input,
textarea {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

select {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.12);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
}

.library-search input { min-width: min(460px, 70vw); }
.library-grid { grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); justify-content: start; }
.library-grid-empty {
  grid-template-columns: 1fr;
}

.library-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 320px;
  gap: 18px;
}

.dashboard-showcase {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.9fr;
  gap: 0;
  margin-bottom: 24px;
}

.dashboard-showcase > .panel,
.dashboard-showcase > .dashboard-side-column > .panel {
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  margin: 0 !important;
  border: none !important;
}

.dashboard-showcase {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.9fr;
  gap: 0;
  margin-bottom: 24px;
  position: relative;
}

.dashboard-showcase > * {
  position: relative;
  /* removing standard padding assignment to let .panel use native */
  border: none !important;
}

/* Horizontal line: Bottom of Row 1 (children 1, 2, 3) */
.dashboard-showcase > *:nth-child(1)::before {
  content: ""; position: absolute; bottom: 0; left: 10%; right: 0; height: 1px; background: var(--panel-border); z-index: 1; pointer-events: none;
}
.dashboard-showcase > *:nth-child(2)::before {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 1px; background: var(--panel-border); z-index: 1; pointer-events: none;
}
.dashboard-showcase > *:nth-child(3)::before {
  content: ""; position: absolute; bottom: 0; left: 0; right: 10%; height: 1px; background: var(--panel-border); z-index: 1; pointer-events: none;
}

/* Vertical lines: Right of Col 1 & 2 (children 1, 2, 4, 5) */
.dashboard-showcase > *:nth-child(1)::after,
.dashboard-showcase > *:nth-child(2)::after {
  content: ""; position: absolute; right: 0; top: 15%; bottom: 0; width: 1px; background: var(--panel-border); z-index: 1; pointer-events: none;
}
.dashboard-showcase > *:nth-child(4)::after,
.dashboard-showcase > *:nth-child(5)::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 15%; width: 1px; background: var(--panel-border); z-index: 1; pointer-events: none;
}

.statistics-showcase {
  grid-template-columns: 1fr;
}

.statistics-panel {
  max-width: 760px;
  margin: 0 auto;
}

.page-frame-statistics {
  width: min(1760px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

body[data-page="statistics"] .app-shell {
  width: min(1760px, calc(100vw - 28px));
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body[data-page="statistics"] .app-shell::before {
  display: none !important;
}

.statistics-page {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.statistics-sidebar {
  position: sticky;
  top: 104px;
  display: grid;
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.statistics-header h2,
.statistics-placeholder-panel h3 {
  margin: 0;
}

.statistics-nav {
  display: grid;
  gap: 5px;
}

.statistics-nav-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.statistics-nav-item:hover,
.statistics-nav-item:focus-visible {
  color: var(--text);
  background: var(--hover-surface);
  outline: 0;
}

.statistics-nav-item.is-active {
  color: var(--accent-text);
}

.statistics-nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: currentColor;
  opacity: 0.62;
}

.statistics-nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.statistics-nav-item.is-active .statistics-nav-icon {
  opacity: 1;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 36%, transparent));
}

.statistics-content {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.statistics-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.statistics-header h2 {
  font-size: clamp(1.6rem, 2.6vw, 2.35rem);
}

.statistics-header-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.statistics-period-context {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.statistics-period-semantics {
  margin: 0;
  max-width: 620px;
}

.statistics-period-semantics span {
  color: var(--text);
  font-weight: 800;
}

.statistics-custom-range {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 7px;
  margin-top: 4px;
}

.statistics-custom-range label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.statistics-custom-range input {
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--surface-panel);
  color: var(--text);
  font: inherit;
}

.statistics-custom-range input[aria-invalid="true"] {
  border-color: #ff6b5f;
}

.statistics-custom-range-separator {
  padding-bottom: 7px;
  color: var(--muted);
}

.statistics-custom-range-error {
  flex-basis: 100%;
  margin: 0;
  color: #ff6b5f;
  font-size: 0.78rem;
  font-weight: 700;
}

.statistics-period-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.statistics-period-chip {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.statistics-period-chip:hover,
.statistics-period-chip:focus-visible {
  color: var(--text);
  outline: 0;
}

.statistics-period-chip.is-active {
  color: var(--accent-text);
}

.statistics-overview {
  display: grid;
  gap: 18px;
}

.statistics-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.statistics-status-card,
.statistics-metric-card,
.statistics-dashboard-panel,
.statistics-placeholder-panel {
  border: 1px solid var(--panel-border);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.045), transparent 42%),
    var(--surface-panel);
  box-shadow: var(--shadow-soft);
}

.statistics-status-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 96px;
  padding: 16px;
  border-radius: 14px;
}

.statistics-status-card p,
.statistics-metric-card p,
.statistics-metric-card small,
.statistics-period-note,
.statistics-placeholder-panel p {
  margin: 0;
  color: var(--muted);
}

.statistics-status-copy {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.statistics-status-copy > div:first-of-type {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.statistics-status-card strong {
  font-size: 1.65rem;
}

.statistics-status-copy > div:first-of-type span {
  color: var(--muted);
  font-weight: 700;
}

.statistics-status-track {
  height: 7px;
  border-radius: 999px;
  background: var(--hover-surface);
  overflow: hidden;
}

.statistics-status-track > span {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.statistics-status-card.is-completed { color: #49c374; }
.statistics-status-card.is-reading { color: #67aaf6; }
.statistics-status-card.is-planned { color: var(--accent-strong); }
.statistics-status-card.is-paused { color: #a56cf0; }
.statistics-status-card.is-dropped { color: #ff6b5f; }

.statistics-period-note {
  padding: 0 2px;
}

.statistics-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.statistics-metric-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 104px;
  padding: 18px;
  border-radius: 14px;
}

.statistics-card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(244, 166, 64, 0.16);
  border: 1px solid rgba(244, 166, 64, 0.2);
  color: currentColor;
}

.statistics-card-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.statistics-status-card .statistics-card-icon {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.statistics-status-card .statistics-card-icon svg {
  width: 42px;
  height: 42px;
}

.statistics-metric-card.is-books { color: #49c374; }
.statistics-metric-card.is-pages { color: var(--accent-strong); }
.statistics-metric-card.is-size { color: #67aaf6; }
.statistics-metric-card.is-year { color: #a56cf0; }
.statistics-metric-card.is-genre { color: #49c374; }
.statistics-metric-card.is-author { color: #46c9d3; }
.statistics-metric-card.is-author-total { color: #49c374; }
.statistics-metric-card.is-author-read { color: #f1ae58; }
.statistics-metric-card.is-author-favorite { color: #b778f0; }
.statistics-metric-card.is-author-productive { color: #67aaf6; }
.statistics-metric-card.is-author-average { color: #f08a31; }
.statistics-metric-card.is-author-active { color: #49c374; }
.statistics-metric-card.is-genre-total { color: #49c374; }
.statistics-metric-card.is-genre-read { color: #f0c24e; }
.statistics-metric-card.is-genre-favorite { color: #b778f0; }
.statistics-metric-card.is-genre-share { color: #67aaf6; }
.statistics-metric-card.is-genre-average { color: #49c374; }
.statistics-metric-card.is-genre-active { color: #f08a31; }
.statistics-metric-card.is-book-size-average { color: #49c374; }
.statistics-metric-card.is-book-size-largest { color: #f0c24e; }
.statistics-metric-card.is-book-size-shortest { color: #b778f0; }
.statistics-metric-card.is-book-size-dominant { color: #67aaf6; }
.statistics-metric-card.is-book-size-very-large { color: #f08a31; }
.statistics-metric-card.is-book-size-missing { color: #9aa1aa; }
.statistics-metric-card.is-rating-average { color: #f0c24e; }
.statistics-metric-card.is-rating-books { color: #49c374; }
.statistics-metric-card.is-rating-muted { color: #9aa1aa; }
.statistics-metric-card.is-rating-favorite { color: #b778f0; }
.statistics-metric-card.is-rating-five-star { color: #f0c24e; }
.statistics-metric-card.is-rating-best-year { color: #67aaf6; }
.statistics-metric-card .statistics-card-icon {
  background: color-mix(in srgb, currentColor 16%, transparent);
  border-color: color-mix(in srgb, currentColor 24%, transparent);
}

.statistics-metric-card > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.statistics-metric-card strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-dashboard-panel {
  min-width: 0;
  padding: 18px;
  border-radius: 14px;
}

.statistics-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.statistics-panel-header h3,
.statistics-panel-header p {
  margin: 0;
}

.statistics-panel-header p {
  color: var(--muted);
  font-size: 0.9rem;
}

.statistics-chart-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 22px;
  min-width: min(520px, 100%);
}

.statistics-chart-tab,
.statistics-preview-more {
  min-height: 34px;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.statistics-chart-tab {
  position: relative;
  padding: 0 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.statistics-preview-more {
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--accent-strong);
}

.statistics-preview-more:hover,
.statistics-preview-more:focus-visible {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 44%, var(--panel-border) 56%);
  outline: 0;
}

.statistics-chart-tab:hover,
.statistics-chart-tab:focus-visible {
  color: var(--text);
  outline: 0;
}

.statistics-chart-tab.is-active {
  color: var(--accent-strong);
}

.statistics-chart-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 48%, transparent);
}

.statistics-bar-chart {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.statistics-chart-row {
  display: grid;
  grid-template-columns: minmax(62px, 112px) minmax(0, 1fr) minmax(34px, auto);
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.statistics-chart-label,
.statistics-mini-bar-row > span,
.statistics-size-row > span {
  overflow: hidden;
  color: var(--muted);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-chart-track,
.statistics-mini-bar-row > div,
.statistics-size-row > div {
  min-width: 0;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.statistics-chart-track > span,
.statistics-mini-bar-row i,
.statistics-size-row i {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #49c374, var(--accent-strong));
}

.statistics-bar-chart.is-books .statistics-chart-track > span {
  background: linear-gradient(90deg, #48c878, #8de2a9);
  box-shadow: 0 0 16px rgba(72, 200, 120, 0.26);
}

.statistics-bar-chart.is-pages .statistics-chart-track > span {
  background: linear-gradient(90deg, #f08a21, var(--accent));
  box-shadow: 0 0 16px rgba(240, 138, 33, 0.28);
}

.statistics-chart-row strong,
.statistics-mini-bar-row strong,
.statistics-size-row strong,
.statistics-size-row em {
  color: var(--text);
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.statistics-chart-axis {
  display: flex;
  justify-content: space-between;
  padding-left: min(112px, 28%);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.statistics-chart-axis-label {
  margin: -2px 0 0;
  padding-left: min(112px, 28%);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.statistics-chart-empty {
  display: grid;
  place-items: center;
  min-height: 160px;
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.statistics-release-years-page {
  display: grid;
  gap: 14px;
}

.statistics-release-years-main {
  min-height: 260px;
}

.statistics-release-mode-pills {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
}

.statistics-release-mode-pill {
  display: inline-grid;
  place-items: center;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.statistics-release-mode-pill:hover,
.statistics-release-mode-pill:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 36%, transparent);
  color: var(--text);
  outline: 0;
}

.statistics-release-mode-pill.is-active {
  border-color: color-mix(in srgb, var(--accent) 74%, var(--panel-border) 26%);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 26%, transparent);
  color: var(--accent-strong);
}

.statistics-release-line-scroll {
  min-width: 0;
  overflow-x: auto;
  padding: 4px 2px 2px;
  scrollbar-color: color-mix(in srgb, var(--accent) 45%, transparent) transparent;
  scrollbar-width: thin;
}

.statistics-release-line-scroll::-webkit-scrollbar {
  height: 8px;
}

.statistics-release-line-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.035);
  border-radius: 999px;
}

.statistics-release-line-scroll::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
  background-clip: padding-box;
}

.statistics-release-line-svg {
  display: block;
  min-width: 680px;
  height: 310px;
}

.statistics-release-line-grid line {
  stroke: color-mix(in srgb, var(--muted) 18%, transparent);
  stroke-dasharray: 4 8;
  stroke-width: 1;
}

.statistics-release-line-grid text {
  fill: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-anchor: end;
}

.statistics-release-line-area {
  fill: color-mix(in srgb, #49c374 18%, transparent);
}

.statistics-release-line-stroke {
  fill: none;
  stroke: #69d98f;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px color-mix(in srgb, #49c374 34%, transparent));
}

.statistics-release-line-point circle {
  fill: #69d98f;
  stroke: var(--surface-panel);
  stroke-width: 3;
  filter: drop-shadow(0 0 8px color-mix(in srgb, #49c374 42%, transparent));
}

.statistics-release-line-value,
.statistics-release-line-label {
  text-anchor: middle;
  font-weight: 850;
}

.statistics-release-line-value {
  fill: var(--text);
  font-size: 0.78rem;
}

.statistics-release-line-label {
  fill: var(--muted);
  font-size: 0.76rem;
}

.statistics-release-line-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 260px;
  border: 1px dashed var(--panel-border);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.statistics-release-line-empty strong {
  color: var(--text);
  font-size: 1rem;
}

.statistics-release-line-empty p {
  max-width: 430px;
  margin: 0;
  line-height: 1.5;
}

.statistics-release-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.96fr);
  gap: 14px;
}

.statistics-release-decades-panel .statistics-panel-header {
  margin-bottom: 12px;
}

.statistics-release-decade-list {
  display: grid;
  gap: 10px;
}

.statistics-release-decade-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(0, 1.4fr) minmax(34px, auto) minmax(42px, auto);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.statistics-release-decade-row > span {
  overflow: hidden;
  color: var(--muted);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-release-decade-row > div {
  min-width: 0;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.statistics-release-decade-row i {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f1ae58, #f5cf8d);
  box-shadow: 0 0 14px rgba(241, 174, 88, 0.18);
}

.statistics-release-decade-row.is-1920-1939 i,
.statistics-release-decade-row.is-1940-1959 i {
  background: linear-gradient(90deg, #c871c9, #da9be2);
  box-shadow: 0 0 14px rgba(200, 113, 201, 0.18);
}

.statistics-release-decade-row.is-1960-1979 i {
  background: linear-gradient(90deg, #5da6dc, #8cc6eb);
  box-shadow: 0 0 14px rgba(93, 166, 220, 0.18);
}

.statistics-release-decade-row.is-1980-1999 i,
.statistics-release-decade-row.is-2000-2019 i {
  background: linear-gradient(90deg, #49c374, #9be36f);
  box-shadow: 0 0 14px rgba(72, 200, 120, 0.24);
}

.statistics-release-decade-row.is-2020-current i {
  background: linear-gradient(90deg, #f08a31, #f6b35d);
  box-shadow: 0 0 14px rgba(240, 138, 49, 0.22);
}

.statistics-release-decade-row.is-unknown i {
  background: linear-gradient(90deg, #9d6d9f, #b486b6);
  box-shadow: 0 0 14px rgba(157, 109, 159, 0.18);
}

.statistics-release-decade-row.is-empty > span,
.statistics-release-decade-row.is-empty strong,
.statistics-release-decade-row.is-empty em {
  opacity: 0.62;
}

.statistics-release-decade-row strong,
.statistics-release-decade-row em {
  color: var(--text);
  font-style: normal;
  font-weight: 800;
  text-align: right;
}

.statistics-release-decade-row em {
  color: var(--muted);
  font-size: 0.82rem;
}

.statistics-release-ranking {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.statistics-release-ranking li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 45px;
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--panel-border) 78%, transparent);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.statistics-release-ranking li > span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 12%, transparent);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.statistics-release-ranking li:nth-child(1) > span {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--accent-strong);
}

.statistics-release-ranking li:nth-child(2) > span {
  background: rgba(93, 166, 220, 0.16);
  color: #8cc6eb;
}

.statistics-release-ranking li:nth-child(3) > span {
  background: rgba(73, 195, 116, 0.16);
  color: #8de2a9;
}

.statistics-release-ranking strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-release-ranking em {
  color: var(--accent-strong);
  font-style: normal;
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.statistics-release-ranking .is-unknown em {
  color: color-mix(in srgb, #b486b6 78%, var(--text) 22%);
}

.statistics-release-insight-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-height: 104px;
}

.statistics-release-insight-panel .statistics-card-icon {
  width: 44px;
  height: 44px;
  background: rgba(73, 195, 116, 0.16);
  color: #8de2a9;
}

.statistics-release-insight-panel h3,
.statistics-release-insight-panel p,
.statistics-release-insight-panel small {
  margin: 0;
}

.statistics-release-insight-panel h3 {
  color: var(--text);
  font-size: 0.92rem;
}

.statistics-release-insight-panel p {
  margin-top: 3px;
  color: var(--text);
  font-weight: 780;
  line-height: 1.45;
}

.statistics-release-insight-panel small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.statistics-release-insight-panel.is-unknown .statistics-card-icon,
.statistics-release-insight-panel.is-empty .statistics-card-icon {
  background: rgba(157, 109, 159, 0.15);
  color: #c99fcd;
}

.statistics-release-insight-panel.is-classic .statistics-card-icon {
  background: rgba(241, 174, 88, 0.16);
  color: #f5cf8d;
}

.statistics-release-skeleton-panel {
  display: grid;
  gap: 8px;
  min-height: 112px;
}

.statistics-release-skeleton-panel h3,
.statistics-release-skeleton-panel p {
  margin: 0;
}

.statistics-release-skeleton-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.statistics-release-empty-panel {
  min-height: 240px;
}

.statistics-authors-page {
  display: grid;
  gap: 14px;
}

.statistics-authors-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.statistics-authors-summary-grid .statistics-metric-card {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 14px;
  min-height: 132px;
}

.statistics-authors-summary-grid .statistics-card-icon {
  width: 34px;
  height: 34px;
}

.statistics-authors-summary-grid .statistics-metric-card strong {
  font-size: 1.05rem;
}

.statistics-authors-lower-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.statistics-author-distribution-panel {
  min-height: 178px;
}

.statistics-author-distribution-bars {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  min-width: 0;
}

.statistics-author-distribution-segment {
  display: grid;
  gap: 10px;
  min-width: 0;
  text-align: center;
}

.statistics-author-distribution-segment strong {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 900;
}

.statistics-author-distribution-segment > div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.statistics-author-distribution-segment i {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: inherit;
}

.statistics-author-distribution-segment span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-author-distribution-segment.is-one i { background: linear-gradient(90deg, #49c374, #72dea0); }
.statistics-author-distribution-segment.is-two-three i { background: linear-gradient(90deg, #75c86b, #a4df7e); }
.statistics-author-distribution-segment.is-four-five i { background: linear-gradient(90deg, #f0c24e, #f5d572); }
.statistics-author-distribution-segment.is-six-ten i { background: linear-gradient(90deg, #f08a31, #f6b35d); }
.statistics-author-distribution-segment.is-eleven-twenty i { background: linear-gradient(90deg, #e85d8f, #f286ad); }
.statistics-author-distribution-segment.is-twenty-plus i { background: linear-gradient(90deg, #9b61df, #bd83f2); }

.statistics-author-distribution-segment.is-empty {
  opacity: 0.6;
}

.statistics-author-top-panel {
  min-height: 250px;
}

.statistics-author-top-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.statistics-author-top-list.is-expanded {
  max-height: min(480px, 60vh);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding-right: 6px;
  scrollbar-color: color-mix(in srgb, var(--accent) 40%, transparent) transparent;
  scrollbar-width: thin;
}

.statistics-author-top-list li {
  display: grid;
  grid-template-columns: 26px 30px minmax(0, 1fr) minmax(76px, 0.7fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.statistics-author-rank,
.statistics-author-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.statistics-author-rank {
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
}

.statistics-author-top-list li:nth-child(1) .statistics-author-rank {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--accent-strong);
}

.statistics-author-avatar {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #6d77e8, #b778f0);
  color: #fff;
  letter-spacing: 0.02em;
}

.statistics-author-top-list li:nth-child(2) .statistics-author-avatar { background: linear-gradient(135deg, #4e8be8, #67c8f6); }
.statistics-author-top-list li:nth-child(3) .statistics-author-avatar { background: linear-gradient(135deg, #e85d8f, #f286ad); }
.statistics-author-top-list li:nth-child(4) .statistics-author-avatar,
.statistics-author-top-list li:nth-child(5) .statistics-author-avatar { background: linear-gradient(135deg, #3eb7b8, #72dea0); }

.statistics-author-top-list strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 840;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-author-top-list li > div {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.statistics-author-top-list i {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #49c374, #72dea0);
  box-shadow: 0 0 14px rgba(72, 200, 120, 0.22);
}

.statistics-author-top-list em {
  color: var(--text);
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.statistics-author-top-list small {
  color: var(--muted);
  font-weight: 760;
}

.statistics-author-show-all {
  margin-top: 14px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
}

.statistics-author-show-all:not(:disabled) {
  cursor: pointer;
}

.statistics-author-show-all:not(:disabled):hover,
.statistics-author-show-all:not(:disabled):focus-visible {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--panel-border) 56%);
  color: var(--accent-strong);
  outline: 0;
}

.statistics-author-genre-panel {
  min-height: 250px;
}

.statistics-author-genre-body {
  display: grid;
  grid-template-columns: minmax(128px, 0.78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: 20px;
}

.statistics-author-donut,
.statistics-book-size-donut,
.statistics-ratings-donut-placeholder {
  position: relative;
  display: grid;
  place-items: center;
  width: min(150px, 100%);
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 999px;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.08);
}

.statistics-author-donut::before,
.statistics-book-size-donut::before,
.statistics-ratings-donut-placeholder::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: inherit;
  background: var(--surface-panel);
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.22);
}

.statistics-author-donut > div,
.statistics-book-size-donut > div,
.statistics-ratings-donut-placeholder > div {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  width: 50%;
  min-width: 0;
  gap: 4px;
  text-align: center;
}

.statistics-author-donut strong,
.statistics-book-size-donut strong,
.statistics-ratings-donut-placeholder strong {
  color: var(--text);
  font-size: 1.45rem;
  line-height: 1;
}

.statistics-author-donut span,
.statistics-book-size-donut span,
.statistics-ratings-donut-placeholder span {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.statistics-author-donut {
  background: conic-gradient(var(--author-donut, rgba(255, 255, 255, 0.08) 0 100%));
}

.statistics-author-genre-legend {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.statistics-author-genre-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 38px;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.statistics-author-genre-row > span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #49c374;
}

.statistics-author-genre-row.is-2 > span { background: #f0c24e; }
.statistics-author-genre-row.is-3 > span { background: #9b61df; }
.statistics-author-genre-row.is-4 > span { background: #67aaf6; }
.statistics-author-genre-row.is-5 > span { background: #e85d8f; }
.statistics-author-genre-row.is-6 > span { background: #35c2c1; }

.statistics-author-genre-row strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-author-genre-row em,
.statistics-author-genre-row small {
  color: var(--muted);
  font-style: normal;
  font-weight: 760;
  text-align: right;
  white-space: nowrap;
}

.statistics-author-genre-row small {
  color: var(--text);
}

.statistics-author-insight-panel {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(120px, 0.32fr);
  align-items: center;
  gap: 16px;
  min-height: 112px;
  overflow: hidden;
}

.statistics-author-insight-panel .statistics-card-icon {
  width: 44px;
  height: 44px;
  background: rgba(73, 195, 116, 0.16);
  border-color: rgba(73, 195, 116, 0.24);
  color: #8de2a9;
}

.statistics-author-insight-panel h3,
.statistics-author-insight-panel p,
.statistics-author-insight-panel small {
  margin: 0;
}

.statistics-author-insight-panel h3 {
  color: var(--text);
  font-size: 0.92rem;
}

.statistics-author-insight-panel p {
  margin-top: 4px;
  color: var(--text);
  font-weight: 780;
  line-height: 1.45;
}

.statistics-author-insight-panel small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.statistics-author-insight-panel.is-favorite .statistics-card-icon {
  background: rgba(244, 166, 64, 0.16);
  border-color: rgba(244, 166, 64, 0.24);
  color: var(--accent-strong);
}

.statistics-author-insight-panel.is-empty .statistics-card-icon {
  background: rgba(157, 109, 159, 0.15);
  border-color: rgba(157, 109, 159, 0.24);
  color: #c99fcd;
}

.statistics-author-insight-art {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
  min-height: 70px;
  opacity: 0.58;
}

.statistics-author-insight-art span {
  display: block;
  width: 12px;
  height: 42px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(244, 166, 64, 0.52), rgba(255, 255, 255, 0.08));
  transform: rotate(-2deg);
}

.statistics-author-insight-art span:nth-child(2) {
  height: 54px;
  background: linear-gradient(180deg, rgba(73, 195, 116, 0.45), rgba(255, 255, 255, 0.08));
  transform: rotate(1deg);
}

.statistics-author-insight-art span:nth-child(3) {
  height: 34px;
  background: linear-gradient(180deg, rgba(103, 170, 246, 0.45), rgba(255, 255, 255, 0.08));
  transform: rotate(3deg);
}

.statistics-author-insight-art i {
  width: 34px;
  height: 46px;
  border-radius: 999px 999px 8px 999px;
  background: linear-gradient(135deg, rgba(73, 195, 116, 0.7), rgba(73, 195, 116, 0.16));
  transform: rotate(28deg);
}

.statistics-genres-page {
  display: grid;
  gap: 14px;
}

.statistics-genres-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.statistics-genres-summary-grid .statistics-metric-card {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 14px;
  min-height: 132px;
}

.statistics-genres-summary-grid .statistics-card-icon {
  width: 34px;
  height: 34px;
}

.statistics-genres-summary-grid .statistics-metric-card strong {
  font-size: 1.05rem;
}

.statistics-genres-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(0, 1.02fr);
  gap: 14px;
}

.statistics-genre-popular-panel,
.statistics-genre-dynamics-panel {
  min-height: 290px;
}

.statistics-genre-popular-list {
  display: grid;
  gap: 10px;
}

.statistics-genre-popular-row {
  display: grid;
  grid-template-columns: minmax(118px, 0.9fr) minmax(0, 1.4fr) 34px 42px;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.statistics-genre-popular-row > span {
  overflow: hidden;
  color: var(--text);
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-genre-popular-row > div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.statistics-genre-popular-row i {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: inherit;
  background: #49c374;
  box-shadow: 0 0 14px rgba(73, 195, 116, 0.2);
}

.statistics-genre-popular-row.is-2 i { background: #f0c24e; box-shadow: 0 0 14px rgba(240, 194, 78, 0.2); }
.statistics-genre-popular-row.is-3 i { background: #9b61df; box-shadow: 0 0 14px rgba(155, 97, 223, 0.2); }
.statistics-genre-popular-row.is-4 i { background: #67aaf6; box-shadow: 0 0 14px rgba(103, 170, 246, 0.2); }
.statistics-genre-popular-row.is-5 i { background: #e85d8f; box-shadow: 0 0 14px rgba(232, 93, 143, 0.2); }
.statistics-genre-popular-row.is-6 i { background: #35c2c1; box-shadow: 0 0 14px rgba(53, 194, 193, 0.18); }
.statistics-genre-popular-row.is-other i { background: #7a7f87; box-shadow: none; }

.statistics-genre-popular-row strong,
.statistics-genre-popular-row em {
  color: var(--text);
  font-style: normal;
  font-weight: 850;
  text-align: right;
}

.statistics-genre-popular-row em {
  color: var(--muted);
}

.statistics-genre-series {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.statistics-genre-series-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.statistics-genre-series-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 780;
}

.statistics-genre-series-legend i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #49c374;
}

.statistics-genre-series-legend .is-2 i { background: #f0c24e; }
.statistics-genre-series-legend .is-3 i { background: #9b61df; }
.statistics-genre-series-legend .is-4 i { background: #67aaf6; }
.statistics-genre-series-legend .is-5 i { background: #e85d8f; }

.statistics-genre-series-scroll {
  min-width: 0;
  overflow-x: auto;
  scrollbar-color: color-mix(in srgb, var(--accent) 40%, transparent) transparent;
  scrollbar-width: thin;
}

.statistics-genre-series-svg {
  display: block;
  min-width: 560px;
  height: 250px;
}

.statistics-genre-series-grid line {
  stroke: color-mix(in srgb, var(--muted) 18%, transparent);
  stroke-dasharray: 4 8;
  stroke-width: 1;
}

.statistics-genre-series-grid text {
  fill: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-anchor: end;
}

.statistics-genre-series-line polyline {
  fill: none;
  stroke: var(--series-color, #49c374);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--series-color, #49c374) 26%, transparent));
}

.statistics-genre-series-line circle {
  fill: var(--series-color, #49c374);
  stroke: var(--surface-panel);
  stroke-width: 2;
}

.statistics-genre-series-hit-targets {
  pointer-events: none;
}

.statistics-genre-series-hit-target {
  fill: transparent;
  pointer-events: all;
  cursor: crosshair;
  outline: none;
}

.statistics-genre-series-hit-target:focus-visible {
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
  stroke: color-mix(in srgb, var(--accent) 55%, transparent);
  stroke-width: 1;
  stroke-dasharray: 4 5;
}

.statistics-genre-tooltip-sources {
  display: none;
}

.statistics-genre-tooltip-source.is-floating {
  position: fixed;
  z-index: 80;
  display: grid;
  width: min(320px, calc(100vw - 24px));
  max-height: min(320px, calc(100vh - 24px));
  overflow: auto;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--surface-control);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  color: var(--text);
  pointer-events: auto;
}

.statistics-genre-tooltip-title {
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 850;
}

.statistics-genre-tooltip-list {
  display: grid;
  gap: 7px;
}

.statistics-genre-tooltip-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.statistics-genre-tooltip-row i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--tooltip-color, #49c374);
}

.statistics-genre-tooltip-row span {
  overflow-wrap: anywhere;
}

.statistics-genre-tooltip-row em {
  color: var(--text);
  font-style: normal;
  font-weight: 850;
  white-space: nowrap;
}

.statistics-genre-series-label {
  fill: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-anchor: middle;
}

.statistics-genres-placeholder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.statistics-genres-lower-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.statistics-genre-share-panel,
.statistics-genre-average-panel {
  min-height: 250px;
}

.statistics-genre-average-ranking li {
  grid-template-columns: 28px minmax(0, 1fr) auto;
}

.statistics-genre-average-ranking em {
  color: var(--muted);
}

.statistics-genre-insight-panel.is-diverse .statistics-card-icon,
.statistics-genre-insight-panel.is-balanced .statistics-card-icon {
  background: rgba(73, 195, 116, 0.16);
  border-color: rgba(73, 195, 116, 0.24);
  color: #8de2a9;
}

.statistics-genre-insight-panel.is-favorite .statistics-card-icon {
  background: rgba(244, 166, 64, 0.16);
  border-color: rgba(244, 166, 64, 0.24);
  color: var(--accent-strong);
}

.statistics-genre-insight-panel.is-no-pages .statistics-card-icon {
  background: rgba(103, 170, 246, 0.16);
  border-color: rgba(103, 170, 246, 0.24);
  color: #8fc4ff;
}

.statistics-genres-placeholder {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-height: 150px;
}

.statistics-genres-placeholder:last-child {
  grid-column: 1 / -1;
}

.statistics-genres-placeholder h3,
.statistics-genres-placeholder p {
  margin: 0;
}

.statistics-genres-placeholder h3 {
  color: var(--text);
  font-size: 0.98rem;
}

.statistics-genres-placeholder p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.statistics-genres-placeholder.is-green { color: #49c374; }
.statistics-genres-placeholder.is-orange { color: var(--accent-strong); }
.statistics-genres-placeholder.is-purple { color: #b778f0; }
.statistics-genres-placeholder.is-blue { color: #67aaf6; }
.statistics-genres-placeholder.is-mint { color: #35c2c1; }

.statistics-genres-placeholder .statistics-card-icon {
  background: color-mix(in srgb, currentColor 16%, transparent);
  border-color: color-mix(in srgb, currentColor 24%, transparent);
}

.statistics-authors-placeholder {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-height: 150px;
}

.statistics-authors-placeholder h3,
.statistics-authors-placeholder p {
  margin: 0;
}

.statistics-authors-placeholder h3 {
  color: var(--text);
  font-size: 0.98rem;
}

.statistics-authors-placeholder p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.statistics-authors-placeholder.is-green { color: #49c374; }
.statistics-authors-placeholder.is-orange { color: var(--accent-strong); }
.statistics-authors-placeholder.is-blue { color: #67aaf6; }
.statistics-authors-placeholder.is-purple { color: #b778f0; }

.statistics-authors-placeholder .statistics-card-icon {
  background: color-mix(in srgb, currentColor 16%, transparent);
  border-color: color-mix(in srgb, currentColor 24%, transparent);
}

.statistics-timeline-chart {
  min-width: 0;
  overflow-x: auto;
  padding: 4px 0 0;
}

.statistics-timeline-svg {
  display: block;
  min-width: 560px;
  height: 230px;
}

.statistics-timeline-baseline {
  stroke: color-mix(in srgb, var(--muted) 20%, transparent);
  stroke-width: 1;
  stroke-dasharray: 4 8;
}

.statistics-timeline-line {
  fill: none;
  stroke: #49c374;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px color-mix(in srgb, #49c374 34%, transparent));
}

.statistics-timeline-chart.is-pages .statistics-timeline-line {
  stroke: var(--accent);
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 38%, transparent));
}

.statistics-timeline-node circle {
  fill: var(--surface-panel);
  stroke: #49c374;
  stroke-width: 4;
  filter: drop-shadow(0 0 8px color-mix(in srgb, #49c374 44%, transparent));
}

.statistics-timeline-chart.is-pages .statistics-timeline-node circle {
  stroke: var(--accent);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 48%, transparent));
}

.statistics-timeline-value,
.statistics-timeline-label {
  text-anchor: middle;
  font-weight: 850;
}

.statistics-timeline-value {
  color: var(--text);
  fill: var(--text);
  font-size: 0.8rem;
}

.statistics-timeline-label {
  color: var(--muted);
  fill: var(--muted);
  font-size: 0.78rem;
}

.statistics-timeline-chart .statistics-chart-axis-label {
  margin-top: -4px;
  padding-left: 0;
}

.statistics-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.statistics-preview-card {
  min-height: 230px;
}

.statistics-preview-card.is-release {
  grid-column: span 2;
}

.statistics-release-scroll {
  overflow-x: auto;
  padding: 10px 4px 4px;
}

.statistics-release-timeline {
  display: flex;
  align-items: end;
  gap: 22px;
  min-width: max-content;
  padding: 14px 8px 4px;
  border-bottom: 1px solid var(--panel-border);
}

.statistics-release-point {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 48px;
  color: var(--muted);
  font-weight: 700;
}

.statistics-release-point i {
  display: block;
  width: calc(10px + 14px * var(--point-strength, 0.35));
  height: calc(10px + 14px * var(--point-strength, 0.35));
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(244, 166, 64, 0.12);
}

.statistics-release-point span {
  color: var(--text);
}

.statistics-release-point small {
  color: var(--muted);
}

.statistics-mini-bars,
.statistics-size-list,
.statistics-ranked-list {
  display: grid;
  gap: 11px;
}

.statistics-mini-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(78px, 0.9fr) 34px;
  gap: 10px;
  align-items: center;
}

.statistics-ranked-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.statistics-ranked-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.statistics-ranked-list li > span {
  color: var(--accent-strong);
  font-weight: 800;
}

.statistics-ranked-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-ranked-list em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}

.statistics-ratings-empty small {
  color: var(--muted);
}

.statistics-size-row {
  display: grid;
  grid-template-columns: minmax(92px, 1fr) minmax(70px, 0.8fr) 32px 42px;
  gap: 10px;
  align-items: center;
}

.statistics-ratings-empty > div:last-child {
  display: grid;
  align-content: center;
  min-height: 136px;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.statistics-ratings-empty p {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.statistics-ratings-preview-body {
  display: grid;
  gap: 14px;
  align-content: center;
  min-height: 136px;
}

.statistics-ratings-preview-average {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.statistics-ratings-preview-average strong {
  color: var(--text);
  font-size: 2rem;
}

.statistics-ratings-preview-average span {
  color: var(--muted);
  font-weight: 700;
}

.statistics-ratings-preview-body dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.statistics-ratings-preview-body dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.statistics-ratings-preview-body dt {
  color: var(--muted);
}

.statistics-ratings-preview-body dd {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.statistics-ratings-preview-empty {
  display: grid;
  align-content: center;
  min-height: 136px;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.statistics-ratings-preview-empty p {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.statistics-ratings-preview-empty small {
  color: var(--muted);
}

.statistics-dynamics-page {
  display: grid;
  gap: 14px;
}

.statistics-dynamics-panel.is-large {
  padding: 18px 18px 22px;
}

.statistics-dynamics-panel.is-large .statistics-panel-header {
  justify-content: flex-start;
  margin-bottom: 12px;
}

.statistics-dynamics-panel.is-large .statistics-chart-tabs {
  justify-content: flex-start;
  min-width: 0;
  width: 100%;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.statistics-dynamics-panel.is-large .statistics-chart-tab.is-active {
  position: relative;
}

.statistics-dynamics-panel.is-large .statistics-bar-chart {
  padding-top: 4px;
  gap: 9px;
}

.statistics-dynamics-panel.is-large .statistics-chart-row {
  grid-template-columns: minmax(48px, 70px) minmax(0, 1fr) minmax(34px, auto);
}

.statistics-dynamics-panel.is-large .statistics-chart-track {
  position: relative;
}

.statistics-dynamics-panel.is-large .statistics-chart-track::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(25% - 1px), rgba(255,255,255,0.055) calc(25% - 1px), rgba(255,255,255,0.055) 25%);
  pointer-events: none;
}

.statistics-dynamics-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.statistics-monthly-pages-panel,
.statistics-trends-panel,
.statistics-comparison-panel,
.statistics-insights-panel {
  min-height: 168px;
}

.statistics-monthly-pages-panel {
  overflow: hidden;
}

.statistics-monthly-pages-panel h3,
.statistics-trends-panel h3,
.statistics-comparison-panel h3,
.statistics-insights-panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.statistics-month-bars {
  display: grid;
  grid-template-columns: repeat(12, minmax(26px, 1fr));
  gap: 8px;
  align-items: end;
  min-height: 152px;
  min-width: 0;
  overflow-x: auto;
  padding: 8px 2px 0;
}

.statistics-month-bar {
  display: grid;
  grid-template-rows: 22px 108px 18px;
  gap: 6px;
  align-items: end;
  justify-items: center;
  min-width: 0;
}

.statistics-month-bar > span {
  overflow: hidden;
  max-width: 100%;
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-month-bar > div {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  width: clamp(18px, 38%, 28px);
  height: 108px;
  min-width: 0;
  overflow: hidden;
  border-radius: 999px 999px 10px 10px;
  background: rgba(255,255,255,0.045);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.035);
}

.statistics-month-bar i {
  display: block;
  width: 100%;
  height: var(--progress-value, 0%);
  min-height: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--accent), #e97f1e);
  box-shadow: 0 -8px 18px rgba(244, 166, 64, 0.28);
}

.statistics-month-bar:not(.is-empty) i {
  min-height: 8px;
}

.statistics-month-bar.is-empty i {
  height: 0;
  min-height: 0;
  background: transparent;
  box-shadow: none;
}

.statistics-month-bar.is-empty > div {
  opacity: 0.58;
}

.statistics-month-bar small {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.statistics-chart-legend span {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 0 14px rgba(244, 166, 64, 0.35);
}

.statistics-trend-list,
.statistics-insight-list {
  display: grid;
  gap: 8px;
}

.statistics-insight-list.is-empty {
  align-content: center;
  min-height: 126px;
}

.statistics-trend-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
}

.statistics-trend-card p,
.statistics-trend-card small {
  margin: 0;
  color: var(--muted);
}

.statistics-trend-card strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text);
  font-size: 1.08rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-trend-card.is-green .statistics-card-icon {
  color: #49c374;
  background: rgba(73, 195, 116, 0.11);
  box-shadow: 0 0 18px rgba(73, 195, 116, 0.14);
}

.statistics-trend-card.is-orange .statistics-card-icon {
  color: var(--accent-strong);
  background: rgba(244, 166, 64, 0.12);
  box-shadow: 0 0 20px rgba(244, 166, 64, 0.16);
}

.statistics-trend-card.is-blue .statistics-card-icon {
  color: #67aaf6;
  background: rgba(103, 170, 246, 0.1);
  box-shadow: 0 0 18px rgba(103, 170, 246, 0.12);
}

.statistics-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 0.8fr 1fr;
  gap: 12px;
  align-items: stretch;
}

.statistics-comparison-panel.is-wide {
  grid-column: span 2;
}

.statistics-comparison-grid article {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 104px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.055);
  border-radius: 14px;
  background: rgba(255,255,255,0.035);
}

.statistics-comparison-grid p,
.statistics-comparison-grid span {
  margin: 0;
  color: var(--muted);
}

.statistics-comparison-grid strong {
  color: var(--text);
  font-size: 1.22rem;
}

.statistics-comparison-grid .is-delta {
  color: var(--accent-strong);
  text-align: center;
  border-color: rgba(244, 166, 64, 0.34);
  background: rgba(244, 166, 64, 0.08);
  box-shadow: 0 0 28px rgba(244, 166, 64, 0.14), inset 0 0 0 1px rgba(244, 166, 64, 0.08);
}

.statistics-comparison-grid .is-delta strong {
  color: var(--accent-strong);
  font-size: clamp(1.4rem, 2vw, 1.8rem);
}

.statistics-comparison-grid .is-delta.is-negative {
  color: #ff8b7e;
  border-color: rgba(255, 107, 95, 0.26);
  background: rgba(255, 107, 95, 0.08);
  box-shadow: 0 0 24px rgba(255, 107, 95, 0.06);
}

.statistics-comparison-grid .is-delta.is-negative strong {
  color: #ff8b7e;
}

.statistics-comparison-grid .is-delta.is-neutral {
  color: var(--muted);
  border-color: rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  box-shadow: none;
}

.statistics-comparison-grid .is-delta.is-neutral strong {
  color: var(--text);
}

.statistics-insights-panel {
  grid-column: span 2;
}

.statistics-insight-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
}

.statistics-insight-list.is-empty .statistics-insight-item {
  grid-template-columns: 1fr;
  place-items: center;
  min-height: 112px;
  border: 1px dashed rgba(255,255,255,0.08);
  text-align: center;
}

.statistics-insight-item span {
  display: block;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  border-radius: 999px;
  border: 2px solid currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 12%, transparent);
}

.statistics-insight-item p {
  margin: 0;
}

.statistics-insight-list.is-empty .statistics-insight-item span {
  display: none;
}

.statistics-insight-item.is-green { color: #49c374; }
.statistics-insight-item.is-orange { color: var(--accent-strong); }
.statistics-insight-item.is-blue { color: #67aaf6; }
.statistics-insight-item.is-muted { color: var(--muted); }

.statistics-book-sizes-page {
  display: grid;
  gap: 14px;
}

.statistics-book-sizes-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.statistics-book-sizes-summary-grid .statistics-metric-card {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 14px;
  min-height: 132px;
}

.statistics-book-sizes-summary-grid .statistics-card-icon {
  width: 34px;
  height: 34px;
}

.statistics-book-sizes-summary-grid .statistics-metric-card strong {
  font-size: 1.05rem;
}

.statistics-book-sizes-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(0, 1.02fr);
  gap: 14px;
}

.statistics-book-size-distribution-panel,
.statistics-book-size-share-panel {
  min-height: 278px;
}

.statistics-book-size-list {
  display: grid;
  gap: 13px;
}

.statistics-book-size-row {
  display: grid;
  grid-template-columns: 12px minmax(104px, 0.78fr) minmax(0, 1.4fr) 38px 42px;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.statistics-book-size-row > span,
.statistics-book-size-legend-row > span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #49c374;
  box-shadow: 0 0 12px rgba(73, 195, 116, 0.22);
}

.statistics-book-size-row strong,
.statistics-book-size-legend-row strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-book-size-row > div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.statistics-book-size-row i {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: inherit;
  background: #49c374;
  box-shadow: 0 0 14px rgba(73, 195, 116, 0.2);
}

.statistics-book-size-row em,
.statistics-book-size-row small,
.statistics-book-size-legend-row em,
.statistics-book-size-legend-row small {
  color: var(--text);
  font-style: normal;
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.statistics-book-size-row small,
.statistics-book-size-legend-row em {
  color: var(--muted);
}

.statistics-book-size-row.is-200-400 > span,
.statistics-book-size-legend-row.is-200-400 > span,
.statistics-book-size-row.is-200-400 i { background: #f0c24e; box-shadow: 0 0 14px rgba(240, 194, 78, 0.2); }

.statistics-book-size-row.is-400-700 > span,
.statistics-book-size-legend-row.is-400-700 > span,
.statistics-book-size-row.is-400-700 i { background: #67aaf6; box-shadow: 0 0 14px rgba(103, 170, 246, 0.2); }

.statistics-book-size-row.is-700-plus > span,
.statistics-book-size-legend-row.is-700-plus > span,
.statistics-book-size-row.is-700-plus i { background: #9b61df; box-shadow: 0 0 14px rgba(155, 97, 223, 0.2); }

.statistics-book-size-row.is-unknown > span,
.statistics-book-size-legend-row.is-unknown > span,
.statistics-book-size-row.is-unknown i { background: #7a7f87; box-shadow: none; }

.statistics-book-size-row.is-empty {
  opacity: 0.62;
}

.statistics-book-size-share-body {
  display: grid;
  grid-template-columns: minmax(128px, 0.78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: 20px;
}

.statistics-book-size-donut {
  background: conic-gradient(var(--book-size-donut, rgba(255, 255, 255, 0.08) 0 100%));
}

.statistics-book-size-legend {
  display: grid;
  gap: 11px;
  min-width: 0;
}

.statistics-book-size-legend-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto 38px;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.statistics-book-sizes-lower-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.statistics-book-size-largest-panel,
.statistics-book-size-average-genre-panel {
  min-height: 230px;
}

.statistics-book-size-ranking {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.statistics-book-size-ranking li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.statistics-book-size-ranking span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.statistics-book-size-ranking li:first-child span {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--accent-strong);
}

.statistics-book-size-ranking strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-book-size-ranking em {
  color: var(--muted);
  font-style: normal;
  font-weight: 820;
  white-space: nowrap;
}

.statistics-book-size-average-genre-list {
  display: grid;
  gap: 12px;
}

.statistics-book-size-average-genre-row {
  display: grid;
  grid-template-columns: minmax(112px, 0.85fr) minmax(0, 1.35fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.statistics-book-size-average-genre-row strong {
  overflow: hidden;
  color: var(--text);
  font-weight: 780;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-book-size-average-genre-row > div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.statistics-book-size-average-genre-row i {
  display: block;
  width: var(--progress-value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f08a31, #f0c24e);
  box-shadow: 0 0 14px rgba(240, 138, 49, 0.22);
}

.statistics-book-size-average-genre-row em {
  color: var(--muted);
  font-style: normal;
  font-weight: 820;
  text-align: right;
  white-space: nowrap;
}

.statistics-book-size-insight-panel {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(120px, 0.32fr);
  align-items: center;
  gap: 16px;
  min-height: 112px;
  overflow: hidden;
}

.statistics-book-size-insight-panel .statistics-card-icon {
  width: 44px;
  height: 44px;
  background: rgba(73, 195, 116, 0.16);
  border-color: rgba(73, 195, 116, 0.24);
  color: #8de2a9;
}

.statistics-book-size-insight-panel.is-large .statistics-card-icon,
.statistics-book-size-insight-panel.is-medium .statistics-card-icon {
  background: rgba(244, 166, 64, 0.16);
  border-color: rgba(244, 166, 64, 0.24);
  color: var(--accent-strong);
}

.statistics-book-size-insight-panel.is-unknown .statistics-card-icon,
.statistics-book-size-insight-panel.is-empty .statistics-card-icon {
  background: rgba(157, 109, 159, 0.15);
  border-color: rgba(157, 109, 159, 0.24);
  color: #c99fcd;
}

.statistics-book-size-insight-panel h3,
.statistics-book-size-insight-panel p,
.statistics-book-size-insight-panel small {
  margin: 0;
}

.statistics-book-size-insight-panel h3 {
  color: var(--text);
  font-size: 0.92rem;
}

.statistics-book-size-insight-panel p {
  margin-top: 4px;
  color: var(--text);
  font-weight: 780;
  line-height: 1.45;
}

.statistics-book-size-insight-panel small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.statistics-book-size-insight-art {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 8px;
  min-height: 70px;
  opacity: 0.56;
}

.statistics-book-size-insight-art span {
  display: block;
  width: 34px;
  height: 48px;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, rgba(244, 166, 64, 0.48), rgba(255, 255, 255, 0.08));
  transform: rotate(-4deg);
}

.statistics-book-size-insight-art span:nth-child(2) {
  height: 62px;
  background: linear-gradient(180deg, rgba(103, 170, 246, 0.42), rgba(255, 255, 255, 0.08));
  transform: rotate(2deg);
}

.statistics-book-size-insight-art i {
  width: 40px;
  height: 28px;
  border-radius: 999px 999px 8px 8px;
  background: linear-gradient(135deg, rgba(73, 195, 116, 0.58), rgba(73, 195, 116, 0.12));
}

.statistics-book-sizes-placeholder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.statistics-book-sizes-placeholder {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-height: 132px;
}

.statistics-book-sizes-placeholder:last-child {
  grid-column: 1 / -1;
}

.statistics-book-sizes-placeholder .statistics-card-icon {
  width: 38px;
  height: 38px;
  background: color-mix(in srgb, currentColor 16%, transparent);
  border-color: color-mix(in srgb, currentColor 24%, transparent);
  color: currentColor;
}

.statistics-book-sizes-placeholder h3,
.statistics-book-sizes-placeholder p {
  margin: 0;
}

.statistics-book-sizes-placeholder h3 {
  color: var(--text);
  font-size: 0.94rem;
}

.statistics-book-sizes-placeholder p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.statistics-book-sizes-placeholder.is-mint { color: #49c374; }
.statistics-book-sizes-placeholder.is-orange { color: #f0c24e; }
.statistics-book-sizes-placeholder.is-blue { color: #67aaf6; }
.statistics-book-sizes-placeholder.is-purple { color: #b778f0; }
.statistics-book-sizes-placeholder.is-green { color: #8de2a9; }

.statistics-ratings-page {
  display: grid;
  gap: 14px;
}

.statistics-ratings-summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.statistics-ratings-summary-grid .statistics-metric-card {
  grid-template-columns: 1fr;
  align-content: start;
  gap: 14px;
  min-height: 132px;
  opacity: 0.9;
}

.statistics-ratings-summary-grid .statistics-card-icon {
  width: 34px;
  height: 34px;
}

.statistics-ratings-summary-grid .statistics-metric-card strong {
  color: color-mix(in srgb, var(--text) 72%, var(--muted) 28%);
  font-size: 1.38rem;
}

.statistics-ratings-main-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.statistics-ratings-empty-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  min-height: 178px;
}

.statistics-ratings-empty-panel .statistics-card-icon {
  width: 42px;
  height: 42px;
  background: color-mix(in srgb, currentColor 16%, transparent);
  border-color: color-mix(in srgb, currentColor 24%, transparent);
  color: currentColor;
}

.statistics-ratings-empty-panel h3,
.statistics-ratings-empty-panel p {
  margin: 0;
}

.statistics-ratings-empty-panel h3 {
  color: var(--text);
  font-size: 0.98rem;
}

.statistics-ratings-empty-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.52;
}

.statistics-ratings-empty-panel.is-orange { color: #f0c24e; }
.statistics-ratings-empty-panel.is-blue { color: #67aaf6; }
.statistics-ratings-empty-panel.is-green { color: #49c374; }
.statistics-ratings-empty-panel.is-purple { color: #b778f0; }

.statistics-ratings-distribution-panel,
.statistics-ratings-yearly-panel,
.statistics-ratings-top-panel,
.statistics-ratings-genres-panel,
.statistics-ratings-authors-panel {
  min-height: 276px;
}

.statistics-ratings-distribution-list {
  display: grid;
  gap: 12px;
}

.statistics-ratings-distribution-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 10px;
  color: #f0c24e;
}

.statistics-ratings-distribution-row strong {
  color: currentColor;
  font-weight: 900;
  white-space: nowrap;
}

.statistics-ratings-distribution-row strong span {
  opacity: 0.75;
}

.statistics-ratings-distribution-row > div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, rgba(255, 255, 255, 0.04));
}

.statistics-ratings-distribution-row i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: currentColor;
}

.statistics-ratings-distribution-row em,
.statistics-ratings-distribution-row small {
  color: var(--muted);
  font-style: normal;
  font-weight: 820;
  text-align: right;
}

.statistics-ratings-distribution-row.is-five { color: #f0a53d; }
.statistics-ratings-distribution-row.is-four { color: #f0c24e; }
.statistics-ratings-distribution-row.is-three { color: #49c374; }
.statistics-ratings-distribution-row.is-two { color: #67aaf6; }
.statistics-ratings-distribution-row.is-one { color: #e85d8f; }

.statistics-ratings-empty-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.statistics-ratings-chart-shell {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  min-height: 188px;
}

.statistics-ratings-y-axis {
  display: grid;
  align-content: stretch;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.statistics-ratings-y-axis span {
  display: flex;
  align-items: center;
}

.statistics-ratings-chart-grid {
  position: relative;
  display: grid;
  align-content: stretch;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
}

.statistics-ratings-chart-grid span {
  border-top: 1px dashed color-mix(in srgb, var(--muted) 18%, transparent);
}

.statistics-ratings-chart-grid span:first-child {
  border-top: 0;
}

.statistics-ratings-chart-grid p {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 18px;
  color: var(--muted);
  font-weight: 780;
  text-align: center;
}

.statistics-ratings-top-skeleton {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.statistics-ratings-top-skeleton li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.statistics-ratings-top-skeleton span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.statistics-ratings-top-skeleton div {
  display: grid;
  gap: 6px;
}

.statistics-ratings-top-skeleton strong,
.statistics-ratings-top-skeleton small {
  display: block;
  width: min(100%, 220px);
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.statistics-ratings-top-skeleton small {
  width: min(64%, 150px);
  height: 7px;
  opacity: 0.72;
}

.statistics-ratings-top-skeleton em {
  color: var(--muted);
  font-style: normal;
  font-weight: 850;
  text-align: right;
}

.statistics-ratings-top-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.statistics-ratings-top-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.statistics-ratings-top-list span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(240, 194, 78, 0.14);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 900;
}

.statistics-ratings-top-list div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.statistics-ratings-top-list strong,
.statistics-ratings-top-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-ratings-top-list strong {
  color: var(--text);
  font-size: 0.92rem;
}

.statistics-ratings-top-list small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.statistics-ratings-top-list em {
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.statistics-ratings-genre-shell {
  display: grid;
  grid-template-columns: minmax(128px, 0.78fr) minmax(0, 1.22fr);
  align-items: center;
  gap: 20px;
}

.statistics-ratings-donut-placeholder {
  background: conic-gradient(
    rgba(240, 194, 78, 0.16) 0 20%,
    rgba(73, 195, 116, 0.14) 20% 40%,
    rgba(103, 170, 246, 0.14) 40% 60%,
    rgba(155, 97, 223, 0.14) 60% 80%,
    rgba(255, 255, 255, 0.08) 80% 100%
  );
}

.statistics-ratings-genre-legend {
  display: grid;
  gap: 10px;
}

.statistics-ratings-genre-legend div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
}

.statistics-ratings-genre-legend span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #f0c24e;
  opacity: 0.45;
}

.statistics-ratings-genre-legend .is-two span { background: #49c374; }
.statistics-ratings-genre-legend .is-three span { background: #67aaf6; }
.statistics-ratings-genre-legend .is-four span { background: #9b61df; }
.statistics-ratings-genre-legend .is-five span { background: #7a7f87; }

.statistics-ratings-genre-legend strong {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
}

.statistics-ratings-genre-legend.has-data div {
  grid-template-columns: 12px minmax(0, 1fr) minmax(96px, auto);
}

.statistics-ratings-genre-legend.has-data span {
  opacity: 0.95;
}

.statistics-ratings-genre-legend.has-data strong {
  height: auto;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.statistics-ratings-genre-legend em {
  color: var(--muted);
  font-style: normal;
  font-weight: 850;
  text-align: right;
}

.statistics-ratings-genre-legend.has-data em {
  color: color-mix(in srgb, var(--text) 82%, var(--muted) 18%);
  font-size: 0.8rem;
  white-space: nowrap;
}

.statistics-ratings-insight-panel {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(120px, 0.32fr);
  align-items: center;
  gap: 16px;
  min-height: 112px;
  overflow: hidden;
}

.statistics-ratings-insight-panel .statistics-card-icon {
  width: 44px;
  height: 44px;
  background: rgba(157, 109, 159, 0.15);
  border-color: rgba(157, 109, 159, 0.24);
  color: #c99fcd;
}

.statistics-ratings-insight-panel h3,
.statistics-ratings-insight-panel p,
.statistics-ratings-insight-panel small {
  margin: 0;
}

.statistics-ratings-insight-panel h3 {
  color: var(--text);
  font-size: 0.92rem;
}

.statistics-ratings-insight-panel p {
  margin-top: 4px;
  color: var(--text);
  font-weight: 780;
  line-height: 1.45;
}

.statistics-ratings-insight-panel small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.statistics-ratings-insight-art {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 7px;
  min-height: 70px;
  opacity: 0.5;
}

.statistics-ratings-insight-art span {
  display: block;
  width: 14px;
  height: 44px;
  border-radius: 999px 999px 4px 4px;
  background: linear-gradient(180deg, rgba(240, 194, 78, 0.5), rgba(255, 255, 255, 0.08));
}

.statistics-ratings-insight-art span:nth-child(2) {
  height: 58px;
  background: linear-gradient(180deg, rgba(103, 170, 246, 0.42), rgba(255, 255, 255, 0.08));
}

.statistics-ratings-insight-art i {
  width: 38px;
  height: 38px;
  clip-path: polygon(50% 0, 61% 34%, 96% 34%, 68% 54%, 79% 88%, 50% 67%, 21% 88%, 32% 54%, 4% 34%, 39% 34%);
  background: linear-gradient(135deg, rgba(240, 194, 78, 0.7), rgba(240, 194, 78, 0.16));
}

.statistics-placeholder-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 360px;
  padding: 42px;
  border-radius: 16px;
  text-align: center;
}

.statistics-placeholder-panel p {
  max-width: 520px;
  line-height: 1.55;
}

body[data-theme="light"][data-page="statistics"] .statistics-status-card,
body[data-theme="light"][data-page="statistics"] .statistics-metric-card,
body[data-theme="light"][data-page="statistics"] .statistics-dashboard-panel,
body[data-theme="light"][data-page="statistics"] .statistics-placeholder-panel {
  background: var(--bg-card);
  border-color: var(--border-color);
  box-shadow: 0 16px 34px rgba(84, 64, 40, 0.08);
}

body[data-theme="light"][data-page="statistics"] .statistics-sidebar {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

body[data-theme="light"][data-page="statistics"] .statistics-period-filter {
  background: var(--bg-soft);
  border-color: var(--border-color);
}

@media (max-width: 1180px) {
  .page-frame-statistics {
    width: min(100% - 24px, 100%);
  }

  .statistics-page {
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 20px;
  }

  .statistics-sidebar {
    top: 88px;
    padding: 0;
    border-radius: 0;
  }

  .statistics-nav-item {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
    min-height: 40px;
    padding: 9px 8px;
    font-size: 0.9rem;
  }

  .statistics-status-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  }

  .statistics-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-authors-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .statistics-genres-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .statistics-book-sizes-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .statistics-ratings-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .statistics-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-preview-card.is-release {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .statistics-page {
    grid-template-columns: 164px minmax(0, 1fr);
    gap: 16px;
  }

  .statistics-header {
    display: grid;
    align-items: start;
  }

  .statistics-period-filter {
    justify-content: flex-start;
  }

  .statistics-dynamics-lower-grid {
    grid-template-columns: 1fr;
  }

  .statistics-authors-summary-grid,
  .statistics-authors-lower-grid,
  .statistics-genres-summary-grid,
  .statistics-genres-main-grid,
  .statistics-genres-lower-grid,
  .statistics-genres-placeholder-grid,
  .statistics-book-sizes-summary-grid,
  .statistics-book-sizes-main-grid,
  .statistics-book-sizes-lower-grid,
  .statistics-book-sizes-placeholder-grid,
  .statistics-ratings-summary-grid,
  .statistics-ratings-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statistics-insights-panel,
  .statistics-comparison-panel.is-wide {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .page-frame-statistics {
    width: min(100% - 16px, 100%);
  }

  .statistics-page {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .statistics-period-filter {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    border-radius: 18px;
  }

  .statistics-period-chip {
    flex: 0 0 auto;
  }

  .statistics-sidebar {
    position: static;
    overflow: hidden;
    padding: 0;
    border-radius: 0;
  }

  .statistics-nav {
    display: flex;
    overflow-x: auto;
    margin: 0 -2px;
    padding: 0 2px 4px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .statistics-nav::-webkit-scrollbar {
    display: none;
  }

  .statistics-nav-item {
    flex: 0 0 auto;
    min-width: max-content;
    grid-template-columns: 18px auto;
    padding: 10px 12px;
  }

  .statistics-status-grid,
  .statistics-metric-grid,
  .statistics-preview-grid,
  .statistics-authors-summary-grid,
  .statistics-authors-lower-grid,
  .statistics-genres-summary-grid,
  .statistics-genres-main-grid,
  .statistics-genres-lower-grid,
  .statistics-genres-placeholder-grid,
  .statistics-book-sizes-summary-grid,
  .statistics-book-sizes-main-grid,
  .statistics-book-sizes-lower-grid,
  .statistics-book-sizes-placeholder-grid,
  .statistics-ratings-summary-grid,
  .statistics-ratings-main-grid {
    grid-template-columns: 1fr;
  }

  .statistics-genres-placeholder:last-child,
  .statistics-book-sizes-placeholder:last-child {
    grid-column: auto;
  }

  .statistics-genre-popular-row {
    grid-template-columns: minmax(0, 1fr) 36px 40px;
  }

  .statistics-genre-popular-row > div {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .statistics-book-size-row {
    grid-template-columns: 12px minmax(0, 1fr) 36px 40px;
  }

  .statistics-book-size-row > div {
    grid-column: 2 / -1;
    grid-row: 2;
  }

  .statistics-book-size-share-body {
    grid-template-columns: 1fr;
  }

  .statistics-book-size-average-genre-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .statistics-book-size-average-genre-row > div {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .statistics-book-size-insight-panel {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .statistics-book-size-insight-art {
    display: none;
  }

  .statistics-ratings-insight-panel {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .statistics-ratings-genre-shell {
    grid-template-columns: 1fr;
  }

  .statistics-ratings-insight-art {
    display: none;
  }

  .statistics-author-distribution-bars {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .statistics-author-distribution-segment {
    grid-template-columns: 64px minmax(0, 1fr) 82px;
    align-items: center;
    text-align: left;
  }

  .statistics-author-distribution-segment strong {
    text-align: right;
  }

  .statistics-author-top-list li {
    grid-template-columns: 24px 30px minmax(0, 1fr) auto auto;
  }

  .statistics-author-top-list li > div {
    display: none;
  }

  .statistics-author-genre-body {
    grid-template-columns: 1fr;
  }

  .statistics-author-genre-row {
    grid-template-columns: 12px minmax(0, 1fr) auto 34px;
  }

  .statistics-author-insight-panel {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .statistics-author-insight-art {
    display: none;
  }

  .statistics-panel-header {
    display: grid;
  }

  .statistics-chart-tabs {
    justify-content: flex-start;
    min-width: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .statistics-chart-tab {
    white-space: nowrap;
  }

  .statistics-dynamics-panel.is-large .statistics-chart-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .statistics-dynamics-panel.is-large {
    overflow-x: auto;
  }

  .statistics-dynamics-panel.is-large .statistics-bar-chart {
    min-width: 560px;
  }

  .statistics-chart-row {
    grid-template-columns: 58px minmax(0, 1fr) 34px;
    gap: 8px;
  }

  .statistics-release-mode-pills {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .statistics-release-lower-grid {
    grid-template-columns: 1fr;
  }

  .statistics-release-decade-row {
    grid-template-columns: minmax(84px, 1fr) minmax(0, 1fr) 30px;
    gap: 8px;
  }

  .statistics-release-decade-row em {
    display: none;
  }

  .statistics-dynamics-panel.is-large .statistics-chart-row {
    grid-template-columns: 52px minmax(0, 1fr) 34px;
  }

  .statistics-chart-axis {
    padding-left: 66px;
  }

  .statistics-chart-axis-label {
    padding-left: 66px;
  }

  .statistics-month-bars {
    grid-template-columns: repeat(12, minmax(34px, 1fr));
    min-width: 520px;
  }

  .statistics-month-bar {
    grid-template-rows: 20px 86px 18px;
  }

  .statistics-comparison-grid {
    grid-template-columns: 1fr;
  }

  .statistics-preview-card.is-release {
    grid-column: auto;
  }
}

.dashboard-side-column {
  display: grid;
  gap: 0;
}

.dashboard-panel {
  text-align: center;
}

.reading-strip,
.finished-strip,
.rank-list,
.year-bars {
  display: grid;
  gap: 12px;
}

.reading-strip,
.finished-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.reading-strip-item,
.finished-strip-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  min-height: 74px;
}

.reading-strip-item img,
.finished-strip-item img,
.random-book img {
  width: 44px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
}

.reading-strip-item > .book-card-cover-placeholder,
.finished-strip-item > .book-card-cover-placeholder {
  width: 44px;
  height: 64px;
  border-radius: 10px;
  font-size: 0.68rem;
}

.reading-strip-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.reading-strip-copy strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

.reading-strip-progress {
  height: 7px;
}

.reading-strip-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.rank-row,
.year-bar-row {
  display: grid;
  align-items: center;
  gap: 12px;
}

.rank-row {
  grid-template-columns: 1fr auto;
}

.combined-ranks-panel {
  display: grid;
  gap: 18px;
}

.combined-ranks-panel .panel-title {
  text-align: center;
}

.combined-ranks-panel > div:first-child,
.combined-ranks-panel > div:last-child {
  display: grid;
  gap: 12px;
}

.year-bar-row {
  grid-template-columns: 56px 1fr 24px;
}

.year-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--hover-surface);
  overflow: hidden;
}

.year-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(116,198,157,0.88), rgba(69,140,101,0.92));
}

.goal-copy {
  margin: 0 0 14px;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  max-width: 90%;
}

.goal-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 8px;
  width: min(86%, 520px);
}

.goal-progress {
  width: 100%;
  height: 13px;
  margin: 0;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--hover-surface) 78%, var(--bg-elevated) 22%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--panel-border) 64%, transparent);
}

.goal-progress > span {
  min-width: 0;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 88%, var(--bg-elevated) 12%),
    color-mix(in srgb, var(--accent-strong) 84%, var(--accent) 16%)
  );
}

.goal-progress.is-complete > span {
  background: linear-gradient(90deg, #d8a052, #e7bd6a);
}

.goal-progress.is-overcomplete > span {
  background: linear-gradient(90deg, #dca052 0%, #e5bd61 52%, #aebf68 100%);
}

.goal-percent {
  color: var(--text-secondary);
  font-size: 0.86rem;
  font-weight: 650;
  justify-self: center;
  text-align: center;
  white-space: nowrap;
}

.goal-panel {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.goal-panel-empty {
  grid-template-rows: auto 1fr;
}

.goal-empty,
.goal-form {
  display: grid;
  gap: 14px;
}

.goal-empty {
  width: 100%;
  justify-items: center;
}

.goal-panel-empty .goal-empty {
  align-self: center;
  padding-bottom: 32px;
}

.goal-action,
.goal-form .primary-button,
.goal-form .ghost-button {
  justify-self: center;
}

.goal-action.secondary-button {
  background: transparent;
  border-color: color-mix(in srgb, var(--panel-border) 78%, var(--text-secondary) 22%);
  color: var(--text-secondary);
}

.goal-form {
  max-width: 320px;
  margin: 0 auto;
}

.goal-form-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.combined-ranks-divider {
  height: 1px;
  background: var(--panel-border);
}

.completion-panel {
  display: grid;
  justify-items: center;
  text-align: center;
}

.completion-ring {
  --completion: 0%;
  display: grid;
  place-items: center;
  width: 190px;
  height: 190px;
  margin: 10px 0 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--completion-center) 0 58%, transparent 59%),
    conic-gradient(var(--completion-fill) 0 var(--completion), var(--completion-track) var(--completion) 100%);
}

.completion-ring div {
  text-align: center;
}

.completion-ring strong {
  display: block;
  font-size: 2.2rem;
}

.completion-ratio {
  text-align: center;
  margin: 2px 0 0;
}

.random-book-panel {
  grid-column: 3;
}

.random-book {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 18px;
  align-items: center;
}

.random-book-centered {
  max-width: 420px;
  margin: 0 auto;
}

.random-book-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
}

.random-book img {
  width: 112px;
  height: 160px;
  border-radius: 14px;
}

.random-book > .book-card-cover-placeholder {
  width: 112px;
  height: 160px;
  border-radius: 14px;
}

.random-book-copy {
  display: grid;
  gap: 12px;
  justify-items: center;
  text-align: center;
}

.random-book-title {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.random-book-title:hover,
.random-book-title:focus-visible {
  color: var(--accent-hover);
  outline: none;
}

.random-book-copy p {
  margin: 0;
  color: var(--text-secondary);
  text-align: center;
}

.progress-shortcuts {
  margin: 12px 0 4px;
}

.catalog-layout {
  gap: 18px;
}

.catalog-search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin: 16px 0 18px;
}

.catalog-review-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 12px;
  cursor: pointer;
}

.catalog-review-filter-text {
  font-size: 0.9em;
  font-weight: 500;
  white-space: nowrap;
}

.catalog-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.catalog-card {
  min-height: 236px;
}

/* ── Catalog card v2 (shared library) ── */
.catalog-card-v2 {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.07);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.catalog-card-v2:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.28);
}

.catalog-card-cover-btn {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  background: #1a1d26;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}

.catalog-card-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.22s ease;
}

.catalog-card-cover-btn:hover .catalog-card-cover-img {
  transform: scale(1.04);
}

.catalog-card-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 14px 16px;
  flex: 1;
}

.catalog-card-title-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 0.97rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  line-height: 1.3;
  transition: color 0.15s;
}

.catalog-card-title-btn:hover {
  color: var(--accent);
}

.catalog-card-author {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.2;
}

.catalog-card-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

.catalog-card-rating-stub {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.catalog-card-add-btn {
  margin-top: auto;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-align: center;
  width: 100%;
}

.catalog-card-add-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #1a1300;
}

.catalog-card-add-btn--in,
.catalog-card-add-btn:disabled {
  border-color: rgba(255,255,255,0.12);
  color: var(--muted);
  cursor: default;
  background: rgba(255,255,255,0.04);
}

body[data-theme="light"] .catalog-search-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

body[data-theme="light"] .catalog-search-form input,
body[data-theme="light"] .catalog-search-form select,
body[data-theme="light"] .catalog-search-form textarea {
  background: var(--surface-input);
  border-color: var(--border-color);
  color: var(--text-primary);
  box-shadow: none;
}

body[data-theme="light"] .catalog-search-form .primary-button,
body[data-theme="light"] .catalog-search-form .secondary-button,
body[data-theme="light"] .catalog-search-form .ghost-button {
  min-height: 46px;
}

body[data-theme="light"] .catalog-review-filter {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 42px;
  margin-right: 0 !important;
  padding: 0 14px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  box-shadow: 0 6px 14px rgba(84, 64, 40, 0.06);
}

body[data-theme="light"] .catalog-review-filter span {
  color: var(--text-secondary);
  font-size: 0.84rem !important;
  font-weight: 700 !important;
}

body[data-theme="light"] .catalog-review-filter input[type="checkbox"],
body[data-theme="light"] .catalog-review-filter .toggle-checkbox {
  accent-color: var(--accent-strong);
}

body[data-theme="light"] .catalog-results-grid {
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 16px;
}

body[data-theme="light"] .catalog-card-v2 {
  border-radius: 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 24px rgba(84, 64, 40, 0.08);
}

body[data-theme="light"] .catalog-card-v2:hover {
  box-shadow: 0 14px 28px rgba(84, 64, 40, 0.11);
}

body[data-theme="light"] .catalog-card-cover-btn {
  background:
    radial-gradient(circle at 30% 20%, rgba(223, 174, 85, 0.14), transparent 34%),
    linear-gradient(180deg, var(--bg-soft), var(--bg-elevated));
}

body[data-theme="light"] .catalog-card-info {
  gap: 8px;
  padding: 16px 16px 18px;
}

body[data-theme="light"] .catalog-card-title-btn {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
}

body[data-theme="light"] .catalog-card-title-btn:hover {
  color: var(--accent-strong);
}

body[data-theme="light"] .catalog-card-author {
  color: var(--text-secondary);
  font-size: 0.84rem;
  line-height: 1.35;
}

body[data-theme="light"] .catalog-card-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

body[data-theme="light"] .catalog-card-rating-stub {
  color: color-mix(in srgb, var(--text-muted) 72%, var(--accent) 28%);
  letter-spacing: 0.08em;
}

body[data-theme="light"] .catalog-card-add-btn {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border-color) 40%);
  background: rgba(223, 174, 85, 0.08);
  color: var(--accent-strong);
  font-weight: 700;
}

body[data-theme="light"] .catalog-card-add-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

body[data-theme="light"] .catalog-card-add-btn--in,
body[data-theme="light"] .catalog-card-add-btn:disabled {
  border-color: rgba(111, 98, 82, 0.16);
  background: var(--bg-soft);
  color: var(--text-muted);
  opacity: 1;
}

body[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body[data-theme="light"] textarea,
body[data-theme="light"] select,
body[data-theme="light"] .field-shell input,
body[data-theme="light"] .field-shell textarea,
body[data-theme="light"] .field-shell select,
body[data-theme="light"] .library-search input,
body[data-theme="light"] .catalog-search-form input,
body[data-theme="light"] .catalog-search-form select,
body[data-theme="light"] .book-detail-inline-input {
  background: var(--surface-input) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

body[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"])::placeholder,
body[data-theme="light"] textarea::placeholder,
body[data-theme="light"] .book-detail-inline-input::placeholder {
  color: var(--text-muted);
}

body[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
body[data-theme="light"] textarea:focus,
body[data-theme="light"] select:focus,
body[data-theme="light"] .field-shell input:focus,
body[data-theme="light"] .field-shell textarea:focus,
body[data-theme="light"] .field-shell select:focus,
body[data-theme="light"] .book-detail-inline-input:focus {
  border-color: var(--accent-strong) !important;
  box-shadow: 0 0 0 3px rgba(185, 120, 36, 0.14) !important;
}

body[data-theme="light"] .refined-filters select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.25 6.5 8 10.25 11.75 6.5' fill='none' stroke='%239b8d7b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7'/%3E%3C/svg%3E");
}

body[data-theme="light"] .primary-button,
body[data-theme="light"] .auth-cta,
body[data-theme="light"] .auth-submit {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)) !important;
  color: var(--accent-text) !important;
  box-shadow: 0 10px 20px rgba(185, 120, 36, 0.14) !important;
}

body[data-theme="light"] .primary-button:hover,
body[data-theme="light"] .primary-button:focus-visible,
body[data-theme="light"] .auth-cta:hover,
body[data-theme="light"] .auth-cta:focus-visible,
body[data-theme="light"] .auth-submit:hover,
body[data-theme="light"] .auth-submit:focus-visible {
  background: linear-gradient(135deg, var(--accent-hover), var(--accent-strong-hover)) !important;
  color: var(--accent-text) !important;
  box-shadow: 0 12px 22px rgba(159, 100, 27, 0.16) !important;
}

body[data-theme="light"] .secondary-button,
body[data-theme="light"] .ghost-button,
body[data-theme="light"] .profile-upload-button:not(.is-disabled) {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 6px 14px rgba(84, 64, 40, 0.06) !important;
}

body[data-theme="light"] .secondary-button:hover,
body[data-theme="light"] .secondary-button:focus-visible,
body[data-theme="light"] .ghost-button:hover,
body[data-theme="light"] .ghost-button:focus-visible,
body[data-theme="light"] .profile-upload-button:not(.is-disabled):hover {
  background: var(--hover-surface) !important;
  color: var(--text-primary) !important;
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border-color) 66%) !important;
  box-shadow: 0 8px 16px rgba(84, 64, 40, 0.08) !important;
}

body[data-theme="light"] .ghost-button {
  background: rgba(255, 249, 240, 0.58) !important;
}

body[data-theme="light"] .inline-link {
  color: var(--accent-strong);
}

body[data-theme="light"] .inline-link:hover {
  color: var(--accent-hover);
}

body[data-theme="light"] button:disabled,
body[data-theme="light"] .primary-button:disabled,
body[data-theme="light"] .secondary-button:disabled,
body[data-theme="light"] .ghost-button:disabled,
body[data-theme="light"] .auth-submit:disabled,
body[data-theme="light"] .auth-google-button:disabled,
body[data-theme="light"] .auth-google-button[aria-disabled="true"],
body[data-theme="light"] .profile-upload-button.is-disabled,
body[data-theme="light"] [aria-disabled="true"] {
  background: var(--bg-soft) !important;
  color: var(--text-muted) !important;
  border-color: rgba(111, 98, 82, 0.16) !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 1;
}

body[data-theme="light"] .primary-button,
body[data-theme="light"] .auth-cta,
body[data-theme="light"] .auth-submit {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 72%, white 28%),
    color-mix(in srgb, var(--accent-strong) 68%, white 32%)
  ) !important;
  color: var(--accent-text) !important;
  box-shadow: 0 8px 18px rgba(159, 100, 27, 0.12) !important;
}

body[data-theme="light"] .primary-button:hover,
body[data-theme="light"] .primary-button:focus-visible,
body[data-theme="light"] .auth-cta:hover,
body[data-theme="light"] .auth-cta:focus-visible,
body[data-theme="light"] .auth-submit:hover,
body[data-theme="light"] .auth-submit:focus-visible {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent-hover) 76%, white 24%),
    color-mix(in srgb, var(--accent-strong-hover) 72%, white 28%)
  ) !important;
  color: var(--accent-text) !important;
  box-shadow: 0 10px 20px rgba(159, 100, 27, 0.14) !important;
}

body[data-theme="light"] .book-status-trigger.status-dropped {
  background: rgba(199, 103, 91, 0.16);
  border-color: rgba(199, 103, 91, 0.3);
  color: #A8463E;
}

body[data-theme="light"] .book-card-favorite-toggle,
body[data-theme="light"] .book-favorite-toggle {
  color: var(--text-muted);
}

body[data-theme="light"] .book-card-favorite-toggle.is-active,
body[data-theme="light"] .book-favorite-toggle.is-active {
  color: #C85E57;
}

body[data-theme="light"] .book-card-favorite-toggle:hover,
body[data-theme="light"] .book-card-favorite-toggle:focus-visible,
body[data-theme="light"] .book-favorite-toggle:hover,
body[data-theme="light"] .book-favorite-toggle:focus-visible {
  color: #D06A62;
}

body[data-theme="light"][data-page="profile"] .app-shell,
body[data-theme="light"][data-page="profile-public"] .app-shell {
  width: min(1760px, calc(100% - 20px));
  margin-top: 0;
}

body[data-theme="light"][data-page="profile"] .app-shell-main,
body[data-theme="light"][data-page="profile-public"] .app-shell-main {
  margin-top: 0;
}

body[data-theme="light"][data-page="profile"] .profile-page,
body[data-theme="light"][data-page="profile-public"] .profile-page {
  gap: 16px;
}

body[data-theme="light"][data-page="profile"] .profile-hero-shell,
body[data-theme="light"][data-page="profile-public"] .profile-hero-shell {
  min-height: 360px;
  border-radius: 24px !important;
  background: linear-gradient(180deg, rgba(255, 249, 240, 0.38), rgba(244, 239, 230, 0.22)) !important;
  border-color: rgba(111, 98, 82, 0.12) !important;
  box-shadow: 0 16px 34px rgba(84, 64, 40, 0.09) !important;
}

body[data-theme="light"][data-page="profile"] .profile-banner,
body[data-theme="light"][data-page="profile-public"] .profile-banner {
  filter: saturate(0.92) brightness(0.98);
}

body[data-theme="light"][data-page="profile"] .profile-banner::after,
body[data-theme="light"][data-page="profile-public"] .profile-banner::after {
  background:
    linear-gradient(180deg, rgba(35, 30, 24, 0.22) 0%, rgba(35, 30, 24, 0.3) 34%, rgba(35, 30, 24, 0.54) 100%);
}

body[data-theme="light"][data-page="profile"] .profile-hero-inner,
body[data-theme="light"][data-page="profile-public"] .profile-hero-inner {
  padding: 28px 30px 30px;
  gap: 24px;
}

body[data-theme="light"][data-page="profile"] .profile-identity-meta,
body[data-theme="light"][data-page="profile-public"] .profile-identity-meta {
  gap: 10px;
}

body[data-theme="light"][data-page="profile"] .subtle-pill,
body[data-theme="light"][data-page="profile-public"] .subtle-pill {
  background: rgba(35, 30, 24, 0.4);
  color: #FFF9F0;
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 8px 18px rgba(35, 30, 24, 0.16);
  backdrop-filter: blur(12px);
}

body[data-theme="light"][data-page="profile"] .profile-title,
body[data-theme="light"][data-page="profile-public"] .profile-title {
  color: #FFF9F0 !important;
  text-shadow: 0 2px 10px rgba(35, 30, 24, 0.24);
}

body[data-theme="light"][data-page="profile"] .profile-bio,
body[data-theme="light"][data-page="profile-public"] .profile-bio,
body[data-theme="light"][data-page="profile"] .profile-hero-copy .eyebrow,
body[data-theme="light"][data-page="profile-public"] .profile-hero-copy .eyebrow {
  color: rgba(255, 249, 240, 0.86) !important;
  text-shadow: 0 1px 8px rgba(35, 30, 24, 0.18);
}

body[data-theme="light"][data-page="profile"] .profile-overview-grid,
body[data-theme="light"][data-page="profile-public"] .profile-overview-grid {
  gap: 12px;
  max-width: 840px;
}

body[data-theme="light"][data-page="profile"] .profile-overview-card,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card {
  background: linear-gradient(180deg, rgba(35, 30, 24, 0.34), rgba(35, 30, 24, 0.24)) !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
  box-shadow: 0 12px 24px rgba(35, 30, 24, 0.12) !important;
  backdrop-filter: blur(14px);
}

body[data-theme="light"][data-page="profile"] .profile-overview-card span,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card span {
  color: rgba(255, 249, 240, 0.78) !important;
}

body[data-theme="light"][data-page="profile"] .profile-overview-card strong,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card strong {
  color: #FFFDF8;
}

body[data-theme="light"][data-page="profile"] .profile-foundation-grid,
body[data-theme="light"][data-page="profile-public"] .profile-foundation-grid {
  gap: 16px;
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel,
body[data-theme="light"][data-page="profile"] .profile-taste-card,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel,
body[data-theme="light"][data-page="profile-public"] .profile-taste-card {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(248, 241, 230, 0.92)) !important;
  border-color: rgba(111, 98, 82, 0.12) !important;
  box-shadow: 0 12px 24px rgba(84, 64, 40, 0.07) !important;
}

body[data-theme="light"][data-page="profile"] .profile-page,
body[data-theme="light"][data-page="profile-public"] .profile-page {
  gap: 0;
}

body[data-theme="light"][data-page="profile"] .profile-hero-shell,
body[data-theme="light"][data-page="profile-public"] .profile-hero-shell {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  min-height: 388px;
  border: 0 !important;
  border-radius: 0 0 26px 26px !important;
  box-shadow: none !important;
}

body[data-theme="light"][data-page="profile"] .profile-banner::after,
body[data-theme="light"][data-page="profile-public"] .profile-banner::after {
  background:
    linear-gradient(180deg, rgba(35, 30, 24, 0.14) 0%, rgba(35, 30, 24, 0.22) 36%, rgba(35, 30, 24, 0.46) 100%);
}

body[data-theme="light"][data-page="profile"] .profile-hero-inner,
body[data-theme="light"][data-page="profile-public"] .profile-hero-inner {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  padding: 34px 0 34px;
}

body[data-theme="light"][data-page="profile"] .profile-foundation-grid,
body[data-theme="light"][data-page="profile-public"] .profile-foundation-grid {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
  margin-top: -8px;
  padding: 20px 0 8px;
  gap: 14px;
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel,
body[data-theme="light"][data-page="profile"] .profile-taste-card,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel,
body[data-theme="light"][data-page="profile-public"] .profile-taste-card {
  box-shadow: 0 8px 18px rgba(84, 64, 40, 0.05) !important;
}

body[data-theme="light"][data-page="profile"],
body[data-theme="light"][data-page="profile-public"] {
  overflow-x: clip;
}

body[data-theme="light"][data-page="profile"] .app-shell,
body[data-theme="light"][data-page="profile-public"] .app-shell {
  width: 100%;
  max-width: none;
  margin-top: 0;
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
}

body[data-theme="light"][data-page="profile"] .app-shell-main,
body[data-theme="light"][data-page="profile-public"] .app-shell-main {
  margin-top: 0;
  padding-top: 0;
}

body[data-theme="light"][data-page="profile"] .profile-page,
body[data-theme="light"][data-page="profile-public"] .profile-page {
  gap: 0;
  width: 100%;
  overflow-x: clip;
}

body[data-theme="light"][data-page="profile"] .profile-hero-shell,
body[data-theme="light"][data-page="profile-public"] .profile-hero-shell {
  width: auto;
  min-height: 380px;
  margin: 0 calc(50% - 50vw);
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  position: relative;
  overflow: visible;
}

body[data-theme="light"][data-page="profile"] .profile-banner::after,
body[data-theme="light"][data-page="profile-public"] .profile-banner::after {
  background:
    linear-gradient(180deg, rgba(35, 30, 24, 0.08) 0%, rgba(35, 30, 24, 0.16) 34%, rgba(35, 30, 24, 0.38) 100%);
}

body[data-theme="light"][data-page="profile"] .profile-hero-inner,
body[data-theme="light"][data-page="profile-public"] .profile-hero-inner {
  width: min(86vw, 1560px);
  margin: 0;
  padding: 0;
  display: grid;
  min-height: 0;
}

body[data-theme="light"][data-page="profile"] .profile-hero-dock.profile-hero-inner,
body[data-theme="light"][data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 16px;
  width: min(86vw, 1560px);
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
}

body[data-theme="light"][data-page="profile"] .profile-avatar-cluster.profile-avatar-column,
body[data-theme="light"][data-page="profile-public"] .profile-avatar-cluster.profile-avatar-column {
  position: static;
  display: contents;
  width: auto;
  min-width: 0;
  height: auto;
  gap: 0;
  padding: 0;
}

body[data-theme="light"][data-page="profile"] .profile-identity-cluster.profile-hero-copy,
body[data-theme="light"][data-page="profile-public"] .profile-identity-cluster.profile-hero-copy {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  align-content: end;
  min-height: auto;
  padding: 0 0 54px;
  margin: 0;
}

body[data-theme="light"][data-page="profile"] .profile-identity-cluster .profile-identity-copy,
body[data-theme="light"][data-page="profile-public"] .profile-identity-cluster .profile-identity-copy {
  display: grid;
  gap: 8px;
  align-content: end;
  justify-items: start;
  align-self: end;
  padding-top: 0;
  max-width: min(360px, 100%);
}

body[data-theme="light"][data-page="profile"] .profile-hero-dock.profile-hero-inner,
body[data-theme="light"][data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
  grid-template-columns: 172px minmax(0, auto);
  grid-template-rows: auto auto;
  column-gap: 20px;
  row-gap: 0;
}

body[data-theme="light"][data-page="profile"] .profile-avatar-frame,
body[data-theme="light"][data-page="profile-public"] .profile-avatar-frame {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 172px;
  height: 172px;
  border-radius: 28px;
  align-self: end;
  margin-bottom: 0;
}

body[data-theme="light"][data-page="profile"] .profile-title,
body[data-theme="light"][data-page="profile-public"] .profile-title {
  max-width: none;
  margin: 0;
}

body[data-theme="light"][data-page="profile"] .profile-overview-grid,
body[data-theme="light"][data-page="profile-public"] .profile-overview-grid {
  width: min(86vw, 1560px) !important;
  max-width: min(86vw, 1560px);
  margin: 0 auto;
  padding: 0;
  gap: 0;
  border-top: 1px solid rgba(111, 98, 82, 0.14);
  border-bottom: 1px solid rgba(111, 98, 82, 0.14);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(248, 241, 230, 0.94));
  box-shadow: none;
}

body[data-theme="light"][data-page="profile"] .profile-overview-card,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card {
  padding: 18px 22px;
  border: 0 !important;
  border-right: 1px solid rgba(111, 98, 82, 0.12) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  gap: 4px;
  justify-items: center;
  align-content: center;
  text-align: center;
}

body[data-theme="light"][data-page="profile"] .profile-overview-card:last-child,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card:last-child {
  border-right: 0 !important;
}

body[data-theme="light"][data-page="profile"] .profile-overview-card span,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card span {
  color: var(--text-muted) !important;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body[data-theme="light"][data-page="profile"] .profile-overview-card strong,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card strong {
  color: var(--text-primary) !important;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.1;
}

body[data-theme="light"][data-page="profile"] .profile-foundation-grid,
body[data-theme="light"][data-page="profile-public"] .profile-foundation-grid {
  width: min(86vw, 1560px) !important;
  max-width: min(86vw, 1560px);
  margin: 0 auto 24px;
  margin-top: 0;
  padding: 28px 30px 30px;
  gap: 0;
  border: 1px solid rgba(111, 98, 82, 0.12);
  border-top: 0;
  border-radius: 0 0 24px 24px;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(248, 241, 230, 0.94));
  box-shadow: 0 14px 32px rgba(84, 64, 40, 0.05);
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel,
body[data-theme="light"][data-page="profile"] .profile-taste-card,
body[data-theme="light"][data-page="profile"] .profile-heatmap-panel,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel,
body[data-theme="light"][data-page="profile-public"] .profile-taste-card,
body[data-theme="light"][data-page="profile-public"] .profile-heatmap-panel {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel {
  padding: 0 28px 0 0;
  border-right: 1px solid rgba(111, 98, 82, 0.12) !important;
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel > .profile-activity-feed,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel > .profile-activity-feed {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(111, 98, 82, 0.12);
  scrollbar-width: thin;
  scrollbar-color: rgba(111, 98, 82, 0.4) transparent;
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel > .profile-activity-feed,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel > .profile-activity-feed {
  gap: 0;
}

body[data-theme="light"][data-page="profile"] .profile-activity-item,
body[data-theme="light"][data-page="profile-public"] .profile-activity-item {
  align-items: flex-start;
  padding: 14px 0;
  border: 0 !important;
  border-bottom: 1px solid rgba(111, 98, 82, 0.12) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-theme="light"][data-page="profile"] .profile-activity-item:last-child,
body[data-theme="light"][data-page="profile-public"] .profile-activity-item:last-child {
  border-bottom: 0 !important;
}

body[data-theme="light"][data-page="profile"] .profile-activity-item strong,
body[data-theme="light"][data-page="profile-public"] .profile-activity-item strong {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 16px;
  line-height: 1.45;
}

body[data-theme="light"][data-page="profile"] .profile-activity-item span,
body[data-theme="light"][data-page="profile-public"] .profile-activity-item span {
  flex: 0 0 auto;
  white-space: nowrap;
  color: var(--text-muted) !important;
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

body[data-theme="light"][data-page="profile"] .profile-activity-item:hover,
body[data-theme="light"][data-page="profile-public"] .profile-activity-item:hover {
  background: rgba(111, 98, 82, 0.04) !important;
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel > .profile-activity-feed::-webkit-scrollbar,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel > .profile-activity-feed::-webkit-scrollbar {
  width: 8px;
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel > .profile-activity-feed::-webkit-scrollbar-thumb,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel > .profile-activity-feed::-webkit-scrollbar-thumb {
  background: rgba(111, 98, 82, 0.34);
  border-radius: 999px;
}

body[data-theme="light"][data-page="profile"] .profile-heatmap-panel,
body[data-theme="light"][data-page="profile-public"] .profile-heatmap-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(111, 98, 82, 0.12) !important;
}

body[data-theme="light"][data-page="profile"] .profile-taste-grid,
body[data-theme="light"][data-page="profile-public"] .profile-taste-grid {
  gap: 0;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(111, 98, 82, 0.12);
}

body[data-theme="light"][data-page="profile"] .profile-taste-card,
body[data-theme="light"][data-page="profile-public"] .profile-taste-card {
  padding: 0 0 0 22px;
}

body[data-theme="light"][data-page="profile"] .profile-taste-card:first-child,
body[data-theme="light"][data-page="profile-public"] .profile-taste-card:first-child {
  padding-left: 0;
  padding-right: 22px;
  border-right: 1px solid rgba(111, 98, 82, 0.12) !important;
}

body[data-theme="light"][data-page="profile"] .profile-editor-stack,
body[data-theme="light"][data-page="profile-public"] .profile-editor-stack {
  margin: 0;
}

body[data-theme="light"][data-page="profile"] .profile-editor-form,
body[data-theme="light"][data-page="profile-public"] .profile-editor-form {
  overflow: hidden;
}

@media (max-width: 1100px) {
  body[data-theme="light"][data-page="profile"] .profile-overview-grid,
  body[data-theme="light"][data-page="profile-public"] .profile-overview-grid,
  body[data-theme="light"][data-page="profile"] .profile-foundation-grid,
  body[data-theme="light"][data-page="profile-public"] .profile-foundation-grid,
  body[data-theme="light"][data-page="profile"] .profile-hero-inner,
  body[data-theme="light"][data-page="profile-public"] .profile-hero-inner {
    width: min(92vw, calc(100% - 24px));
  }

  body[data-theme="light"][data-page="profile"] .profile-foundation-grid,
  body[data-theme="light"][data-page="profile-public"] .profile-foundation-grid {
    padding: 22px 20px 24px;
  }

  body[data-theme="light"][data-page="profile"] .profile-feed-panel,
  body[data-theme="light"][data-page="profile-public"] .profile-feed-panel {
    padding-right: 0;
    padding-bottom: 20px;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(111, 98, 82, 0.12) !important;
  }

  body[data-theme="light"][data-page="profile"] .profile-taste-grid,
  body[data-theme="light"][data-page="profile-public"] .profile-taste-grid {
    gap: 18px;
  }

  body[data-theme="light"][data-page="profile"] .profile-taste-card,
  body[data-theme="light"][data-page="profile-public"] .profile-taste-card,
  body[data-theme="light"][data-page="profile"] .profile-taste-card:first-child,
  body[data-theme="light"][data-page="profile-public"] .profile-taste-card:first-child {
    padding: 0;
    border-right: 0 !important;
  }

  body[data-theme="light"][data-page="profile"] .profile-overview-card,
  body[data-theme="light"][data-page="profile-public"] .profile-overview-card {
    border-right: 0 !important;
    border-bottom: 1px solid rgba(111, 98, 82, 0.12) !important;
  }

  body[data-theme="light"][data-page="profile"] .profile-overview-card:last-child,
  body[data-theme="light"][data-page="profile-public"] .profile-overview-card:last-child {
    border-bottom: 0 !important;
  }
}

body[data-page="catalog"] .app-shell {
  width: min(1680px, calc(100% - 28px));
}

body[data-page="catalog"] .catalog-layout {
  gap: 14px;
}

body[data-page="catalog"] .catalog-layout > .panel {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

body[data-page="catalog"] .catalog-search-form {
  margin: 8px 0 16px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

body[data-page="catalog"] .catalog-search-form .primary-button {
  width: auto;
  min-width: 0;
  padding-inline: 18px;
  justify-self: start;
  white-space: nowrap;
}

body[data-page="catalog"] .catalog-results-grid {
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 14px;
}

body[data-page="catalog"] .catalog-card-info {
  gap: 6px;
  padding: 13px 13px 14px;
}

body[data-page="catalog"] .catalog-card-add-btn {
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: 9px;
}

body[data-theme="light"][data-page="catalog"] .app-shell {
  width: min(1680px, calc(100% - 28px));
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(248, 241, 230, 0.92));
  border-color: rgba(111, 98, 82, 0.1);
  box-shadow: 0 12px 30px rgba(84, 64, 40, 0.07);
}

body[data-theme="light"][data-page="catalog"] .catalog-layout {
  gap: 14px;
}

body[data-theme="light"][data-page="catalog"] .catalog-layout > .panel {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

body[data-theme="light"][data-page="catalog"] .catalog-search-form {
  margin: 8px 0 16px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

body[data-theme="light"][data-page="catalog"] .catalog-results-grid {
  grid-template-columns: repeat(auto-fill, minmax(214px, 1fr));
  gap: 14px;
}

body[data-theme="light"][data-page="catalog"] .catalog-card-v2 {
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(84, 64, 40, 0.07);
}

body[data-theme="light"][data-page="catalog"] .catalog-card-v2:hover {
  box-shadow: 0 10px 22px rgba(84, 64, 40, 0.09);
}

body[data-theme="light"][data-page="catalog"] .catalog-card-info {
  gap: 6px;
  padding: 13px 13px 14px;
}

body[data-theme="light"][data-page="catalog"] .catalog-card-title-btn {
  font-size: 0.95rem;
  line-height: 1.3;
}

body[data-theme="light"][data-page="catalog"] .catalog-card-author {
  font-size: 0.81rem;
}

body[data-theme="light"][data-page="catalog"] .catalog-card-meta,
body[data-theme="light"][data-page="catalog"] .catalog-card-rating-stub {
  font-size: 0.76rem;
}

body[data-theme="light"][data-page="catalog"] .catalog-card-add-btn {
  margin-top: 10px;
  padding: 7px 12px;
  border-radius: 9px;
}

body[data-theme="light"][data-page="catalog"] .catalog-card-add-btn--in,
body[data-theme="light"][data-page="catalog"] .catalog-card-add-btn:disabled {
  background: linear-gradient(180deg, rgba(248, 241, 230, 0.96), rgba(255, 253, 248, 0.92));
}

body[data-theme="light"][data-page="catalog"] .catalog-layout .panel-title {
  margin-bottom: 10px;
  font-size: 1.5rem;
}

body[data-theme="light"][data-page="catalog"] .catalog-search-form .primary-button {
  width: auto;
  min-width: 0;
  padding-inline: 18px;
  justify-self: start;
  white-space: nowrap;
}

.library-panel {
  padding: 22px;
}

body[data-page="library"] .library-panel {
  position: relative;
  overflow: visible;
  border: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(240, 217, 166, 0.026), transparent 34%),
    linear-gradient(180deg, rgba(42, 38, 32, 0.48) 0%, rgba(35, 32, 27, 0.38) 100%);
  box-shadow: none;
  backdrop-filter: blur(30px);
  isolation: isolate;
}

body[data-theme="light"][data-page="library"] .library-panel {
  background:
    radial-gradient(circle at 50% 0%, rgba(217, 164, 65, 0.036), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.7) 0%, rgba(239, 231, 218, 0.5) 100%);
}

body[data-theme="light"][data-page="library"] .dashboard-showcase > *::before,
body[data-theme="light"][data-page="library"] .dashboard-showcase > *::after {
  background: color-mix(in srgb, var(--border-color) 76%, var(--text-secondary) 24%);
  opacity: 0.82;
}

body[data-theme="light"][data-page="library"] .goal-progress {
  background: color-mix(in srgb, var(--hover-surface) 66%, var(--bg-elevated) 34%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border-color) 68%, transparent);
}

body[data-theme="light"][data-page="library"] .goal-progress > span {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--accent) 82%, var(--bg-elevated) 18%),
    color-mix(in srgb, var(--accent-strong) 78%, var(--accent) 22%)
  );
}

body[data-theme="light"][data-page="library"] .goal-progress.is-complete > span {
  background: linear-gradient(90deg, #daa04b, #e5b657);
}

body[data-theme="light"][data-page="library"] .goal-progress.is-overcomplete > span {
  background: linear-gradient(90deg, #d99b42 0%, #e4bd58 52%, #afbf62 100%);
}

body[data-theme="light"][data-page="library"] .refined-toolbar {
  background: color-mix(in srgb, var(--surface-input) 78%, var(--bg-card) 22%);
  border-color: color-mix(in srgb, var(--border-color) 86%, var(--text-muted) 14%);
}

body[data-page="library"] .library-panel::before {
  content: "";
  position: absolute;
  inset: -24px;
  border-radius: calc(var(--radius-xl) + 20px);
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.028), transparent 62%),
    radial-gradient(circle at 50% 100%, rgba(0,0,0,0.08), transparent 68%);
  filter: blur(28px);
  pointer-events: none;
  z-index: 0;
}

body[data-page="library"] .library-panel::after {
  content: "";
  position: absolute;
  inset: -56px;
  border-radius: calc(var(--radius-xl) + 40px);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.045), transparent 52%),
    radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.12), transparent 68%);
  filter: blur(64px);
  pointer-events: none;
  z-index: 0;
}

body[data-page="library"] .library-panel > * {
  position: relative;
  z-index: 2;
}

.library-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.clubs-layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
}

.club-create-panel,
.club-list-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.club-form {
  gap: 14px;
}

.club-form textarea,
.club-form select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--panel-border) 72%, rgba(255,255,255,0.08));
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
  color: var(--text);
  font: inherit;
}

.club-form textarea {
  min-height: 112px;
  resize: vertical;
}

.club-form textarea:focus,
.club-form select:focus {
  outline: none;
  border-color: rgba(217, 170, 75, 0.42);
  box-shadow: 0 0 0 4px rgba(217, 170, 75, 0.12);
}

.club-form-actions {
  margin: 4px 0 0;
}

.club-join-panel {
  display: grid;
  gap: 12px;
}

.club-join-panel h4 {
  margin: 0;
  font-size: 1rem;
}

.club-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.clubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.club-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
}

body[data-theme="light"] .club-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.74));
}

.club-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.club-card-copy {
  display: grid;
  gap: 6px;
}

.club-card-copy h4 {
  margin: 0;
  font-size: 1.08rem;
}

.club-card-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.club-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.club-card-actions {
  display: grid;
  gap: 10px;
}

.club-invite-token {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bg-soft);
  color: var(--text-secondary);
  font-size: 0.88rem;
  word-break: break-all;
}

.club-visibility-pill {
  flex: 0 0 auto;
}

.club-visibility-open {
  background: rgba(116, 198, 157, 0.12);
  color: #74c69d;
  border-color: rgba(116, 198, 157, 0.2);
}

.club-visibility-closed {
  background: rgba(217, 164, 65, 0.12);
  color: #e0b356;
  border-color: rgba(217, 164, 65, 0.2);
}

.library-main-title {
  margin: 0;
  font-size: 2.05rem;
  line-height: 1.05;
}

.library-summary-divider-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin: 20px 0 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--panel-border);
  gap: 0;
}

.library-summary-item {
  padding: 0 16px;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.library-summary-item:first-child {
  padding-left: 0;
}

.library-summary-item:last-child {
  border-right: none;
  padding-right: 0;
}

.library-summary-item .small {
  text-transform: uppercase;
  color: var(--color-text-mild, #9a9b9c);
  margin: 0 0 8px 0;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
}

.library-summary-item .stat-value {
  font-family: inherit;
  font-weight: 700;
  font-size: 1.45rem;
  color: var(--text, #fff);
  line-height: 1;
}

.refined-toolbar {
  margin-top: 0;
  padding: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  background: rgba(255,255,255,0.03);
}

.refined-filters {
  position: relative;
}

.refined-filters select,
.refined-search input {
  min-height: 48px;
}

.refined-filters select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.25 6.5 8 10.25 11.75 6.5' fill='none' stroke='%23d7d1c4' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
}

.refined-search {
  flex: 1;
}

.book-card-library {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  padding: 16px 18px 92px;
  min-height: 318px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.018));
  border-radius: 20px;
}

.book-card-top {
  display: grid;
  grid-template-columns: 98px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.book-card-cover {
  display: grid;
  place-items: center;
  width: 98px;
  height: 138px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: none;
  cursor: pointer;
  overflow: hidden;
}

.book-card-cover img {
  width: 98px;
  height: 138px;
  border-radius: 12px;
  object-fit: cover;
  background: #222733;
  box-shadow: 0 10px 22px rgba(0,0,0,0.18);
}

.book-card-cover-placeholder {
  display: grid;
  place-items: center;
  width: 98px;
  height: 138px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.book-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.book-card-body-lower {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.book-card-body-lower-reading,
.book-card-body-lower-settled {
  width: min(100%, 178px);
}

.book-card-title {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  font-size: 1.12rem;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-card-author,
.book-card-genre {
  color: var(--muted);
  margin: 0;
  line-height: 1.25;
}

.compact-progress {
  height: 8px;
}

.book-card-actions {
  display: flex;
  gap: 10px;
}

.book-card-actions-single {
  justify-content: center;
}

.compact-button {
  flex: 1;
  min-height: 40px;
}

.compact-button-centered {
  flex: 0 0 auto;
  min-width: 78px;
  padding: 8px 16px;
  font-size: 0.95rem;
}

.book-card-date {
  margin: 0;
  text-align: center;
}

.book-card-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.book-card-status-row-footer {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  justify-content: space-between;
  align-items: center;
  margin: 0;
}

.book-status-shell {
  position: relative;
}

.book-status-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px 0 14px;
  border: 1px solid rgba(180, 150, 90, 0.2);
  border-radius: 14px;
  background: rgba(180, 150, 90, 0.12);
  color: #BFA46A;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.book-status-trigger.status-planned {
  background: rgba(180, 150, 90, 0.12);
  border-color: rgba(180, 150, 90, 0.2);
  color: #BFA46A;
}

.book-status-trigger.status-reading {
  background: rgba(217, 164, 65, 0.14);
  border-color: rgba(217, 164, 65, 0.22);
  color: #E6C27A;
}

.book-status-trigger.status-completed {
  background: rgba(120, 180, 140, 0.18);
  border-color: rgba(120, 180, 140, 0.25);
  color: #A9D5B5;
}

.book-status-trigger.status-dropped {
  background: linear-gradient(180deg, rgba(133, 73, 81, 0.76), rgba(104, 50, 61, 0.86));
  border-color: rgba(214, 123, 137, 0.22);
  color: #ffe3e6;
}

.book-status-trigger:hover,
.book-status-trigger:focus-visible {
  box-shadow: 0 10px 24px rgba(0,0,0,0.14);
  transform: translateY(-1px);
  outline: none;
}

body[data-theme="light"] .book-status-trigger.status-planned {
  background: #EFE6D6;
  border-color: #E0D4BF;
  color: #7A6A4F;
}

body[data-theme="light"] .book-status-trigger.status-reading {
  background: #F4E7C6;
  border-color: #E6D3A3;
  color: #8A6B2F;
}

body[data-theme="light"] .book-status-trigger.status-completed {
  background: #E6F1E8;
  border-color: #CFE3D2;
  color: #3F7A4F;
}

.book-status-caret {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-left: 2px;
  padding-left: 8px;
  border-left: 1px solid color-mix(in srgb, currentColor 74%, #3f392f 26%);
  color: color-mix(in srgb, currentColor 74%, #3f392f 26%);
  flex: 0 0 20px;
  opacity: 0.92;
}

.book-status-caret svg {
  display: block;
  width: 14px;
  height: 14px;
}

.book-status-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 12;
  display: grid;
  gap: 4px;
  min-width: 172px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg-elevated) 100%);
  box-shadow: 0 18px 40px rgba(0,0,0,0.22);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.book-status-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.book-status-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.book-status-option:hover,
.book-status-option.active {
  background: var(--hover-surface);
  transform: translateX(2px);
}

.book-status-option-check {
  min-width: 10px;
  color: var(--accent);
}

.book-card-favorite-toggle {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.book-card-favorite-toggle svg {
  width: 22px;
  height: 22px;
}

.book-card-favorite-toggle.is-active {
  color: #D57A7A;
}

.book-card-favorite-toggle:hover,
.book-card-favorite-toggle:focus-visible {
  color: var(--text-secondary);
  outline: none;
}

.book-card-favorite-toggle.is-active:hover,
.book-card-favorite-toggle.is-active:focus-visible {
  color: #D57A7A;
}

.book-card-progress-block,
.book-card-completion-block {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.book-card-progress-block-reading {
  width: 100%;
  margin: 0;
}

.book-card-progress-caption {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.book-card-progress-caption span:nth-child(2) {
  justify-self: center;
}

.book-card-progress-caption span:last-child {
  justify-self: end;
}

.book-card-progress-caption-reading {
  grid-template-columns: 1fr auto;
  width: 100%;
  margin: 0;
}

.book-card-progress-block .compact-progress {
  width: 100%;
  margin: 0;
}

.book-card-pages-line {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.book-card-inline-edit {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.book-card-inline-edit svg {
  width: 13px;
  height: 13px;
}

.book-card-inline-edit:hover,
.book-card-inline-edit:focus-visible {
  color: var(--text);
  outline: none;
}

.book-card-info-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: center;
}

.book-card-completion-block-centered {
  width: 100%;
  margin: 0;
}

.book-card-date-reading {
  width: 100%;
  margin: 0;
}

.book-card-rating-placeholder,
.book-card-rating-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 24px;
  color: var(--muted);
  font-size: 0.92rem;
  width: 100%;
  margin: 0;
  justify-content: center;
  text-align: center;
}

.book-card-body-lower-reading .book-card-progress-caption,
.book-card-body-lower-reading .book-card-info-line,
.book-card-body-lower-reading .book-card-date,
.book-card-body-lower-settled .book-card-info-line,
.book-card-body-lower-settled .book-card-date,
.book-card-body-lower-settled .book-card-rating-placeholder,
.book-card-body-lower-settled .book-card-rating-row {
  text-align: left;
}

.book-card-body-lower-reading .book-card-rating-row,
.book-card-body-lower-reading .book-card-rating-placeholder,
.book-card-body-lower-settled .book-card-rating-row,
.book-card-body-lower-settled .book-card-rating-placeholder {
  justify-content: flex-start;
}

.book-card-rating-stars {
  color: #e0b356;
  letter-spacing: 0.06em;
}

.inline-progress-form {
  display: grid;
  gap: 10px;
}

.inline-progress-actions {
  display: flex;
  gap: 10px;
}

.book-card-tools {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.book-card-edit,
.book-card-remove {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  line-height: 1;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.book-card-edit {
  background: var(--hover-surface);
  color: var(--accent);
}

.book-card-edit svg {
  display: block;
  width: 15px;
  height: 15px;
}

.book-card-edit:hover,
.book-card-edit:focus-visible {
  background: var(--panel-border);
  color: var(--accent-hover);
  transform: scale(1.05);
  outline: none;
}

.book-card-remove {
  background: rgba(138, 31, 31, 0.14);
  color: #ff6f6f;
  font-size: 1.35rem;
  font-weight: 500;
}

.book-card-remove:hover,
.book-card-remove:focus-visible {
  background: rgba(173, 39, 39, 0.22);
  color: #ff8d8d;
  transform: scale(1.05);
  outline: none;
}

.book-card-empty {
  display: grid;
  place-items: center;
  min-height: 320px;
  width: 100%;
}

.empty-book-cta {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 16px;
  width: 100%;
  min-height: 280px;
  padding: 24px;
  border: 0;
  background: none;
  color: var(--text);
  cursor: pointer;
}

.empty-book-cover {
  position: relative;
  display: grid;
  place-items: center;
  width: 144px;
  aspect-ratio: 3 / 4.2;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px dashed var(--panel-border);
}

.empty-book-label {
  width: 82%;
  text-align: center;
  letter-spacing: 0.02em;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--text-secondary);
}

.book-cover {
  width: 100%;
  aspect-ratio: 3 / 4.2;
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 14px;
}

.book-card h4,
.book-hero-copy h3 { margin: 0 0 8px; font-size: 1.25rem; }

.book-card p,
.book-hero-copy p,
.form-note { margin: 0 0 8px; }

.book-detail-page {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 30px;
  padding: 28px;
  margin: 24px 0;
}

.book-page-edit-trigger {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  outline: none;
}

.book-page-edit-trigger svg {
  width: 40px;
  height: 40px;
}

.book-page-edit-trigger:hover,
.book-page-edit-trigger:focus-visible {
  color: var(--accent-hover);
}

.book-detail-cover-column {
  display: grid;
  align-content: start;
  gap: 14px;
}

.book-detail-cover {
  width: 100%;
  margin: 0;
}

.book-detail-cover img,
.book-detail-cover .book-card-cover-placeholder {
  width: 100%;
  aspect-ratio: 3 / 4.2;
  border-radius: 18px;
}

.book-detail-status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.book-detail-status-bar .book-status-shell {
  flex: 0 0 auto;
}

.book-detail-status-trigger {
  min-height: 48px;
  padding: 0 13px 0 18px;
  font-size: 0.98rem;
  font-weight: 800;
}

.book-detail-status-trigger .book-status-caret {
  width: 24px;
  height: 24px;
  flex-basis: 24px;
  padding-left: 9px;
}

.book-detail-main {
  display: grid;
  align-content: start;
  gap: 10px;
}

.book-detail-topline {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-bottom: 2px;
}

.book-detail-back-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.book-detail-title {
  margin: 0;
  font-family: "Literata", serif;
  font-size: 2.1rem;
  line-height: 1.08;
}

.book-detail-author {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.book-detail-genres {
  margin: 0;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.book-detail-genre-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease;
}

.book-detail-genre-link:hover,
.book-detail-genre-link:focus-visible {
  color: var(--accent);
  outline: none;
  text-decoration: underline;
}

.book-detail-genre-fallback {
  color: var(--muted);
}

.book-detail-meta {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}

.book-detail-meta-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.book-detail-meta-row span {
  color: var(--muted);
}

.book-detail-meta-row strong {
  color: var(--text);
  font-weight: 700;
}

.book-detail-meta-form {
  align-items: start;
}

.book-detail-inline-input {
  width: min(100%, 240px);
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--panel-border) 72%, rgba(255,255,255,0.08));
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.book-detail-inline-input:focus {
  outline: none;
  border-color: rgba(217, 170, 75, 0.42);
  box-shadow: 0 0 0 4px rgba(217, 170, 75, 0.12);
}

.book-detail-inline-date {
  width: min(100%, 240px);
}

.book-detail-description {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.book-detail-description .section-title {
  margin: 0;
}

.genre-page-panel {
  display: grid;
  gap: 18px;
}

.genre-page-topline {
  display: flex;
  justify-content: flex-start;
}

.genre-page-title {
  margin-bottom: 0;
}

.genre-page-subtitle {
  margin: -6px 0 0;
}

.book-favorite-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.book-favorite-toggle svg {
  width: 26px;
  height: 26px;
}

.book-favorite-toggle.is-active {
  color: #D57A7A;
}

.book-favorite-toggle:hover,
.book-favorite-toggle:focus-visible {
  color: var(--text-secondary);
  outline: none;
}

.book-favorite-toggle.is-active:hover,
.book-favorite-toggle.is-active:focus-visible {
  color: #D57A7A;
}

.book-page-progress-form {
  display: grid;
  gap: 12px;
  max-width: 300px;
  margin-top: 8px;
}

.book-page-progress-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.book-hero {
  display: grid;
  grid-template-columns: 260px 1fr 320px;
  gap: 24px;
  padding: 24px;
  margin: 24px 0;
}

.book-meta { gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 20px; }
.form-grid { gap: 14px; flex-wrap: wrap; }
.form-grid > * { flex: 1 1 220px; }

.profile-page {
  display: grid;
  gap: 20px;
}

body[data-page="profile"] .app-shell,
body[data-page="profile-public"] .app-shell {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding-inline: 0;
  backdrop-filter: none;
}

.profile-hero-shell {
  position: relative;
  overflow: hidden;
  min-height: 340px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(42, 38, 32, 0.78), rgba(28, 26, 22, 0.92));
  border: 1px solid rgba(255,255,255,0.05);
}

.profile-banner {
  position: absolute;
  inset: 0;
  background-image: var(--profile-banner-image), url("/assets/profile-default-banner.jpg");
  background-size: cover, cover;
  background-position: center, center;
  filter: saturate(0.85);
}

.profile-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 28px;
  align-items: end;
  min-height: 340px;
  padding: 36px;
}

.profile-avatar-column {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.profile-avatar-frame {
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 28px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
  box-shadow: 0 18px 40px rgba(0,0,0,0.22);
  position: relative;
  color: var(--text);
}

.profile-avatar-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.profile-avatar-frame span {
  font-size: 52px;
  font-weight: 800;
  color: var(--text);
}

.profile-avatar-frame.is-editable,
.profile-banner.is-editable {
  cursor: pointer;
}

.profile-avatar-frame.is-editable:hover,
.profile-avatar-frame.is-editable:focus-visible {
  outline: none;
  border-color: rgba(230, 181, 102, 0.35);
}

.profile-media-hint {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #FFFFFF;
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.profile-avatar-frame.is-editable:hover .profile-media-hint,
.profile-avatar-frame.is-editable:focus-visible .profile-media-hint {
  opacity: 1;
  transform: translateY(0);
}

.profile-identity-meta {
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.subtle-pill {
  background: rgba(32, 30, 26, 0.78);
  border-color: rgba(255,255,255,0.08);
  color: var(--text);
}

.profile-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
}

.profile-title {
  margin: 0;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.profile-bio {
  max-width: 820px;
  margin: 0;
  color: var(--text-soft);
  font-size: 17px;
  line-height: 1.6;
}

/* ── Hero stats (inside banner) ── */
/* ── Hero action buttons ── */
.profile-hero-actions {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 2;
  display: flex;
  gap: 10px;
}

.profile-edit-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(12px);
  color: #fff;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.profile-edit-button:hover {
  background: rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.35);
}

.profile-edit-button svg {
  flex-shrink: 0;
}

/* ── Overview cards (2 cards with icons) ── */
.profile-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.profile-overview-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-radius: 20px;
  background: var(--surface-panel, rgba(31, 33, 37, 0.65));
  border: 1px solid var(--panel-border);
}

.profile-overview-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.profile-overview-copy {
  display: grid;
  gap: 2px;
}

.profile-overview-copy strong {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.profile-overview-copy span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft, var(--muted));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-overview-copy small {
  font-size: 12px;
  color: var(--text-muted, var(--muted));
}

/* ── Sidebar widgets ── */
.profile-sidebar {
  display: grid;
  gap: 16px;
  align-content: start;
}

.profile-sidebar-widget {
  display: grid;
  gap: 14px;
}

.profile-sidebar-widget h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.sidebar-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Goal ring widget ── */
.sidebar-goal-ring-row {
  display: flex;
  align-items: center;
  gap: 18px;
}

.sidebar-goal-ring {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent-strong, #d6a24a) 0% var(--goal-progress, 0%),
    rgba(255,255,255,0.08) var(--goal-progress, 0%) 100%
  );
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
}

.sidebar-goal-ring::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: var(--surface-panel, rgba(31, 33, 37, 0.95));
}

.sidebar-goal-ring span {
  position: relative;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.sidebar-goal-copy {
  display: grid;
  gap: 4px;
}

.sidebar-goal-copy p {
  margin: 0;
  font-size: 14px;
  color: var(--text-soft, var(--muted));
}

.sidebar-goal-empty {
  padding: 12px 0;
}

/* ── Placeholder widgets ── */
.sidebar-placeholder-list {
  display: grid;
  gap: 10px;
}

.sidebar-placeholder-item {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px dashed var(--panel-border);
  background: rgba(255,255,255,0.02);
}

.sidebar-placeholder-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
  color: var(--text-soft, var(--muted));
}

.sidebar-placeholder-item p {
  margin: 0;
}

.profile-foundation-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 20px;
}

.profile-feed-panel,
.profile-editor-panel,
.profile-taste-card {
  background: linear-gradient(180deg, rgba(42, 38, 32, 0.84), rgba(29, 27, 23, 0.9));
}

.profile-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.profile-activity-feed {
  display: grid;
  gap: 12px;
}

.profile-heatmap-panel {
  margin-top: 18px;
}

.profile-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.profile-filter-chip {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.03);
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}

.profile-filter-chip.active {
  color: var(--text);
  background: rgba(240, 217, 166, 0.16);
  border-color: rgba(214, 162, 74, 0.28);
}

.profile-filter-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.profile-heatmap-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  grid-auto-columns: 12px;
  gap: 6px;
  margin-top: 18px;
  justify-content: start;
}

.profile-heatmap-cell {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.03);
}

.profile-heatmap-cell.level-1 { background: rgba(214, 162, 74, 0.18); }
.profile-heatmap-cell.level-2 { background: rgba(214, 162, 74, 0.32); }
.profile-heatmap-cell.level-3 { background: rgba(214, 162, 74, 0.5); }
.profile-heatmap-cell.level-4 { background: rgba(214, 162, 74, 0.72); }

.profile-activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.04);
}

.profile-activity-item span {
  color: var(--text-muted);
  font-size: 13px;
}

.profile-taste-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.profile-pill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.profile-tag-pill {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font: inherit;
  font-weight: 600;
}

.genre-pill-label {
  display: inline-flex;
  cursor: pointer;
  transition: opacity 0.2s;
}
.genre-pill-label .hidden-checkbox {
  display: none;
}
.genre-pill-label .hidden-checkbox:checked + .selectable-pill {
  background: var(--button-bg, #b3734b);
  color: var(--color-text-invert, #fff);
  border-color: var(--button-bg, #b3734b);
}
.genre-pill-label:hover .selectable-pill {
  border-color: var(--button-bg, #b3734b);
}

.profile-editor-stack {
  gap: 20px;
}

.profile-editor-panel .field-shell {
  display: grid;
  gap: 8px;
}

.profile-editor-panel .field-shell span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.profile-editor-panel .field-shell small {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.4;
}

.profile-media-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-upload-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.profile-upload-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(42, 38, 32, 0.88), rgba(29, 27, 23, 0.92));
  color: var(--text-secondary);
}

.profile-upload-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.profile-upload-preview-avatar {
  aspect-ratio: 1 / 1;
  min-height: 180px;
}

.profile-upload-preview-avatar span {
  font-size: 54px;
  font-weight: 800;
  color: var(--text);
}

.profile-upload-preview-banner {
  aspect-ratio: 16 / 6;
  min-height: 140px;
}

.profile-upload-preview-banner span {
  padding: 0 16px;
  text-align: center;
  font-size: 14px;
}

.profile-upload-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg-elevated));
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.profile-upload-button:hover {
  border-color: var(--accent-strong);
  background: linear-gradient(180deg, var(--hover-surface), var(--bg-elevated));
}

.profile-upload-button input {
  display: none;
}

.profile-upload-button.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.profile-upload-button.is-disabled:hover {
  border-color: var(--panel-border);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg-elevated));
}
.settings-grid { gap: 14px; align-items: stretch; }
.setting-card { min-height: 160px; }
.admin-grid { grid-template-columns: 1.1fr 0.9fr; margin-top: 24px; }

.report-row {
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel-border);
}

.callout {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(116, 198, 157, 0.12);
  border: 1px solid rgba(116, 198, 157, 0.16);
}

.status-panel {
  margin-top: 18px;
}

.status-panel-compact {
  align-self: end;
}

.toast {
  margin-bottom: 18px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(116, 198, 157, 0.25);
  background: rgba(116, 198, 157, 0.14);
}

.empty-state {
  padding: 32px 20px;
  border-radius: 20px;
  border: 1px dashed var(--panel-border);
  text-align: center;
  color: var(--muted);
}

.compact {
  padding: 18px;
}

.full-width {
  width: 100%;
}

.auth-form {
  margin-top: 18px;
}

@keyframes auth-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 176px);
  padding: 18px 0 10px;
}

.auth-card {
  width: min(440px, 100%);
  margin: 0 auto;
  padding: 26px 24px 22px;
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  animation: auth-fade-up 320ms cubic-bezier(.22,1,.36,1);
}

.auth-card-header {
  text-align: center;
}

.auth-card-header .panel-title {
  margin-bottom: 0;
}

.auth-google-block {
  margin-top: 18px;
  display: grid;
  animation: auth-fade-up 420ms cubic-bezier(.22,1,.36,1);
  animation-delay: 40ms;
  animation-fill-mode: both;
}

.auth-google-slot {
  width: 100%;
  display: grid;
}

.auth-google-button {
  width: 100%;
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--panel-border) 58%);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

.auth-google-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 70%, white 30%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.auth-google-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(253, 216, 112, 0.18), 0 10px 24px rgba(0, 0, 0, 0.12);
}

.auth-google-button:disabled,
.auth-google-button[aria-disabled="true"] {
  opacity: 0.64;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-google-button-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
}

.auth-google-button-icon svg {
  width: 32px;
  height: 32px;
  fill: url(#auth-google-gradient);
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.16)) drop-shadow(0 2px 6px rgba(253, 216, 112, 0.22));
}

.auth-google-button-copy {
  line-height: 1;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 16px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1;
  animation: auth-fade-up 460ms cubic-bezier(.22,1,.36,1);
  animation-delay: 80ms;
  animation-fill-mode: both;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--panel-border));
}

.auth-divider::after {
  background: linear-gradient(90deg, var(--panel-border), transparent);
}

.auth-form-polished {
  gap: 12px;
  animation: auth-fade-up 520ms cubic-bezier(.22,1,.36,1);
  animation-delay: 120ms;
  animation-fill-mode: both;
}

.field-shell {
  display: grid;
  gap: 8px;
}

.field-shell span {
  font-size: 0.9rem;
  font-weight: 700;
}

.field-shell input {
  width: 100%;
  min-height: 48px;
  border-radius: 14px;
  border-color: color-mix(in srgb, var(--panel-border) 70%, rgba(255,255,255,0.08));
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.02));
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field-shell input:focus {
  border-color: rgba(217, 170, 75, 0.42);
  box-shadow: 0 0 0 4px rgba(217, 170, 75, 0.12);
  transform: translateY(-1px);
}

.auth-forgot-link {
  justify-self: end;
  margin-top: 2px;
}

.inline-link {
  padding: 0;
  border: 0;
  background: none;
  color: #4f83ff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.inline-link:hover {
  color: #78a0ff;
}

.auth-submit {
  margin-top: 6px;
  min-height: 48px;
  border-radius: 14px;
}

.auth-footer-copy {
  margin: 16px 0 0;
  color: var(--muted);
  text-align: center;
  animation: auth-fade-up 580ms cubic-bezier(.22,1,.36,1);
  animation-delay: 160ms;
  animation-fill-mode: both;
}

.library-panel-full {
  width: 100%;
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  margin-top: 12px;
  border: 1px solid var(--panel-border);
}

.club-page-hero,
.club-members-panel,
.club-page-empty {
  display: grid;
  gap: 18px;
}

.club-page-topline {
  display: flex;
  justify-content: flex-start;
}

.club-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.club-page-copy {
  display: grid;
  gap: 8px;
}

.club-page-copy .small,
.club-page-title {
  margin: 0;
}

.club-page-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.club-members-list {
  display: grid;
  gap: 12px;
}

.club-member-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.club-member-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(217,164,65,0.28), rgba(239,216,165,0.16));
  color: var(--text);
  font-weight: 800;
}

.club-member-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.club-member-copy strong,
.club-member-copy p {
  margin: 0;
}

.club-member-copy p {
  color: var(--muted);
}

.club-member-meta {
  display: grid;
  justify-items: end;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-align: right;
}

.club-member-role {
  font-weight: 700;
  color: var(--text);
}

/* Shared design-system overrides for v0.7.8 */
.app-shell,
.panel,
.book-card,
.stat-card,
.setting-card,
.report-card,
.admin-table,
.auth-card,
.library-panel,
.profile-overview-card,
.profile-upload-card,
.profile-activity-item,
.lang-dropdown,
.header-profile-dropdown,
.club-member-row,
.club-list-card,
.empty-state,
.callout {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14) !important;
  backdrop-filter: none !important;
}

.panel,
.book-card,
.stat-card,
.setting-card,
.report-card,
.admin-table,
.auth-card,
.profile-overview-card,
.profile-upload-card,
.profile-activity-item,
.lang-dropdown,
.header-profile-dropdown,
.club-member-row,
.empty-state {
  background-image: none !important;
}

.site-header,
.header-utility,
.lang-dropdown,
.header-profile-dropdown {
  background: var(--surface-header) !important;
}

.site-header {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

body[data-layout="immersive"] .app-shell {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.primary-button,
.auth-cta,
.profile-upload-button:not(.is-disabled) {
  background: var(--accent) !important;
  color: #1A1A1A !important;
  border: 0 !important;
  box-shadow: none !important;
}

.primary-button:hover,
.primary-button:focus-visible,
.auth-cta:hover,
.auth-cta:focus-visible,
.profile-upload-button:not(.is-disabled):hover {
  background: var(--accent-hover) !important;
  color: #1A1A1A !important;
}

body[data-page="library"] .library-panel-header .primary-button,
body[data-page="catalog"] .catalog-search-form .primary-button {
  color: #1b1207 !important;
  background: var(--accent) !important;
  border: 0 !important;
  box-shadow: 0 10px 24px rgba(244, 166, 64, 0.22) !important;
}

body[data-page="library"] .library-panel-header .primary-button:hover,
body[data-page="library"] .library-panel-header .primary-button:focus-visible,
body[data-page="catalog"] .catalog-search-form .primary-button:hover,
body[data-page="catalog"] .catalog-search-form .primary-button:focus-visible {
  color: #1b1207 !important;
  background: var(--accent) !important;
  box-shadow: 0 10px 24px rgba(244, 166, 64, 0.22) !important;
}

body[data-theme="light"][data-page="library"] .library-panel-header .primary-button,
body[data-theme="light"][data-page="catalog"] .catalog-search-form .primary-button {
  color: #2a1705 !important;
  background: linear-gradient(180deg, #f4c06a 0%, #e7a84d 100%) !important;
  box-shadow:
    0 10px 22px rgba(185, 120, 36, 0.22),
    0 0 0 1px rgba(143, 86, 18, 0.08),
    0 0 28px rgba(244, 166, 64, 0.2) !important;
}

body[data-theme="light"][data-page="library"] .library-panel-header .primary-button:hover,
body[data-theme="light"][data-page="library"] .library-panel-header .primary-button:focus-visible,
body[data-theme="light"][data-page="catalog"] .catalog-search-form .primary-button:hover,
body[data-theme="light"][data-page="catalog"] .catalog-search-form .primary-button:focus-visible {
  color: #2a1705 !important;
  background: linear-gradient(180deg, #f7c978 0%, #ecaf55 100%) !important;
  box-shadow:
    0 12px 26px rgba(185, 120, 36, 0.26),
    0 0 0 1px rgba(143, 86, 18, 0.1),
    0 0 34px rgba(244, 166, 64, 0.24) !important;
}

.secondary-button,
.ghost-button {
  background: transparent !important;
  color: #CFCFCF !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: none !important;
}

.secondary-button:hover,
.secondary-button:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible {
  background: rgba(255, 255, 255, 0.03) !important;
  color: var(--text-primary) !important;
}

.field-shell,
.profile-form-section,
.auth-form-polished,
.profile-editor-form,
form.stack {
  gap: 24px;
}

.profile-form-section {
  display: grid;
}

.profile-form-section-head {
  display: grid;
  gap: 6px;
  margin-bottom: 0;
}

.profile-form-section-head h4 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.profile-form-grid {
  gap: 16px;
}

.field-shell span,
.small,
.eyebrow,
.book-card-meta,
.book-card-author,
.book-card-genre,
.profile-overview-card span,
.profile-activity-item span,
.book-detail-meta-row span {
  color: var(--text-muted) !important;
}

body,
.panel-title,
.book-card-title,
.book-detail-title,
.profile-title,
.rank-row strong,
.stat-value,
.report-row strong,
.profile-activity-item strong {
  color: var(--text-primary);
}

.book-detail-author,
.book-card-author,
.book-detail-genre-link,
.profile-bio,
.lang-option-label {
  color: var(--text-secondary) !important;
}

.field-shell input,
.field-shell textarea,
.field-shell select,
.book-detail-inline-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px;
  background: var(--surface-input) !important;
  color: var(--text-primary);
  box-shadow: none !important;
}

.field-shell textarea {
  min-height: 120px;
  padding: 14px;
  resize: vertical;
}

.field-shell input:focus,
.field-shell textarea:focus,
.field-shell select:focus,
.book-detail-inline-input:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(230, 181, 102, 0.14) !important;
}

.profile-hero-shell {
  border: 1px solid var(--border-color) !important;
  background: var(--bg-card) !important;
  border-radius: 12px !important;
}

.profile-banner {
  filter: saturate(0.92) brightness(0.9);
}

.profile-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.profile-banner.is-editable::before {
  content: attr(data-banner-label);
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  color: #FFFFFF;
  font-size: 0.86rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.profile-banner.is-editable:hover::before {
  opacity: 1;
  transform: translateY(0);
}

.profile-title {
  color: #FFFFFF !important;
  font-size: clamp(44px, 5vw, 68px);
}

.profile-overview-card,
.profile-upload-card,
.profile-activity-item,
.profile-taste-card,
.profile-feed-panel,
.profile-editor-panel {
  backdrop-filter: none !important;
  background: var(--bg-card) !important;
}

.profile-heatmap-cell {
  background: #2A2A2E !important;
  border: 0 !important;
}

.profile-heatmap-cell.level-1 { background: #5A4A2F !important; }
.profile-heatmap-cell.level-2 { background: #A67C3B !important; }
.profile-heatmap-cell.level-3,
.profile-heatmap-cell.level-4 { background: #E6B566 !important; }

.profile-id-button {
  cursor: pointer;
}

.profile-public-topline,
.profile-hero-copy .profile-public-topline {
  display: flex;
  justify-content: flex-start;
}

.profile-page .hero-actions {
  margin: 0;
}

.profile-page.is-public .profile-foundation-grid {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="profile"],
body[data-page="profile-public"] {
  --profile-content-width: min(86vw, 1560px);
  overflow-x: clip;
}

body[data-page="profile"] .app-shell,
body[data-page="profile-public"] .app-shell {
  width: 100%;
  max-width: none;
  margin-top: 0;
  padding-top: 0;
  padding-left: 0;
  padding-right: 0;
}

body[data-page="profile"] .app-shell-main,
body[data-page="profile-public"] .app-shell-main {
  margin-top: 0;
  padding-top: 0;
}

body[data-page="profile"] .profile-page,
body[data-page="profile-public"] .profile-page {
  gap: 0;
  width: 100%;
  overflow-x: clip;
}

body[data-page="profile"] .profile-hero-shell,
body[data-page="profile-public"] .profile-hero-shell {
  width: auto;
  min-height: 380px;
  margin: 0 calc(50% - 50vw);
  position: relative;
  overflow: visible;
}

body[data-page="profile"] .profile-hero-inner,
body[data-page="profile-public"] .profile-hero-inner {
  width: var(--profile-content-width);
  margin: 0;
  padding: 0;
  display: grid;
  min-height: 0;
}

body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
  position: absolute;
  left: 50%;
  bottom: 0;
  z-index: 1;
  display: grid;
  grid-template-columns: 172px minmax(0, auto);
  grid-template-rows: auto auto;
  align-items: end;
  column-gap: 20px;
  row-gap: 0;
  width: var(--profile-content-width);
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
}

body[data-page="profile"] .profile-avatar-cluster.profile-avatar-column,
body[data-page="profile-public"] .profile-avatar-cluster.profile-avatar-column {
  position: static;
  display: contents;
  width: auto;
  min-width: 0;
  height: auto;
  gap: 0;
  padding: 0;
}

body[data-page="profile"] .profile-identity-cluster.profile-hero-copy,
body[data-page="profile-public"] .profile-identity-cluster.profile-hero-copy {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  align-content: end;
  min-height: auto;
  padding: 0 0 54px;
  margin: 0;
}

body[data-page="profile"] .profile-identity-cluster .profile-identity-copy,
body[data-page="profile-public"] .profile-identity-cluster .profile-identity-copy {
  display: grid;
  gap: 8px;
  align-content: end;
  justify-items: start;
  align-self: end;
  padding-top: 0;
  max-width: min(360px, 100%);
}

body[data-page="profile"] .profile-avatar-frame,
body[data-page="profile-public"] .profile-avatar-frame {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 172px;
  height: 172px;
  align-self: end;
  margin-bottom: 0;
}

body[data-page="profile"] .profile-title,
body[data-page="profile-public"] .profile-title {
  max-width: none;
  margin: 0;
}

body[data-page="profile"] .profile-overview-grid,
body[data-page="profile-public"] .profile-overview-grid,
body[data-page="profile"] .profile-tabs-shell,
body[data-page="profile-public"] .profile-tabs-shell,
body[data-page="profile"] .profile-foundation-grid,
body[data-page="profile-public"] .profile-foundation-grid {
  width: var(--profile-content-width);
  max-width: calc(100vw - 32px);
  margin-left: auto;
  margin-right: auto;
}

body[data-page="profile"] .profile-overview-grid,
body[data-page="profile-public"] .profile-overview-grid {
  margin-top: 0;
  margin-bottom: 0;
}

body[data-page="profile"] .profile-tabs-shell,
body[data-page="profile-public"] .profile-tabs-shell {
  display: grid;
  gap: 0;
  margin-top: 18px;
}

body[data-page="profile"] .profile-foundation-grid,
body[data-page="profile-public"] .profile-foundation-grid {
  margin-top: 16px;
  margin-bottom: 28px;
}

body[data-page="profile"] .profile-banner,
body[data-page="profile-public"] .profile-banner {
  filter: saturate(0.96) brightness(0.94);
}

body[data-page="profile"] .profile-banner::after,
body[data-page="profile-public"] .profile-banner::after {
  background:
    radial-gradient(circle at 18% 78%, rgba(0, 0, 0, 0.26), transparent 34%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.24) 46%, rgba(0, 0, 0, 0.56) 100%);
}

body[data-theme="light"][data-page="profile"] .profile-banner,
body[data-theme="light"][data-page="profile-public"] .profile-banner {
  filter: saturate(0.98) brightness(1);
}

body[data-theme="light"][data-page="profile"] .profile-banner::after,
body[data-theme="light"][data-page="profile-public"] .profile-banner::after {
  background:
    radial-gradient(circle at 18% 78%, rgba(35, 30, 24, 0.18), transparent 34%),
    linear-gradient(180deg, rgba(35, 30, 24, 0.04) 0%, rgba(35, 30, 24, 0.16) 46%, rgba(35, 30, 24, 0.42) 100%);
}

body[data-page="profile"] .profile-avatar-frame,
body[data-page="profile-public"] .profile-avatar-frame {
  border-width: 1px;
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.2);
}

body[data-page="profile"] .profile-title,
body[data-page="profile-public"] .profile-title {
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.34);
}

body[data-page="profile"] .profile-identity-meta,
body[data-page="profile-public"] .profile-identity-meta {
  justify-items: start;
  text-align: left;
}

body[data-page="profile"] .profile-identity-meta .subtle-pill,
body[data-page="profile-public"] .profile-identity-meta .subtle-pill {
  min-height: 30px;
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.34);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
  backdrop-filter: blur(10px);
}

body[data-theme="light"][data-page="profile"] .profile-identity-meta .subtle-pill,
body[data-theme="light"][data-page="profile-public"] .profile-identity-meta .subtle-pill {
  background: rgba(35, 30, 24, 0.34);
  border-color: rgba(255, 249, 240, 0.22);
  color: rgba(255, 249, 240, 0.94);
}

body[data-page="profile"] .profile-overview-grid,
body[data-page="profile-public"] .profile-overview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

body[data-page="profile"] .profile-tabs,
body[data-page="profile-public"] .profile-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-card) 82%, var(--bg-elevated) 18%);
  scrollbar-width: none;
}

body[data-page="profile"] .profile-tabs::-webkit-scrollbar,
body[data-page="profile-public"] .profile-tabs::-webkit-scrollbar {
  display: none;
}

body[data-page="profile"] .profile-tab,
body[data-page="profile-public"] .profile-tab {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

body[data-page="profile"] .profile-tab:hover,
body[data-page="profile-public"] .profile-tab:hover,
body[data-page="profile"] .profile-tab:focus-visible,
body[data-page="profile-public"] .profile-tab:focus-visible {
  outline: none;
  background: var(--hover-surface);
  color: var(--text-primary);
}

body[data-page="profile"] .profile-tab.active,
body[data-page="profile-public"] .profile-tab.active {
  background: var(--surface-control);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--border-color);
}

body[data-page="profile"] .profile-tabs-shell > .profile-tab-panel,
body[data-page="profile-public"] .profile-tabs-shell > .profile-tab-panel {
  margin-top: 16px;
}

body[data-page="profile"] .profile-tabs-shell > .profile-tab-panel .empty-state,
body[data-page="profile-public"] .profile-tabs-shell > .profile-tab-panel .empty-state {
  margin: 0;
  padding: 28px 24px;
  border-style: solid;
  background: color-mix(in srgb, var(--bg-card) 88%, var(--bg-elevated) 12%) !important;
  box-shadow: none !important;
}

body[data-page="profile"] .profile-foundation-grid,
body[data-page="profile-public"] .profile-foundation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: start;
  gap: 22px;
  padding: 22px;
  border: 1px solid var(--border-color);
  border-radius: 24px;
  background: color-mix(in srgb, var(--bg-card) 88%, var(--bg-elevated) 12%);
}

body[data-page="profile"] .profile-page.is-public .profile-foundation-grid,
body[data-page="profile-public"] .profile-page.is-public .profile-foundation-grid {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
}

body[data-page="profile"] .profile-feed-panel,
body[data-page="profile-public"] .profile-feed-panel,
body[data-page="profile"] .profile-taste-card,
body[data-page="profile-public"] .profile-taste-card,
body[data-page="profile"] .profile-heatmap-panel,
body[data-page="profile-public"] .profile-heatmap-panel {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body[data-page="profile"] .profile-feed-panel,
body[data-page="profile-public"] .profile-feed-panel {
  min-width: 0;
  padding: 0 22px 0 0;
  border-right: 1px solid var(--border-color) !important;
}

body[data-page="profile"] .profile-sidebar,
body[data-page="profile-public"] .profile-sidebar {
  display: grid;
  align-content: start;
  gap: 0;
  min-width: 0;
}

body[data-page="profile"] .profile-sidebar-value,
body[data-page="profile-public"] .profile-sidebar-value {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-sidebar-note,
body[data-page="profile-public"] .profile-sidebar-note {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

body[data-page="profile"] .profile-feed-panel > .profile-activity-feed,
body[data-page="profile-public"] .profile-feed-panel > .profile-activity-feed {
  max-height: 340px;
  overflow-y: auto;
  gap: 0;
  padding-right: 8px;
  border-bottom: 1px solid var(--border-color);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 42%, transparent) transparent;
}

body[data-page="profile"] .profile-activity-item,
body[data-page="profile-public"] .profile-activity-item {
  align-items: flex-start;
  padding: 14px 0;
  border: 0 !important;
  border-bottom: 1px solid var(--border-color) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-page="profile"] .profile-activity-item:last-child,
body[data-page="profile-public"] .profile-activity-item:last-child {
  border-bottom: 0 !important;
}

body[data-page="profile"] .profile-activity-item:hover,
body[data-page="profile-public"] .profile-activity-item:hover {
  background: color-mix(in srgb, var(--hover-surface) 48%, transparent) !important;
}

body[data-page="profile"] .profile-activity-item strong,
body[data-page="profile-public"] .profile-activity-item strong {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 16px;
  line-height: 1.45;
}

body[data-page="profile"] .profile-activity-item span,
body[data-page="profile-public"] .profile-activity-item span {
  flex: 0 0 auto;
  white-space: nowrap;
  text-align: right;
}

body[data-page="profile"] .profile-heatmap-panel,
body[data-page="profile-public"] .profile-heatmap-panel,
body[data-page="profile"] .profile-taste-grid,
body[data-page="profile-public"] .profile-taste-grid {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
}

body[data-page="profile"] .profile-taste-grid,
body[data-page="profile-public"] .profile-taste-grid {
  gap: 18px;
}

body[data-page="profile"] .profile-taste-card,
body[data-page="profile-public"] .profile-taste-card {
  padding: 0;
}

body[data-page="profile"],
body[data-page="profile-public"] {
  --profile-content-width: min(1220px, calc(100% - 64px));
}

body[data-page="profile"] .profile-page,
body[data-page="profile-public"] .profile-page {
  gap: 0;
  overflow-x: clip;
}

body[data-page="profile"] .profile-hero-shell,
body[data-page="profile-public"] .profile-hero-shell {
  min-height: clamp(340px, 34vw, 390px);
  margin: 0 calc(50% - 50vw);
  overflow: hidden;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: clamp(28px, 5vw, 76px);
  width: var(--profile-content-width);
  max-width: calc(100vw - 32px);
  min-height: 0;
  padding: 0;
  transform: translateX(-50%);
}

body[data-page="profile"] .profile-hero-primary,
body[data-page="profile-public"] .profile-hero-primary {
  display: flex;
  align-items: flex-end;
  gap: clamp(22px, 3vw, 34px);
  min-width: 0;
}

body[data-page="profile"] .profile-avatar-cluster.profile-avatar-column,
body[data-page="profile-public"] .profile-avatar-cluster.profile-avatar-column {
  display: block;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding: 0;
}

body[data-page="profile"] .profile-avatar-frame,
body[data-page="profile-public"] .profile-avatar-frame {
  width: clamp(148px, 14vw, 180px);
  height: clamp(148px, 14vw, 180px);
  grid-column: auto;
  grid-row: auto;
  align-self: auto;
  margin: 0;
  border-radius: 30px;
}

body[data-page="profile"] .profile-identity-cluster.profile-hero-copy,
body[data-page="profile-public"] .profile-identity-cluster.profile-hero-copy {
  display: grid;
  grid-column: auto;
  grid-row: auto;
  align-self: end;
  align-content: end;
  min-width: 0;
  max-width: min(620px, 100%);
  padding: 0 0 10px;
  margin: 0;
}

body[data-page="profile"] .profile-identity-cluster .profile-identity-copy,
body[data-page="profile-public"] .profile-identity-cluster .profile-identity-copy {
  max-width: min(620px, 100%);
  gap: 9px;
}

body[data-page="profile"] .profile-title,
body[data-page="profile-public"] .profile-title {
  font-size: clamp(42px, 5vw, 66px);
  overflow-wrap: anywhere;
}

body[data-page="profile"] .profile-bio,
body[data-page="profile-public"] .profile-bio {
  max-width: 560px;
  font-size: clamp(15px, 1.5vw, 17px);
}

body[data-page="profile"] .profile-hero-secondary,
body[data-page="profile-public"] .profile-hero-secondary {
  display: grid;
  justify-items: end;
  gap: 34px;
  min-width: 0;
  padding-bottom: 6px;
}

body[data-page="profile"] .profile-hero-secondary:empty,
body[data-page="profile-public"] .profile-hero-secondary:empty {
  display: none;
}

body[data-page="profile"] .profile-hero-actions,
body[data-page="profile-public"] .profile-hero-actions {
  position: static;
  display: flex;
  justify-content: flex-end;
}

body[data-page="profile"] .profile-overview-grid,
body[data-page="profile-public"] .profile-overview-grid,
body[data-page="profile"] .profile-tabs-shell,
body[data-page="profile-public"] .profile-tabs-shell,
body[data-page="profile"] .profile-foundation-grid,
body[data-page="profile-public"] .profile-foundation-grid {
  width: var(--profile-content-width) !important;
  max-width: calc(100vw - 32px);
}

body[data-page="profile"] .profile-overview-grid,
body[data-page="profile-public"] .profile-overview-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

body[data-page="profile"] .profile-overview-card,
body[data-page="profile-public"] .profile-overview-card {
  min-height: 118px;
  padding: 22px 24px;
  border: 1px solid var(--border-color) !important;
  border-radius: 18px !important;
  background: color-mix(in srgb, var(--bg-card) 92%, var(--bg-elevated) 8%) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.045) !important;
  backdrop-filter: none !important;
}

body[data-page="profile"] .profile-overview-card:nth-child(2),
body[data-page="profile-public"] .profile-overview-card:nth-child(2) {
  order: 4;
}

body[data-page="profile"] .profile-overview-card-year,
body[data-page="profile-public"] .profile-overview-card-year {
  order: 2;
}

body[data-page="profile"] .profile-overview-card-goal,
body[data-page="profile-public"] .profile-overview-card-goal {
  order: 3;
}

body[data-page="profile"] .profile-tabs-shell,
body[data-page="profile-public"] .profile-tabs-shell {
  margin-top: 24px;
}

body[data-page="profile"] .profile-tabs,
body[data-page="profile-public"] .profile-tabs {
  gap: clamp(18px, 3vw, 34px);
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  background: transparent;
}

body[data-page="profile"] .profile-tab,
body[data-page="profile-public"] .profile-tab {
  min-height: 46px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="profile"] .profile-tab.active,
body[data-page="profile-public"] .profile-tab.active {
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--accent-strong);
  color: var(--text-primary);
}

body[data-page="profile"] .profile-foundation-grid,
body[data-page="profile-public"] .profile-foundation-grid {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 22px;
  margin-top: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

body[data-page="profile"] .profile-feed-panel,
body[data-page="profile-public"] .profile-feed-panel,
body[data-page="profile"] .profile-sidebar-widget,
body[data-page="profile-public"] .profile-sidebar-widget {
  border: 1px solid var(--border-color) !important;
  border-radius: 20px !important;
  background: color-mix(in srgb, var(--bg-card) 92%, var(--bg-elevated) 8%) !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04) !important;
}

body[data-page="profile"] .profile-feed-panel,
body[data-page="profile-public"] .profile-feed-panel {
  padding: 24px;
  border-right: 1px solid var(--border-color) !important;
}

body[data-page="profile"] .profile-sidebar,
body[data-page="profile-public"] .profile-sidebar {
  gap: 14px;
}

body[data-page="profile"] .profile-sidebar-widget,
body[data-page="profile-public"] .profile-sidebar-widget {
  padding: 20px;
}

body[data-page="profile"] .profile-tabs-shell > .profile-tab-panel .empty-state,
body[data-page="profile-public"] .profile-tabs-shell > .profile-tab-panel .empty-state {
  border: 1px solid var(--border-color);
  border-radius: 20px;
}

body[data-page="profile-settings"] .page-frame-profile {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
}

body[data-page="profile-settings"] .profile-settings-page {
  display: grid;
  grid-template-columns: minmax(160px, 200px) minmax(0, 1fr);
  gap: clamp(20px, 2.6vw, 34px);
  align-items: start;
}

body[data-page="profile-settings"] .profile-settings-sidebar {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 14px;
  padding: 6px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="profile-settings"] .profile-settings-sidebar-title {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-page="profile-settings"] .profile-settings-nav {
  display: grid;
  gap: 4px;
}

body[data-page="profile-settings"] .profile-settings-nav-item {
  appearance: none;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 700;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

body[data-page="profile-settings"] .profile-settings-nav-item:hover,
body[data-page="profile-settings"] .profile-settings-nav-item:focus-visible {
  background: transparent;
  color: var(--text-primary);
  outline: none;
}

body[data-page="profile-settings"] .profile-settings-nav-item.is-active {
  background: transparent;
  color: var(--accent-strong);
}

body[data-page="profile-settings"] .profile-settings-content {
  display: grid;
  gap: 22px;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="profile-settings"] .profile-settings-header {
  display: grid;
  gap: 8px;
  padding: 30px 34px 0;
}

body[data-page="profile-settings"] .profile-settings-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

body[data-page="profile-settings"] .profile-settings-header p {
  max-width: 620px;
  margin: 0;
  color: var(--text-secondary);
}

body[data-page="profile-settings"] .profile-editor-stack {
  width: 100%;
  gap: 0;
}

body[data-page="profile-settings"] .profile-editor-panel {
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-page="profile-settings"] .profile-section-header {
  margin: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

body[data-page="profile-settings"] .profile-section-header-quiet {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body[data-page="profile-settings"] .profile-editor-form {
  display: grid;
  gap: 0;
  overflow: visible;
}

body[data-page="profile-settings"] .profile-form-section {
  gap: 16px;
  padding: 24px 34px;
  border: 0;
  border-top: 1px solid var(--border-color);
  border-radius: 0;
  background: transparent;
}

body[data-page="profile-settings"] .profile-settings-profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 280px);
  gap: 28px;
  padding: 24px 34px;
  border-top: 1px solid var(--border-color);
}

body[data-page="profile-settings"] .profile-settings-fields,
body[data-page="profile-settings"] .profile-settings-media {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

body[data-page="profile-settings"] .profile-form-section-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

body[data-page="profile-settings"] .profile-section-header .panel-title {
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

body[data-page="profile-settings"] .profile-form-section-head h4 {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

body[data-page="profile-settings"] .profile-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

body[data-page="profile-settings"] .profile-form-grid .field-shell-wide {
  grid-column: 1 / -1;
}

body[data-page="profile-settings"] .field-shell input:disabled {
  cursor: not-allowed;
  opacity: 1;
  background: color-mix(in srgb, var(--surface-input) 70%, var(--bg-elevated) 30%) !important;
  color: var(--text-muted);
  border-style: dashed !important;
}

body[data-page="profile-settings"] .profile-media-grid {
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
}

body[data-page="profile-settings"] .profile-upload-card {
  gap: 10px;
  padding: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-page="profile-settings"] .profile-upload-preview {
  border-color: var(--border-color);
  background:
    var(--profile-banner-image, none) center / cover no-repeat,
    linear-gradient(180deg, var(--bg-soft), var(--bg-elevated));
}

body[data-page="profile-settings"] .profile-upload-preview-avatar {
  width: 92px;
  height: 92px;
  min-height: 92px;
  margin: 0 auto;
  border-radius: 20px;
}

body[data-page="profile-settings"] .profile-upload-preview-banner {
  min-height: 96px;
  border-radius: 16px;
}

body[data-page="profile-settings"] .profile-upload-button {
  width: 100%;
}

body[data-page="profile-settings"] .profile-settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(210px, 280px);
  gap: 20px;
  align-items: center;
}

body[data-page="profile-settings"] .profile-settings-row strong {
  display: block;
  color: var(--text-primary);
  font-size: 0.98rem;
}

body[data-page="profile-settings"] .profile-settings-row p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

body[data-page="profile-settings"] .profile-editor-form .hero-actions {
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin: 2px 0 0;
  padding: 22px 34px 30px;
  border-top: 1px solid var(--border-color);
}

body[data-page="profile-settings"] .profile-editor-form .hero-actions .primary-button,
body[data-page="profile-settings"] .profile-editor-form .hero-actions .secondary-button {
  min-height: 44px;
}

@media (max-width: 1100px) {
  body[data-page="profile"],
  body[data-page="profile-public"] {
    --profile-content-width: min(92vw, calc(100% - 24px));
  }

  body[data-page="profile"] .profile-foundation-grid,
  body[data-page="profile-public"] .profile-foundation-grid,
  body[data-page="profile"] .profile-page.is-public .profile-foundation-grid,
  body[data-page="profile-public"] .profile-page.is-public .profile-foundation-grid {
    grid-template-columns: 1fr;
    padding: 20px;
  }

  body[data-page="profile"] .profile-feed-panel,
  body[data-page="profile-public"] .profile-feed-panel {
    padding-right: 0;
    padding-bottom: 20px;
    border-right: 0 !important;
    border-bottom: 1px solid var(--border-color) !important;
  }

}

@media (max-width: 820px) {
  body[data-page="profile"],
  body[data-page="profile-public"] {
    --profile-content-width: min(100%, calc(100% - 20px));
  }

  body[data-page="profile"] .profile-hero-shell,
  body[data-page="profile-public"] .profile-hero-shell {
    min-height: 320px;
  }

  body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
  body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
    grid-template-columns: 132px minmax(0, 1fr);
    column-gap: 14px;
    max-width: calc(100vw - 20px);
  }

  body[data-page="profile"] .profile-avatar-frame,
  body[data-page="profile-public"] .profile-avatar-frame {
    width: 132px;
    height: 132px;
    border-radius: 22px;
  }

  body[data-page="profile"] .profile-identity-cluster.profile-hero-copy,
  body[data-page="profile-public"] .profile-identity-cluster.profile-hero-copy {
    padding-bottom: 34px;
  }

  body[data-page="profile"] .profile-title,
  body[data-page="profile-public"] .profile-title {
    font-size: clamp(32px, 8vw, 44px);
    line-height: 1;
    overflow-wrap: anywhere;
  }

  body[data-page="profile"] .profile-overview-card,
  body[data-page="profile-public"] .profile-overview-card {
    min-height: 88px;
    padding: 14px 12px;
  }

  body[data-page="profile"] .profile-tabs,
  body[data-page="profile-public"] .profile-tabs {
    border-radius: 18px;
  }

  body[data-page="profile"] .profile-foundation-grid,
  body[data-page="profile-public"] .profile-foundation-grid {
    padding: 16px;
    border-radius: 20px;
  }

  body[data-page="profile"] .profile-feed-panel > .profile-activity-feed,
  body[data-page="profile-public"] .profile-feed-panel > .profile-activity-feed {
    max-height: 300px;
  }

  body[data-page="profile"] .profile-taste-grid,
  body[data-page="profile-public"] .profile-taste-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="profile-settings"] .page-frame-profile {
    width: min(100%, calc(100% - 20px));
  }

  body[data-page="profile-settings"] .profile-settings-page {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  body[data-page="profile-settings"] .profile-settings-content {
    border-radius: 0;
  }

  body[data-page="profile-settings"] .profile-settings-header {
    padding: 0;
  }

  body[data-page="profile-settings"] .profile-settings-sidebar {
    position: static;
    padding: 14px;
    border-radius: 18px;
  }

  body[data-page="profile-settings"] .profile-settings-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  body[data-page="profile-settings"] .profile-settings-nav-item {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  body[data-page="profile-settings"] .profile-editor-panel {
    padding: 0;
    border-radius: 0;
  }

  body[data-page="profile-settings"] .profile-form-section {
    padding: 18px 0;
  }

  body[data-page="profile-settings"] .profile-settings-profile-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 18px 0;
  }

  body[data-page="profile-settings"] .profile-settings-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  body[data-page="profile-settings"] .profile-form-grid,
  body[data-page="profile-settings"] .profile-media-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="profile-settings"] .profile-upload-preview-avatar {
    width: 88px;
    height: 88px;
    min-height: 88px;
  }

  body[data-page="profile-settings"] .profile-editor-form .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  body[data-page="profile-settings"] .profile-editor-form .hero-actions .primary-button,
  body[data-page="profile-settings"] .profile-editor-form .hero-actions .secondary-button {
    width: 100%;
  }
}

@media (max-width: 1100px) {
  body[data-page="profile"],
  body[data-page="profile-public"] {
    --profile-content-width: min(92vw, calc(100% - 24px));
  }

  body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
  body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
    grid-template-columns: 1fr;
    gap: 22px;
    bottom: 24px;
  }

  body[data-page="profile"] .profile-hero-secondary,
  body[data-page="profile-public"] .profile-hero-secondary {
    justify-items: start;
    gap: 18px;
    width: 100%;
  }

  body[data-page="profile"] .profile-overview-grid,
  body[data-page="profile-public"] .profile-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-page="profile"] .profile-foundation-grid,
  body[data-page="profile-public"] .profile-foundation-grid,
  body[data-page="profile"] .profile-page.is-public .profile-foundation-grid,
  body[data-page="profile-public"] .profile-page.is-public .profile-foundation-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body[data-page="profile"],
  body[data-page="profile-public"] {
    --profile-content-width: min(100%, calc(100% - 20px));
  }

  body[data-page="profile"] .profile-hero-shell,
  body[data-page="profile-public"] .profile-hero-shell {
    min-height: 430px;
  }

  body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
  body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
    grid-template-columns: 1fr;
    max-width: calc(100vw - 20px);
    bottom: 20px;
  }

  body[data-page="profile"] .profile-hero-primary,
  body[data-page="profile-public"] .profile-hero-primary {
    gap: 14px;
  }

  body[data-page="profile"] .profile-avatar-frame,
  body[data-page="profile-public"] .profile-avatar-frame {
    width: 112px;
    height: 112px;
    border-radius: 22px;
  }

  body[data-page="profile"] .profile-identity-cluster.profile-hero-copy,
  body[data-page="profile-public"] .profile-identity-cluster.profile-hero-copy {
    padding-bottom: 4px;
  }

  body[data-page="profile"] .profile-hero-actions,
  body[data-page="profile-public"] .profile-hero-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  body[data-page="profile"] .profile-edit-button,
  body[data-page="profile-public"] .profile-edit-button {
    flex: 1 1 220px;
  }

  body[data-page="profile"] .profile-overview-grid,
  body[data-page="profile-public"] .profile-overview-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body[data-page="profile"] .profile-feed-panel,
  body[data-page="profile-public"] .profile-feed-panel,
  body[data-page="profile"] .profile-sidebar-widget,
  body[data-page="profile-public"] .profile-sidebar-widget {
    border-radius: 18px !important;
  }

  body[data-page="profile"] .profile-feed-panel,
  body[data-page="profile-public"] .profile-feed-panel {
    padding: 18px;
  }
}

/* Profile hero reference composition pass */
body[data-page="profile"],
body[data-page="profile-public"] {
  --profile-content-width: min(1760px, calc(100% - 96px));
}

body[data-page="profile"] .profile-hero-shell,
body[data-page="profile-public"] .profile-hero-shell {
  min-height: clamp(370px, 33vw, 430px);
  margin: 0 calc(50% - 50vw);
  overflow: hidden;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-page="profile"] .profile-banner,
body[data-page="profile-public"] .profile-banner {
  filter: saturate(0.98) brightness(0.92);
}

body[data-page="profile"] .profile-banner::after,
body[data-page="profile-public"] .profile-banner::after {
  background:
    radial-gradient(circle at 14% 76%, rgba(0, 0, 0, 0.28), transparent 32%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.3) 42%, rgba(0, 0, 0, 0.18) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.2) 48%, rgba(0, 0, 0, 0.56) 100%);
}

body[data-theme="light"][data-page="profile"] .profile-banner,
body[data-theme="light"][data-page="profile-public"] .profile-banner {
  filter: saturate(1) brightness(0.98);
}

body[data-theme="light"][data-page="profile"] .profile-banner::after,
body[data-theme="light"][data-page="profile-public"] .profile-banner::after {
  background:
    radial-gradient(circle at 14% 76%, rgba(35, 30, 24, 0.26), transparent 32%),
    linear-gradient(90deg, rgba(35, 30, 24, 0.48) 0%, rgba(35, 30, 24, 0.25) 42%, rgba(35, 30, 24, 0.1) 100%),
    linear-gradient(180deg, rgba(35, 30, 24, 0.04) 0%, rgba(35, 30, 24, 0.15) 48%, rgba(35, 30, 24, 0.42) 100%);
}

body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
  position: absolute;
  left: 50%;
  bottom: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, auto);
  align-items: end;
  gap: clamp(32px, 6vw, 92px);
  width: var(--profile-content-width);
  max-width: calc(100vw - 32px);
  min-height: 0;
  padding: 0;
  transform: translateX(-50%);
}

body[data-page="profile"] .profile-page.is-public .profile-hero-dock.profile-hero-inner,
body[data-page="profile-public"] .profile-page.is-public .profile-hero-dock.profile-hero-inner {
  grid-template-columns: minmax(0, 1fr);
}

body[data-page="profile"] .profile-hero-primary,
body[data-page="profile-public"] .profile-hero-primary {
  display: flex;
  align-items: flex-end;
  gap: clamp(28px, 3vw, 42px);
  min-width: 0;
}

body[data-page="profile"] .profile-avatar-frame,
body[data-page="profile-public"] .profile-avatar-frame {
  width: clamp(150px, 13vw, 184px);
  height: clamp(150px, 13vw, 184px);
  flex: 0 0 auto;
  border-radius: 30px;
  border-color: rgba(255, 255, 255, 0.72);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.28);
}

body[data-page="profile"] .profile-identity-cluster.profile-hero-copy,
body[data-page="profile-public"] .profile-identity-cluster.profile-hero-copy {
  max-width: min(660px, 100%);
  padding: 0 0 12px;
}

body[data-page="profile"] .profile-identity-cluster .profile-identity-copy,
body[data-page="profile-public"] .profile-identity-cluster .profile-identity-copy {
  max-width: min(660px, 100%);
  gap: 14px;
}

body[data-page="profile"] .profile-title,
body[data-page="profile-public"] .profile-title {
  font-size: clamp(52px, 5.8vw, 82px);
  color: #fffaf0 !important;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.36);
}

body[data-page="profile"] .profile-bio,
body[data-page="profile-public"] .profile-bio {
  max-width: 620px;
  color: rgba(255, 250, 240, 0.92) !important;
  font-size: clamp(1.05rem, 1.1vw, 1.22rem);
  line-height: 1.55;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.28);
}

body[data-page="profile"] .profile-meta-line,
body[data-page="profile-public"] .profile-meta-line {
  gap: 18px;
  color: rgba(255, 250, 240, 0.88);
  font-size: clamp(1rem, 1vw, 1.12rem);
  line-height: 1.35;
}

body[data-page="profile"] .profile-meta-line span,
body[data-page="profile-public"] .profile-meta-line span {
  gap: 8px;
}

body[data-page="profile"] .profile-meta-icon,
body[data-page="profile-public"] .profile-meta-icon {
  width: 18px;
  height: 18px;
}

body[data-page="profile"] .profile-identity-meta,
body[data-page="profile-public"] .profile-identity-meta {
  justify-items: start;
}

body[data-page="profile"] .profile-identity-meta .subtle-pill,
body[data-page="profile-public"] .profile-identity-meta .subtle-pill {
  min-height: 30px;
  padding: 0 14px;
  background: rgba(20, 18, 15, 0.48);
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 250, 240, 0.94);
  font-size: 0.95rem;
  box-shadow: none;
  backdrop-filter: blur(12px);
}

body[data-page="profile"] .profile-hero-secondary,
body[data-page="profile-public"] .profile-hero-secondary {
  display: grid;
  justify-items: end;
  align-content: end;
  gap: clamp(28px, 5vw, 48px);
  min-width: 0;
  padding-bottom: 4px;
}

body[data-page="profile"] .profile-hero-actions,
body[data-page="profile-public"] .profile-hero-actions {
  position: static;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

body[data-page="profile"] .profile-edit-button,
body[data-page="profile-public"] .profile-edit-button {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 253, 248, 0.92);
  color: #241a0f;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

body[data-page="profile"] .profile-edit-button:hover,
body[data-page="profile-public"] .profile-edit-button:hover {
  background: #fffdf8;
  border-color: rgba(255, 255, 255, 0.42);
}

/* Profile stats strip polish */
body[data-page="profile"] .profile-overview-grid,
body[data-page="profile-public"] .profile-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  width: var(--profile-content-width) !important;
  max-width: calc(100vw - 32px);
  margin: 26px auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-page="profile"] .profile-overview-card,
body[data-page="profile-public"] .profile-overview-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 120px;
  padding: 22px 24px;
  border: 1px solid color-mix(in srgb, var(--border-color) 76%, transparent) !important;
  border-radius: 18px !important;
  background: color-mix(in srgb, var(--bg-card) 94%, var(--bg-elevated) 6%) !important;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.055) !important;
  text-align: left;
  backdrop-filter: none !important;
}

body[data-theme="light"][data-page="profile"] .profile-overview-card,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 249, 240, 0.94)) !important;
  box-shadow: 0 16px 34px rgba(84, 64, 40, 0.075) !important;
}

body[data-page="profile"] .profile-overview-icon,
body[data-page="profile-public"] .profile-overview-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, var(--bg-elevated) 84%);
  color: var(--accent-strong);
  font-size: 24px;
}

body[data-page="profile"] .profile-overview-card-total .profile-overview-icon,
body[data-page="profile-public"] .profile-overview-card-total .profile-overview-icon {
  background: color-mix(in srgb, #79a9ff 18%, var(--bg-elevated) 82%);
}

body[data-page="profile"] .profile-overview-card-year .profile-overview-icon,
body[data-page="profile-public"] .profile-overview-card-year .profile-overview-icon {
  background: color-mix(in srgb, var(--success) 18%, var(--bg-elevated) 82%);
}

body[data-page="profile"] .profile-overview-card-goal .profile-overview-icon,
body[data-page="profile-public"] .profile-overview-card-goal .profile-overview-icon {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-elevated) 82%);
}

body[data-page="profile"] .profile-overview-card-streak .profile-overview-icon,
body[data-page="profile-public"] .profile-overview-card-streak .profile-overview-icon {
  background: color-mix(in srgb, var(--danger) 16%, var(--bg-elevated) 84%);
}

body[data-page="profile"] .profile-overview-copy,
body[data-page="profile-public"] .profile-overview-copy {
  gap: 4px;
  min-width: 0;
}

body[data-page="profile"] .profile-overview-copy strong,
body[data-page="profile-public"] .profile-overview-copy strong {
  color: var(--text-primary) !important;
  font-size: clamp(28px, 3vw, 34px);
  line-height: 1;
}

body[data-page="profile"] .profile-overview-copy span,
body[data-page="profile-public"] .profile-overview-copy span {
  color: var(--text-secondary) !important;
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: none;
}

body[data-page="profile"] .profile-overview-copy small,
body[data-page="profile-public"] .profile-overview-copy small {
  color: var(--text-muted) !important;
  font-size: 0.78rem;
  line-height: 1.35;
}

body[data-page="profile"] .profile-overview-card-total {
  order: 1;
}

body[data-page="profile"] .profile-overview-card-year {
  order: 2;
}

body[data-page="profile"] .profile-overview-card-goal {
  order: 3;
}

body[data-page="profile"] .profile-overview-card-streak,
body[data-page="profile"] .profile-overview-card:nth-child(2),
body[data-page="profile-public"] .profile-overview-card-streak,
body[data-page="profile-public"] .profile-overview-card:nth-child(2) {
  order: 4;
}

@media (max-width: 1100px) {
  body[data-page="profile"] .profile-overview-grid,
  body[data-page="profile-public"] .profile-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 820px) {
  body[data-page="profile"] .profile-overview-grid,
  body[data-page="profile-public"] .profile-overview-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: calc(100vw - 20px);
  }

  body[data-page="profile"] .profile-overview-card,
  body[data-page="profile-public"] .profile-overview-card {
    min-height: 96px;
    padding: 16px;
  }
}

@media (max-width: 1100px) {
  body[data-page="profile"],
  body[data-page="profile-public"] {
    --profile-content-width: min(92vw, calc(100% - 24px));
  }

  body[data-page="profile"] .profile-hero-shell,
  body[data-page="profile-public"] .profile-hero-shell {
    min-height: 470px;
  }

  body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
  body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
    grid-template-columns: 1fr;
    gap: 24px;
    bottom: 24px;
  }

  body[data-page="profile"] .profile-hero-secondary,
  body[data-page="profile-public"] .profile-hero-secondary {
    justify-items: start;
    gap: 18px;
  }
}

@media (max-width: 820px) {
  body[data-page="profile"],
  body[data-page="profile-public"] {
    --profile-content-width: min(100%, calc(100% - 20px));
  }

  body[data-page="profile"] .profile-hero-shell,
  body[data-page="profile-public"] .profile-hero-shell {
    min-height: 540px;
  }

  body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
  body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner {
    bottom: 20px;
    max-width: calc(100vw - 20px);
  }

  body[data-page="profile"] .profile-hero-primary,
  body[data-page="profile-public"] .profile-hero-primary {
    align-items: flex-end;
    gap: 14px;
  }

  body[data-page="profile"] .profile-avatar-frame,
  body[data-page="profile-public"] .profile-avatar-frame {
    width: 112px;
    height: 112px;
    border-radius: 22px;
  }

  body[data-page="profile"] .profile-title,
  body[data-page="profile-public"] .profile-title {
    font-size: clamp(32px, 8vw, 44px);
  }

  body[data-page="profile"] .profile-bio,
  body[data-page="profile-public"] .profile-bio {
    font-size: 14px;
    line-height: 1.45;
  }

}

/* Profile tabs and wall skeleton pass */
body[data-page="profile"] .profile-tabs-shell,
body[data-page="profile-public"] .profile-tabs-shell {
  min-width: 0;
  width: 100%;
  max-width: none;
  margin: 0;
}

body[data-page="profile"] .profile-tabs,
body[data-page="profile-public"] .profile-tabs {
  display: flex;
  gap: clamp(20px, 3vw, 38px);
  overflow-x: auto;
  padding: 0;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  scrollbar-width: none;
}

body[data-page="profile"] .profile-tabs::-webkit-scrollbar,
body[data-page="profile-public"] .profile-tabs::-webkit-scrollbar {
  display: none;
}

body[data-page="profile"] .profile-tab,
body[data-page="profile-public"] .profile-tab {
  position: relative;
  flex: 0 0 auto;
  min-height: 48px;
  padding: 0 0 13px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  box-shadow: none;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 760;
  white-space: nowrap;
  cursor: pointer;
}

body[data-page="profile"] .profile-tab::after,
body[data-page="profile-public"] .profile-tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
}

body[data-page="profile"] .profile-tab:hover,
body[data-page="profile-public"] .profile-tab:hover,
body[data-page="profile"] .profile-tab:focus-visible,
body[data-page="profile-public"] .profile-tab:focus-visible {
  outline: none;
  background: transparent;
  color: var(--text-primary);
}

body[data-page="profile"] .profile-tab.active,
body[data-page="profile-public"] .profile-tab.active,
body[data-page="profile"] .profile-tab.is-active,
body[data-page="profile-public"] .profile-tab.is-active {
  background: transparent;
  color: var(--text-primary);
  box-shadow: none;
}

body[data-page="profile"] .profile-tab.active::after,
body[data-page="profile-public"] .profile-tab.active::after,
body[data-page="profile"] .profile-tab.is-active::after,
body[data-page="profile-public"] .profile-tab.is-active::after {
  background: var(--accent-strong);
}

body[data-page="profile"] .profile-tabs-shell > .profile-tab-panel,
body[data-page="profile-public"] .profile-tabs-shell > .profile-tab-panel {
  margin-top: 18px;
}

body[data-page="profile"] .profile-tab-empty-state,
body[data-page="profile-public"] .profile-tab-empty-state {
  display: grid;
  gap: 8px;
  min-height: 210px;
  margin: 0;
  padding: 34px;
  align-content: center;
  justify-items: start;
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--bg-card) 92%, var(--bg-elevated) 8%) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.045) !important;
}

body[data-page="profile"] .profile-tab-empty-kicker,
body[data-page="profile-public"] .profile-tab-empty-kicker {
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-page="profile"] .profile-tab-empty-state h3,
body[data-page="profile-public"] .profile-tab-empty-state h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  line-height: 1.1;
}

body[data-page="profile"] .profile-tab-empty-state p,
body[data-page="profile-public"] .profile-tab-empty-state p {
  max-width: 560px;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

body[data-page="profile"] .profile-wall-panel,
body[data-page="profile-public"] .profile-wall-panel {
  display: grid;
  gap: 18px;
  padding: 26px;
  border: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent) !important;
  border-radius: 22px !important;
  background: color-mix(in srgb, var(--bg-card) 94%, var(--bg-elevated) 6%) !important;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.045) !important;
}

body[data-page="profile"] .profile-wall-panel .profile-section-header,
body[data-page="profile-public"] .profile-wall-panel .profile-section-header {
  margin: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 76%, transparent);
}

body[data-page="profile"] .profile-wall-description,
body[data-page="profile-public"] .profile-wall-description {
  max-width: 620px;
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

body[data-page="profile"] .profile-wall-body,
body[data-page="profile-public"] .profile-wall-body {
  min-width: 0;
}

body[data-page="profile"] .profile-wall-body > .empty-state,
body[data-page="profile-public"] .profile-wall-body > .empty-state {
  margin: 0;
  padding: 28px 0 8px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: left;
}

body[data-page="profile"] .profile-wall-body > .profile-activity-feed,
body[data-page="profile-public"] .profile-wall-body > .profile-activity-feed {
  max-height: 380px;
  overflow-y: auto;
  display: grid;
  gap: 0;
  padding-right: 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 42%, transparent) transparent;
}

body[data-page="profile"] .profile-wall-body .profile-activity-item,
body[data-page="profile-public"] .profile-wall-body .profile-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 15px 0;
  border: 0 !important;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-page="profile"] .profile-wall-body .profile-activity-item:last-child,
body[data-page="profile-public"] .profile-wall-body .profile-activity-item:last-child {
  border-bottom: 0 !important;
}

body[data-page="profile"] .profile-wall-body .profile-activity-item strong,
body[data-page="profile-public"] .profile-wall-body .profile-activity-item strong {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-primary);
  line-height: 1.45;
}

body[data-page="profile"] .profile-wall-body .profile-activity-item span,
body[data-page="profile-public"] .profile-wall-body .profile-activity-item span {
  flex: 0 0 auto;
  color: var(--text-muted) !important;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: nowrap;
  text-align: right;
}

body[data-page="profile"] .profile-wall-body .profile-activity-item:hover,
body[data-page="profile-public"] .profile-wall-body .profile-activity-item:hover {
  background: color-mix(in srgb, var(--hover-surface) 42%, transparent) !important;
}

@media (max-width: 820px) {
  body[data-page="profile"] .profile-tabs-shell,
  body[data-page="profile-public"] .profile-tabs-shell {
    max-width: calc(100vw - 20px);
    margin-top: 22px;
  }

  body[data-page="profile"] .profile-tabs,
  body[data-page="profile-public"] .profile-tabs {
    gap: 20px;
  }

  body[data-page="profile"] .profile-tab-empty-state,
  body[data-page="profile-public"] .profile-tab-empty-state,
  body[data-page="profile"] .profile-wall-panel,
  body[data-page="profile-public"] .profile-wall-panel {
    padding: 20px;
    border-radius: 18px !important;
  }

  body[data-page="profile"] .profile-wall-body .profile-activity-item,
  body[data-page="profile-public"] .profile-wall-body .profile-activity-item {
    display: grid;
    gap: 5px;
  }

  body[data-page="profile"] .profile-wall-body .profile-activity-item span,
  body[data-page="profile-public"] .profile-wall-body .profile-activity-item span {
    text-align: left;
  }
}

/* Profile sidebar composition pass */
body[data-page="profile"] .profile-sidebar,
body[data-page="profile-public"] .profile-sidebar {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

body[data-page="profile"] .profile-sidebar-widget,
body[data-page="profile-public"] .profile-sidebar-widget {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent) !important;
  border-radius: 20px !important;
  background: color-mix(in srgb, var(--bg-card) 94%, var(--bg-elevated) 6%) !important;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.045) !important;
}

body[data-theme="light"][data-page="profile"] .profile-sidebar-widget,
body[data-theme="light"][data-page="profile-public"] .profile-sidebar-widget {
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 249, 240, 0.94)) !important;
  box-shadow: 0 14px 30px rgba(84, 64, 40, 0.065) !important;
}

body[data-page="profile"] .profile-sidebar-widget h4,
body[data-page="profile-public"] .profile-sidebar-widget h4 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 820;
  letter-spacing: -0.01em;
}

body[data-page="profile"] .profile-sidebar-widget-following,
body[data-page="profile-public"] .profile-sidebar-widget-following {
  gap: 16px;
}

body[data-page="profile"] .profile-following-preview,
body[data-page="profile-public"] .profile-following-preview {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

body[data-page="profile"] .profile-following-avatar,
body[data-page="profile-public"] .profile-following-avatar,
body[data-page="profile"] .profile-following-more,
body[data-page="profile-public"] .profile-following-more {
  display: inline-grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  overflow: hidden;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border-color) 82%, transparent);
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
}

body[data-page="profile"] button.profile-following-avatar,
body[data-page="profile-public"] button.profile-following-avatar {
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

body[data-page="profile"] button.profile-following-avatar:hover,
body[data-page="profile"] button.profile-following-avatar:focus-visible,
body[data-page="profile-public"] button.profile-following-avatar:hover,
body[data-page="profile-public"] button.profile-following-avatar:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
  outline: none;
  transform: translateY(-2px);
}

body[data-page="profile"] .profile-following-avatar img,
body[data-page="profile-public"] .profile-following-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

body[data-page="profile"] .profile-following-more,
body[data-page="profile-public"] .profile-following-more {
  background: transparent;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 650;
}

body[data-page="profile"] .profile-following-footer,
body[data-page="profile-public"] .profile-following-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid color-mix(in srgb, var(--border-color) 72%, transparent);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

body[data-page="profile"] .profile-following-footer > :last-child,
body[data-page="profile-public"] .profile-following-footer > :last-child {
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
}

body[data-page="profile"] .profile-following-empty,
body[data-page="profile-public"] .profile-following-empty {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

body[data-page="profile"] .profile-sidebar-widget .small,
body[data-page="profile-public"] .profile-sidebar-widget .small {
  color: var(--text-muted);
  line-height: 1.45;
}

body[data-page="profile"] .profile-sidebar-widget-goal {
  gap: 16px;
}

body[data-page="profile"] .sidebar-goal-ring-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

body[data-page="profile"] .sidebar-goal-ring {
  width: 76px;
  height: 76px;
  background: conic-gradient(
    var(--accent-strong) 0% var(--goal-progress, 0%),
    color-mix(in srgb, var(--border-color) 72%, transparent) var(--goal-progress, 0%) 100%
  );
}

body[data-page="profile"] .sidebar-goal-ring::before {
  inset: 7px;
  background: var(--bg-card);
}

body[data-page="profile"] .sidebar-goal-ring span {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 850;
}

body[data-page="profile"] .sidebar-goal-copy p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
}

body[data-page="profile"] .sidebar-goal-empty {
  padding: 0;
}

body[data-page="profile"] .sidebar-placeholder-list,
body[data-page="profile-public"] .sidebar-placeholder-list {
  display: grid;
  gap: 0;
}

body[data-page="profile"] .sidebar-placeholder-item,
body[data-page="profile-public"] .sidebar-placeholder-item {
  padding: 12px 0;
  border: 0;
  border-top: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
  border-radius: 0;
  background: transparent;
}

body[data-page="profile"] .sidebar-placeholder-item:first-child,
body[data-page="profile-public"] .sidebar-placeholder-item:first-child {
  border-top: 0;
  padding-top: 0;
}

body[data-page="profile"] .sidebar-placeholder-item strong,
body[data-page="profile-public"] .sidebar-placeholder-item strong {
  margin: 0 0 4px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 760;
}

body[data-page="profile"] .profile-sidebar-widget-genres .profile-pill-cloud,
body[data-page="profile-public"] .profile-sidebar-widget-genres .profile-pill-cloud {
  gap: 8px;
}

body[data-page="profile"] .profile-sidebar-widget-genres .profile-tag-pill,
body[data-page="profile-public"] .profile-sidebar-widget-genres .profile-tag-pill {
  min-height: 32px;
  padding: 0 12px;
  border-color: color-mix(in srgb, var(--border-color) 80%, transparent);
  background: color-mix(in srgb, var(--bg-soft) 78%, transparent);
  color: var(--text-secondary);
  font-size: 0.84rem;
  box-shadow: none;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

body[data-page="profile-public"] .profile-sidebar-widget-public-empty {
  color: var(--text-muted);
}

/* Profile owner/public differentiation pass */
body[data-page="profile"] .profile-page.is-owner .profile-avatar-frame.is-editable,
body[data-page="profile-public"] .profile-page.is-owner .profile-avatar-frame.is-editable {
  cursor: pointer;
}

body[data-page="profile"] .profile-page.is-owner .profile-avatar-frame.is-editable:hover,
body[data-page="profile-public"] .profile-page.is-owner .profile-avatar-frame.is-editable:hover {
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 52px rgba(0, 0, 0, 0.34);
}

body[data-page="profile"] .profile-page.is-owner .profile-id-button,
body[data-page="profile-public"] .profile-page.is-owner .profile-id-button {
  cursor: pointer;
}

body[data-page="profile"] .profile-page.is-owner .profile-id-button:hover,
body[data-page="profile"] .profile-page.is-owner .profile-id-button:focus-visible,
body[data-page="profile-public"] .profile-page.is-owner .profile-id-button:hover,
body[data-page="profile-public"] .profile-page.is-owner .profile-id-button:focus-visible {
  background: rgba(255, 253, 248, 0.18);
  border-color: rgba(255, 255, 255, 0.34);
  color: #fffdf8;
}

body[data-page="profile"] .profile-page.is-public .profile-id-chip,
body[data-page="profile-public"] .profile-page.is-public .profile-id-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  vertical-align: middle;
  cursor: default;
  user-select: text;
}

body[data-page="profile"] .profile-page.is-public .profile-sidebar-widget,
body[data-page="profile-public"] .profile-page.is-public .profile-sidebar-widget {
  box-shadow: none !important;
}

body[data-page="profile"] .profile-page.is-public .profile-sidebar-widget-public-empty .empty-state,
body[data-page="profile-public"] .profile-page.is-public .profile-sidebar-widget-public-empty .empty-state {
  justify-items: start;
  text-align: left;
}

body[data-page="profile"] .profile-page.is-public .profile-tab-empty-state,
body[data-page="profile-public"] .profile-page.is-public .profile-tab-empty-state {
  cursor: default;
}

/* Light profile visual polish pass */
body[data-theme="light"][data-page="profile"] .profile-banner,
body[data-theme="light"][data-page="profile-public"] .profile-banner {
  filter: saturate(1.04) contrast(1.02) brightness(0.98);
}

body[data-theme="light"][data-page="profile"] .profile-banner::after,
body[data-theme="light"][data-page="profile-public"] .profile-banner::after {
  background:
    radial-gradient(circle at 14% 76%, rgba(36, 26, 15, 0.34), transparent 34%),
    linear-gradient(90deg, rgba(36, 26, 15, 0.58) 0%, rgba(36, 26, 15, 0.34) 40%, rgba(36, 26, 15, 0.12) 100%),
    linear-gradient(180deg, rgba(36, 26, 15, 0.02) 0%, rgba(36, 26, 15, 0.16) 46%, rgba(36, 26, 15, 0.5) 100%);
}

body[data-theme="light"][data-page="profile"] .profile-avatar-frame,
body[data-theme="light"][data-page="profile-public"] .profile-avatar-frame {
  border: 4px solid rgba(255, 253, 248, 0.9);
  box-shadow:
    0 22px 48px rgba(45, 38, 29, 0.26),
    0 0 0 1px rgba(228, 214, 195, 0.32);
}

body[data-theme="light"][data-page="profile"] .profile-title,
body[data-theme="light"][data-page="profile-public"] .profile-title {
  color: #fffdf8 !important;
  text-shadow: 0 3px 18px rgba(36, 26, 15, 0.5);
}

body[data-theme="light"][data-page="profile"] .profile-bio,
body[data-theme="light"][data-page="profile-public"] .profile-bio {
  color: rgba(255, 253, 248, 0.94) !important;
  text-shadow: 0 2px 12px rgba(36, 26, 15, 0.42);
}

body[data-theme="light"][data-page="profile"] .profile-meta-line,
body[data-theme="light"][data-page="profile-public"] .profile-meta-line {
  color: rgba(255, 253, 248, 0.92);
  text-shadow: 0 2px 10px rgba(36, 26, 15, 0.46);
}

body[data-theme="light"][data-page="profile"] .profile-meta-icon,
body[data-theme="light"][data-page="profile-public"] .profile-meta-icon {
  color: rgba(255, 253, 248, 0.92);
}

body[data-theme="light"][data-page="profile"] .profile-identity-meta .subtle-pill,
body[data-theme="light"][data-page="profile-public"] .profile-identity-meta .subtle-pill {
  background: rgba(36, 26, 15, 0.44);
  border-color: rgba(255, 253, 248, 0.24);
  color: rgba(255, 253, 248, 0.96);
}

body[data-theme="light"][data-page="profile"] .profile-edit-button,
body[data-theme="light"][data-page="profile-public"] .profile-edit-button {
  background: rgba(255, 253, 248, 0.94);
  border-color: rgba(255, 253, 248, 0.7);
  color: var(--accent-text);
  box-shadow: 0 14px 32px rgba(36, 26, 15, 0.18);
}

body[data-theme="light"][data-page="profile"] .profile-edit-button:hover,
body[data-theme="light"][data-page="profile-public"] .profile-edit-button:hover {
  background: var(--bg-card);
  border-color: rgba(255, 253, 248, 0.86);
  box-shadow: 0 16px 36px rgba(36, 26, 15, 0.22);
}

body[data-theme="light"][data-page="profile"] .profile-overview-card,
body[data-theme="light"][data-page="profile-public"] .profile-overview-card {
  border-color: rgba(228, 214, 195, 0.72) !important;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 249, 240, 0.92)) !important;
  box-shadow: 0 14px 34px rgba(84, 64, 40, 0.085) !important;
}

body[data-theme="light"][data-page="profile"] .profile-overview-icon,
body[data-theme="light"][data-page="profile-public"] .profile-overview-icon {
  box-shadow: inset 0 0 0 1px rgba(255, 253, 248, 0.68);
}

body[data-theme="light"][data-page="profile"] .profile-tabs,
body[data-theme="light"][data-page="profile-public"] .profile-tabs {
  border-bottom-color: rgba(111, 98, 82, 0.16);
}

body[data-theme="light"][data-page="profile"] .profile-tab,
body[data-theme="light"][data-page="profile-public"] .profile-tab {
  color: var(--text-secondary);
}

body[data-theme="light"][data-page="profile"] .profile-tab:hover,
body[data-theme="light"][data-page="profile"] .profile-tab:focus-visible,
body[data-theme="light"][data-page="profile-public"] .profile-tab:hover,
body[data-theme="light"][data-page="profile-public"] .profile-tab:focus-visible,
body[data-theme="light"][data-page="profile"] .profile-tab.active,
body[data-theme="light"][data-page="profile-public"] .profile-tab.active {
  color: var(--text-primary);
}

body[data-theme="light"][data-page="profile"] .profile-tab.active::after,
body[data-theme="light"][data-page="profile-public"] .profile-tab.active::after {
  background: linear-gradient(90deg, transparent, var(--accent-strong), transparent);
}

body[data-theme="light"][data-page="profile"] .profile-feed-panel,
body[data-theme="light"][data-page="profile-public"] .profile-feed-panel,
body[data-theme="light"][data-page="profile"] .profile-tab-empty-state,
body[data-theme="light"][data-page="profile-public"] .profile-tab-empty-state,
body[data-theme="light"][data-page="profile"] .profile-sidebar-widget,
body[data-theme="light"][data-page="profile-public"] .profile-sidebar-widget {
  border-color: rgba(228, 214, 195, 0.7) !important;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 249, 240, 0.9)) !important;
  box-shadow: 0 12px 30px rgba(84, 64, 40, 0.065) !important;
}

body[data-theme="light"][data-page="profile"] .profile-section-header,
body[data-theme="light"][data-page="profile-public"] .profile-section-header {
  border-bottom-color: rgba(111, 98, 82, 0.14);
}

body[data-theme="light"][data-page="profile"] .profile-activity-item,
body[data-theme="light"][data-page="profile-public"] .profile-activity-item,
body[data-theme="light"][data-page="profile"] .sidebar-placeholder-item,
body[data-theme="light"][data-page="profile-public"] .sidebar-placeholder-item {
  border-color: rgba(111, 98, 82, 0.13);
}

body[data-theme="light"][data-page="profile"] .profile-sidebar-widget-genres .profile-tag-pill,
body[data-theme="light"][data-page="profile-public"] .profile-sidebar-widget-genres .profile-tag-pill {
  border-color: rgba(228, 214, 195, 0.78);
  background: rgba(248, 241, 230, 0.82);
  color: var(--text-secondary);
}

/* Dark profile safety polish pass */
body[data-theme="dark"][data-page="profile"] .profile-banner,
body[data-theme="dark"][data-page="profile-public"] .profile-banner {
  filter: saturate(1.02) contrast(1.01) brightness(0.96);
}

body[data-theme="dark"][data-page="profile"] .profile-banner::after,
body[data-theme="dark"][data-page="profile-public"] .profile-banner::after {
  background:
    linear-gradient(rgba(0, 0, 0, 0.46), rgba(0, 0, 0, 0.46)),
    radial-gradient(circle at 14% 76%, rgba(0, 0, 0, 0.28), transparent 34%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.54) 0%, rgba(0, 0, 0, 0.3) 42%, rgba(0, 0, 0, 0.14) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0.14) 46%, rgba(0, 0, 0, 0.52) 100%);
}

body[data-theme="dark"][data-page="profile"] .profile-avatar-frame,
body[data-theme="dark"][data-page="profile-public"] .profile-avatar-frame {
  border: 4px solid rgba(255, 248, 234, 0.58);
  box-shadow:
    0 22px 46px rgba(0, 0, 0, 0.34),
    0 0 0 1px rgba(230, 181, 102, 0.12);
}

body[data-theme="dark"][data-page="profile"] .profile-title,
body[data-theme="dark"][data-page="profile-public"] .profile-title {
  color: #fff8ea !important;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.62);
}

body[data-theme="dark"][data-page="profile"] .profile-bio,
body[data-theme="dark"][data-page="profile-public"] .profile-bio {
  color: rgba(255, 248, 234, 0.88) !important;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.52);
}

body[data-theme="dark"][data-page="profile"] .profile-identity-meta .subtle-pill,
body[data-theme="dark"][data-page="profile-public"] .profile-identity-meta .subtle-pill {
  background: rgba(18, 18, 20, 0.5);
  border-color: rgba(255, 248, 234, 0.18);
  color: rgba(255, 248, 234, 0.94);
}

body[data-theme="dark"][data-page="profile"] .profile-edit-button,
body[data-theme="dark"][data-page="profile-public"] .profile-edit-button {
  background: rgba(28, 28, 30, 0.88);
  border-color: rgba(230, 181, 102, 0.28);
  color: var(--text-primary);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.36);
}

body[data-theme="dark"][data-page="profile"] .profile-edit-button:hover,
body[data-theme="dark"][data-page="profile-public"] .profile-edit-button:hover {
  background: rgba(35, 35, 39, 0.94);
  border-color: rgba(230, 181, 102, 0.42);
  color: #fff8ea;
}

body[data-theme="dark"][data-page="profile"] .profile-overview-card,
body[data-theme="dark"][data-page="profile-public"] .profile-overview-card,
body[data-theme="dark"][data-page="profile"] .profile-feed-panel,
body[data-theme="dark"][data-page="profile-public"] .profile-feed-panel,
body[data-theme="dark"][data-page="profile"] .profile-tab-empty-state,
body[data-theme="dark"][data-page="profile-public"] .profile-tab-empty-state,
body[data-theme="dark"][data-page="profile"] .profile-sidebar-widget,
body[data-theme="dark"][data-page="profile-public"] .profile-sidebar-widget {
  border-color: rgba(255, 255, 255, 0.075) !important;
  background: color-mix(in srgb, var(--bg-card) 94%, var(--bg-elevated) 6%) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16) !important;
}

body[data-theme="dark"][data-page="profile"] .profile-overview-icon,
body[data-theme="dark"][data-page="profile-public"] .profile-overview-icon {
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-card) 80%);
  color: #f2c983;
  box-shadow: inset 0 0 0 1px rgba(230, 181, 102, 0.14);
}

body[data-theme="dark"][data-page="profile"] .profile-tabs,
body[data-theme="dark"][data-page="profile-public"] .profile-tabs,
body[data-theme="dark"][data-page="profile"] .profile-section-header,
body[data-theme="dark"][data-page="profile-public"] .profile-section-header {
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"][data-page="profile"] .profile-tab,
body[data-theme="dark"][data-page="profile-public"] .profile-tab {
  color: var(--text-secondary);
}

body[data-theme="dark"][data-page="profile"] .profile-tab:hover,
body[data-theme="dark"][data-page="profile"] .profile-tab:focus-visible,
body[data-theme="dark"][data-page="profile-public"] .profile-tab:hover,
body[data-theme="dark"][data-page="profile-public"] .profile-tab:focus-visible,
body[data-theme="dark"][data-page="profile"] .profile-tab.active,
body[data-theme="dark"][data-page="profile-public"] .profile-tab.active {
  color: var(--text-primary);
}

body[data-theme="dark"][data-page="profile"] .profile-tab.active::after,
body[data-theme="dark"][data-page="profile-public"] .profile-tab.active::after {
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

body[data-theme="dark"][data-page="profile"] .profile-wall-body .profile-activity-item,
body[data-theme="dark"][data-page="profile-public"] .profile-wall-body .profile-activity-item,
body[data-theme="dark"][data-page="profile"] .sidebar-placeholder-item,
body[data-theme="dark"][data-page="profile-public"] .sidebar-placeholder-item {
  border-color: rgba(255, 255, 255, 0.08) !important;
}

body[data-theme="dark"][data-page="profile"] .profile-wall-body .profile-activity-item:hover,
body[data-theme="dark"][data-page="profile-public"] .profile-wall-body .profile-activity-item:hover {
  background: rgba(255, 255, 255, 0.035) !important;
}

body[data-theme="dark"][data-page="profile"] .profile-sidebar-widget-genres .profile-tag-pill,
body[data-theme="dark"][data-page="profile-public"] .profile-sidebar-widget-genres .profile-tag-pill {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
}

body[data-page="profile"] .profile-sidebar-widget-genres .profile-tag-pill:hover,
body[data-page="profile"] .profile-sidebar-widget-genres .profile-tag-pill:focus-visible,
body[data-page="profile-public"] .profile-sidebar-widget-genres .profile-tag-pill:hover,
body[data-page="profile-public"] .profile-sidebar-widget-genres .profile-tag-pill:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 72%, transparent);
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-soft));
  color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent);
  outline: none;
}

/* Profile hero reference layout: stats live inside the banner, not below it. */
body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner,
body[data-page="profile"] .profile-page.is-public .profile-hero-dock.profile-hero-inner,
body[data-page="profile-public"] .profile-page.is-public .profile-hero-dock.profile-hero-inner {
  grid-template-columns: minmax(0, 1fr) minmax(500px, 34vw);
  grid-template-rows: auto auto;
  column-gap: clamp(28px, 5vw, 72px);
  row-gap: 24px;
}

body[data-theme="light"][data-page="profile"] .profile-avatar-cluster.profile-avatar-column,
body[data-theme="light"][data-page="profile-public"] .profile-avatar-cluster.profile-avatar-column {
  display: block;
  width: auto;
  height: auto;
}

body[data-theme="light"][data-page="profile"] .profile-identity-cluster.profile-hero-copy,
body[data-theme="light"][data-page="profile-public"] .profile-identity-cluster.profile-hero-copy {
  display: block;
  grid-column: auto;
  grid-row: auto;
  padding: 0 0 8px;
}

body[data-theme="light"][data-page="profile"] .profile-identity-cluster .profile-identity-copy,
body[data-theme="light"][data-page="profile-public"] .profile-identity-cluster .profile-identity-copy {
  max-width: min(640px, 100%);
}

body[data-page="profile"] .profile-hero-primary,
body[data-page="profile-public"] .profile-hero-primary {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: end;
  transform: translate(28px, -14px);
}

body[data-page="profile"] .profile-hero-secondary,
body[data-page="profile-public"] .profile-hero-secondary {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
}

body[data-page="profile-public"] .profile-page.is-public .profile-hero-secondary {
  width: min(100%, 620px);
}

body[data-page="profile-public"] .profile-page.is-public .profile-follow-button {
  margin-right: 28px;
}

body[data-page="profile"] .profile-hero-stats,
body[data-page="profile-public"] .profile-hero-stats {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  align-self: end;
  display: grid;
  grid-template-columns: repeat(3, minmax(128px, 1fr));
  gap: 0;
  width: min(100%, 620px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

body[data-page="profile"] .profile-page.is-public .profile-hero-stats,
body[data-page="profile-public"] .profile-page.is-public .profile-hero-stats {
  grid-row: 1 / span 2;
}

body[data-page="profile"] .profile-hero-stat,
body[data-page="profile-public"] .profile-hero-stat {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  min-height: 92px;
  padding: 0 28px;
  border-left: 1px solid rgba(255, 250, 240, 0.2);
  background: transparent;
  color: rgba(255, 250, 240, 0.88);
  text-align: center;
}

body[data-page="profile"] .profile-hero-stat:first-child,
body[data-page="profile-public"] .profile-hero-stat:first-child {
  border-left: 0;
}

body[data-page="profile"] .profile-hero-stat strong,
body[data-page="profile-public"] .profile-hero-stat strong {
  color: #fffaf0;
  font-size: clamp(32px, 3.2vw, 44px);
  line-height: 1;
}

body[data-page="profile"] .profile-hero-stat span,
body[data-page="profile-public"] .profile-hero-stat span,
body[data-page="profile"] .profile-hero-stat small,
body[data-page="profile-public"] .profile-hero-stat small {
  color: rgba(255, 250, 240, 0.72);
  font-size: 0.76rem;
  font-weight: 750;
  line-height: 1.25;
}

body[data-page="profile"] .profile-hero-stat small,
body[data-page="profile-public"] .profile-hero-stat small {
  color: rgba(255, 250, 240, 0.58);
  font-weight: 650;
  margin-top: -2px;
}

body[data-page="profile"] .profile-avatar-frame,
body[data-page="profile-public"] .profile-avatar-frame {
  width: clamp(196px, 15.5vw, 232px);
  height: clamp(196px, 15.5vw, 232px);
  border-radius: 34px;
}

body[data-page="profile"] .profile-edit-button,
body[data-page="profile-public"] .profile-edit-button {
  border-radius: 14px;
}

body[data-theme="light"][data-page="profile"] .profile-banner::after,
body[data-theme="light"][data-page="profile-public"] .profile-banner::after {
  background:
    linear-gradient(rgba(20, 16, 12, 0.46), rgba(20, 16, 12, 0.46)),
    radial-gradient(circle at 14% 76%, rgba(35, 30, 24, 0.46), transparent 34%),
    linear-gradient(90deg, rgba(35, 30, 24, 0.68) 0%, rgba(35, 30, 24, 0.42) 42%, rgba(35, 30, 24, 0.2) 100%),
    linear-gradient(180deg, rgba(35, 30, 24, 0.08) 0%, rgba(35, 30, 24, 0.2) 46%, rgba(35, 30, 24, 0.58) 100%);
}

body[data-page="profile"] .profile-overview-grid,
body[data-page="profile-public"] .profile-overview-grid,
body[data-page="profile"] .profile-overview-card-goal,
body[data-page="profile-public"] .profile-overview-card-goal {
  display: none !important;
}

body[data-page="profile"] .profile-hero-actions,
body[data-page="profile-public"] .profile-hero-actions {
  align-items: center;
}

body[data-theme="light"][data-page="profile"] .profile-hero-dock.profile-hero-inner,
body[data-theme="light"][data-page="profile-public"] .profile-hero-dock.profile-hero-inner,
body[data-theme="light"][data-page="profile"] .profile-page.is-public .profile-hero-dock.profile-hero-inner,
body[data-theme="light"][data-page="profile-public"] .profile-page.is-public .profile-hero-dock.profile-hero-inner {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: 32px;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(500px, 34vw);
  grid-template-rows: auto auto;
  align-items: end;
  width: var(--profile-content-width);
  max-width: calc(100vw - 32px);
  min-height: 0;
  padding: 0;
  column-gap: clamp(28px, 5vw, 72px);
  row-gap: 24px;
  transform: translateX(-50%);
}

body[data-theme="light"][data-page="profile"] .profile-hero-primary,
body[data-theme="light"][data-page="profile-public"] .profile-hero-primary {
  display: flex;
  grid-column: 1;
  grid-row: 1 / span 2;
  align-items: flex-end;
  align-self: end;
  gap: clamp(28px, 3vw, 42px);
  min-width: 0;
  transform: translate(28px, -14px);
}

body[data-theme="light"][data-page="profile"] .profile-avatar-cluster.profile-avatar-column,
body[data-theme="light"][data-page="profile-public"] .profile-avatar-cluster.profile-avatar-column {
  display: block;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  height: auto;
  padding: 0;
}

body[data-theme="light"][data-page="profile"] .profile-avatar-frame,
body[data-theme="light"][data-page="profile-public"] .profile-avatar-frame {
  grid-column: auto;
  grid-row: auto;
  width: clamp(196px, 15.5vw, 232px);
  height: clamp(196px, 15.5vw, 232px);
  border-radius: 34px;
  align-self: auto;
  margin-bottom: 0;
}

body[data-theme="light"][data-page="profile"] .profile-identity-cluster.profile-hero-copy,
body[data-theme="light"][data-page="profile-public"] .profile-identity-cluster.profile-hero-copy {
  display: block;
  grid-column: auto;
  grid-row: auto;
  align-self: auto;
  width: min(660px, 100%);
  max-width: min(660px, 100%);
  min-height: auto;
  padding: 0 0 12px;
  margin: 0;
}

body[data-theme="light"][data-page="profile"] .profile-identity-cluster .profile-identity-copy,
body[data-theme="light"][data-page="profile-public"] .profile-identity-cluster .profile-identity-copy {
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 14px;
  max-width: min(660px, 100%);
  padding-top: 0;
}

body[data-theme="light"][data-page="profile"] .profile-hero-secondary,
body[data-theme="light"][data-page="profile-public"] .profile-hero-secondary {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
}

body[data-theme="light"][data-page="profile"] .profile-hero-stats,
body[data-theme="light"][data-page="profile-public"] .profile-hero-stats {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  justify-self: end;
  width: min(100%, 620px);
}

@media (max-width: 1100px) {
  body[data-page="profile"] .profile-hero-dock.profile-hero-inner,
  body[data-page="profile-public"] .profile-hero-dock.profile-hero-inner,
  body[data-page="profile"] .profile-page.is-public .profile-hero-dock.profile-hero-inner,
  body[data-page="profile-public"] .profile-page.is-public .profile-hero-dock.profile-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    row-gap: 16px;
  }

  body[data-page="profile"] .profile-hero-primary,
  body[data-page="profile-public"] .profile-hero-primary,
  body[data-page="profile"] .profile-hero-secondary,
  body[data-page="profile-public"] .profile-hero-secondary,
  body[data-page="profile"] .profile-hero-stats,
  body[data-page="profile-public"] .profile-hero-stats {
    grid-column: 1;
  }

  body[data-page="profile"] .profile-hero-primary,
  body[data-page="profile-public"] .profile-hero-primary {
    grid-row: 1;
    transform: none;
  }

  body[data-page="profile"] .profile-hero-secondary,
  body[data-page="profile-public"] .profile-hero-secondary {
    grid-row: 2;
    justify-self: start;
  }

  body[data-page="profile-public"] .profile-page.is-public .profile-follow-button {
    margin-right: 0;
  }

  body[data-page="profile"] .profile-hero-stats,
  body[data-page="profile-public"] .profile-hero-stats,
  body[data-page="profile"] .profile-page.is-public .profile-hero-stats,
  body[data-page="profile-public"] .profile-page.is-public .profile-hero-stats {
    grid-row: 3;
    justify-self: start;
    width: min(100%, 520px);
  }

  body[data-page="profile"] .profile-page.is-public .profile-hero-stats,
  body[data-page="profile-public"] .profile-page.is-public .profile-hero-stats {
    grid-row: 2;
  }

  body[data-theme="light"][data-page="profile"] .profile-hero-dock.profile-hero-inner,
  body[data-theme="light"][data-page="profile-public"] .profile-hero-dock.profile-hero-inner,
  body[data-theme="light"][data-page="profile"] .profile-page.is-public .profile-hero-dock.profile-hero-inner,
  body[data-theme="light"][data-page="profile-public"] .profile-page.is-public .profile-hero-dock.profile-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    row-gap: 16px;
  }

  body[data-theme="light"][data-page="profile"] .profile-hero-primary,
  body[data-theme="light"][data-page="profile-public"] .profile-hero-primary {
    grid-column: 1;
    grid-row: 1;
    transform: none;
  }

  body[data-theme="light"][data-page="profile"] .profile-hero-secondary,
  body[data-theme="light"][data-page="profile-public"] .profile-hero-secondary {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  body[data-theme="light"][data-page="profile"] .profile-hero-stats,
  body[data-theme="light"][data-page="profile-public"] .profile-hero-stats,
  body[data-theme="light"][data-page="profile"] .profile-page.is-public .profile-hero-stats,
  body[data-theme="light"][data-page="profile-public"] .profile-page.is-public .profile-hero-stats {
    grid-column: 1;
    grid-row: 3;
    justify-self: start;
    width: min(100%, 520px);
  }

  body[data-theme="light"][data-page="profile"] .profile-page.is-public .profile-hero-stats,
  body[data-theme="light"][data-page="profile-public"] .profile-page.is-public .profile-hero-stats {
    grid-row: 2;
  }
}

@media (max-width: 820px) {
  body[data-page="profile"] .profile-hero-stats,
  body[data-page="profile-public"] .profile-hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    border-radius: 16px;
  }

  body[data-page="profile"] .profile-hero-stat,
  body[data-page="profile-public"] .profile-hero-stat {
    min-height: 74px;
    padding: 12px;
  }

  body[data-page="profile"] .profile-hero-stat span,
  body[data-page="profile-public"] .profile-hero-stat span,
  body[data-page="profile"] .profile-hero-stat small,
  body[data-page="profile-public"] .profile-hero-stat small {
    font-size: 0.68rem;
  }
}

body[data-page="profile"] .profile-sidebar > .profile-heatmap-panel,
body[data-page="profile-public"] .profile-sidebar > .profile-heatmap-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent) !important;
  border-radius: 20px !important;
  background: color-mix(in srgb, var(--bg-card) 94%, var(--bg-elevated) 6%) !important;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.045) !important;
}

body[data-page="profile"] .profile-sidebar > .profile-heatmap-panel .profile-section-header,
body[data-page="profile-public"] .profile-sidebar > .profile-heatmap-panel .profile-section-header {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
}

body[data-page="profile"] .profile-sidebar > .profile-heatmap-panel .eyebrow,
body[data-page="profile-public"] .profile-sidebar > .profile-heatmap-panel .eyebrow {
  display: none;
}

body[data-page="profile"] .profile-sidebar > .profile-heatmap-panel .profile-filter-group,
body[data-page="profile-public"] .profile-sidebar > .profile-heatmap-panel .profile-filter-group {
  justify-content: start;
}

body[data-page="profile"] .profile-sidebar > .profile-heatmap-panel .profile-heatmap-grid,
body[data-page="profile-public"] .profile-sidebar > .profile-heatmap-panel .profile-heatmap-grid {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
}

body[data-theme="light"][data-page="profile"] .profile-sidebar > .profile-heatmap-panel,
body[data-theme="light"][data-page="profile-public"] .profile-sidebar > .profile-heatmap-panel {
  border-color: rgba(228, 214, 195, 0.7) !important;
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 249, 240, 0.9)) !important;
  box-shadow: 0 12px 30px rgba(84, 64, 40, 0.065) !important;
}

body[data-theme="dark"][data-page="profile"] .profile-sidebar > .profile-heatmap-panel,
body[data-theme="dark"][data-page="profile-public"] .profile-sidebar > .profile-heatmap-panel {
  border-color: rgba(255, 255, 255, 0.075) !important;
  background: color-mix(in srgb, var(--bg-card) 94%, var(--bg-elevated) 6%) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16) !important;
}

/* Profile wall composer and public thought posts */
body[data-page="profile"] .profile-wall-composer,
body[data-page="profile-public"] .profile-wall-composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  padding: 22px;
  border: 1px solid color-mix(in srgb, var(--border-color) 76%, transparent);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-card) 92%, var(--bg-elevated) 8%);
}

body[data-page="profile"] .profile-wall-composer-avatar,
body[data-page="profile-public"] .profile-wall-composer-avatar {
  width: 52px;
  height: 52px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text-primary);
  font-weight: 800;
}

body[data-page="profile"] .profile-wall-composer-avatar img,
body[data-page="profile-public"] .profile-wall-composer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body[data-page="profile"] .profile-wall-composer-body,
body[data-page="profile-public"] .profile-wall-composer-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

body[data-page="profile"] .profile-wall-composer textarea,
body[data-page="profile-public"] .profile-wall-composer textarea {
  width: 100%;
  min-height: 54px;
  resize: none;
  border-radius: 14px;
}

body[data-page="profile"] .profile-wall-composer-actions,
body[data-page="profile-public"] .profile-wall-composer-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

body[data-page="profile"] .profile-wall-composer-type,
body[data-page="profile-public"] .profile-wall-composer-type {
  display: none;
}

body[data-page="profile"] .profile-wall-toolstrip,
body[data-page="profile-public"] .profile-wall-toolstrip {
  display: flex;
  align-items: center;
  gap: clamp(14px, 3vw, 34px);
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

body[data-page="profile"] .profile-wall-tool,
body[data-page="profile-public"] .profile-wall-tool {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 780;
}

body[data-page="profile"] .profile-wall-tool.is-active,
body[data-page="profile-public"] .profile-wall-tool.is-active {
  display: none;
}

body[data-page="profile"] .profile-wall-tool:disabled,
body[data-page="profile-public"] .profile-wall-tool:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

body[data-page="profile"] .profile-wall-submit,
body[data-page="profile-public"] .profile-wall-submit {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 34px;
  margin-left: auto;
  padding-inline: 8px;
}

body[data-page="profile"] .profile-wall-composer-actions > .primary-button[type="submit"],
body[data-page="profile-public"] .profile-wall-composer-actions > .primary-button[type="submit"] {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 34px;
  margin-left: auto;
  padding: 2px 12px;
  align-self: flex-end;
  white-space: nowrap;
}

body[data-page="profile"] .profile-wall-post,
body[data-page="profile-public"] .profile-wall-post {
  display: grid !important;
}

body[data-page="profile"] .profile-wall-post-card,
body[data-page="profile-public"] .profile-wall-post-card {
  position: relative;
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: clamp(18px, 2vw, 24px) !important;
  border: 1px solid color-mix(in srgb, var(--border-color) 76%, transparent) !important;
  border-radius: 18px !important;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 34%),
    color-mix(in srgb, var(--bg-card) 93%, var(--bg-elevated) 7%) !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.18) !important;
}

body[data-page="profile"] .profile-wall-post-header,
body[data-page="profile-public"] .profile-wall-post-header,
body[data-page="profile"] .profile-wall-post-actions,
body[data-page="profile-public"] .profile-wall-post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

body[data-page="profile"] .profile-wall-post-author,
body[data-page="profile-public"] .profile-wall-post-author {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

body[data-page="profile"] .profile-wall-post-avatar,
body[data-page="profile-public"] .profile-wall-post-avatar {
  width: 50px;
  height: 50px;
  overflow: hidden;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-soft));
  color: var(--text-primary);
  font-weight: 850;
}

body[data-page="profile"] .profile-wall-post-avatar img,
body[data-page="profile-public"] .profile-wall-post-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body[data-page="profile"] .profile-wall-post-author strong,
body[data-page="profile-public"] .profile-wall-post-author strong {
  display: block;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.25;
}

body[data-page="profile"] .profile-wall-post-author span,
body[data-page="profile-public"] .profile-wall-post-author span {
  display: block;
  margin-top: 2px;
  color: var(--text-muted) !important;
  font-size: 0.84rem;
  text-align: left !important;
}

body[data-page="profile"] .profile-wall-post-menu,
body[data-page="profile-public"] .profile-wall-post-menu {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 1.35rem;
  line-height: 1;
  list-style: none;
}

body[data-page="profile"] .profile-wall-post-menu-shell,
body[data-page="profile-public"] .profile-wall-post-menu-shell {
  position: absolute;
  z-index: 3;
  top: clamp(18px, 2vw, 24px);
  right: clamp(18px, 2vw, 24px);
}

body[data-page="profile"] .profile-wall-post-menu::-webkit-details-marker,
body[data-page="profile-public"] .profile-wall-post-menu::-webkit-details-marker {
  display: none;
}

body[data-page="profile"] .profile-wall-post-menu-popover,
body[data-page="profile-public"] .profile-wall-post-menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

body[data-page="profile"] .profile-wall-post-menu-popover button,
body[data-page="profile-public"] .profile-wall-post-menu-popover button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: left;
}

body[data-page="profile"] .profile-wall-post-menu-popover button:hover,
body[data-page="profile-public"] .profile-wall-post-menu-popover button:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

body[data-page="profile"] .profile-wall-post-card.has-post-menu .profile-wall-post-header,
body[data-page="profile-public"] .profile-wall-post-card.has-post-menu .profile-wall-post-header {
  padding-right: 42px;
}

body[data-page="profile"] .profile-wall-post-menu:hover,
body[data-page="profile-public"] .profile-wall-post-menu:hover {
  background: color-mix(in srgb, var(--text-primary) 8%, transparent);
  color: var(--text-primary);
}

body[data-page="profile"] .profile-wall-post-body,
body[data-page="profile-public"] .profile-wall-post-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

body[data-page="profile"] .profile-wall-post-body p,
body[data-page="profile-public"] .profile-wall-post-body p {
  margin: 0;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

body[data-page="profile"] .profile-wall-book-card,
body[data-page="profile-public"] .profile-wall-book-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-elevated) 78%, var(--bg-card) 22%);
}

body[data-page="profile"] .profile-wall-book-cover,
body[data-page="profile-public"] .profile-wall-book-cover {
  width: 76px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-soft) 82%, transparent), color-mix(in srgb, var(--bg-card) 94%, transparent));
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-page="profile"] .profile-wall-book-cover img,
body[data-page="profile-public"] .profile-wall-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body[data-page="profile"] .profile-wall-book-meta,
body[data-page="profile-public"] .profile-wall-book-meta {
  display: grid;
  gap: 8px;
  min-width: 0;
}

body[data-page="profile"] .profile-wall-book-meta > strong,
body[data-page="profile-public"] .profile-wall-book-meta > strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="profile"] .profile-wall-book-meta > span,
body[data-page="profile-public"] .profile-wall-book-meta > span {
  color: var(--text-muted);
  font-size: 0.9rem;
}

body[data-page="profile"] .profile-wall-book-rating,
body[data-page="profile-public"] .profile-wall-book-rating {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 0.92rem;
}

body[data-page="profile"] .profile-wall-book-rating strong,
body[data-page="profile-public"] .profile-wall-book-rating strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}

body[data-page="profile"] .profile-wall-post-actions,
body[data-page="profile-public"] .profile-wall-post-actions {
  justify-content: flex-start;
  gap: clamp(18px, 4vw, 34px);
  padding-top: 2px;
}

body[data-page="profile"] .profile-wall-action,
body[data-page="profile-public"] .profile-wall-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 760;
}

body[data-page="profile"] .profile-wall-action:hover,
body[data-page="profile-public"] .profile-wall-action:hover {
  color: var(--text-primary);
}

body[data-page="profile"] .profile-wall-action-like,
body[data-page="profile-public"] .profile-wall-action-like {
  color: #ff5d57;
}

body[data-theme="light"][data-page="profile"] .profile-wall-post-card,
body[data-theme="light"][data-page="profile-public"] .profile-wall-post-card {
  border-color: rgba(226, 212, 190, 0.72) !important;
  background:
    radial-gradient(circle at 10% 0%, rgba(238, 184, 91, 0.14), transparent 36%),
    rgba(255, 253, 248, 0.96) !important;
  box-shadow: 0 18px 42px rgba(100, 76, 43, 0.1) !important;
}

body[data-theme="light"][data-page="profile"] .profile-wall-book-card,
body[data-theme="light"][data-page="profile-public"] .profile-wall-book-card {
  border-color: rgba(226, 212, 190, 0.76);
  background: rgba(255, 250, 242, 0.82);
}

body[data-theme="light"][data-page="profile"] .profile-wall-composer,
body[data-theme="light"][data-page="profile-public"] .profile-wall-composer {
  border-color: rgba(228, 214, 195, 0.58);
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 14px 34px rgba(84, 64, 40, 0.07);
}

body[data-theme="dark"][data-page="profile"] .profile-wall-composer,
body[data-theme="dark"][data-page="profile-public"] .profile-wall-composer {
  border-color: rgba(255, 255, 255, 0.075);
  background: color-mix(in srgb, var(--bg-card) 94%, var(--bg-elevated) 6%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

body[data-page="profile"] .app-shell.app-shell-main,
body[data-page="profile-public"] .app-shell.app-shell-main {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

body[data-page="profile"] .app-shell.app-shell-main::before,
body[data-page="profile-public"] .app-shell.app-shell-main::before {
  display: none !important;
}

body[data-page="profile"] .profile-social-shell,
body[data-page="profile-public"] .profile-social-shell {
  width: var(--profile-content-width) !important;
  max-width: calc(100vw - 32px);
  margin: clamp(26px, 4vw, 38px) auto 0;
}

body[data-page="profile"] .profile-social-shell > .profile-tabs,
body[data-page="profile-public"] .profile-social-shell > .profile-tabs {
  width: 100%;
  margin: 0;
}

body[data-page="profile"] .profile-social-shell .profile-tab.is-active,
body[data-page="profile-public"] .profile-social-shell .profile-tab.is-active {
  color: var(--accent-strong);
}

body[data-page="profile"] .profile-social-shell > .profile-foundation-grid,
body[data-page="profile-public"] .profile-social-shell > .profile-foundation-grid {
  width: 100% !important;
  max-width: none !important;
  margin: 18px 0 0 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px) !important;
  gap: clamp(20px, 3vw, 34px) !important;
  align-items: start;
}

body[data-page="profile"] .profile-tab-panel,
body[data-page="profile-public"] .profile-tab-panel {
  display: grid;
  min-width: 0;
  gap: 18px;
}

body[data-page="profile"] .profile-wall-panel,
body[data-page="profile-public"] .profile-wall-panel {
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-page="profile"] .profile-wall-body > .profile-activity-feed,
body[data-page="profile-public"] .profile-wall-body > .profile-activity-feed {
  max-height: none !important;
  overflow: visible !important;
  display: grid;
  gap: 18px !important;
  padding-right: 0 !important;
  border-bottom: 0 !important;
}

body[data-page="profile"] .profile-wall-body .profile-activity-item,
body[data-page="profile-public"] .profile-wall-body .profile-activity-item {
  border-bottom: 0 !important;
}

body[data-page="profile"] .profile-wall-body > .profile-wall-empty,
body[data-page="profile-public"] .profile-wall-body > .profile-wall-empty {
  display: grid;
  gap: 8px;
  padding: 34px !important;
  border: 1px solid color-mix(in srgb, var(--border-color) 76%, transparent) !important;
  border-radius: 18px !important;
  background: color-mix(in srgb, var(--bg-card) 92%, var(--bg-elevated) 8%) !important;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.1) !important;
}

body[data-page="profile"] .profile-wall-empty h3,
body[data-page="profile-public"] .profile-wall-empty h3,
body[data-page="profile"] .profile-wall-empty p,
body[data-page="profile-public"] .profile-wall-empty p {
  margin: 0;
}

body[data-page="profile"] .profile-wall-empty p,
body[data-page="profile-public"] .profile-wall-empty p {
  color: var(--text-muted);
  line-height: 1.5;
}

body[data-page="profile"] .profile-wall-tool.is-active,
body[data-page="profile-public"] .profile-wall-tool.is-active {
  display: inline-flex;
  color: var(--accent-strong);
}

body[data-page="profile"] .profile-wall-image-card,
body[data-page="profile-public"] .profile-wall-image-card {
  width: 100%;
  max-height: 360px;
  margin: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--border-color) 74%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
}

body[data-page="profile"] .profile-wall-image-card img,
body[data-page="profile-public"] .profile-wall-image-card img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: cover;
}

body[data-page="profile"] .profile-sidebar-empty p,
body[data-page="profile-public"] .profile-sidebar-empty p,
body[data-page="profile"] .profile-sidebar-widget-privacy p,
body[data-page="profile-public"] .profile-sidebar-widget-privacy p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

body[data-page="profile"] .profile-sidebar-widget-privacy .ghost-button,
body[data-page="profile-public"] .profile-sidebar-widget-privacy .ghost-button {
  justify-self: start;
  width: max-content;
}

body[data-page="profile"] .profile-foundation-grid.is-full-width,
body[data-page="profile-public"] .profile-foundation-grid.is-full-width {
  grid-template-columns: 1fr !important;
}

body[data-page="profile"] .profile-reviews-tab,
body[data-page="profile-public"] .profile-reviews-tab {
  display: grid;
  gap: clamp(22px, 3vw, 34px);
  min-width: 0;
}

body[data-page="profile"] .profile-reviews-top-grid,
body[data-page="profile-public"] .profile-reviews-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: clamp(18px, 2vw, 24px);
  align-items: stretch;
}

body[data-page="profile"] .profile-reviews-hero-card,
body[data-page="profile-public"] .profile-reviews-hero-card,
body[data-page="profile"] .profile-review-ideas-card,
body[data-page="profile-public"] .profile-review-ideas-card,
body[data-page="profile"] .profile-reviews-empty-state,
body[data-page="profile-public"] .profile-reviews-empty-state {
  border: 1px solid color-mix(in srgb, var(--border-color) 76%, transparent);
  border-radius: 20px;
  background:
    radial-gradient(circle at 14% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 36%),
    color-mix(in srgb, var(--bg-card) 93%, var(--bg-elevated) 7%);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.16);
}

body[data-page="profile"] .profile-reviews-hero-card,
body[data-page="profile-public"] .profile-reviews-hero-card {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.25fr);
  gap: clamp(22px, 3vw, 34px);
  min-width: 0;
  padding: clamp(24px, 3vw, 34px);
  overflow: hidden;
}

body[data-page="profile"] .profile-reviews-hero-copy,
body[data-page="profile-public"] .profile-reviews-hero-copy {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 14px;
  min-width: 0;
}

body[data-page="profile"] .profile-reviews-eyebrow,
body[data-page="profile-public"] .profile-reviews-eyebrow {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 880;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-page="profile"] .profile-reviews-hero-copy h2,
body[data-page="profile-public"] .profile-reviews-hero-copy h2,
body[data-page="profile"] .profile-review-ideas-card h3,
body[data-page="profile-public"] .profile-review-ideas-card h3,
body[data-page="profile"] .profile-reviews-section-header h2,
body[data-page="profile-public"] .profile-reviews-section-header h2 {
  margin: 0;
  color: var(--text-primary);
  line-height: 1.12;
}

body[data-page="profile"] .profile-reviews-hero-copy h2,
body[data-page="profile-public"] .profile-reviews-hero-copy h2 {
  max-width: 380px;
  font-size: clamp(1.55rem, 2.4vw, 2.25rem);
}

body[data-page="profile"] .profile-reviews-hero-copy p,
body[data-page="profile-public"] .profile-reviews-hero-copy p,
body[data-page="profile"] .profile-review-ideas-card p,
body[data-page="profile-public"] .profile-review-ideas-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

body[data-page="profile"] .profile-review-new-button,
body[data-page="profile-public"] .profile-review-new-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  margin-top: 26px;
  padding: 0 28px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #211608;
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 13%, transparent), 0 18px 42px color-mix(in srgb, var(--accent) 28%, transparent);
  font: inherit;
  font-weight: 850;
}

body[data-page="profile"] .profile-review-new-button:hover,
body[data-page="profile-public"] .profile-review-new-button:hover,
body[data-page="profile"] .profile-review-new-button:focus-visible,
body[data-page="profile-public"] .profile-review-new-button:focus-visible {
  outline: none;
  transform: translateY(-1px);
  box-shadow: 0 0 0 9px color-mix(in srgb, var(--accent) 17%, transparent), 0 22px 46px color-mix(in srgb, var(--accent) 34%, transparent);
}

body[data-page="profile"] .profile-review-composer-shell,
body[data-page="profile-public"] .profile-review-composer-shell {
  min-width: 0;
  align-self: center;
}

body[data-page="profile"] .profile-review-form-shell,
body[data-page="profile-public"] .profile-review-form-shell {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--border-color) 80%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-elevated) 78%, transparent);
}

body[data-page="profile"] .profile-review-form-shell label,
body[data-page="profile-public"] .profile-review-form-shell label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 760;
}

body[data-page="profile"] .profile-review-book-select,
body[data-page="profile-public"] .profile-review-book-select,
body[data-page="profile"] .profile-review-field-preview,
body[data-page="profile-public"] .profile-review-field-preview,
body[data-page="profile"] .profile-review-text-preview,
body[data-page="profile-public"] .profile-review-text-preview {
  border: 1px solid color-mix(in srgb, var(--border-color) 78%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-card) 86%, transparent);
}

body[data-page="profile"] .profile-review-book-select,
body[data-page="profile-public"] .profile-review-book-select {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 8px;
  color: var(--text-secondary);
}

body[data-page="profile"] .profile-review-book-cover-mini,
body[data-page="profile-public"] .profile-review-book-cover-mini {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 15%, var(--bg-soft));
  color: var(--text-muted);
  font-size: 0.52rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

body[data-page="profile"] .profile-review-book-select button,
body[data-page="profile-public"] .profile-review-book-select button {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
}

body[data-page="profile"] .profile-review-form-grid,
body[data-page="profile-public"] .profile-review-form-grid {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
}

body[data-page="profile"] .profile-review-stars,
body[data-page="profile-public"] .profile-review-stars {
  margin-top: 7px;
  color: var(--accent-strong);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
}

body[data-page="profile"] .profile-review-field-preview,
body[data-page="profile-public"] .profile-review-field-preview,
body[data-page="profile"] .profile-review-text-preview,
body[data-page="profile-public"] .profile-review-text-preview {
  margin-top: 7px;
  padding: 10px 12px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.45;
}

body[data-page="profile"] .profile-review-text-preview,
body[data-page="profile-public"] .profile-review-text-preview {
  min-height: 74px;
}

body[data-page="profile"] .profile-review-form-footer,
body[data-page="profile-public"] .profile-review-form-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

body[data-page="profile"] .profile-review-ideas-card,
body[data-page="profile-public"] .profile-review-ideas-card {
  display: grid;
  align-content: start;
  gap: 22px;
  min-width: 0;
  padding: clamp(22px, 3vw, 30px);
}

body[data-page="profile"] .profile-review-ideas-heading,
body[data-page="profile-public"] .profile-review-ideas-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

body[data-page="profile"] .profile-review-ideas-heading svg,
body[data-page="profile-public"] .profile-review-ideas-heading svg {
  flex: 0 0 auto;
  color: var(--accent-strong);
  filter: drop-shadow(0 0 10px color-mix(in srgb, var(--accent) 34%, transparent));
}

body[data-page="profile"] .profile-review-ideas-heading h3,
body[data-page="profile-public"] .profile-review-ideas-heading h3 {
  font-size: 1rem;
}

body[data-page="profile"] .profile-review-ideas-heading p,
body[data-page="profile-public"] .profile-review-ideas-heading p {
  margin-top: 8px;
  font-size: 0.86rem;
}

body[data-page="profile"] .profile-review-idea-chips,
body[data-page="profile-public"] .profile-review-idea-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

body[data-page="profile"] .profile-review-idea-chips span,
body[data-page="profile-public"] .profile-review-idea-chips span {
  padding: 9px 12px;
  border: 1px solid color-mix(in srgb, var(--border-color) 74%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 760;
}

body[data-page="profile"] .profile-review-ideas-note,
body[data-page="profile-public"] .profile-review-ideas-note {
  max-width: 340px;
  font-size: 0.9rem;
}

body[data-page="profile"] .profile-reviews-section,
body[data-page="profile-public"] .profile-reviews-section {
  display: grid;
  gap: 18px;
  min-width: 0;
}

body[data-page="profile"] .profile-reviews-section-header,
body[data-page="profile-public"] .profile-reviews-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

body[data-page="profile"] .profile-reviews-section-header h2,
body[data-page="profile-public"] .profile-reviews-section-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(1.15rem, 1.5vw, 1.45rem);
}

body[data-page="profile"] .profile-reviews-section-header h2 span,
body[data-page="profile-public"] .profile-reviews-section-header h2 span {
  display: inline-grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-primary) 8%, transparent);
  color: var(--text-muted);
  font-size: 0.82rem;
}

body[data-page="profile"] .profile-review-controls,
body[data-page="profile-public"] .profile-review-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

body[data-page="profile"] .profile-review-sort-button,
body[data-page="profile-public"] .profile-review-sort-button,
body[data-page="profile"] .profile-review-view-toggle button,
body[data-page="profile-public"] .profile-review-view-toggle button {
  border: 1px solid color-mix(in srgb, var(--border-color) 70%, transparent);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-card) 78%, transparent);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 760;
}

body[data-page="profile"] .profile-review-sort-button,
body[data-page="profile-public"] .profile-review-sort-button {
  min-height: 36px;
  padding: 0 12px;
}

body[data-page="profile"] .profile-review-view-toggle,
body[data-page="profile-public"] .profile-review-view-toggle {
  display: inline-flex;
  gap: 6px;
}

body[data-page="profile"] .profile-review-view-toggle button,
body[data-page="profile-public"] .profile-review-view-toggle button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
}

body[data-page="profile"] .profile-review-view-toggle button.is-active,
body[data-page="profile-public"] .profile-review-view-toggle button.is-active {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: var(--accent-strong);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 10%, transparent);
}

body[data-page="profile"] .profile-reviews-grid,
body[data-page="profile-public"] .profile-reviews-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

body[data-page="profile"] .profile-review-card,
body[data-page="profile-public"] .profile-review-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--border-color) 74%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-card) 92%, var(--bg-elevated) 8%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

body[data-page="profile"] .profile-review-card-cover,
body[data-page="profile-public"] .profile-review-card-cover {
  display: grid;
  place-items: center;
  width: 74px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-soft));
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body[data-page="profile"] .profile-review-card-cover img,
body[data-page="profile-public"] .profile-review-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body[data-page="profile"] .profile-review-card-body,
body[data-page="profile-public"] .profile-review-card-body {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
}

body[data-page="profile"] .profile-review-card-body h3,
body[data-page="profile-public"] .profile-review-card-body h3,
body[data-page="profile"] .profile-review-card-body p,
body[data-page="profile-public"] .profile-review-card-body p {
  margin: 0;
}

body[data-page="profile"] .profile-review-card-body h3,
body[data-page="profile-public"] .profile-review-card-body h3 {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 0.98rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="profile"] .profile-review-card-body p,
body[data-page="profile-public"] .profile-review-card-body p {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-page="profile"] .profile-review-card-text,
body[data-page="profile-public"] .profile-review-card-text {
  display: -webkit-box;
  white-space: normal !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

body[data-page="profile"] .profile-review-card-rating,
body[data-page="profile-public"] .profile-review-card-rating {
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
}

body[data-page="profile"] .profile-review-card-link,
body[data-page="profile-public"] .profile-review-card-link {
  justify-self: start;
  margin-top: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 850;
}

body[data-page="profile"] .profile-reviews-empty-state,
body[data-page="profile-public"] .profile-reviews-empty-state {
  display: grid;
  gap: 10px;
  justify-items: start;
  max-width: 560px;
  padding: clamp(24px, 3vw, 34px);
}

body[data-page="profile"] .profile-reviews-empty-state h3,
body[data-page="profile-public"] .profile-reviews-empty-state h3,
body[data-page="profile"] .profile-reviews-empty-state p,
body[data-page="profile-public"] .profile-reviews-empty-state p {
  margin: 0;
}

body[data-page="profile"] .profile-reviews-empty-state p,
body[data-page="profile-public"] .profile-reviews-empty-state p {
  color: var(--text-muted);
  line-height: 1.5;
}

body[data-theme="light"][data-page="profile"] .profile-reviews-hero-card,
body[data-theme="light"][data-page="profile-public"] .profile-reviews-hero-card,
body[data-theme="light"][data-page="profile"] .profile-review-ideas-card,
body[data-theme="light"][data-page="profile-public"] .profile-review-ideas-card,
body[data-theme="light"][data-page="profile"] .profile-reviews-empty-state,
body[data-theme="light"][data-page="profile-public"] .profile-reviews-empty-state {
  border-color: rgba(226, 212, 190, 0.72);
  background:
    radial-gradient(circle at 12% 0%, rgba(238, 184, 91, 0.14), transparent 36%),
    rgba(255, 253, 248, 0.96);
  box-shadow: 0 18px 42px rgba(100, 76, 43, 0.1);
}

@media (max-width: 1100px) {
  body[data-page="profile"] .profile-overview-grid,
  body[data-page="profile-public"] .profile-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 1040px) {
  body[data-page="profile"] .profile-social-shell > .profile-foundation-grid,
  body[data-page="profile-public"] .profile-social-shell > .profile-foundation-grid {
    grid-template-columns: 1fr !important;
  }

  body[data-page="profile"] .profile-reviews-top-grid,
  body[data-page="profile-public"] .profile-reviews-top-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="profile"] .profile-reviews-hero-card,
  body[data-page="profile-public"] .profile-reviews-hero-card {
    grid-template-columns: 1fr;
  }

  body[data-page="profile"] .profile-reviews-grid,
  body[data-page="profile-public"] .profile-reviews-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  body[data-page="profile"] .profile-social-shell,
  body[data-page="profile-public"] .profile-social-shell {
    max-width: calc(100vw - 20px);
  }

  body[data-page="profile"] .profile-wall-composer,
  body[data-page="profile-public"] .profile-wall-composer {
    grid-template-columns: 1fr;
  }

  body[data-page="profile"] .profile-wall-composer-avatar,
  body[data-page="profile-public"] .profile-wall-composer-avatar {
    display: none;
  }

  body[data-page="profile"] .profile-wall-book-card,
  body[data-page="profile-public"] .profile-wall-book-card {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
  }

  body[data-page="profile"] .profile-wall-book-cover,
  body[data-page="profile-public"] .profile-wall-book-cover {
    width: 58px;
  }

  body[data-page="profile"] .profile-reviews-hero-card,
  body[data-page="profile-public"] .profile-reviews-hero-card,
  body[data-page="profile"] .profile-review-ideas-card,
  body[data-page="profile-public"] .profile-review-ideas-card {
    border-radius: 16px;
    padding: 18px;
  }

  body[data-page="profile"] .profile-review-form-grid,
  body[data-page="profile-public"] .profile-review-form-grid,
  body[data-page="profile"] .profile-reviews-section-header,
  body[data-page="profile-public"] .profile-reviews-section-header,
  body[data-page="profile"] .profile-review-controls,
  body[data-page="profile-public"] .profile-review-controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  body[data-page="profile"] .profile-review-new-button,
  body[data-page="profile-public"] .profile-review-new-button {
    width: 100%;
  }

  body[data-page="profile"] .profile-reviews-grid,
  body[data-page="profile-public"] .profile-reviews-grid,
  body[data-page="profile"] .profile-review-card,
  body[data-page="profile-public"] .profile-review-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body[data-page="profile"] .profile-overview-grid,
  body[data-page="profile-public"] .profile-overview-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 1100px) {
  body[data-page="profile"] .profile-sidebar,
  body[data-page="profile-public"] .profile-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  body[data-page="profile"] .profile-sidebar,
  body[data-page="profile-public"] .profile-sidebar {
    grid-template-columns: 1fr;
  }

  body[data-page="profile"] .profile-sidebar-widget,
  body[data-page="profile-public"] .profile-sidebar-widget {
    padding: 18px;
    border-radius: 18px !important;
  }
}

body[data-theme="light"] .site-header {
  background: var(--surface-header) !important;
  border-bottom: 1px solid rgba(111, 98, 82, 0.12);
  box-shadow: 0 10px 24px rgba(84, 64, 40, 0.08);
  backdrop-filter: blur(14px);
}

body[data-theme="light"] .brand-home h1,
body[data-theme="light"] .header-profile-link,
body[data-theme="light"] .header-profile-option,
body[data-theme="light"] .lang-option {
  color: var(--text-primary);
}

body[data-theme="light"] .brand-home .eyebrow,
body[data-theme="light"] .nav-button,
body[data-theme="light"] .lang-option-label,
body[data-theme="light"] .header-profile-caret {
  color: var(--text-secondary);
}

body[data-theme="light"] .nav-button:hover,
body[data-theme="light"] .nav-button.active,
body[data-theme="light"] .header-profile-link:hover,
body[data-theme="light"] .header-profile-link:focus-visible {
  color: var(--text-primary);
}

body[data-theme="light"] .nav-button::after {
  background: linear-gradient(90deg, rgba(191, 120, 36, 0), rgba(191, 120, 36, 0.88), rgba(191, 120, 36, 0));
}

body[data-theme="light"] .header-utility,
body[data-theme="light"] .lang-dropdown,
body[data-theme="light"] .header-profile-dropdown {
  background: var(--surface-control) !important;
  border-color: var(--border-color) !important;
  box-shadow: 0 14px 28px rgba(84, 64, 40, 0.1) !important;
}

body[data-theme="light"] .header-utility {
  color: var(--text-primary);
}

body[data-theme="light"] .header-utility:hover,
body[data-theme="light"] .header-utility:focus-visible {
  background: var(--surface-control-hover) !important;
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border-color) 68%) !important;
  box-shadow: 0 10px 22px rgba(84, 64, 40, 0.12) !important;
}

body[data-theme="light"] .lang-toggle-button,
body[data-theme="light"] .header-theme-toggle {
  background: transparent !important;
  box-shadow: none !important;
}

body[data-theme="light"] .lang-toggle-button.header-utility,
body[data-theme="light"] .lang-toggle-button:hover,
body[data-theme="light"] .lang-toggle-button:focus-visible,
body[data-theme="light"] .lang-toggle-button:active {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none;
  outline: none;
}

body[data-theme="light"] .lang-toggle-button:hover .lang-toggle-shell,
body[data-theme="light"] .lang-toggle-button:focus-visible .lang-toggle-shell {
  background: transparent;
  box-shadow: none;
}

body[data-theme="light"] .lang-toggle-caret,
body[data-theme="light"] .header-profile-mark {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(111, 98, 82, 0.12);
  box-shadow: 0 6px 14px rgba(84, 64, 40, 0.08);
}

body[data-theme="light"] .lang-dropdown,
body[data-theme="light"] .header-profile-dropdown {
  background: var(--bg-card) !important;
}

body[data-theme="light"] .lang-option:hover,
body[data-theme="light"] .lang-option.active,
body[data-theme="light"] .header-profile-option:hover,
body[data-theme="light"] .header-profile-option:focus-visible {
  background: var(--hover-surface);
  color: var(--text-primary);
}

body[data-theme="light"] .lang-option.active .lang-option-label {
  color: var(--text-secondary);
}

body[data-theme="light"] .lang-option-check {
  color: var(--accent-strong);
}

body[data-theme="light"] .header-profile-option-danger {
  color: var(--danger);
}

body[data-theme="light"] .header-profile-option-danger:hover,
body[data-theme="light"] .header-profile-option-danger:focus-visible {
  color: var(--danger);
  background: rgba(199, 103, 91, 0.1);
}

body[data-theme="light"] .theme-toggle-track {
  border-color: color-mix(in srgb, var(--border-color) 88%, white 12%);
  background: linear-gradient(180deg, var(--bg-soft), var(--bg-card));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72), inset 0 -1px 0 rgba(111, 98, 82, 0.06);
}

body[data-theme="light"] #theme-toggle:hover .theme-toggle-track {
  background: linear-gradient(180deg, var(--hover-surface), var(--bg-card));
  border-color: color-mix(in srgb, var(--accent) 26%, var(--border-color) 74%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.74), inset 0 -1px 0 rgba(111, 98, 82, 0.08);
}

#theme-toggle:focus-visible .theme-toggle-track {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--panel-border) 70%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent), inset 0 1px 0 rgba(255,255,255,0.08);
}

body[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
body[data-theme="light"] textarea,
body[data-theme="light"] select,
body[data-theme="light"] .field-shell input,
body[data-theme="light"] .field-shell textarea,
body[data-theme="light"] .field-shell select,
body[data-theme="light"] .library-search input,
body[data-theme="light"] .catalog-search-form input,
body[data-theme="light"] .catalog-search-form select,
body[data-theme="light"] .catalog-search-form textarea,
body[data-theme="light"] .book-detail-inline-input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px;
  background: var(--surface-input) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
  outline: none;
}

body[data-theme="light"] textarea,
body[data-theme="light"] .field-shell textarea {
  min-height: 118px;
  padding: 13px 14px;
  line-height: 1.5;
  resize: vertical;
}

body[data-theme="light"] select,
body[data-theme="light"] .field-shell select,
body[data-theme="light"] .catalog-search-form select {
  padding-right: 38px;
}

body[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"])::placeholder,
body[data-theme="light"] textarea::placeholder,
body[data-theme="light"] .book-detail-inline-input::placeholder {
  color: var(--text-muted);
  opacity: 0.82;
}

body[data-theme="light"] .field-shell,
body[data-theme="light"] .profile-editor-panel .field-shell {
  gap: 7px;
}

body[data-theme="light"] .field-shell span,
body[data-theme="light"] .profile-editor-panel .field-shell span,
body[data-theme="light"] .profile-form-section-head h4 {
  color: var(--text-secondary) !important;
}

body[data-theme="light"] .field-shell small,
body[data-theme="light"] .profile-editor-panel .field-shell small,
body[data-theme="light"] .small {
  color: var(--text-muted) !important;
}

body[data-theme="light"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus,
body[data-theme="light"] textarea:focus,
body[data-theme="light"] select:focus,
body[data-theme="light"] .field-shell input:focus,
body[data-theme="light"] .field-shell textarea:focus,
body[data-theme="light"] .field-shell select:focus,
body[data-theme="light"] .library-search input:focus,
body[data-theme="light"] .catalog-search-form input:focus,
body[data-theme="light"] .catalog-search-form select:focus,
body[data-theme="light"] .catalog-search-form textarea:focus,
body[data-theme="light"] .book-detail-inline-input:focus {
  border-color: var(--accent-strong) !important;
  box-shadow: 0 0 0 3px rgba(185, 120, 36, 0.13) !important;
}

body[data-theme="light"] input:disabled,
body[data-theme="light"] textarea:disabled,
body[data-theme="light"] select:disabled,
body[data-theme="light"] input[readonly],
body[data-theme="light"] textarea[readonly] {
  background: var(--bg-soft) !important;
  color: var(--text-muted) !important;
  border-color: rgba(111, 98, 82, 0.14) !important;
  opacity: 1;
  cursor: not-allowed;
}

body[data-theme="light"] .auth-google-button {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-color);
  box-shadow: 0 6px 14px rgba(84, 64, 40, 0.06);
}

body[data-theme="light"] .auth-google-button:hover,
body[data-theme="light"] .auth-google-button:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--border-color) 70%);
  box-shadow: 0 8px 16px rgba(84, 64, 40, 0.08);
}

body[data-theme="light"] .site-header {
  border-bottom: 1px solid rgba(111, 98, 82, 0.1);
  box-shadow: 0 6px 18px rgba(84, 64, 40, 0.06);
}

body[data-theme="light"] .site-header-inner {
  min-height: 68px;
  align-items: center;
}

body[data-theme="light"] .brand-home h1 {
  color: var(--text-primary);
}

body[data-theme="light"] .brand-home .eyebrow {
  color: var(--text-muted);
}

body[data-theme="light"] .brand-home:hover h1,
body[data-theme="light"] .brand-home:hover .eyebrow {
  color: var(--text-primary);
}

body[data-theme="light"] .nav-button {
  padding: 8px 0;
  color: var(--text-secondary);
  line-height: 1.1;
}

body[data-theme="light"] .nav-button:hover,
body[data-theme="light"] .nav-button.active {
  color: var(--text-primary);
}

body[data-theme="light"] .nav-button::after {
  bottom: -10px;
  height: 2px;
  background: linear-gradient(90deg, rgba(185, 120, 36, 0), rgba(185, 120, 36, 0.72), rgba(185, 120, 36, 0));
}

body[data-theme="light"] .auth-slot,
body[data-theme="light"] .header-user,
body[data-theme="light"] .toolbar-header {
  align-items: center;
  gap: 12px;
}

body[data-theme="light"] .header-utility {
  min-height: 44px;
}

body[data-theme="light"] .lang-toggle-button.header-utility,
body[data-theme="light"] .lang-toggle-button:hover,
body[data-theme="light"] .lang-toggle-button:focus-visible,
body[data-theme="light"] .lang-toggle-button:active {
  min-height: 44px;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-theme="light"] .lang-toggle-button:hover .lang-toggle-code,
body[data-theme="light"] .lang-toggle-button:focus-visible .lang-toggle-code {
  color: inherit;
}

body[data-theme="light"] .lang-toggle-button:hover .lang-toggle-caret,
body[data-theme="light"] .lang-toggle-button:focus-visible .lang-toggle-caret {
  background: var(--bg-card);
  box-shadow: 0 6px 14px rgba(84, 64, 40, 0.08);
}

body[data-theme="light"] .lang-dropdown,
body[data-theme="light"] .header-profile-dropdown {
  background: var(--bg-card) !important;
  border-color: rgba(111, 98, 82, 0.13) !important;
  box-shadow: 0 12px 26px rgba(84, 64, 40, 0.09) !important;
}

body[data-theme="light"] .lang-option,
body[data-theme="light"] .header-profile-option {
  border-radius: 10px;
}

body[data-theme="light"] .lang-option:hover,
body[data-theme="light"] .lang-option.active,
body[data-theme="light"] .header-profile-option:hover,
body[data-theme="light"] .header-profile-option:focus-visible {
  background: color-mix(in srgb, var(--hover-surface) 72%, transparent);
  color: var(--text-primary);
  transform: none;
}

body[data-theme="light"] .header-profile-option-danger {
  color: #A8463E;
}

body[data-theme="light"] .header-profile-option-danger:hover,
body[data-theme="light"] .header-profile-option-danger:focus-visible {
  background: rgba(199, 103, 91, 0.09);
  color: #A8463E;
}

body[data-theme="light"] .profile-activity-feed,
body[data-theme="light"] .club-members-list,
body[data-theme="light"] .report-list {
  gap: 0;
}

body[data-theme="light"] .profile-activity-item,
body[data-theme="light"] .club-member-row,
body[data-theme="light"] .report-row,
body[data-theme="light"] .admin-grid .report-list .report-card,
body[data-theme="light"] .mini-book,
body[data-theme="light"] .finished-book,
body[data-theme="light"] .rank-row {
  border: 0 !important;
  border-bottom: 1px solid rgba(111, 98, 82, 0.12) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body[data-theme="light"] .profile-activity-item,
body[data-theme="light"] .club-member-row,
body[data-theme="light"] .report-row,
body[data-theme="light"] .admin-grid .report-list .report-card {
  padding: 14px 0;
}

body[data-theme="light"] .mini-book,
body[data-theme="light"] .finished-book,
body[data-theme="light"] .rank-row {
  padding: 10px 0;
}

body[data-theme="light"] .profile-activity-item:last-child,
body[data-theme="light"] .club-member-row:last-child,
body[data-theme="light"] .report-row:last-child,
body[data-theme="light"] .admin-grid .report-list .report-card:last-child,
body[data-theme="light"] .mini-book:last-child,
body[data-theme="light"] .finished-book:last-child,
body[data-theme="light"] .rank-row:last-child {
  border-bottom: 0 !important;
}

body[data-theme="light"] .profile-activity-item:hover,
body[data-theme="light"] .club-member-row:hover,
body[data-theme="light"] .report-row:hover,
body[data-theme="light"] .admin-grid .report-list .report-card:hover,
body[data-theme="light"] .mini-book:hover,
body[data-theme="light"] .finished-book:hover,
body[data-theme="light"] .rank-row:hover {
  background: rgba(111, 98, 82, 0.035) !important;
}

body[data-theme="light"] .club-member-copy p,
body[data-theme="light"] .club-member-meta,
body[data-theme="light"] .report-row span,
body[data-theme="light"] .admin-grid .report-list .report-card .small,
body[data-theme="light"] .profile-activity-item span {
  color: var(--text-muted) !important;
}

body[data-theme="light"] .report-row,
body[data-theme="light"] .club-member-row {
  align-items: center;
}

body[data-theme="light"] .report-row span:last-child,
body[data-theme="light"] .club-member-meta,
body[data-theme="light"] .profile-activity-item span {
  text-align: right;
}

body[data-theme="light"] .admin-grid .report-list .report-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

body[data-theme="light"] .admin-grid .report-list .report-card .small {
  margin: 0;
  white-space: nowrap;
}

body[data-theme="light"] .profile-feed-panel > .profile-activity-feed,
body[data-theme="light"] .admin-grid .report-list {
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--text-muted) 34%, transparent) transparent;
}

/* Admin shell */
body[data-page="admin"] {
  --shell-width-current: 100%;
  --shell-margin-start: 0;
  --shell-margin-end: 0;
  --shell-padding-current: 0;
  --shell-radius-current: 0;
  --shell-border-current: 0;
  --shell-background-current: var(--bg-main);
  --shell-shadow-current: none;
}

body[data-page="admin"] .site-header {
  display: none;
}

body[data-page="admin"] .app-shell-main {
  min-height: 100vh;
  margin-top: 0;
}

.page-frame-admin {
  min-height: 100vh;
  gap: 0;
}

.admin-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
  background: var(--bg-main);
}

.admin-sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: start;
  gap: 28px;
  height: 100vh;
  padding: 30px 20px;
  border-right: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--bg-card) 86%, var(--bg-main));
}

.admin-sidebar-brand {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 0 10px 22px;
  border: 0;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
}

.admin-sidebar-home,
.admin-sidebar-overview {
  width: fit-content;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease;
}

.admin-sidebar-home {
  font-family: "Literata", serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.admin-sidebar-overview {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.admin-sidebar-home:hover,
.admin-sidebar-home:focus-visible,
.admin-sidebar-overview:hover,
.admin-sidebar-overview:focus-visible,
.admin-sidebar-overview.is-active {
  color: var(--accent-strong);
}

.admin-sidebar-home:focus-visible,
.admin-sidebar-overview:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.admin-sidebar-nav {
  display: grid;
  align-content: start;
  gap: 6px;
}

.admin-sidebar-link {
  position: relative;
  min-height: 44px;
  padding: 10px 14px 10px 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.admin-sidebar-link::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.admin-sidebar-link:hover,
.admin-sidebar-link:focus-visible {
  background: var(--hover-surface);
  color: var(--text-primary);
}

.admin-sidebar-link:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.admin-sidebar-link.is-active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.admin-sidebar-link.is-active::before {
  background: var(--accent-strong);
}

.admin-shell-main {
  min-width: 0;
  align-content: start;
  padding: clamp(28px, 4vw, 56px);
}

.admin-overview {
  display: grid;
  align-content: start;
  gap: clamp(32px, 5vw, 64px);
  width: min(100%, 880px);
}

.admin-overview-header {
  display: grid;
  gap: 10px;
  max-width: 680px;
}

.admin-overview-header h1,
.admin-overview-header p,
.admin-overview-summary h2,
.admin-overview-summary p {
  margin: 0;
}

.admin-overview-header h1 {
  font-family: "Literata", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.admin-overview-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.65;
}

.admin-overview-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  padding: clamp(24px, 3vw, 32px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  box-shadow: var(--shadow-soft);
}

.admin-overview-summary h2 {
  margin-top: 5px;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.admin-overview-count {
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr);
  align-items: baseline;
  gap: 2px 12px;
  min-width: 220px;
}

.admin-overview-count strong {
  grid-row: 1 / span 2;
  color: var(--accent-strong);
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  line-height: 1;
}

.admin-overview-count span {
  color: var(--text-primary);
  font-weight: 700;
}

.admin-overview-count p,
.admin-overview-state {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.45;
}

.admin-overview-state.is-error {
  color: var(--danger);
}

@media (max-width: 820px) {
  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-sidebar {
    z-index: 15;
    grid-template-columns: max-content minmax(0, 1fr);
    grid-template-rows: auto;
    align-items: center;
    gap: 16px;
    height: auto;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
  }

  .admin-sidebar-brand {
    width: auto;
    min-width: 142px;
    padding: 2px 16px 2px 0;
    border-right: 1px solid var(--border-color);
    border-bottom: 0;
  }

  .admin-sidebar-home {
    font-size: 1.3rem;
  }

  .admin-sidebar-overview {
    font-size: 0.68rem;
  }

  .admin-sidebar-nav {
    display: flex;
    gap: 4px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .admin-sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-sidebar-link {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .admin-sidebar-link::before {
    top: auto;
    right: 12px;
    bottom: 0;
    left: 12px;
    width: auto;
    height: 2px;
  }

  .admin-shell-main {
    padding: 24px 18px 36px;
  }

  .admin-overview-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-overview-count {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .admin-sidebar {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .admin-sidebar-brand {
    min-width: 0;
    padding-right: 0;
    border-right: 0;
  }

  .admin-shell-main {
    padding-inline: 14px;
  }
}

/* Moderation workspace */
.moderation-admin-page {
  gap: 18px;
}

.moderation-page-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 4px 2px;
}

.moderation-page-header h2 {
  margin: 0;
  font-size: clamp(1.65rem, 2vw, 2.2rem);
  letter-spacing: 0;
}

.moderation-page-summary {
  display: grid;
  min-width: 96px;
  justify-items: end;
}

.moderation-page-summary strong {
  color: var(--accent-strong);
  font-size: 2rem;
  line-height: 1;
}

.moderation-page-summary span {
  margin-top: 5px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.admin-section-tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-soft);
}

.admin-section-tabs button {
  min-height: 36px;
  padding: 7px 12px;
  border: 0;
  border-radius: 6px;
  color: var(--text-secondary);
  background: transparent;
  font-weight: 700;
}

.admin-section-tabs button:not(:disabled):hover,
.admin-section-tabs button:focus-visible {
  color: var(--text-primary);
  background: var(--hover-surface);
}

.admin-section-tabs button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.admin-section-tabs button.is-active {
  color: var(--accent-text);
  background: var(--accent);
  box-shadow: 0 5px 16px color-mix(in srgb, var(--accent) 24%, transparent);
}

.admin-section-tabs button.is-active:not(:disabled):hover,
.admin-section-tabs button.is-active:focus-visible {
  color: var(--accent-text);
  background: var(--accent-hover);
}

body[data-page="admin"] button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.staff-admin-workspace {
  display: grid;
  gap: 16px;
}

.audit-admin-workspace {
  display: grid;
  gap: 20px;
}

.audit-filter-form {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) minmax(180px, 1.2fr) minmax(145px, 0.7fr) minmax(145px, 0.7fr) auto;
  gap: 12px;
  align-items: end;
}

.audit-filter-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.audit-filter-form label span {
  color: var(--text-secondary);
  font-size: 12px;
}

.audit-list {
  border-top: 1px solid var(--border-color);
}

.audit-row {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(200px, 0.8fr) minmax(280px, 1.8fr);
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}

.audit-row-heading,
.audit-actor {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.audit-row-heading time,
.audit-actor span {
  color: var(--text-secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.audit-payload {
  max-height: 180px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.audit-empty {
  padding: 44px 16px;
  text-align: center;
  color: var(--text-secondary);
}

.audit-empty.is-error {
  color: var(--danger);
}

.audit-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.audit-pagination span {
  color: var(--text-secondary);
  font-size: 13px;
}

@media (max-width: 980px) {
  .audit-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .audit-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}

@media (max-width: 560px) {
  .audit-filter-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .audit-pagination {
    justify-content: space-between;
  }
}

.staff-search-form {
  display: grid;
  grid-template-columns: minmax(220px, 520px) auto;
  gap: 10px;
  align-items: center;
}

.staff-list {
  border-top: 1px solid var(--border-color);
}

.staff-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) minmax(250px, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 86px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border-color);
}

.staff-identity,
.staff-roles {
  min-width: 0;
}

.staff-identity {
  display: grid;
  gap: 4px;
}

.staff-identity span,
.staff-no-role {
  overflow-wrap: anywhere;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

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

.staff-role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-soft);
}

.staff-role-badge > span {
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 700;
}

.staff-role-badge button {
  align-self: stretch;
  width: 30px;
  border: 0;
  border-left: 1px solid var(--border-color);
  border-radius: 0;
  color: var(--danger);
  background: transparent;
  font-size: 1rem;
}

.staff-role-form {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 8px;
}

.staff-empty {
  display: grid;
  place-content: center;
  min-height: 240px;
  color: var(--text-secondary);
  text-align: center;
}

.staff-empty p {
  margin: 6px 0 0;
}

.staff-empty.is-error {
  color: var(--danger);
}

@media (max-width: 900px) {
  .staff-row {
    grid-template-columns: 1fr 1fr;
  }

  .staff-role-form {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .admin-section-tabs {
    width: 100%;
  }

  .admin-section-tabs button {
    flex: 1;
  }

  .staff-search-form,
  .staff-row,
  .staff-role-form {
    grid-template-columns: 1fr;
  }
}

.moderation-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
}

.moderation-toolbar label,
.moderation-resolution label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.moderation-toolbar label > span,
.moderation-resolution label > span {
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
}

.moderation-toolbar select {
  min-width: 0;
  height: 44px;
  box-sizing: border-box;
  padding: 0 38px 0 13px;
  border-color: var(--border-color);
  border-radius: 10px;
  background-color: var(--surface-input);
  color: var(--text-primary);
  line-height: normal;
  color-scheme: dark;
}

body[data-theme="light"] .moderation-toolbar select {
  color-scheme: light;
}

.moderation-toolbar select:hover {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--border-color));
}

.moderation-toolbar select:focus-visible {
  border-color: var(--accent-strong);
  outline: 2px solid color-mix(in srgb, var(--accent) 34%, transparent);
  outline-offset: 1px;
}

.moderation-toolbar select option {
  background: var(--surface-input);
  color: var(--text-primary);
}

.moderation-toolbar > button {
  min-width: 118px;
  min-height: 44px;
  border-radius: 10px;
}

.moderation-workspace {
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(0, 1.5fr);
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
}

.moderation-queue-panel {
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
  background: color-mix(in srgb, var(--bg-card) 82%, var(--bg-soft));
}

.moderation-bulk-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg-card) 72%, var(--bg-soft));
}

.moderation-bulk-toolbar span {
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 750;
}

.moderation-queue-item-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: stretch;
  border-bottom: 1px solid var(--border-color);
}

.moderation-queue-item-row.is-selected {
  background: color-mix(in srgb, var(--accent-soft) 68%, var(--bg-card));
}

.moderation-queue-item-row.is-bulk-selected {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--accent-strong) 72%, var(--success));
}

.moderation-queue-select {
  display: grid;
  place-items: start center;
  padding-top: 18px;
  cursor: pointer;
}

.moderation-queue-select input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-strong);
}

.moderation-queue-select.is-disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.moderation-queue-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 24px;
  gap: 12px;
  width: 100%;
  min-height: 92px;
  padding: 14px;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.moderation-queue-item:hover {
  background: var(--hover-surface);
}

.moderation-queue-item.is-selected {
  background: color-mix(in srgb, var(--accent-soft) 68%, var(--bg-card));
  box-shadow: inset 3px 0 0 var(--accent-strong);
}

.moderation-queue-cover,
.moderation-detail-cover {
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  background: var(--bg-soft);
  font-family: Georgia, serif;
  font-weight: 800;
}

.moderation-queue-cover {
  width: 48px;
  height: 68px;
}

.moderation-queue-cover img,
.moderation-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.moderation-queue-copy {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 5px;
}

.moderation-queue-title,
.moderation-queue-subtitle {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.moderation-queue-title {
  font-weight: 750;
}

.moderation-queue-subtitle {
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.moderation-queue-meta,
.moderation-detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.moderation-queue-meta {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.moderation-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--bg-soft);
  font-size: 0.7rem;
  font-weight: 750;
}

.moderation-badge.status-open,
.moderation-badge.priority-normal {
  border-color: color-mix(in srgb, var(--text-secondary) 34%, transparent);
  color: var(--text-secondary);
}

.moderation-badge.status-claimed,
.moderation-badge.status-in_review,
.moderation-badge.priority-high {
  border-color: color-mix(in srgb, var(--accent-strong) 40%, transparent);
  color: var(--accent-strong);
}

.moderation-badge.status-blocked,
.moderation-badge.status-rejected,
.moderation-badge.priority-urgent {
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
  color: var(--danger);
}

.moderation-badge.status-resolved {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  color: var(--success);
}

.moderation-queue-count {
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-align: right;
}

.moderation-queue-item-user {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  cursor: default;
}

.moderation-queue-item-user:hover {
  background: transparent;
}

.moderation-target-identity {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
}

.moderation-target-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  color: var(--accent-strong);
  background: var(--bg-soft);
  font-weight: 800;
}

.moderation-target-avatar.is-detail {
  flex-basis: 64px;
  width: 64px;
  height: 64px;
}

.moderation-target-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.moderation-target-copy,
.moderation-target-meta,
.moderation-target-detail-meta {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.moderation-target-name {
  width: fit-content;
  max-width: 100%;
  color: var(--text);
  font-weight: 750;
  overflow-wrap: anywhere;
}

a.moderation-target-name:hover {
  color: var(--accent-strong);
}

a.moderation-target-name:focus-visible,
.moderation-queue-open:focus-visible,
.moderation-target-filter button:focus-visible,
.moderation-pagination button:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
}

.moderation-target-tag,
.moderation-target-reasons,
.moderation-target-report-count {
  color: var(--text-secondary);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.moderation-target-meta {
  grid-column: 1 / -1;
  padding-left: 58px;
}

.moderation-queue-open {
  grid-column: 2;
  grid-row: 1;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text);
  background: var(--bg-soft);
  cursor: pointer;
}

.moderation-queue-open:hover {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

.moderation-queue-item-fallback {
  grid-template-columns: minmax(0, 1fr) auto;
}

.moderation-detail-header-report {
  grid-template-columns: 1fr;
}

.moderation-target-block .moderation-target-identity {
  margin-bottom: 12px;
}

.moderation-target-detail-meta {
  padding-left: 74px;
}

.moderation-target-fallback p {
  margin: 0;
  color: var(--text-secondary);
}

.moderation-target-fallback.is-warning {
  color: var(--danger);
}

.moderation-target-filter,
.moderation-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.moderation-target-filter {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-strong) 35%, var(--border-color));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}

.moderation-pagination {
  justify-content: center;
  padding-top: 16px;
  color: var(--text-secondary);
}

.moderation-queue-empty,
.moderation-detail-empty {
  display: grid;
  place-content: center;
  min-height: 240px;
  padding: 28px;
  color: var(--text-secondary);
  text-align: center;
}

.moderation-queue-empty p,
.moderation-detail-empty p {
  margin: 7px 0 0;
}

.moderation-queue-empty.is-error {
  color: var(--danger);
}

.moderation-detail-panel {
  min-width: 0;
  overflow-y: auto;
}

.moderation-detail-content {
  padding: 24px;
}

.moderation-detail-header {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-color);
}

.moderation-detail-cover {
  width: 86px;
  aspect-ratio: 2 / 3;
}

.moderation-detail-header h3 {
  margin: 10px 0 4px;
  font-size: 1.35rem;
  letter-spacing: 0;
}

.moderation-detail-header p {
  margin: 0 0 8px;
  color: var(--text-secondary);
}

.moderation-actions {
  display: grid;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border-color);
}

.moderation-status-actions,
.moderation-resolution > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.moderation-resolution {
  display: grid;
  gap: 10px;
}

.moderation-resolution-fields {
  display: grid;
  gap: 8px;
}

.moderation-resolution-fields input {
  width: 100%;
}

.moderation-report-list {
  display: grid;
  gap: 10px;
}

.moderation-report-item {
  padding-block: 10px;
  border-bottom: 1px solid var(--border-color);
}

.moderation-report-item:last-child {
  border-bottom: 0;
}

.moderation-report-item p {
  margin: 5px 0;
}

.moderation-report-item span {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.moderation-resolution textarea,
.moderation-comment-form textarea {
  resize: vertical;
}

.moderation-reject-button {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 42%, transparent);
}

.moderation-terminal-result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-color);
}

.moderation-detail-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border-color);
}

.moderation-detail-section:last-child {
  border-bottom: 0;
}

.moderation-detail-section h4 {
  margin: 0 0 12px;
  font-size: 0.94rem;
  letter-spacing: 0;
}

.moderation-json {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-secondary);
  background: var(--bg-soft);
  font: 0.78rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.moderation-diff {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--border-color);
}

.moderation-diff-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.6fr) minmax(0, 1fr) 22px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  font-size: 0.84rem;
}

.moderation-diff-old {
  color: var(--text-secondary);
  text-decoration: line-through;
  overflow-wrap: anywhere;
}

.moderation-diff-new {
  color: var(--success);
  overflow-wrap: anywhere;
}

.moderation-diff-arrow,
.moderation-empty-value {
  color: var(--text-secondary);
}

.moderation-comments,
.moderation-timeline {
  display: grid;
  gap: 10px;
}

.moderation-comment {
  padding: 11px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-soft);
}

.moderation-comment p {
  margin: 5px 0;
  overflow-wrap: anywhere;
}

.moderation-comment span,
.moderation-timeline-item p {
  color: var(--text-secondary);
  font-size: 0.72rem;
}

.moderation-comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-top: 12px;
}

.moderation-timeline-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.moderation-timeline-item p {
  margin: 4px 0 0;
}

.moderation-timeline-marker {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent-strong);
}

@media (max-width: 900px) {
  .moderation-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .moderation-toolbar > button {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .moderation-workspace {
    grid-template-columns: 1fr;
    min-height: 0;
    overflow: visible;
  }

  .moderation-queue-panel {
    max-height: 440px;
    border-right: 0;
    border-bottom: 1px solid var(--border-color);
  }

  .moderation-detail-panel {
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .moderation-page-header {
    flex-direction: column;
    align-items: start;
  }

  .moderation-page-summary {
    min-width: 54px;
    justify-items: start;
  }

  .moderation-toolbar {
    grid-template-columns: 1fr;
  }

  .moderation-toolbar > button {
    width: 100%;
  }

  .moderation-detail-content {
    padding: 16px;
  }

  .moderation-detail-header {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
  }

  .moderation-detail-header-report {
    grid-template-columns: 1fr;
  }

  .moderation-detail-cover {
    width: 64px;
  }

  .moderation-diff-row {
    grid-template-columns: 1fr;
  }

  .moderation-diff-arrow {
    transform: rotate(90deg);
  }

  .moderation-comment-form {
    grid-template-columns: 1fr;
  }

  .moderation-queue-item-user {
    grid-template-columns: 1fr;
  }

  .moderation-queue-open {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }

  .moderation-target-meta,
  .moderation-target-detail-meta {
    padding-left: 0;
  }

  .moderation-target-filter {
    align-items: stretch;
  }

  .moderation-target-filter button {
    width: 100%;
  }
}

body[data-theme="light"] .profile-feed-panel > .profile-activity-feed::-webkit-scrollbar,
body[data-theme="light"] .admin-grid .report-list::-webkit-scrollbar {
  width: 8px;
}

body[data-theme="light"] .profile-feed-panel > .profile-activity-feed::-webkit-scrollbar-thumb,
body[data-theme="light"] .admin-grid .report-list::-webkit-scrollbar-thumb {
  background: rgba(111, 98, 82, 0.3);
  border-radius: 999px;
}

@media (max-width: 1180px) {
  .site-header-inner,
  .hero,
  .dashboard-grid,
  .library-shell,
  .dashboard-showcase,
  .clubs-layout,
  .book-detail-page,
  .book-hero,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-showcase > *::after {
    display: none !important;
  }
  .dashboard-showcase > *::before {
    content: "";
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: var(--panel-border);
  }
  .dashboard-showcase > *:last-child::before {
    display: none !important;
  }

  .profile-hero-inner,
  .profile-foundation-grid,
  .profile-overview-grid,
  .profile-taste-grid {
    grid-template-columns: 1fr;
  }

  .profile-filter-group {
    justify-content: flex-start;
  }

  .profile-avatar-column {
    justify-items: flex-start;
  }

  .profile-identity-meta {
    justify-items: flex-start;
    text-align: left;
  }

  .library-summary-divider-row {
    grid-template-columns: repeat(3, 1fr);
    row-gap: 24px;
  }
  .library-summary-item:nth-child(3n) {
    border-right: none;
  }
  .library-summary-item {
    margin-bottom: 8px; /* Give some breathing room for wrapped items */
  }

  .reading-strip,
  .finished-strip {
    grid-template-columns: 1fr;
  }

  .nav-header {
    justify-content: flex-start;
    gap: 18px;
  }

  .club-page-header {
    flex-direction: column;
  }

  .club-page-badges {
    justify-content: flex-start;
  }
}

@media (min-width: 900px) and (max-width: 1100px) {
  .site-header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas:
      "brand controls"
      "nav nav";
    align-items: center;
    column-gap: 20px;
    row-gap: 12px;
    padding: 12px 20px 10px;
  }

  .site-header-inner > .brand-home {
    grid-area: brand;
    justify-self: start;
  }

  .site-header-inner > .nav-header {
    grid-area: nav;
    justify-self: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 18px;
    max-width: 100%;
    overflow-x: auto;
    padding-top: 2px;
    scrollbar-width: none;
  }

  .nav-header::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    white-space: nowrap;
  }

  .site-header-inner > .toolbar-header {
    grid-area: controls;
    justify-self: end;
    align-self: center;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .site-header-inner .auth-slot,
  .site-header-inner .header-user {
    width: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
  }

  body[data-theme="light"] .site-header-inner {
    min-height: 0;
  }
}

@media (min-width: 761px) and (max-width: 820px) {
  .site-header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas:
      "brand controls"
      "nav nav";
    align-items: center;
    column-gap: 14px;
    row-gap: 8px;
    width: calc(100% - 20px);
    padding: 10px 12px 9px;
  }

  .site-header-inner > .brand-home {
    grid-area: brand;
    justify-self: start;
    min-width: 0;
  }

  .brand-header h1 {
    font-size: 1.55rem;
  }

  .brand-header .eyebrow {
    font-size: 0.64rem;
    letter-spacing: 0.06em;
  }

  .site-header-inner > .nav-header {
    grid-area: nav;
    justify-self: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 16px;
    max-width: 100%;
    overflow-x: auto;
    padding: 2px 0 3px;
    scrollbar-width: none;
  }

  .site-header-inner > .nav-header::-webkit-scrollbar {
    display: none;
  }

  .site-header-inner .nav-button {
    white-space: nowrap;
  }

  .site-header-inner > .toolbar-header {
    grid-area: controls;
    justify-self: end;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  .site-header-inner .auth-slot,
  .site-header-inner .header-user {
    width: auto;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  body[data-theme="light"] .site-header-inner {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: static;
  }

  .site-header-inner {
    grid-template-columns: 1fr;
    width: calc(100% - 16px);
    padding: 14px 0;
    gap: 14px;
  }

  .app-shell {
    width: calc(100% - 16px);
    margin: 8px auto;
    padding: 12px;
    border-radius: 22px;
  }

  body[data-layout="bare"] .app-shell {
    width: calc(100% - 16px);
    margin: 0 auto;
    padding: 0;
  }

  .topbar { flex-direction: column; align-items: stretch; }
  .toolbar-header,
  .library-panel-header,
  .book-card-actions {
    flex-direction: column;
  }
  .toolbar-header {
    align-items: flex-start;
  }
  .auth-slot,
  .header-user {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }
  .hero { padding: 20px; }
  .hero-stats,
  .library-summary-row,
  .quick-grid { grid-template-columns: 1fr; }
  .catalog-search-form {
    grid-template-columns: 1fr;
  }
  .random-book-panel {
    grid-column: auto;
  }
  .library-search input { min-width: 100%; }
  .metadata-row,
  .book-detail-meta-row { grid-template-columns: 1fr; }
  .club-member-row {
    grid-template-columns: 1fr;
    justify-items: start;
  }
  .club-member-meta {
    justify-items: start;
    text-align: left;
  }
}

@media (max-width: 820px) {
  body[data-page="library"] .library-panel {
    padding: 16px;
    overflow: hidden;
  }

  body[data-page="library"] .library-panel::before {
    inset: -10px;
    filter: blur(18px);
  }

  body[data-page="library"] .library-panel::after {
    display: none;
  }

  body[data-page="library"] .library-summary-divider-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 16px 0 18px;
    padding-bottom: 18px;
    row-gap: 0;
  }

  body[data-page="library"] .library-summary-item {
    min-width: 0;
    padding: 12px 14px;
    border-right: 1px solid var(--panel-border);
    border-bottom: 1px solid var(--panel-border);
  }

  body[data-page="library"] .library-summary-item:nth-child(2n) {
    border-right: 0;
  }

  body[data-page="library"] .library-summary-item:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  body[data-page="library"] .library-summary-item:first-child {
    padding-left: 14px;
  }

  body[data-page="library"] .library-summary-item:last-child {
    padding-right: 14px;
  }

  body[data-page="library"] .library-summary-item .stat-value {
    font-size: 1.28rem;
  }

  body[data-page="library"] .library-toolbar.refined-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    margin: 16px 0 14px;
  }

  body[data-page="library"] .refined-filters,
  body[data-page="library"] .refined-search {
    width: 100%;
  }

  body[data-page="library"] .refined-filters select,
  body[data-page="library"] .refined-search input,
  body[data-page="library"] .library-search input {
    width: 100%;
    min-width: 0;
  }

  body[data-page="library"] .library-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  body[data-page="library"] .book-card-library {
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 14px 14px 72px;
  }

  body[data-page="library"] .book-card-top {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
  }

  body[data-page="library"] .book-card-cover,
  body[data-page="library"] .book-card-cover img,
  body[data-page="library"] .book-card-cover-placeholder {
    width: 88px;
    height: 124px;
  }

  body[data-page="library"] .book-card-status-row-footer {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
}

/* Header reference refresh: search + notifications + avatar menu. */
.site-header-inner {
  grid-template-columns: max-content minmax(0, 1fr) max-content;
}

.brand-header .eyebrow {
  display: none;
}

.brand-header h1 {
  font-size: clamp(1.75rem, 2.5vw, 2.25rem);
  line-height: 1;
}

.toolbar-header,
.auth-slot {
  min-width: 0;
}

.auth-slot {
  gap: 14px;
}

.header-search-form {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(240px, 24vw, 360px);
  min-width: 0;
}

.header-search-form input {
  width: 100%;
  min-height: 42px;
  padding: 0 44px 0 18px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: var(--surface-control);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.header-search-form input::placeholder {
  color: var(--muted);
}

.header-search-form input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 34%, var(--panel-border) 66%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.header-search-submit,
.header-icon-button {
  appearance: none;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.header-search-submit {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 30px;
  height: 30px;
  transform: translateY(-50%);
}

.header-icon-button {
  width: 42px;
  height: 42px;
  border-radius: 999px;
}

.header-search-submit:hover,
.header-search-submit:focus-visible,
.header-icon-button:hover,
.header-icon-button:focus-visible {
  color: var(--text);
  outline: none;
}

.header-notification-menu {
  position: relative;
}

.header-notification-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: -8px;
  display: grid;
  min-width: 240px;
  padding: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: var(--surface-control);
  box-shadow: 0 18px 36px rgba(0,0,0,0.2);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 30;
}

.header-notification-dropdown[hidden] {
  display: none;
}

.header-notification-dropdown[data-open="true"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.header-notification-empty {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.header-profile-link {
  gap: 6px;
}

.header-profile-mark {
  width: 38px;
  height: 38px;
  overflow: hidden;
  border-radius: 999px;
  font-weight: 800;
}

.header-profile-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-profile-caret {
  width: 16px;
  height: 16px;
}

.header-profile-dropdown,
.header-notification-dropdown {
  border: 1px solid var(--panel-border);
}

body[data-theme="light"] .header-search-form input,
body[data-theme="light"] .header-notification-dropdown {
  background: var(--bg-card);
  border-color: rgba(111, 98, 82, 0.13);
  box-shadow: 0 12px 26px rgba(84, 64, 40, 0.09);
}

body[data-theme="light"] .header-search-form input {
  box-shadow: 0 8px 18px rgba(84, 64, 40, 0.06);
}

body[data-theme="light"] .header-search-submit,
body[data-theme="light"] .header-icon-button {
  color: var(--text-secondary);
}

body[data-theme="light"] .header-search-submit:hover,
body[data-theme="light"] .header-search-submit:focus-visible,
body[data-theme="light"] .header-icon-button:hover,
body[data-theme="light"] .header-icon-button:focus-visible {
  color: var(--text-primary);
}

@media (min-width: 1101px) and (max-width: 1180px) {
  .site-header-inner {
    grid-template-columns: max-content minmax(0, 1fr) max-content;
  }
}

@media (min-width: 900px) and (max-width: 1100px) {
  .header-search-form {
    width: clamp(220px, 30vw, 320px);
  }
}

@media (min-width: 761px) and (max-width: 820px) {
  .header-search-form {
    width: 190px;
  }

  .auth-slot {
    gap: 8px;
  }

  .header-icon-button {
    width: 36px;
    height: 36px;
  }

  .header-profile-mark {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 760px) {
  .site-header-inner {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar-header,
  .auth-slot,
  .header-user {
    width: 100%;
    flex-direction: row;
    align-items: center;
  }

  .auth-slot {
    flex-wrap: wrap;
  }

  .header-search-form {
    flex: 1 1 100%;
    order: 2;
    width: 100%;
  }

  .header-notification-menu,
  .header-profile-menu {
    order: 3;
  }
}

@media (min-width: 761px) and (max-width: 820px) {
  body[data-page="library"] .dashboard-showcase {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
  }

  body[data-page="library"] .dashboard-showcase > *::before,
  body[data-page="library"] .dashboard-showcase > *::after {
    display: none !important;
  }

  body[data-page="library"] .dashboard-showcase > *:nth-child(1),
  body[data-page="library"] .dashboard-showcase > *:nth-child(2) {
    grid-column: span 3;
    border-bottom: 1px solid var(--panel-border) !important;
  }

  body[data-page="library"] .dashboard-showcase > *:nth-child(1) {
    border-right: 1px solid var(--panel-border) !important;
  }

  body[data-page="library"] .dashboard-side-column {
    grid-column: 1 / -1;
    border-bottom: 1px solid var(--panel-border) !important;
  }

  body[data-page="library"] .combined-ranks-panel {
    grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr);
    align-items: start;
    gap: 16px;
  }

  body[data-page="library"] .combined-ranks-divider {
    width: 1px;
    height: 100%;
  }

  body[data-page="library"] .goal-panel,
  body[data-page="library"] .completion-panel {
    grid-column: span 3;
  }

  body[data-page="library"] .goal-panel,
  body[data-page="library"] .completion-panel {
    border-right: 1px solid var(--panel-border) !important;
  }

  body[data-page="library"] .goal-panel {
    gap: 10px;
  }

  body[data-page="library"] .goal-copy {
    max-width: 100%;
    margin-bottom: 8px;
    font-size: 0.98rem;
    line-height: 1.35;
  }

  body[data-page="library"] .goal-progress-row {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 8px;
  }

  body[data-page="library"] .goal-progress {
    height: 13px;
    background: color-mix(in srgb, var(--hover-surface) 78%, var(--bg-elevated) 22%);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--panel-border) 72%, transparent);
  }

  body[data-page="library"] .goal-progress > span {
    min-width: 0;
  }

  body[data-page="library"] .goal-percent {
    font-size: 0.82rem;
    justify-self: center;
    text-align: center;
  }

  body[data-page="library"] .goal-action {
    min-height: 38px;
    padding-inline: 14px;
  }

  body[data-page="library"] .completion-ring {
    width: 132px;
    height: 132px;
    margin: 4px 0 8px;
  }

  body[data-page="library"] .completion-ring strong {
    font-size: 1.72rem;
  }

  body[data-page="library"] .random-book {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  body[data-page="library"] .random-book img {
    width: 76px;
    height: 108px;
    border-radius: 12px;
  }

  body[data-page="library"] .random-book > .book-card-cover-placeholder {
    width: 76px;
    height: 108px;
    border-radius: 12px;
  }

  body[data-page="library"] .random-book-title {
    font-size: 1rem;
  }

  body[data-page="library"] .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  body[data-page="library"] .book-card-library {
    padding: 12px 12px 66px;
  }

  body[data-page="library"] .book-card-top {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  body[data-page="library"] .book-card-cover,
  body[data-page="library"] .book-card-cover img,
  body[data-page="library"] .book-card-cover-placeholder {
    width: 76px;
    height: 108px;
  }

  body[data-page="library"] .book-card-title {
    font-size: 1rem;
    line-height: 1.16;
  }

  body[data-page="library"] .book-card-author,
  body[data-page="library"] .book-card-genre,
  body[data-page="library"] .book-card-info-line,
  body[data-page="library"] .book-card-date,
  body[data-page="library"] .book-card-rating-placeholder,
  body[data-page="library"] .book-card-rating-row {
    font-size: 0.84rem;
  }

  body[data-page="library"] .book-status-trigger {
    min-height: 32px;
    padding: 0 8px 0 10px;
    font-size: 0.82rem;
  }

  body[data-page="library"] .book-card-status-row-footer {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}
