/* ============================================================
   BiblioIndex — Personal Book Collection Manager
   Design tokens + components
   ============================================================ */
[x-cloak] { display: none !important; }

:root {
  /* Brand */
  --primary:        #2F7A55;
  --primary-dark:   #286B4A;
  --primary-light:  #3A8F65;
  --primary-tint:   rgba(47, 122, 85, 0.10);
  --primary-tint-2: rgba(39, 174, 96, 0.16);

  /* Neutrals */
  --dark-base:   #2C3E50;
  --dark-grey:   #34495E;
  --mid-grey:    #566573;
  --light-grey:  #D5D8DC;
  --extra-light: #ECF0F1;
  --white:       #FFFFFF;

  /* Status */
  --success: #2F7A55;
  --warning: #E67E22;
  --error:   #C0392B;
  --info:    #2980B9;

  /* Surfaces */
  --bg-main:    #F5F3EE;
  --bg-card:    #FFFFFF;
  --bg-sidebar: #1B2420;

  /* Text */
  --text-strong: #2C3E50;
  --text-body:   #34495E;
  --text-muted:  #566573;
  --text-faint:  #9aa6ad;
  --text-onDark: #C3CBC5;
  --text-onDark-muted: #7E8A84;

  /* Type */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-ui: 'Karla', system-ui, sans-serif;

  /* Radius / shadow */
  --radius-sm: 6px;
  --radius:    9px;
  --radius-lg: 14px;
  --shadow-card: 0 2px 6px rgba(44, 62, 80, 0.06);
  --shadow-card-hover: 0 10px 28px rgba(44, 62, 80, 0.13);
  --shadow-pop: 0 18px 50px rgba(44, 62, 80, 0.22);

  /* Cover cloth palette (muted, library-binding) */
  --cloth-1: #355C7D; /* slate blue */
  --cloth-2: #6C5B7B; /* plum */
  --cloth-3: #2A6F62; /* deep teal */
  --cloth-4: #8C3B3B; /* oxblood */
  --cloth-5: #B07D2B; /* mustard ochre */
  --cloth-6: #355040; /* forest */
  --cloth-7: #46566B; /* indigo grey */
  --cloth-8: #9C5A3C; /* burnt sienna */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-main);
  color: var(--text-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5 { margin: 0; font-family: var(--font-display); color: var(--text-strong); font-weight: 600; line-height: 1.08; }
p { margin: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--primary); color: #fff; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
.app.app-collapsed { grid-template-columns: 78px 1fr; }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--bg-sidebar);
  color: var(--text-onDark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px 18px;
  overflow: hidden;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 22px; }
.sidebar-toggle {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center;
  color: #93a3b3; transition: background .14s, color .14s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-toggle .ico { width: 20px; height: 20px; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  min-width: 0;
}
.brand > div:last-child { min-width: 0; }
.brand-name, .brand-sub { white-space: nowrap; overflow: hidden; }

/* Collapsed state */
.sidebar.collapsed { padding: 22px 14px 18px; }
.sidebar.collapsed .sidebar-top { flex-direction: column; gap: 14px; margin-bottom: 18px; }
.sidebar.collapsed .brand > div:last-child { display: none; }
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-count,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .profile-text { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 11px; }
.sidebar.collapsed .nav-label { height: 14px; }
.sidebar.collapsed .nav-group { margin-top: 14px; }
.sidebar.collapsed .profile { justify-content: center; padding: 8px; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--primary-light), var(--primary-dark));
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25);
  flex: 0 0 auto;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--text-strong);
  line-height: 1;
}
.brand-name.on-dark { color: #fff; }
.brand-name span { color: var(--primary); }
.brand-name.on-dark span { color: var(--primary-light); }
.brand-sub {
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-onDark-muted);
  margin-top: 3px;
}

.nav-group { margin-top: 8px; }
.nav-label {
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #6f8093;
  padding: 0 12px;
  margin: 18px 0 8px;
  font-weight: 700;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  color: #c2cdd8;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.nav-item .ico { width: 19px; height: 19px; flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(47,122,85,.35); }
.nav-item.active .ico { opacity: 1; }
.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 700;
  color: #8597a8;
  background: rgba(255,255,255,.06);
  padding: 1px 8px;
  border-radius: 20px;
}
.nav-item.active .nav-count { color: #fff; background: rgba(255,255,255,.22); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.profile {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 10px;
}
.profile:hover { background: rgba(255,255,255,.05); }
.profile .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(140deg, #5aa9e6, #355C7D);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
  flex: 0 0 auto;
}
.profile .pname { font-size: 13.5px; font-weight: 700; color: #fff; line-height: 1.2; }
.profile .pmeta { font-size: 11.5px; color: var(--text-onDark-muted); }

/* ---------- Main column ---------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.page, .dv { padding: clamp(20px, 4vw, 44px) clamp(16px, 4.5vw, 48px) 96px; max-width: 1160px; width: 100%; margin: 0 auto; }

.page-head { margin-bottom: 28px; }
.page-head--split { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head--split .btn { background: #fff; color: var(--text-strong); border-radius: 10px; padding: 12px 20px; font-weight: 600; font-size: 14px; }
.eyebrow {
  font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--primary-dark); font-weight: 700; margin-bottom: 8px;
}
.page-title { font-size: clamp(38px, 5vw, 54px); font-weight: 500; line-height: 1.05; letter-spacing: -.01em; color: #1F2421; }
.page-sub { color: var(--text-muted); font-size: 15.5px; margin-top: 6px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px;
  margin: 38px 0 16px;
}
.section-title { font-size: 30px; font-weight: 500; white-space: nowrap; color: #1F2421; }
.section-link { font-size: 13.5px; font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
.section-link:hover { color: var(--primary); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 8px; font-size: 14px; font-weight: 700;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(47,122,85,.25); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { border: 1.5px solid var(--primary); color: var(--primary-dark); }
.btn-secondary:hover { background: var(--primary-tint); }
.btn-ghost { color: var(--text-muted); border: 1.5px solid var(--light-grey); background: #fff; }
.btn-ghost:hover { border-color: var(--mid-grey); color: var(--text-strong); }

/* ---------- Stat cards ---------- */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat-card {
  background: var(--bg-card); border: 1px solid var(--extra-light);
  border-radius: var(--radius-lg); padding: 20px 22px;
  box-shadow: var(--shadow-card);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-ico {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center; background: var(--primary-tint); color: var(--primary-dark);
}
.stat-ico .ico { width: 20px; height: 20px; }
.stat-ico.amber { background: rgba(230,126,34,.12); color: #c0651a; }
.stat-ico.blue  { background: rgba(41,128,185,.12); color: var(--info); }
.stat-ico.plum  { background: rgba(108,91,123,.14); color: #6C5B7B; }
.stat-delta { font-size: 12px; font-weight: 700; color: var(--primary-dark); }
.stat-value { font-family: var(--font-display); font-size: 40px; font-weight: 600; color: var(--text-strong); line-height: 1; margin-top: 14px; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 6px; font-weight: 500; }

/* ---------- Generic card ---------- */
.card {
  background: var(--bg-card); border: 1px solid var(--extra-light);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}

/* ---------- Book cover (typographic cloth) ---------- */
.cover {
  position: relative;
  -webkit-user-select: none; user-select: none;
  aspect-ratio: 2 / 3;
  border-radius: 4px 7px 7px 4px;
  overflow: hidden;
  color: #fff;
  display: flex; flex-direction: column;
  padding: 14px 13px 13px 17px;
  box-shadow: 0 6px 18px rgba(44,62,80,.22);
  background: var(--cloth, var(--cloth-1));
}
/* spine shading + cloth texture */
.cover::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,.32) 0, rgba(0,0,0,.12) 7px, rgba(0,0,0,0) 16px),
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.18)),
    repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 2px, rgba(0,0,0,0) 2px 4px);
  pointer-events: none;
}
.cover::after {
  content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 1px;
  background: rgba(255,255,255,.18);
}
.cover-pub {
  position: relative; font-size: 8.5px; letter-spacing: .22em; text-transform: uppercase;
  font-weight: 700; opacity: .72; margin-left: 4px;
}
.cover-rule { position: relative; height: 1px; background: rgba(255,255,255,.4); margin: 9px 0 0 4px; width: 34px; }
.cover-spacer { flex: 1 1 auto; min-height: 8px; }
.cover > *:not(.cover-spacer) { flex: 0 0 auto; }
.cover-title {
  position: relative; font-family: var(--font-display); font-weight: 600;
  line-height: 1.04; letter-spacing: .2px; margin-left: 4px;
  font-size: clamp(15px, 2vw, 21px);
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-author {
  position: relative; margin: 9px 0 2px 4px; font-size: 10px; letter-spacing: .08em;
  text-transform: uppercase; font-weight: 700; opacity: .82;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cover-emblem {
  position: relative; margin: 7px 0 0 4px; width: 18px; height: 18px; opacity: .55;
}
.cover.sm { padding: 9px 8px 9px 12px; border-radius: 3px 5px 5px 3px; }
.cover.sm .cover-title { font-size: 12.5px; }
.cover.sm .cover-pub, .cover.sm .cover-author, .cover.sm .cover-rule, .cover.sm .cover-emblem { display: none; }
.cover.lg { padding: 26px 22px 22px 28px; }
.cover.lg .cover-title { font-size: clamp(24px, 3vw, 34px); }
.cover.lg .cover-author { font-size: 12px; }

/* ---------- Status pill ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .02em; line-height: 1.6;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.reading  { background: rgba(41,128,185,.12); color: var(--info); }
.pill.read     { background: var(--primary-tint); color: var(--primary-dark); }
.pill.wishlist { background: rgba(230,126,34,.13); color: #c0651a; }
.pill.unread   { background: var(--extra-light); color: var(--mid-grey); }

/* ---------- Stars ---------- */
.stars { display: inline-flex; gap: 2px; align-items: center; }
.stars .ico { width: 15px; height: 15px; color: var(--light-grey); }
.stars .ico.on { color: #E8B53D; }
.stars.lg .ico { width: 19px; height: 19px; }

/* ---------- Progress ---------- */
.progress { height: 7px; border-radius: 20px; background: var(--extra-light); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--primary), var(--primary-light)); }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 7px; font-weight: 600; }

/* ---------- Currently reading row ---------- */
.reading-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.reading-card { display: flex; gap: 16px; padding: 18px; cursor: pointer; transition: box-shadow .18s, transform .18s; }
.reading-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.reading-card .cover { width: 78px; flex: 0 0 auto; }
.reading-card .rc-body { min-width: 0; display: flex; flex-direction: column; }
.reading-card .rc-body > * { flex: 0 0 auto; }
.rc-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; color: var(--text-strong); line-height: 1.12; flex: 0 0 auto; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-author { font-size: 13px; color: var(--text-muted); margin-top: 3px; flex: 0 0 auto; }
.rc-prog { margin-top: auto; }

/* ---------- Book grid ---------- */
.book-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 26px 22px; }
.book-cell { cursor: pointer; }
.book-cell { min-width: 0; }
.book-cell, .dv-cover, .bk-more .c { perspective: 900px; }
/* 3D flip on hover: the whole book turns to reveal its spine */
.book3d {
  --spine-d: 26px;
  position: relative; transform-style: preserve-3d;
  transition: transform .4s cubic-bezier(.2,.7,.2,1);
}
.book-cell:hover .book3d, .dv-book:hover .book3d, .bk-more a:hover .book3d { transform: translateX(calc(var(--spine-d) * .6)) rotateY(28deg); }
.book3d .cover { transition: box-shadow .4s; }
.book-cell:hover .book3d .cover, .dv-book:hover .book3d .cover, .bk-more a:hover .book3d .cover { box-shadow: var(--shadow-pop); }
.book-spine {
  position: absolute; top: 0; bottom: 0; right: 100%; width: var(--spine-d);
  transform-origin: 100% 50%; transform: rotateY(-90deg);
  background-color: var(--cloth); color: #fff;
  background-image: linear-gradient(90deg, rgba(0,0,0,.22), rgba(0,0,0,0) 40%, rgba(0,0,0,.18));
  border-radius: 3px 0 0 3px; overflow: hidden;
  display: flex; align-items: center; gap: 8px; padding: 10px 0;
  writing-mode: vertical-rl;
}
.book-spine-title { font-family: var(--font-display); font-size: 11px; font-weight: 700; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1 1 auto; min-height: 0; }
.book-spine-author { font-size: 7.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; opacity: .7; white-space: nowrap; max-height: 40%; overflow: hidden; text-overflow: ellipsis; }
.book3d.is-light .book-spine { color: #2a2a2a; }
@media (hover: none), (prefers-reduced-motion: reduce) {
  .book-cell:hover .book3d, .dv-book:hover .book3d, .bk-more a:hover .book3d { transform: none; }
}
.bc-meta { margin-top: 12px; }
.bc-title { font-family: var(--font-display); font-size: 18.5px; font-weight: 600; color: var(--text-strong); line-height: 1.12; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bc-author { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.bc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; }

/* ---------- Book list ---------- */
.book-list { display: flex; flex-direction: column; }
.list-head, .list-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 2.6fr) minmax(0, 1.5fr) minmax(0, 1.5fr) 56px 92px minmax(0, 1.3fr);
  align-items: center; gap: 24px;
}
.list-head {
  padding: 16px 22px 14px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; border-bottom: 1px solid var(--extra-light);
}
.list-row {
  padding: 0 22px; height: 59px; border-bottom: 1px solid var(--extra-light); cursor: pointer;
  transition: background .14s;
}
.list-row:hover { background: #fbfcfc; }
.lr-mini { width: 24px; height: 38px; border-radius: 2px 3px 3px 2px; background: var(--cloth); box-shadow: inset 3px 0 0 rgba(255,255,255,.18); }
.lr-text { font-size: 13.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-loc { font-size: 12.5px; font-weight: 600; color: var(--primary-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-loc.muted { color: var(--text-faint); }
.list-row .stars .ico { width: 12px; height: 12px; }
.lr-title { font-family: var(--font-display); font-size: 18px; font-weight: 500; color: var(--text-strong); line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-genre { font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }
.lr-author { font-size: 13px; color: var(--text-muted); }
.lr-year { font-size: 13px; color: var(--text-muted); }

/* ---------- Toolbar / search ---------- */
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.search {
  position: relative; flex: 1 1 320px; min-width: 240px;
}
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-faint); }
.search input {
  width: 100%; height: 48px; padding: 0 14px 0 42px; border-radius: 12px;
  border: 1px solid var(--light-grey); background: #fff; color: var(--text-strong);
  font-family: inherit; font-size: 14.5px;
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }

.chips { display: flex; gap: 9px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 20px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--light-grey); color: var(--text-body); background: #fff;
  transition: all .14s;
}
.chip:hover { border-color: var(--mid-grey); }
.chip.active { background: #1F2421; border-color: #1F2421; color: #fff; }
.chip .ct { font-size: 11.5px; opacity: .8; }

.viewtoggle { display: inline-flex; height: 48px; align-items: center; background: #fff; border: 1px solid var(--light-grey); border-radius: 12px; padding: 4px; }
.viewtoggle button {
  width: 44px; height: 38px; border-radius: 8px; display: grid; place-items: center; color: var(--text-faint);
}
.viewtoggle button .ico { width: 18px; height: 18px; }
.viewtoggle button.active { background: #1F2421; color: #fff; }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none; padding: 14px 38px 14px 42px; border-radius: 12px; min-width: 172px; font-size: 14.5px;
  border: 1px solid var(--light-grey); background: #fff; color: var(--text-strong);
  font-family: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.select-wrap select:focus { outline: none; border-color: var(--primary); }
.select-wrap .ico.lead { left: 14px; right: auto; width: 18px; height: 18px; color: var(--text-strong); }
.select-wrap .ico { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }

.result-meta { font-size: 13.5px; color: var(--text-muted); margin-bottom: 18px; font-weight: 400; }
.result-meta b { color: inherit; font-weight: inherit; }

/* ---------- Genre breakdown ---------- */
.breakdown { padding: 22px 24px; }
.brk-row { display: grid; grid-template-columns: 130px 1fr 46px; align-items: center; gap: 14px; margin-bottom: 14px; }
.brk-row:last-child { margin-bottom: 0; }
.brk-name { font-size: 13.5px; font-weight: 600; color: var(--text-body); }
.brk-bar { height: 9px; border-radius: 20px; background: var(--extra-light); overflow: hidden; }
.brk-bar > i { display: block; height: 100%; border-radius: 20px; }
.brk-val { font-size: 13px; font-weight: 700; color: var(--text-muted); text-align: right; }

/* ---------- Goal ---------- */
.goal-card { padding: 24px; display: flex; gap: 24px; align-items: center; }
.ring { flex: 0 0 auto; }
.goal-body h4 { font-size: 23px; }
.goal-body .gnum { font-family: var(--font-display); font-size: 30px; color: var(--text-strong); font-weight: 600; }

/* ---------- Detail page ---------- */
.detail-back {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 22px;
}
.detail-back:hover { color: var(--primary-dark); }
.detail-back .ico { width: 17px; height: 17px; }
.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 48px; align-items: start; }
.detail-cover-col { position: sticky; top: 34px; }
.detail-cover-col .cover { width: 100%; }
.detail-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.detail-actions .btn { justify-content: center; }
.spec {
  margin-top: 22px; border-top: 1px solid var(--extra-light); padding-top: 6px;
}
.spec-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--extra-light); font-size: 13.5px; }
.spec-row:last-child { border-bottom: none; }
.spec-k { color: var(--text-muted); font-weight: 500; }
.spec-v { color: var(--text-strong); font-weight: 700; text-align: right; }
.spec-v.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-weight: 600; font-size: 12.5px; }

.detail-genre { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--primary-dark); font-weight: 700; }
.detail-title { font-size: 52px; font-weight: 600; letter-spacing: -.5px; margin-top: 10px; line-height: 1.02; }
.detail-author { font-size: 19px; color: var(--text-muted); margin-top: 10px; }
.detail-author b { color: var(--text-strong); font-weight: 700; }
.detail-statrow { display: flex; gap: 28px; align-items: center; margin: 24px 0 4px; flex-wrap: wrap; }
.detail-statitem .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; }
.detail-statitem .v { font-size: 16px; font-weight: 700; color: var(--text-strong); margin-top: 3px; display: flex; align-items: center; gap: 7px; }

.tagrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.tag { padding: 5px 13px; border-radius: 20px; background: var(--extra-light); color: var(--text-body); font-size: 12.5px; font-weight: 600; }

.detail-block { margin-top: 34px; }
.detail-block h3 { font-size: 24px; margin-bottom: 12px; }
.synopsis { font-size: 16.5px; line-height: 1.72; color: var(--text-body); max-width: 64ch; }
.synopsis p + p { margin-top: 14px; }

.note-card { padding: 20px 22px; background: #fffdf5; border: 1px solid #f2ead0; border-radius: var(--radius); }
.note-card + .note-card { margin-top: 12px; }
.note-quote { font-family: var(--font-display); font-size: 21px; line-height: 1.35; color: var(--text-strong); font-style: italic; }
.note-meta { font-size: 12px; color: var(--text-muted); margin-top: 10px; font-weight: 600; }
.note-meta b { color: var(--primary-dark); }

.related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }

/* ============================================================
   Added: minimal cover, location, top nav, shelves, login, preview bar
   ============================================================ */

/* ---------- Minimal cover (icon + initials) ---------- */
.cover-min {
  aspect-ratio: 2 / 3; border-radius: 7px; background: #eef6f1;
  border: 1px solid #d6e8dd; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(44,62,80,.08);
}
.cover-min .cm-ico { width: 34px; height: 34px; opacity: .75; stroke-width: 1.5; }
.cover-min .cm-init { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: .04em; }
.cover-min.sm { border-radius: 5px; gap: 3px; }
.cover-min.sm .cm-ico { width: 16px; height: 16px; }
.cover-min.sm .cm-init { font-size: 13px; }
.cover-min.lg .cm-ico { width: 52px; height: 52px; }
.cover-min.lg .cm-init { font-size: 40px; }

/* ---------- Location chip ---------- */
.loc-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  color: var(--primary-dark); white-space: nowrap;
}
.loc-chip .ico { width: 13px; height: 13px; flex: 0 0 auto; }
.loc-chip.none { color: var(--text-faint); font-weight: 500; }
.loc-chip.sm { font-size: 11.5px; }
.bc-loc { margin-top: 7px; }

/* ---------- Top nav layout ---------- */
.app-top { display: block; min-height: 100vh; }
.app-top .main { display: block; }
.topnav {
  position: sticky; top: 0; z-index: 30; background: var(--bg-sidebar);
  box-shadow: 0 2px 14px rgba(44,62,80,.18);
}
.topnav-inner {
  display: flex; align-items: center; gap: 16px;
  max-width: 1360px; margin: 0 auto; padding: 13px 32px;
}
.tn-brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-mark.sm { width: 32px; height: 32px; font-size: 18px; border-radius: 8px; }
.tn-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: #fff; }
.tn-name span { color: var(--primary-light); }
.tn-search { flex: 1 1 auto; max-width: 460px; }
.tn-search input {
  background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.14); color: #fff; cursor: pointer;
}
.tn-search input::placeholder { color: #9fb0c1; }
.tn-search .ico { color: #9fb0c1; }
.tn-search input:focus { background: rgba(255,255,255,.14); box-shadow: 0 0 0 3px rgba(47,122,85,.3); border-color: var(--primary); }
.tn-links { display: flex; gap: 4px; flex: 0 0 auto; }
.tn-link {
  padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #c2cdd8;
  transition: background .15s, color .15s;
}
.tn-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.tn-link.active { color: #fff; background: var(--primary); }
.tn-add { padding: 9px 16px; flex: 0 0 auto; }
.tn-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(140deg, #5aa9e6, #355C7D); color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}
.tn-logout { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: #9fb0c1; flex: 0 0 auto; }
.tn-logout:hover { background: rgba(255,255,255,.07); color: #fff; }
.tn-logout .ico { width: 19px; height: 19px; }
.app-top .page { max-width: 1360px; }

/* ---------- Shelves ---------- */
.bookcase-stack { display: flex; flex-direction: column; gap: 40px; }
.bookcase-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.bookcase-count { font-size: 13.5px; color: var(--text-muted); font-weight: 600; }
.bookcase-body {
  background: linear-gradient(180deg, #fbfaf7, #f4f1ea);
  border: 1px solid #e7e2d6; border-radius: 12px; padding: 8px 22px 4px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), var(--shadow-card);
}
.shelf { display: block; padding: 12px 0 0; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 18px; }
.shelf-head .shelf-label, .shelf-head .shelf-count { padding-bottom: 0; }
.shelf-meta { display: flex; align-items: baseline; gap: 16px; }
.shelf-share { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: #2F7A55; }
.shelf-share:hover { text-decoration: underline; }
.shelf-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; padding-bottom: 18px; }
.shelf-count { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; text-align: right; padding-bottom: 18px; }
.shelf-run { position: relative; }
.spines { display: flex; align-items: flex-end; gap: 2px; min-height: 156px; padding-left: 4px; }
.shelf-board {
  height: 9px; border-radius: 2px; margin-top: 0;
  background: linear-gradient(180deg, #8a6f4e, #6d5638);
  box-shadow: 0 6px 10px rgba(44,62,80,.16), inset 0 1px 0 rgba(255,255,255,.25);
}
.shelf-empty { font-size: 13px; color: #b8b09c; font-style: italic; align-self: center; padding: 60px 0; }
.spine {
  position: relative; border-radius: 2px 2px 0 0; background: var(--cloth);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 12px 3px 8px; cursor: pointer; color: var(--spine-text, #fff); overflow: hidden;
  box-shadow: inset -3px 0 6px rgba(0,0,0,.28), inset 2px 0 0 rgba(255,255,255,.18), 0 3px 8px rgba(44,62,80,.2);
  transition: transform .16s ease, margin .16s ease;
}
.spine:hover { transform: translateY(-12px); box-shadow: inset -3px 0 6px rgba(0,0,0,.28), 0 12px 22px rgba(44,62,80,.3); }
/* A book opened from its detail page: lifted off the shelf and glowing in its own colour. */
.spine.spotlight { transform: translateY(-16px); z-index: 2; box-shadow: inset -3px 0 6px rgba(0,0,0,.28), 0 14px 26px rgba(44,62,80,.35), 0 0 0 2px #fff, 0 0 22px 6px var(--cloth); animation: spine-glow 1.6s ease-in-out 3; }
@keyframes spine-glow {
  50% { box-shadow: inset -3px 0 6px rgba(0,0,0,.28), 0 14px 26px rgba(44,62,80,.35), 0 0 0 2px #fff, 0 0 40px 14px var(--cloth); }
}
@media (prefers-reduced-motion: reduce) { .spine.spotlight { animation: none; } }
.spine-band { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.35); }
.spine-title {
  writing-mode: vertical-rl; transform: rotate(180deg); font-size: 7.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; opacity: .7; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: auto;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* Unsorted pile */
.pile-sub { margin: -6px 0 14px; font-size: 14px; color: var(--text-muted); }
.pile-stack { display: flex; flex-direction: column-reverse; align-items: flex-start; width: 100%; justify-content: flex-start; padding: 28px 0 22px 4px; min-height: 190px; }
.pile-base { height: 9px; width: 100%; align-self: stretch; margin-top: 0; background: #d9d4c5; border-radius: 1px; order: -1; }
.pile-book {
  display: flex; align-items: center; height: 28px; padding: 0 14px; margin-bottom: -1px; border-radius: 2px;
  background: var(--cloth); color: var(--spine-text, #fff); cursor: grab; max-width: 100%;
  box-shadow: inset 0 -3px 5px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.2), 0 2px 4px rgba(44,62,80,.15);
  transition: transform .16s ease;
}
.pile-book:hover { transform: translateY(-3px); }
.pile-book.dragging { opacity: .4; }
.pile-title { font-size: inherit; line-height: 1; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Detail location callout ---------- */
.loc-callout {
  margin-top: 16px; display: flex; gap: 14px; align-items: center;
  background: var(--primary-tint); border: 1px solid var(--primary-border, rgba(47,122,85,.3));
  border-radius: var(--radius); padding: 14px 16px;
}
.loc-callout.none { background: var(--extra-light); border-color: #e2e6e7; }
.lc-ico { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; }
.loc-callout.none .lc-ico { background: var(--mid-grey); }
.lc-ico .ico { width: 21px; height: 21px; }
.lc-cap { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.lc-val { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--text-strong); line-height: 1.1; margin-top: 1px; }
.lc-sub { font-size: 13px; color: var(--text-muted); font-weight: 600; margin-top: 1px; }

/* ---------- Login ---------- */
.login-stage {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, #eef4f0, transparent),
    var(--bg-main);
  padding: 40px 20px;
}
.login-card {
  width: 100%; max-width: 410px; background: #fff; border: 1px solid var(--extra-light);
  border-radius: 16px; box-shadow: 0 24px 60px rgba(44,62,80,.12); padding: 40px 38px 30px; text-align: center;
}
.login-mark {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 18px;
  background: linear-gradient(150deg, var(--primary-light), var(--primary-dark));
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: 32px; color: #fff;
  box-shadow: 0 8px 20px rgba(47,122,85,.3), inset 0 1px 0 rgba(255,255,255,.3);
}
.login-title { font-size: 36px; font-weight: 600; letter-spacing: -.3px; }
.login-sub { color: var(--text-muted); font-size: 15px; margin-top: 6px; margin-bottom: 26px; }
.login-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; border: 1px solid var(--light-grey); border-radius: 9px; background: #fff;
  font-size: 14.5px; font-weight: 700; color: var(--text-strong); transition: background .15s, border-color .15s; white-space: nowrap;
}
.login-google:hover { background: #fafbfb; border-color: var(--mid-grey); }
.g-glyph {
  font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 20px; line-height: 1;
  background: conic-gradient(from -45deg, #ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-or { display: flex; align-items: center; gap: 14px; margin: 22px 0; color: var(--text-faint); }
.login-or::before, .login-or::after { content: ""; flex: 1; height: 1px; background: var(--extra-light); }
.login-or span { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; }
.field { display: block; text-align: left; margin-bottom: 14px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-body); margin-bottom: 6px; }
.field-input { position: relative; display: block; }
.field-input .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-faint); }
.field-input input {
  width: 100%; padding: 11px 14px 11px 40px; border-radius: 9px; border: 1px solid var(--light-grey);
  font-family: inherit; font-size: 14.5px; color: var(--text-strong); background: #fff;
}
.field-input input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.login-submit { width: 100%; justify-content: center; margin-top: 6px; padding: 12px; }
.login-foot { font-size: 13.5px; color: var(--text-muted); margin-top: 20px; }
.login-foot a { color: var(--primary-dark); font-weight: 700; }
.login-foot a:hover { color: var(--primary); }
.login-legal { max-width: 410px; text-align: center; color: var(--text-faint); font-size: 13px; margin-top: 22px; line-height: 1.6; }

/* ---------- Preview switcher ---------- */
.preview-bar {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 16px; padding: 8px 8px 8px 16px;
  background: rgba(44,62,80,.96); border-radius: 14px; box-shadow: 0 16px 40px rgba(44,62,80,.4);
  backdrop-filter: blur(6px);
}
.pv-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #9fb0c1; font-weight: 700; }
.pv-group { display: flex; align-items: center; gap: 8px; }
.pv-cap { font-size: 12px; color: #c2cdd8; font-weight: 600; }
.seg-wrap { display: flex; background: rgba(255,255,255,.1); border-radius: 9px; padding: 3px; gap: 2px; }
.seg {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 700; color: #c2cdd8; transition: background .14s, color .14s;
}
.seg .ico { width: 15px; height: 15px; }
.seg:hover { color: #fff; }
.seg.on { background: var(--primary); color: #fff; }

@media (max-width: 980px) {
  .topnav-inner { flex-wrap: wrap; padding: 12px 20px; }
  .tn-search { order: 3; max-width: none; flex-basis: 100%; }
  .tn-links { flex: 1 1 auto; overflow-x: auto; }
  .preview-bar { flex-wrap: wrap; gap: 10px; max-width: calc(100vw - 24px); }
}

/* ---------- Sort dropdown ---------- */
.sort { position: relative; }
.sort-btn { display: inline-flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; min-width: 172px; border-radius: 10px; border: 1px solid var(--light-grey); background: #fff; color: var(--text-strong); font: inherit; font-size: 14.5px; font-weight: 500; cursor: pointer; }
.sort-btn .ico { width: 17px; height: 17px; flex: none; color: var(--text-muted); }
.sort-btn .caret { width: 13px; height: 13px; margin-left: auto; color: var(--text-faint); transition: transform .15s; }
.sort-btn.open { border-color: #2F7A55; background: #F1F6F2; }
.sort-btn.open .caret { transform: rotate(180deg); }
.sort-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: max-content; min-width: 190px; margin: 0; padding: 6px; list-style: none; background: #fff; border: 1px solid #DFDACF; border-radius: 10px; box-shadow: 0 10px 28px rgba(31,36,33,.12); }
.sort-menu li { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 38px; padding: 0 12px; border-radius: 7px; font-size: 14.5px; font-weight: 400; color: var(--text-body); cursor: pointer; }
.sort-menu li:hover { background: #F5F3EE; }
.sort-menu li.on { background: #E9F1EB; color: #1F2421; font-weight: 700; }
.sort-menu li svg { color: #2F7A55; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 28px; border-top: 1px solid var(--light-grey); }
.pager-info { font-size: 13.5px; color: var(--text-muted); }
.pager-info b { font-weight: 400; color: var(--text-muted); }
.pager-btns { display: flex; align-items: center; gap: 8px; }
.pager-btn { display: inline-flex; align-items: center; gap: 6px; height: 38px; min-width: 38px; padding: 0 14px; justify-content: center; border-radius: 9px; border: 1px solid var(--light-grey); background: #fff; color: var(--text-strong); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.pager-btn .ico { width: 14px; height: 14px; }
.pager-btn:hover:not(:disabled) { border-color: var(--mid-grey); }
.pager-btn:disabled { opacity: .45; cursor: default; }
.pager-num { padding: 0; }
.pager-num.active { background: #1F2421; border-color: #1F2421; color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .related-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    padding: 14px 20px; gap: 18px; overflow-x: auto;
  }
  .brand { margin: 0; padding: 0; }
  .brand-sub { display: none; }
  .nav-label, .sidebar-foot { display: none; }
  .nav-group { display: flex; gap: 6px; margin: 0; }
  .nav-item { margin: 0; white-space: nowrap; }
  .nav-count { display: none; }
  .reading-grid { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; gap: 28px; }
  .detail-cover-col { position: static; max-width: 260px; }
  .page { padding: 28px 24px 56px; }
}
@media (max-width: 640px) {
  .stat-row { grid-template-columns: 1fr; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-title { font-size: 38px; }
  .list-head { display: none; }
  .list-row { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 14px; }
  .list-row .lr-text, .list-row .stars { display: none; }
}

/* ============================================================
   v3 additions: image covers, languages, authors, search +
   add modals, drag-reorder, sidebar search, by-genre, source
   ============================================================ */

/* Image cover */
.cover.cover-img { padding: 0; background: #2c3e50; }
.cover.cover-img::before, .cover.cover-img::after { display: none; }
.cover.cover-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* Wishlist / owned pills already share .pill */
.pill.owned { background: var(--primary-tint); color: var(--primary-dark); }

/* Language badges */
.langs { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.lang-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .04em; color: var(--mid-grey);
  background: var(--extra-light); border-radius: 4px; padding: 2px 6px; line-height: 1.3;
}
.detail-statitem .langs .lang-badge { font-size: 12px; padding: 3px 9px; }

/* Author chips (detail) */
.author-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.author-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  color: var(--text-body); background: #fff; border: 1px solid var(--extra-light); border-radius: 20px; padding: 5px 12px;
}
.author-chip .ico { width: 13px; height: 13px; color: var(--text-faint); }
.author-chip.etal { color: var(--text-muted); font-style: italic; background: var(--bg-main); }

/* Source line (detail) */
.source-line {
  display: inline-flex; align-items: center; gap: 9px; margin-top: 18px;
  background: var(--bg-main); border: 1px solid var(--extra-light); border-radius: 9px; padding: 9px 14px;
  font-size: 14px; color: var(--text-body);
}
.source-line .ico { width: 18px; height: 18px; color: var(--primary-dark); }
.source-line b { color: var(--text-strong); font-weight: 700; }

/* Sidebar search button */
.sb-search {
  display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 16px;
  padding: 10px 12px; border-radius: 9px; background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.08); color: #9fb0c1; transition: background .15s;
}
.sb-search:hover { background: rgba(255,255,255,.12); color: #fff; }
.sb-search .ico { width: 18px; height: 18px; flex: 0 0 auto; }
.sb-search-text { font-size: 13.5px; font-weight: 500; }
.sb-search-short { display: none; font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.sb-kbd {
  margin-left: auto; font-family: var(--font-ui); font-size: 11px; font-weight: 700; color: #93a3b3;
  background: rgba(255,255,255,.08); border-radius: 5px; padding: 2px 6px;
}
.sidebar.collapsed .sb-search { justify-content: center; padding: 11px; }
.sidebar.collapsed .sb-search-text, .sidebar.collapsed .sb-kbd { display: none; }

/* Genre color dot in nav */
.nav-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; margin: 0 5px; }

/* Dashboard bookcases list */
.case-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--extra-light); cursor: pointer; }
.case-row:last-child { border-bottom: none; }
.case-row:hover { background: #fbfcfc; }
.case-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--primary-tint); color: var(--primary-dark); display: grid; place-items: center; flex: 0 0 auto; }
.case-ico .ico { width: 18px; height: 18px; }
.case-name { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--text-strong); }
.case-meta { margin-left: auto; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

/* Spine drag handle + states */
.spine { touch-action: none; }
.spine-grip {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%); opacity: 0; transition: opacity .15s;
  color: rgba(255,255,255,.7);
}
.spine-grip .ico { width: 14px; height: 14px; }
.spine:hover .spine-grip { opacity: .9; }
.spine.dragging { opacity: .4; }
.spine.drop-over { outline: 2px dashed rgba(255,255,255,.7); outline-offset: 2px; }
.spines.reordering .spine { cursor: grabbing; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(28,40,54,.55);
  backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center;
  padding: 80px 20px 40px; overflow-y: auto;
}
.search-overlay { padding-top: 96px; }

/* Search modal */
.search-panel {
  width: 100%; max-width: 640px; background: #FCFBF8; border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); overflow: hidden; animation: pop .16s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.search-bar { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--extra-light); }
.search-bar-ico { width: 22px; height: 22px; color: var(--text-faint); flex: 0 0 auto; }
.search-bar input { flex: 1; border: none; outline: none; font-family: 'Hanken Grotesk', system-ui, sans-serif; font-size: 16px; color: var(--text-strong); background: transparent; }
.search-bar input::placeholder { color: var(--text-faint); }
.search-esc { font-size: 11px; font-weight: 700; color: var(--text-muted); background: var(--extra-light); border-radius: 6px; padding: 4px 9px; }
.search-body { max-height: 60vh; overflow-y: auto; padding: 8px; }
.search-hint { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; padding: 8px 10px 6px; }
.search-results { display: flex; flex-direction: column; }
.search-result { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 10px; text-align: left; width: 100%; transition: background .12s; }
.search-result:hover { background: var(--bg-main); }
.sr-cover { width: 34px; flex: 0 0 auto; }
.sr-cover .cover { width: 34px; }
.sr-main { flex: 1; min-width: 0; }
.sr-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text-strong); line-height: 1.1; }
.sr-author { font-size: 12.5px; color: var(--text-muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-side { display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 5px; flex: 0 0 auto; }
.search-spinner { width: 20px; height: 20px; margin: 1px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--extra-light); border-top-color: var(--primary); animation: search-spin .7s linear infinite; }
@keyframes search-spin { to { transform: rotate(360deg); } }
.search-body { transition: opacity .15s, filter .15s; }
.search-body.blurred { min-height: 240px; filter: blur(3px); opacity: .6; pointer-events: none; user-select: none; }
.search-body.loading { opacity: .55; }
.sr-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-tint); color: var(--primary-dark); font-size: 12px; font-weight: 700; letter-spacing: .03em; }
.search-result.on { background: var(--bg-main); }
.search-foot { position: relative; display: flex; align-items: center; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--extra-light); font-size: 12.5px; color: var(--text-muted); }
.sf-hint { display: inline-flex; align-items: center; gap: 6px; }
.sf-hint .ico { width: 14px; height: 14px; }
.sf-count { flex: 1; text-align: right; }
.sf-filters { position: relative; }
.search-result mark { background: #F1E7B8; color: inherit; border-radius: 3px; padding: 0 1px; }
.loc-chip.wish { color: #8A6A2E; }
.sf-toggle { font-size: 12.5px; color: var(--text-muted); background: var(--extra-light); border-radius: 7px; padding: 5px 10px; }
.sf-toggle:hover { color: var(--text-strong); }
.sf-toggle kbd { font-family: ui-monospace, monospace; font-weight: 700; font-size: 11.5px; color: var(--text-body); }
.sf-pop { position: absolute; right: -6px; bottom: calc(100% + 14px); width: min(616px, calc(100vw - 40px)); background: #fff; border-radius: 12px; box-shadow: var(--shadow-pop); border: 1px solid var(--extra-light); padding: 16px 18px; z-index: 5; }
.sf-pop::after { content: ''; position: absolute; bottom: -7px; right: 42px; width: 12px; height: 12px; background: #fff; border-right: 1px solid var(--extra-light); border-bottom: 1px solid var(--extra-light); transform: rotate(45deg); }
.sf-pop-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); margin-bottom: 12px; }
.sf-pop-head span:first-child { letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }
.sf-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 6px 20px; }
.sf-item { display: flex; align-items: baseline; gap: 10px; text-align: left; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; font-size: 12.5px; color: var(--text-faint); }
.sf-item:hover { background: var(--bg-main); }
.sf-item code { font-family: ui-monospace, monospace; font-size: 13px; font-weight: 700; color: var(--primary-dark); white-space: nowrap; }
@media (max-width: 560px) { .sf-grid { grid-template-columns: 1fr; } .sf-hint { display: none; } }
.search-empty { text-align: center; color: var(--text-muted); padding: 26px 0 34px; }
.search-empty .ico { width: 28px; height: 28px; opacity: .5; }
.search-empty p { margin: 0 0 14px; font-family: var(--font-display); font-size: 26px; font-weight: 500; color: var(--text-strong); }
.se-sub { font-size: 13.5px; }
.se-add { background: var(--primary-tint); color: var(--primary-dark); border: 1px solid var(--light-grey); border-radius: 9px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; }
.se-add:hover { border-color: var(--primary); }

/* Add modal */
.add-panel {
  width: 100%; max-width: 620px; background: #FCFBF8; border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45);
  animation: pop .16s ease;
}
.add-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 24px 26px 14px; border-bottom: 1px solid var(--extra-light); }
.add-title { font-size: 30px; font-weight: 600; margin-top: 2px; }
.modal-x { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; color: var(--text-muted); }
.modal-x:hover { background: var(--extra-light); color: var(--text-strong); }
.modal-x .ico { width: 20px; height: 20px; }
.add-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 22px 26px 26px; }
.add-body .fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.add-body .span2 { grid-column: 1 / -1; }
.add-body .fld-trio { display: grid; grid-template-columns: 3fr 3fr 6fr; gap: 16px; }
.add-body label { font-size: 13px; font-weight: 600; color: var(--text-body); }
.fld-hint { color: var(--text-faint); font-weight: 500; }
.fld-tip { display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; border-radius: 50%; background: var(--light-grey);
  color: var(--text-muted); font-size: 10px; font-weight: 700; cursor: default;
  position: relative; vertical-align: middle; margin-left: 4px; line-height: 1; }
.fld-tip::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: #2c3e50; color: #fff; font-size: 11px; font-weight: 500;
  white-space: nowrap; padding: 4px 8px; border-radius: 6px; pointer-events: none;
  opacity: 0; transition: opacity .15s; z-index: 10; }
.fld-tip:hover::after { opacity: 1; }
.add-body input[type=text], .add-body input[type=number], .add-body input[type=date], .add-body input:not([type]), .add-body textarea {
  width: 100%; padding: 10px 13px; border-radius: 9px; border: 1px solid var(--light-grey);
  font-family: inherit; font-size: 14.5px; color: var(--text-strong); background: #fff;
}
.add-body input:focus, .add-body textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.add-body input[type=date] { color-scheme: light; }
.add-body textarea { resize: vertical; }
.fld.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld.two > div { display: flex; flex-direction: column; gap: 6px; }
.select-wrap.full { position: relative; display: block; }
.select-wrap.full select { width: 100%; appearance: none; padding: 10px 38px 10px 13px; border-radius: 9px; border: 1px solid var(--light-grey); background: #fff; font-family: inherit; font-size: 14.5px; font-weight: 600; color: var(--text-strong); cursor: pointer; }
.select-wrap.full select:focus { outline: none; border-color: var(--primary); }
.select-wrap.full .ico { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.check { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 500 !important; color: var(--text-muted) !important; font-size: 13px; cursor: pointer; margin-top: 2px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); flex: 0 0 auto; }
.lang-toggle, .seg-toggle { display: flex; flex-wrap: wrap; gap: 8px; }
.lang-opt { padding: 7px 13px; border-radius: 8px; border: 1px solid var(--light-grey); background: #fff; font-size: 13px; font-weight: 600; color: var(--text-body); transition: all .12s; }
.lang-opt:hover { border-color: var(--mid-grey); }
.lang-opt.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg-toggle { gap: 0; border: 1px solid var(--light-grey); border-radius: 9px; padding: 3px; width: max-content; }
.seg-toggle button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 6px; font-size: 14px; font-weight: 700; color: var(--text-muted); }
.seg-toggle button .ico { width: 16px; height: 16px; }
.seg-toggle button.on { background: var(--primary-tint); color: var(--primary-dark); }
.rate-input { gap: 4px; }
.rate-input button { line-height: 0; }
.rate-input .ico { width: 26px; height: 26px; }
.add-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; padding-top: 18px; border-top: 1px solid var(--extra-light); }
.add-foot .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* Flags + custom language UI */
.lang-badge .flag, .lang-opt .flag { font-size: 12px; margin-right: 5px; line-height: 1; }
.detail-statitem .lang-badge .flag { font-size: 14px; }
.lang-opt { display: inline-flex; align-items: center; }
.lang-opt.add { color: var(--primary-dark); border-style: dashed; border-color: var(--primary); }
.lang-opt.add:hover { background: var(--primary-tint); }
.lang-opt.add .ico { width: 14px; height: 14px; margin-right: 5px; }
.lang-add { display: flex; gap: 8px; margin-top: 10px; }
.lang-add input { flex: 1; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--light-grey); font-family: inherit; font-size: 14px; }
.lang-add input.code-in { flex: 0 0 80px; }
.lang-add input.code-in::placeholder { text-transform: none; }
.lang-add input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.btn.sm { padding: 8px 16px; font-size: 13.5px; }

@media (max-width: 560px) {
  .add-body { grid-template-columns: 1fr; }
  .modal-overlay { padding-top: 40px; }
}


/* ISBN lookup button + spinner */
.isbn-btn { width: 38px; height: 38px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.isbn-spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .65s linear infinite; }

/* Highlight fields filled by ISBN lookup */
.field-filled { border-color: var(--primary) !important; box-shadow: 0 0 0 3px var(--primary-tint) !important; transition: border-color .15s, box-shadow .15s; }

/* ISBN loading overlay */
.add-panel { position: relative; }
.modal-loading { position: absolute; inset: 0; border-radius: 16px; background: rgba(255,255,255,.75); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 10; }
.modal-loading .isbn-spinner { width: 32px; height: 32px; border-width: 3px; }

/* Series badge on book detail */
.series-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 5px 12px; background: var(--extra-light); border-radius: 20px; font-size: 13px; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.series-badge:hover { background: var(--primary-tint); color: var(--primary-dark); }
.series-badge .ico { width: 13px; height: 13px; }

/* Settings page */
.settings-layout { display: flex; gap: 40px; align-items: flex-start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; width: 190px; flex-shrink: 0; position: sticky; top: 24px; }
.settings-nav a { padding: 8px 0; font-size: 14px; font-weight: 500; color: var(--text-muted); text-decoration: none; }
.settings-nav a:hover { color: var(--text-strong); }
.settings-nav a.active { color: var(--primary-dark); font-weight: 700; }
@media (max-width: 760px) { .settings-layout { flex-direction: column; gap: 16px; } .settings-nav { flex-direction: row; flex-wrap: wrap; gap: 4px 18px; width: auto; position: static; } }
.settings-wrap { display: flex; flex-direction: column; gap: 40px; flex: 1; min-width: 0; max-width: 720px; }
.settings-section { background: #FCFBF8; border: 1px solid #E4E0D6; border-radius: 18px; padding: 28px 28px 30px; box-shadow: none; }
.settings-section-title { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.15; color: var(--text-strong); margin-bottom: 4px; }
.settings-section-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.settings-saved { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--primary-dark); background: var(--primary-tint); padding: 6px 14px; border-radius: 20px; margin-bottom: 16px; }
.settings-saved .ico { width: 13px; height: 13px; }
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-form .fld input { width: 100%; padding: 10px 13px; border-radius: 9px; border: 1px solid var(--light-grey); font-family: inherit; font-size: 14.5px; color: var(--text-strong); background: #fff; }
.settings-form .fld input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.settings-form .fld { display: flex; flex-direction: column; gap: 6px; }
.settings-form .fld label { font-size: 13px; font-weight: 700; color: var(--text-muted); }
.settings-form .fld.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.settings-foot { display: flex; justify-content: flex-end; padding-top: 4px; }
.fld-error { font-size: 12px; color: var(--error); font-weight: 600; }
.settings-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.settings-item { background: var(--bg-main); border: 1px solid var(--extra-light); border-radius: 10px; padding: 12px 14px; }
.settings-item-head { display: flex; align-items: center; gap: 10px; }
.settings-item-name { flex: 1; font-size: 14.5px; font-weight: 600; color: var(--text-strong); }
.settings-item-actions { display: flex; align-items: center; gap: 6px; }
.settings-act { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 7px; color: var(--text-muted); }
.settings-act:hover { background: var(--extra-light); color: var(--text-strong); }
.settings-act.danger:hover { background: #fdecea; color: var(--error); }
.settings-act.primary { width: auto; padding: 0 10px; font-size: 13px; font-weight: 700; color: var(--primary-dark); }
.settings-act .ico { width: 14px; height: 14px; }
.settings-inline-input { flex: 1; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--primary); font-family: inherit; font-size: 14px; color: var(--text-strong); outline: none; box-shadow: 0 0 0 3px var(--primary-tint); }
.settings-add-row { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.settings-add-row .settings-inline-input { border-color: var(--light-grey); box-shadow: none; }
.settings-add-row .settings-inline-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.settings-error { font-size: 13px; color: var(--error); font-weight: 600; margin-top: 6px; }
.settings-shelves { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--extra-light); }
.settings-shelf-chip { display: inline-flex; align-items: center; gap: 5px; background: #fff; border: 1px solid var(--light-grey); border-radius: 20px; padding: 3px 10px 3px 12px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.settings-shelf-chip button { display: flex; align-items: center; color: var(--text-faint); }
.settings-shelf-chip button:hover { color: var(--error); }
.settings-shelf-chip .ico { width: 12px; height: 12px; }
.settings-shelf-add { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--primary-dark); padding: 3px 10px; border-radius: 20px; border: 1px dashed var(--primary); }
.settings-shelf-add:hover { background: var(--primary-tint); }
.settings-shelf-add .ico { width: 13px; height: 13px; }
.settings-item-lang { display: flex; align-items: center; gap: 10px; cursor: grab; }
.settings-item-lang:active { cursor: grabbing; }
.settings-drag-handle { color: var(--text-faint); display: flex; }
.settings-drag-handle .ico { width: 15px; height: 15px; }

/* Cover upload in add/edit modal */
.cover-upload-row { display: flex; align-items: center; gap: 14px; }
.cover-upload-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 9px; border: 1.5px dashed var(--light-grey); font-size: 14px; font-weight: 600; color: var(--text-muted); cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.cover-upload-btn:hover { border-color: var(--primary); color: var(--primary-dark); background: var(--primary-tint); }
.cover-upload-btn .ico { width: 15px; height: 15px; }
.cover-upload-preview { width: 52px; height: 72px; border-radius: 6px; overflow: hidden; flex-shrink: 0; border: 1px solid var(--light-grey); }
.cover-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.cover-color-input { width: 52px; height: 38px; padding: 2px; border-radius: 8px; border: 1px solid var(--light-grey); cursor: pointer; }

/* Cover upload — book-shaped clickable area */
.cover-upload-area {
  width: 86px; aspect-ratio: 2/3;
  border-radius: 4px 7px 7px 4px;
  box-shadow: 0 6px 18px rgba(44,62,80,.22);
  background: var(--cloth, #566573);
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
  transition: box-shadow .18s;
}
.cover-upload-area::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.32) 0, rgba(0,0,0,.12) 7px, rgba(0,0,0,0) 16px),
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(0,0,0,.18)),
    repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 2px, rgba(0,0,0,0) 2px 4px);
}
.cover-upload-area::after {
  content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 1px;
  background: rgba(255,255,255,.18);
}
.cover-upload-area:hover { box-shadow: 0 10px 28px rgba(44,62,80,.35); }
.cover-upload-area img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover-upload-placeholder {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: rgba(255,255,255,.75); font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.cover-upload-placeholder .ico { width: 20px; height: 20px; }
.cover-upload-meta { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; }

.cover-upload-remove { position: absolute; top: 5px; right: 5px; z-index: 2; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; }
.cover-upload-remove:hover { background: var(--error); }
.cover-upload-remove .ico { width: 11px; height: 11px; }

/* Flag-prefixed input */
.input-flag-wrap { display: flex; align-items: center; gap: 7px; border: 1px solid var(--light-grey); border-radius: 9px; padding: 0 11px; background: #fff; }
.input-flag-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.input-flag-wrap .input-flag { font-size: 17px; line-height: 1; flex-shrink: 0; width: 22px; text-align: center; display: inline-block; }
.input-flag-wrap input { flex: 1; border: none !important; box-shadow: none !important; outline: none; padding: 10px 0; font-family: inherit; font-size: 14.5px; color: var(--text-strong); background: transparent !important; min-width: 0; width: 60px; }
.input-flag-wrap.sm { border-radius: 8px; padding: 0 9px; }
.input-flag-wrap.sm input { padding: 8px 0; font-size: 13.5px; }
.input-flag-wrap.error { border-color: var(--error) !important; box-shadow: 0 0 0 3px rgba(192,57,43,.12) !important; }

/* Tag input in add/edit modal */
.tag-input-wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 7px 10px; border: 1px solid var(--light-grey); border-radius: 9px; background: #fff; min-height: 42px; cursor: text; }
.tag-input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.tag-input-wrap input { border: none !important; outline: none; background: transparent !important; font-family: inherit; font-size: 14px; color: var(--text-strong); min-width: 80px; flex: 1; padding: 2px 0; box-shadow: none !important; }
.tag.editable { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 10px; }
.tag.editable button { display: flex; align-items: center; color: var(--text-faint); padding: 0; }
.tag.editable button:hover { color: var(--error); }
.tag.editable .ico { width: 11px; height: 11px; }

/* Tag input redesign in modals */
.modal-tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag.modal-tag { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; transition: background .13s, color .13s; }
.tag.modal-tag:hover { background: #fdecea; color: var(--error); }
.tag.modal-tag .ico { width: 10px; height: 10px; opacity: .6; flex-shrink: 0; }
.tag.modal-tag:hover .ico { opacity: 1; }
.modal-error { flex: 1 1 100%; font-size: 13px; font-weight: 600; color: var(--error); background: #fdecea; border-radius: 8px; padding: 8px 12px; margin-bottom: 0; }

/* Empty library state */
.library-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 80px 40px; gap: 16px; }
.library-empty-graphic { width: 96px; height: 96px; border-radius: 28px; background: var(--primary-tint); display: grid; place-items: center; margin-bottom: 8px; }
.library-empty-graphic .ico { width: 44px; height: 44px; color: var(--primary-dark); }
.library-empty-title { font-family: var(--font-display); font-size: 32px; font-weight: 600; color: var(--text-strong); margin: 0; }
.library-empty-sub { font-size: 15px; color: var(--text-muted); max-width: 360px; line-height: 1.6; margin: 0; }
.library-empty--filter .library-empty-graphic { background: var(--extra-light); }
.library-empty--filter .library-empty-graphic .ico { color: var(--text-faint); }

/* Shelf spine tooltip */
.spine-tip {
  position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: 290px; background: #fff; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(44,62,80,.26); padding: 16px; z-index: 100;
  display: flex; gap: 16px; pointer-events: none;
}
.spine-tip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: #fff;
}
.spine-tip-cover {
  width: 72px; flex-shrink: 0; aspect-ratio: 2/3; border-radius: 4px 6px 6px 4px;
  background: var(--cloth, #566573);
  box-shadow: 0 3px 10px rgba(44,62,80,.2);
}
.spine-tip-cover img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px 5px 5px 3px; }
.spine-tip-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.spine-tip-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--text-strong); line-height: 1.2; }
.spine-tip-author { font-size: 13px; color: var(--text-muted); font-weight: 500; margin-top: 2px; }
.spine-tip-meta { font-size: 12px; color: var(--text-faint); display: flex; gap: 6px; margin-top: 4px; }
.spine-tip-meta span + span::before { content: '·'; margin-right: 6px; }
.spine-tip-stars { margin-top: 4px; }
.spine-tip-stars .ico { width: 11px; height: 11px; }
.spine-wrap { position: relative; display: flex; flex-direction: column; align-items: center; }
.spine-tip [class*="cover"] { width: 64px; }
.settings-form input[type=file] { font-family: inherit; font-size: 14px; color: var(--text-muted); }

/* ---------- v2 redesign: sidebar + page colours ---------- */
body{background:#F5F3EE}
.sidebar{background:#1B2420;color:#C3CBC5}
.brand-mark{background:#2F7A55;box-shadow:none;font-weight:600}
.brand-name,.brand-name.on-dark{color:#F4F1EA}
.brand-name span,.brand-name.on-dark span{color:#7FC9A1}
.brand-sub{color:#7E8A84}
.sidebar-toggle{color:#8E9A93}
.sidebar-toggle:hover{background:rgba(255,255,255,.07);color:#fff}
.sb-search{background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);color:#8E9A93}
.sb-search:hover{background:rgba(255,255,255,.04);border-color:rgba(255,255,255,.16);color:#8E9A93}
.sb-kbd{background:rgba(255,255,255,.07);color:#9AA59F}
.nav-label{color:#66726C}
.nav-item{color:#B9C2BC;border-radius:7px}
.nav-item .ico{color:#8E9A93;opacity:1}
.nav-item:hover{background:transparent;color:#fff}
.nav-item.active{background:rgba(255,255,255,.08);color:#fff;box-shadow:none}
.nav-item.active .ico{color:#6FC394}
.nav-count,.nav-item.active .nav-count{background:transparent;color:#7E8A84;padding:0;font-weight:500;font-size:11px}
.sidebar-foot{border-top:1px solid rgba(255,255,255,.07);padding-top:14px}
.sf-row{display:flex;align-items:center;gap:10px;padding:0 8px}
.sf-row .profile{flex:1;min-width:0;padding:0;margin:0}
.sf-row .profile:hover{background:transparent}
.profile .avatar{width:34px;height:34px;background:#33433B;color:#DDEBE2;font-size:12px;letter-spacing:.04em}
.profile .pname{font-size:14px;font-weight:600;color:#F4F1EA;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile .pmeta{font-size:12px;color:#7E8A84;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.profile-text{min-width:0}
.logout-form{margin:0;flex-shrink:0}
.sf-out{width:32px;height:32px;border:0;border-radius:8px;background:transparent;color:#7E8A84;display:grid;place-items:center;cursor:pointer}
.sf-out:hover{background:rgba(255,255,255,.07);color:#fff}
.legal-links{display:flex;flex-wrap:nowrap;gap:12px;padding:12px 8px 0;font-size:11px;white-space:nowrap}
.legal-links a{color:#7E8A84;text-decoration:none}
.legal-links a:hover{text-decoration:underline}
.sidebar.collapsed .legal-links{display:none}
.sidebar.collapsed .sf-row{flex-direction:column;padding:0}

/* ---------- v2 dashboard ---------- */
.dv{color:#1F2421}
.dv-head{margin-bottom:36px}
.dv-eyebrow{font-size:11px;font-weight:700;letter-spacing:.18em;text-transform:uppercase;color:#2F7A55}
.dv-head h1{font-family:var(--font-display);font-weight:500;font-size:clamp(38px,5vw,54px);line-height:1.05;margin:10px 0;letter-spacing:-.01em;color:#1F2421}
.dv-head p{margin:0;font-size:15px;color:#6B6F68}
.dv-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(150px,100%),1fr));border-top:1px solid #DFDACF;border-bottom:1px solid #DFDACF;margin-bottom:52px}
.dv-stats a{padding:22px 20px 20px 0;color:#1F2421;text-decoration:none}
.dv-stats a:hover{color:#2F7A55}
.dv-stats b{display:block;font-family:var(--font-display);font-size:48px;font-weight:500;line-height:1}
.dv-stats span{display:block;font-size:13px;color:#6B6F68;margin-top:8px}
.dv-sechead{display:flex;align-items:baseline;justify-content:space-between;gap:16px;margin-bottom:20px}
.dv-sechead h2,.dv-h2{font-family:var(--font-display);font-weight:500;font-size:30px;margin:0;color:#1F2421}
.dv-h2{margin-bottom:18px}
.dv-sechead a{display:inline-flex;align-items:center;gap:6px;color:#2F7A55;font-size:13px;font-weight:600;text-decoration:none}
.dv-books{display:flex;gap:22px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;scrollbar-width:none;padding:30px 2px 6px;margin:-4px -2px 0}
.dv-books::-webkit-scrollbar{display:none}
.dv-books.dragging{scroll-snap-type:none;cursor:grabbing;user-select:none}
@media (hover:hover) and (pointer:fine){.dv-books{cursor:grab}}
.dv-book{flex:0 0 calc((100% - 4 * 22px) / 5);min-width:0;scroll-snap-align:start;color:inherit;text-decoration:none}
.dv-book .cover{width:100%}
.dv-title{font-family:var(--font-display);font-size:18px;font-weight:500;line-height:1.2;margin-top:14px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.dv-author{font-size:13px;color:#6B6F68;margin-top:4px}
.dv-loc{font-size:12px;color:#2F7A55;font-weight:600;margin-top:6px}
.dv-split{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(340px,100%),1fr));gap:28px;margin-top:60px}
.dv-card{background:#FCFBF8;border:1px solid #E4E0D6;border-radius:12px}
.dv-genre{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"n c" "bar bar";align-items:center;gap:8px 16px;padding:10px 0;color:inherit;text-decoration:none}
.dv-genre .n{grid-area:n;display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500}
.dv-genre .n i{width:8px;height:8px;border-radius:2px;flex:none}
.dv-genre .bar{grid-area:bar;height:6px;border-radius:3px;background:#ECE8DF;overflow:hidden}
.dv-genre .bar div{height:100%;border-radius:3px}
.dv-genre .c{grid-area:c;font-size:13px;text-align:right;font-variant-numeric:tabular-nums;color:#6B6F68}
.dv-case{display:block;padding:16px 0;border-bottom:1px solid #EEEAE1;color:#1F2421;text-decoration:none}
.dv-case:last-child{border-bottom:0}
.dv-case .r{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.dv-case .n{font-family:var(--font-display);font-size:21px;font-weight:500}
.dv-case .s{font-size:12px;color:#6B6F68}
.dv-case .bar{height:4px;border-radius:2px;background:#ECE8DF;margin-top:10px;overflow:hidden}
.dv-case .bar div{height:100%;background:#2F7A55}

/* ---------- v2 book detail ---------- */
.bk{color:#1F2421}
.bk-back{display:inline-flex;align-items:center;gap:6px;color:#2F7A55;font-size:13px;font-weight:600;margin-bottom:28px;text-decoration:none}
.bk-back .ico{width:14px;height:14px}
.bk-grid{display:grid;grid-template-columns:minmax(220px,300px) minmax(0,1fr);gap:clamp(32px,5vw,56px);align-items:start}
.bk-side{width:100%}
.bk-cover .cover{width:100%}
.bk-btns{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:22px}
.bk-btn{display:flex;align-items:center;justify-content:center;gap:3px;height:42px;border:1px solid #CFC9BB;border-radius:8px;background:transparent;color:#1F2421;font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap;text-decoration:none}
.bk-btn:hover{border-color:#1F2421}
.bk-btn .ico{width:16px;height:16px}
.bk-btn.primary{background:#2F7A55;border-color:#2F7A55;color:#fff}
.bk-btn.primary:hover{background:#286B4A;border-color:#286B4A}
.bk-loc{display:flex;align-items:center;justify-content:space-between;width:100%;margin-top:14px;padding:16px 18px;border:1px solid #D7E6DC;border-radius:10px;background:#EAF2EC;color:#1F2421;text-decoration:none}
.bk-loc .cap{font-size:10px;font-weight:700;letter-spacing:.16em;text-transform:uppercase;color:#2F7A55}
.bk-loc .val{font-family:var(--font-display);font-size:24px;font-weight:500;margin-top:4px}
.bk-loc .sub{font-size:13px;color:#4A4E48}
.bk-loc>span{color:#2F7A55;display:flex}
.bk-loc.pile{border-color:#E8D9BC;background:#F4ECDD}
.bk-loc.pile .cap,.bk-loc.pile>span{color:#8A5F1E}
.bk-spec{margin-top:22px}
.bk-spec>div{display:flex;justify-content:space-between;gap:16px;padding:11px 0;border-top:1px solid #E4E0D6;font-size:13px}
.bk-spec .k{color:#6B6F68}
.bk-spec .v{font-weight:600;text-align:right}
.bk-copy{display:inline-flex;align-items:center;gap:6px;margin:-6px -8px;padding:6px 8px;border:0;border-radius:6px;background:transparent;color:#1F2421;font:inherit;font-weight:600;cursor:pointer;font-variant-numeric:tabular-nums}
.bk-copy:hover{background:#EFEBE3}
.bk-copy .ok{display:inline-flex;align-items:center;gap:4px;color:#2F7A55;font-size:12px}
.bk-main{min-width:0}
.bk-eyebrow{font-size:11px;font-weight:700;letter-spacing:.18em;text-transform:uppercase;color:#2F7A55}
.bk-title{font-family:var(--font-display);font-weight:500;font-size:clamp(38px,5vw,58px);line-height:1.02;margin:10px 0 12px;text-wrap:balance;color:#1F2421}
.bk-by{font-size:17px;color:#4A4E48}
.bk-by a,.bk-by b{font-weight:600;color:#1F2421;text-decoration:none}
.bk-by a:hover{color:#2F7A55}
.bk-meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:24px;margin:32px 0;padding:20px 0;border-top:1px solid #E4E0D6;border-bottom:1px solid #E4E0D6}
.bk-meta .k{font-size:10px;font-weight:700;letter-spacing:.16em;text-transform:uppercase;color:#9A9C94;margin-bottom:8px}
.bk-status{display:inline-flex;align-items:center;gap:7px;font-size:14px;font-weight:700;color:#1F5C3E;line-height:1}
.bk-status.wish{color:#8A5F1E}
.bk-status svg{flex:none;width:20px;height:20px}
.bk-stars{display:flex;align-items:center;gap:2px;margin-top:-2px}
.bk-stars button{border:0;background:none;padding:10px 3px;margin:-10px 0;font-size:20px;line-height:1;color:#D9D4C8;cursor:pointer}
.bk-stars button.on{color:#D4A04A}
.bk-stars span{font-size:12px;color:#6B6F68;margin-left:8px}
.bk-langs{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px}
.bk-langs span,.bk-langs button{display:inline-flex;align-items:center;gap:7px;font-size:14px;font-weight:600}
.bk-langs i{font-family:'JetBrains Mono',monospace;font-style:normal;font-size:10px;padding:3px 5px;border-radius:4px;background:#E8E4DA;color:#4A4E48}
.bk-added{font-size:14px;font-weight:600}
.bk-h2{font-family:var(--font-display);font-weight:500;font-size:26px;margin:0 0 8px;color:#1F2421}
.bk-syn{margin:0;font-size:15px;line-height:1.6;color:#1F2421;max-width:62ch}
.bk-syn p{margin:0 0 10px}
.bk-syn.empty{color:#6B6F68}
.bk-tags{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin-top:16px}
.bk-tags .lbl{font-size:13px;color:#4A4E48;margin-right:6px;text-decoration:none}
.bk-tags .tag{height:26px;display:inline-flex;align-items:center;padding:0 10px;border-radius:13px;background:#E8E4DA;font-size:12px;font-weight:600;color:#4A4E48}
.bk-also{display:flex;align-items:baseline;justify-content:space-between;gap:16px;margin:44px 0 18px}
.bk-also .bk-h2{margin:0;min-width:0}
.bk-also a{flex-shrink:0;display:inline-flex;align-items:center;gap:6px;color:#2F7A55;font-size:13px;font-weight:600;text-decoration:none}
.bk-more{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(140px,100%),1fr));gap:22px}
.bk-more a{min-width:0;color:inherit;text-decoration:none}
.bk-more .cover{width:100%}
.bk-more .t{font-family:var(--font-display);font-size:17px;font-weight:500;line-height:1.2;margin-top:12px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.bk-more .a{font-size:12px;color:#6B6F68;margin-top:3px}
@media (max-width:760px){.bk-grid{grid-template-columns:1fr}.bk-side{max-width:340px}}
@media (max-width:640px){.bk-meta{grid-template-columns:repeat(2,minmax(0,1fr))}}
.bk-langs.codes{gap:6px}
.bk-share{grid-column:1 / -1}

/* ---------- v2 share modal ---------- */
.add-panel.sh{max-width:700px;background:#FCFBF8;border-radius:14px;box-shadow:0 30px 80px -20px rgba(0,0,0,.45);overflow:hidden}
.sh .add-head{padding:24px 26px 18px;border-bottom:1px solid #E4E0D6}
.sh .add-title{font-family:var(--font-display);font-weight:500;font-size:32px;margin-top:6px;line-height:1.05}
.sh-body{padding:22px 26px 26px}
.sh-row{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;margin:0}
.sh-row b{display:block;font-size:15px;font-weight:600}
.sh-row small{display:block;font-size:13px;color:#6B6F68;margin-top:2px;line-height:1.45}
.ax-switch-like{flex:none;width:44px;height:26px;border:0;border-radius:13px;padding:3px;background:#CFC9BB;display:flex;justify-content:flex-start;cursor:pointer}
.ax-switch-like span{width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25)}
.ax-switch-like.on{background:#2F7A55;justify-content:flex-end}
.sh-url{display:flex;gap:10px;margin-top:18px}
.sh-url code{flex:1;min-width:0;display:flex;align-items:center;height:46px;padding:0 16px;border:1px solid #DCD7CC;border-radius:9px;background:#F3F1EC;font-family:'JetBrains Mono',monospace;font-size:14px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sh-copy{height:46px;padding:0 20px;border:0;border-radius:9px;background:#2F7A55;color:#fff;font:inherit;font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap}
.sh-copy:hover{background:#286B4A}
.sh-exp-head{display:flex;justify-content:space-between;align-items:baseline;margin:22px 0 10px;font-size:14px;font-weight:600}
.sh-exp-head .mut{font-size:13px;font-weight:400;color:#6B6F68}
.sh-pills{display:flex;flex-wrap:wrap;gap:8px}
.sh-pills button{height:36px;padding:0 16px;border:1px solid #DCD7CC;border-radius:8px;background:#fff;color:#1F2421;font:inherit;font-size:14px;font-weight:600;cursor:pointer}
.sh-pills button:hover{border-color:#1F2421}
.sh-pills button.on{background:#1F2421;border-color:#1F2421;color:#fff}
.sh-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-top:22px;padding-top:20px;border-top:1px solid #E4E0D6}
.sh-stats b{display:block;font-family:var(--font-display);font-size:26px;font-weight:500;line-height:1.1}
.sh-stats span{display:block;font-size:13px;color:#6B6F68;margin-top:4px}
.sh-note{margin-top:18px;padding:10px 14px;border-radius:9px;background:#EAF2EC;color:#1F5C3E;font-size:13px;font-weight:600}
.sh-actions{display:flex;flex-wrap:wrap;align-items:center;gap:20px;margin-top:22px}
.sh-actions form{margin:0;display:flex;align-items:center;height:42px}
.sh-open{display:inline-flex;align-items:center;gap:10px;height:42px;padding:0 18px;border:1px solid #CFC9BB;border-radius:8px;background:transparent;color:#1F2421;font-size:14px;font-weight:600;text-decoration:none}
.sh-open:hover{border-color:#1F2421}
.sh-regen{display:inline-flex;align-items:center;gap:6px;border:0;background:none;padding:0;color:#2F7A55;font:inherit;font-size:14px;font-weight:600;line-height:1;cursor:pointer}
.sh-regen svg{flex:none;display:block}
.sh-off{margin:18px 0 0;font-size:13px;line-height:1.55;color:#6B6F68}
.sh-foot{padding:14px 28px;background:#F7F5F0;border-top:1px solid #E4E0D6;font-size:13px;color:#6B6F68}
.sh-foot a{display:inline-flex;align-items:center;gap:4px;vertical-align:bottom;color:#2F7A55;font-weight:600;text-decoration:none}
.sh-foot svg{flex:none}

/* ---------- public shared page ---------- */
.pub-bar{background:#1B2420;color:#C3CBC5;font-size:13px;padding:10px 24px;text-align:center}
.pub-bar a{display:inline-flex;align-items:center;gap:6px;vertical-align:middle;color:#7FC9A1;font-weight:600;text-decoration:none;margin-left:14px}
.pub-head-in{max-width:1160px;margin:0 auto;padding:22px clamp(16px,4.5vw,48px);display:flex;align-items:center;gap:16px}
.pub-actions{margin-left:auto;display:flex;gap:18px;align-items:center}
.pub-actions .in{color:#1F2421;font-size:14px;font-weight:600;text-decoration:none}
.pub-actions .cta{height:38px;padding:0 16px;border-radius:8px;background:#2F7A55;color:#fff;font-size:14px;font-weight:600;display:inline-flex;align-items:center;text-decoration:none}
.pub-actions .cta:hover{background:#286B4A}

/* ---------- confirm dialog ---------- */
.add-panel.cf{max-width:440px;margin-top:12vh;background:#FCFBF8;border-radius:14px;box-shadow:0 30px 80px -20px rgba(0,0,0,.45);overflow:hidden}
.cf-body{padding:28px 28px 22px}
.cf-body .add-title{font-family:var(--font-display);font-weight:500;font-size:32px;line-height:1.1;margin:0}
.cf-body p{margin:12px 0 0;font-size:15px;line-height:1.55;color:#4A4E48}
.cf-body b{color:#1F2421}
.cf-foot{display:flex;justify-content:flex-end;gap:10px;padding:16px 24px;border-top:1px solid #E4E0D6}
.cf-foot .bk-btn{padding:0 20px;height:44px}
.cf-foot .bk-btn:disabled{opacity:.6;cursor:default}

.bk-langs i.flag{background:none;padding:0;font-size:20px;line-height:1;border-radius:0}

/* ---------- v2 catalog cards: title, author, year · pages, location ---------- */
.bc-meta{margin-top:14px}
.bc-title{font-weight:500;font-size:18px;color:#1F2421}
.bc-author{font-size:13px;color:#6B6F68;margin-top:4px}
.bc-info{font-size:12px;color:#9A9C94;margin-top:6px}
.bc-where{font-size:12px;color:#2F7A55;font-weight:600;margin-top:3px}
.bc-where.wish{color:#8A5F1E}
.bc-where.pile{color:#9A9C94}
.dv-loc.pile{color:#9A9C94}

/* "Also on…" thumbnails */
.bk-more{grid-template-columns:repeat(auto-fill,minmax(min(132px,100%),1fr));gap:20px}
.bk-more .cover{padding:12px 11px 11px 15px;border-radius:3px 6px 6px 3px;box-shadow:0 5px 14px rgba(44,62,80,.2)}
.bk-more .cover-pub{font-size:7px;letter-spacing:.18em;margin-left:3px}
.bk-more .cover-rule{margin:7px 0 0 3px;width:28px}
.bk-more .cover-title{font-size:14px;margin-left:3px;line-height:1.05;-webkit-line-clamp:4}
.bk-more .cover-author{font-size:7.5px;margin:7px 0 1px 3px}
.bk-more .cover-emblem{display:none}
.bk-more .t{font-size:16px;margin-top:11px}
.bk-more .a{font-size:12px}

/* ---------- toast (CSS only: auto-hides, or close with ×) ---------- */
.tt-off{position:absolute;opacity:0;pointer-events:none}
.tt-wrap{position:fixed;top:24px;left:50%;transform:translateX(-50%);z-index:300;width:min(440px,calc(100vw - 32px));animation:tt-hide .3s 5s forwards}
.tt-off:checked+.tt-wrap{display:none}
.tt{display:flex;align-items:center;gap:14px;padding:14px 14px 14px 16px;border-radius:12px;background:#FCFBF8;border:1px solid #E4E0D6;border-top:4px solid #2F7A55;box-shadow:0 18px 50px rgba(0,0,0,.28);animation:tt-in .22s cubic-bezier(.2,.9,.3,1.2)}
.tt-ico{flex:none;width:32px;height:32px;border-radius:50%;background:#2F7A55;color:#fff;display:grid;place-items:center;font-size:17px;font-weight:700}
.tt-msg{flex:1;font-size:14.5px;font-weight:600;line-height:1.4;color:#1F2421}
.tt-x{flex:none;width:30px;height:30px;border-radius:8px;color:#6B6F68;font-size:22px;line-height:30px;text-align:center;cursor:pointer}
.tt-x:hover{background:#F0ECE3}
@keyframes tt-in{from{opacity:0;transform:translateY(-10px)}}
@keyframes tt-hide{to{opacity:0;visibility:hidden}}
.bk-copy:focus:not(:focus-visible){outline:none}
button.tt-x{border:0;background:none;padding:0;font-family:inherit}
.bk-textlink{border:0;background:none;padding:0;font:inherit;color:#2F7A55;font-weight:600;cursor:pointer}
.bk-textlink:hover{text-decoration:underline}

/* ---------- v2 edit modal ---------- */
.add-panel.ed{max-width:700px;background:#FCFBF8;border-radius:14px;box-shadow:0 30px 80px -20px rgba(0,0,0,.45);overflow:hidden;font-family:inherit}
.ed-head{display:flex;align-items:flex-start;justify-content:space-between;padding:26px 28px 18px;border-bottom:1px solid #E4E0D6}
.ed-eyebrow{font-size:11px;font-weight:700;letter-spacing:.18em;text-transform:uppercase;color:#2F7A55}
.ed-title{font-family:var(--font-display);font-weight:500;font-size:34px;line-height:1.05;margin:6px 0 0;color:#1F2421}
.ed-x{width:36px;height:36px;border:0;background:none;border-radius:8px;color:#4A4E48;cursor:pointer;display:grid;place-items:center}
.ed-x:hover{background:#F0ECE3}
.ed-x .ico{width:18px;height:18px}
.ed-body{padding:22px 28px 0;display:flex;flex-direction:column;gap:20px}
.ed-f{display:flex;flex-direction:column;gap:7px;min-width:0;position:relative}
.ed-f>label,.ed-f>.ed-lbl{font-size:13px;font-weight:600;color:#1F2421}
.ed-sub{font-weight:400;color:#9A9C94;margin-left:4px}
.ed-hint{font-size:12px;color:#9A9C94}
.ed .ed-f input[type=text],.ed .ed-f input[type=number],.ed .ed-f input[type=date],.ed .ed-f textarea,.ed .ed-select select{width:100%;height:44px;padding:0 13px;border:1px solid #DCD7CC;border-radius:8px;background:#fff;font:inherit;font-size:14px;color:#1F2421;outline:none;box-shadow:none}
.ed .ed-f textarea{height:auto;padding:11px 13px;resize:vertical;min-height:84px}
.ed .ed-f input:focus,.ed .ed-f textarea:focus,.ed .ed-select select:focus,.ed-multi.open{border-color:#2F7A55;box-shadow:0 0 0 3px rgba(47,122,85,.15)}
.ed .ed-f input.changed{border-color:#2F7A55}
.ed-row > .ed-f{min-width:0}
.ed .ed-f input[type=date]{display:block;width:100%;max-width:100%;min-width:0;-webkit-appearance:none;appearance:none;text-align:left}
.ed .ed-f input[type=date]::-webkit-date-and-time-value{text-align:left;min-height:1.2em}
.ed-row{display:grid;gap:16px}
.ed-pub{grid-template-columns:minmax(0,1fr) 130px 130px}
.ed-trio{grid-template-columns:repeat(3,minmax(0,1fr))}
.ed-two{grid-template-columns:repeat(2,minmax(0,1fr))}
.ed-series{grid-template-columns:minmax(0,1fr) 130px}
.ed-select{position:relative}
.ed-select select{appearance:none;-webkit-appearance:none;padding-right:38px!important;cursor:pointer}
.ed-select .ico{position:absolute;right:13px;top:50%;transform:translateY(-50%);width:16px;height:16px;color:#6B6F68;pointer-events:none}
.ed-isbn{display:flex;gap:10px}
.ed-isbn input{flex:1;min-width:0}
.ed-tint{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:44px;padding:0 18px;border:1px solid #9CC5AE;border-radius:8px;background:#EAF2EC;color:#1F5C3E;font:inherit;font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap}
.ed-tint:hover{background:#E0EDE5}
.ed-tint:disabled{opacity:.55;cursor:default}
@media (max-width:560px){.ed-scan span{display:none}.ed-scan{padding:0 14px}}
.scan-overlay{position:fixed;inset:0;z-index:300;background:rgba(16,21,18,.6);display:flex;align-items:center;justify-content:center}
.scan-win{display:flex;flex-direction:column;width:560px;max-width:100%;height:min(560px,100%);border-radius:16px;overflow:hidden;background:#101512;color:#F4F1EA}
.scan-head{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;font-weight:600;font-size:15px}
.scan-head .ed-x{color:#F4F1EA}
.scan-head .ed-x:hover{background:rgba(244,241,234,.16)}
.scan-view{position:relative;flex:1;min-height:0;background:#000}
.scan-view video{width:100%;height:100%;object-fit:cover}
.scan-frame{position:absolute;left:16%;right:16%;top:20%;bottom:20%;border:2px solid #7FC9A1;border-radius:12px;box-shadow:0 0 0 9999px rgba(16,21,18,.45)}
.scan-foot{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 18px;font-size:13px}
@media (max-width:640px){.scan-win{width:100%;height:100%;border-radius:0}}
.ed-showas{display:flex;align-items:center;gap:8px;font-size:12px;color:#6B6F68}
.ed-showas button{height:26px;padding:0 12px;border:1px solid #DCD7CC;border-radius:13px;background:#fff;color:#1F2421;font:inherit;font-size:12px;font-weight:600;cursor:pointer}
.ed-showas button.on{background:#1F2421;border-color:#1F2421;color:#fff}
.ed-multi{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-height:44px;padding:6px 38px 6px 8px;border:1px solid #DCD7CC;border-radius:8px;background:#fff;cursor:pointer}
.ed-multi .ed-caret{position:absolute;right:13px;top:14px;width:16px;height:16px;color:#6B6F68}
.ed-ph{padding:0 5px;color:#9A9C94;font-size:14px}
.ed-chip{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 6px 0 9px;border-radius:6px;background:#E3EFE7;color:#1F5C3E;font-size:13px;font-weight:600}
.ed-chip .flag{font-size:15px;line-height:1}
.ed-chip button{border:0;background:none;color:#1F5C3E;font-size:15px;line-height:1;padding:0 3px;cursor:pointer;opacity:.7}
.ed-chip button:hover{opacity:1}
.ed-menu{position:absolute;left:0;right:0;top:calc(100% - 4px);z-index:20;max-height:320px;overflow:auto;padding:4px;border:1px solid #DCD7CC;border-radius:10px;background:#fff;box-shadow:0 12px 32px rgba(31,36,33,.14)}
.ed-menu button{display:flex;align-items:center;gap:10px;width:100%;height:36px;padding:0 10px;border:0;border-radius:6px;background:transparent;font:inherit;font-size:14px;color:#1F2421;text-align:left;cursor:pointer}
.ed-menu button .flag{font-size:16px}
.ed-menu button svg{margin-left:auto}
.ed-menu button:hover{background:#F3F1EC}
.ed-menu button.on{font-weight:600}
.ed-menu .ed-menu-add{color:#2F7A55;font-weight:600;border-top:1px solid #EEEAE1;border-radius:0;margin-top:4px}
.ed-stars{display:flex;align-items:center;gap:2px}
.ed-stars button{border:0;background:none;padding:2px 3px;font-size:24px;line-height:1;color:#D9D4C8;cursor:pointer}
.ed-stars button.on{color:#D4A04A}
.ed-stars span{font-size:13px;color:#6B6F68;margin-left:10px}
.ed-cover{display:flex;gap:30px;align-items:flex-start}
.ed-cover .cover-upload-area{width:140px;flex:none}
.ed-cover-side{flex:1;min-width:0}
.ed-upload{height:38px;padding:0 16px}
.ed-sw-cap{font-size:12px;font-weight:600;color:rgb(107,111,104);margin:16px 0 6px}
.ed-cover-btns+.ed-sw-cap{margin-top:16px}
.ed-swatches{display:flex;flex-wrap:wrap;gap:8px}
.ed-swatches button{width:20px;height:20px;border:0;border-radius:5px;cursor:pointer;padding:0}
.ed-swatches button.on{box-shadow:0 0 0 2px #FCFBF8,0 0 0 4px #1F2421}
.ed-custom{position:relative;display:inline-block;width:20px;height:20px;cursor:pointer}
.ed-custom span{display:grid;place-items:center;width:20px;height:20px;border-radius:5px;background:conic-gradient(#e24,#fb3,#4c6,#3ae,#a5e,#e24);color:#fff;font-size:13px;font-weight:700;line-height:1}
.ed-custom input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}
.ed-custom span.on{box-shadow:0 0 0 2px #FCFBF8,0 0 0 4px #1F2421}
.ed-divider{height:1px;background:#E4E0D6;margin:0 -28px}
.ed-seg{display:inline-flex;padding:3px;border:1px solid #DCD7CC;border-radius:10px;background:#fff;width:max-content}
.ed-seg button{display:inline-flex;align-items:center;gap:8px;height:36px;padding:0 16px;border:0;border-radius:7px;background:transparent;color:#1F2421;font:inherit;font-size:14px;font-weight:600;cursor:pointer}
.ed-seg button .ico{width:16px;height:16px}
.ed-seg button.on{background:#E3EFE7;color:#1F5C3E}
.ed-foot{display:flex;justify-content:flex-end;gap:10px;padding:16px 28px;margin:4px -28px 0;border-top:1px solid #E4E0D6;background:#FCFBF8;position:sticky;bottom:0}
.ed-cancel{height:44px;padding:0 20px;border:1px solid #CFC9BB;border-radius:8px;background:#fff;color:#1F2421;font:inherit;font-size:14px;font-weight:600;cursor:pointer}
.ed-cancel:hover{border-color:#1F2421}
.ed-save{height:44px;padding:0 22px;border:0;border-radius:8px;background:#2F7A55;color:#fff;font:inherit;font-size:15px;font-weight:600;cursor:pointer}
.ed-save:hover{background:#286B4A}
.ed-save:disabled{opacity:.5;cursor:not-allowed}
@media (max-width:640px){.ed-pub,.ed-trio,.ed-two,.ed-series{grid-template-columns:1fr 1fr}.ed-pub .ed-f:first-child{grid-column:1/-1}.ed-cover{flex-direction:column}}

/* custom selects + multi-selects (edit modal) */
.ed-sel{position:relative}
.ed-selbtn{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;height:44px;padding:0 13px;border:1px solid #DCD7CC;border-radius:8px;background:#fff;color:#1F2421;font:inherit;font-size:14px;text-align:left;cursor:pointer}
.ed-selbtn .ico{width:16px;height:16px;color:#6B6F68;flex:none}
.ed-selbtn.open{border-color:#2F7A55;box-shadow:0 0 0 3px rgba(47,122,85,.15)}
.ed-menu button.on{background:#EEF5F0;font-weight:600}
.ed-menu .dot{width:8px;height:8px;border-radius:2px;flex:none;display:inline-block}
.ed-chip .dot{width:8px;height:8px;border-radius:2px;flex:none}
.ed-check{width:18px;height:18px;flex:none;border:1.5px solid #CFC9BB;border-radius:5px;background:#fff;display:grid;place-items:center}
.ed-check svg{opacity:0}
.ed-check.on{background:#2F7A55;border-color:#2F7A55}
.ed-check.on svg{opacity:1}
.ed-menu button:has(.ed-check) .flag{font-size:16px}
.ed-menu button,.ed-selbtn,.ed-multi{outline:none}
.ed-menu button:focus-visible{background:#F3F1EC}
.ed-menu button:focus:not(:focus-visible){outline:none;box-shadow:none}
.ed-menu .ed-check svg{margin:0;display:block}
.bk-more .cover.cover-img,.bk-cover .cover.cover-img{padding:0}

/* series + tags on book detail */
.bk-block{margin-top:28px;padding-top:24px;border-top:1px solid #E4E0D6}
.bk-block+.bk-block{margin-top:22px;padding-top:0;border-top:0}
.bk-cap{font-size:10px;font-weight:700;letter-spacing:.16em;text-transform:uppercase;color:#9A9C94;margin-bottom:10px}
.bk-series{display:inline-flex;align-items:center;gap:14px;text-decoration:none;color:#1F2421}
.bk-series .ico{width:36px;height:36px;border-radius:9px;background:#EDE9DF;color:#4A4E48;display:grid;place-items:center;flex:none}
.bk-series .n{font-family:var(--font-display);font-size:24px;font-weight:500;line-height:1}
.bk-series .p{font-size:13px;font-weight:700;color:#6B6F68;letter-spacing:.02em}
.bk-series:hover .n{color:#2F7A55}
.bk-taglist{display:flex;flex-wrap:wrap;gap:8px}
.bk-taglist span,.bk-taglist button{display:inline-flex;align-items:center;gap:5px;height:32px;padding:0 14px;border:1px solid #DCD7CC;border-radius:16px;background:#fff;font-size:13px;font-weight:500;color:#1F2421}
.bk-taglist button{font-family:inherit;cursor:pointer;transition:border-color .13s,background .13s}
.bk-taglist button:hover{border-color:#9CC5AE;background:#EAF2EC}
.bk-taglist i{font-style:normal;color:#2F7A55;font-weight:600}
.bk-textlink{text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:3px;text-decoration-color:#2F7A55}

/* ---------- ISBN look-up panel ---------- */
.lk-overlay{position:fixed;inset:0;z-index:310;display:grid;place-items:center;padding:24px;background:rgba(31,36,33,.38)}
.lk-card{width:100%;max-width:420px;border-radius:14px;background:#FCFBF8;box-shadow:0 24px 64px rgba(31,36,33,.28);overflow:hidden}
.lk-head{display:flex;align-items:center;gap:14px;padding:22px 24px 6px}
.lk-badge{display:grid;place-items:center;width:40px;height:40px;flex-shrink:0;border-radius:10px;background:#F3F1EC;color:#4A4E48;font-size:18px;font-weight:700}
.lk-card.is-found .lk-badge{background:#EAF2EC;color:#1F5C3E}
.lk-card.is-none .lk-badge,.lk-card.is-bad .lk-badge{background:#F7EDE9;color:#8A3A3A}
.lk-spin{width:18px;height:18px;border-radius:50%;border:2.5px solid #CFC9BB;border-top-color:#4A4E48;animation:lkSpin .7s linear infinite}
@keyframes lkSpin{to{transform:rotate(360deg)}}
.lk-heading{min-width:0}
.lk-title{font-family:var(--font-display);font-size:24px;font-weight:500;line-height:1.1}
.lk-isbn{font-family:'JetBrains Mono',monospace;font-size:12px;color:#6B6F68;margin-top:3px}
.lk-msg{padding:10px 24px 20px;font-size:14px;line-height:1.5;color:#4A4E48}
.lk-hit{display:flex;align-items:center;gap:16px;margin:0 24px 20px;padding:14px 16px;border:1px solid #E4E0D6;border-radius:10px;background:#fff}
.lk-hit-cover{flex:0 0 auto;width:64px;height:96px;border-radius:3px 5px 5px 3px;overflow:hidden;background:#E4E0D6;box-shadow:0 4px 12px rgba(44,62,80,.22)}
.lk-hit-cover img{display:block;width:100%;height:100%;object-fit:cover}
.lk-hit-text{min-width:0}
.lk-hit-title{font-size:16px;font-weight:600;color:#1F2421}
.lk-hit-author{font-size:13px;color:#4A4E48;margin-top:2px}
.lk-hit-meta{font-size:12px;color:#6B6F68;margin-top:8px}
.lk-foot{display:flex;justify-content:flex-end;gap:10px;padding:14px 24px;border-top:1px solid #E4E0D6;background:#F7F5F0}
.lk-btn{height:38px;padding:0 16px;border:1px solid #CFC9BB;border-radius:8px;background:transparent;color:#1F2421;font:inherit;font-size:14px;font-weight:600;cursor:pointer}
.lk-btn:hover{background:#EFECE4}
.lk-primary{padding:0 18px;border-color:#2F7A55;background:#2F7A55;color:#fff}
.lk-primary:hover{background:#286B4A}

.ed .ed-f .ed-menu-search{position:sticky;top:-4px;z-index:1;display:flex;align-items:center;gap:8px;height:40px;margin:-4px -4px 4px;padding:0 14px;border-bottom:1px solid #DCD7CC;background:#fff;color:#6B6F68;font-size:inherit;font-weight:400}
.ed-menu-search .ico{width:16px;height:16px;flex:0 0 auto}
.ed .ed-f .ed-menu-search input[type=text]{flex:1;width:auto;min-width:0;height:100%;padding:0;border:0;border-radius:0;outline:0;box-shadow:none;background:transparent;font:inherit;font-size:14px;color:#1F2421}
.ed .ed-f .ed-menu-search input[type=text]:focus{border:0;box-shadow:none}
.ed-menu-empty{padding:14px 10px;font-size:13px;color:#6B6F68}

/* ---------- Unsaved-changes prompt (reuses the look-up card) ---------- */
.uc-card{max-width:420px}
.uc-body{padding:24px 24px 20px}
.uc-body .lk-title{font-size:26px}
.uc-msg{margin:10px 0 0;font-size:14px;line-height:1.5;color:#4A4E48}
.uc-discard{border-color:#9A3B33;background:#9A3B33;color:#fff}
.uc-discard:hover{background:#862F28}
.ed-foot .modal-error{flex:1 1 auto;align-self:center;margin:0}

/* ---------- Secondary title ---------- */
.ed .ed-link{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;padding:0;border:0;background:none;color:#2F7A55;font:inherit;font-size:13px;font-weight:600;cursor:pointer}
.ed .ed-link:hover{color:#1F5C3E}
.ed-link .ico{width:14px;height:14px}
.ed-subrow{display:flex;gap:10px}
.ed-subrow input{flex:1;min-width:0}
.ed-trash{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;border:1px solid #E8C9C2;border-radius:8px;background:#FBEFEC;color:#B0443A;cursor:pointer}
.ed-trash:hover{background:#F6E0DA}
.ed-trash .ico{width:18px;height:18px}
.bk-subtitle{margin:-4px 0 12px;font-family:var(--font-display);font-size:clamp(18px,2.2vw,24px);font-style:italic;color:#4A4E48;line-height:1.25}
.lk-hit-sources{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.lk-src{display:inline-flex;align-items:center;height:22px;padding:0 9px;border-radius:11px;background:#EAF2EC;color:#1F5C3E;font-size:11px;font-weight:600}

/* ---------- Public shared book ---------- */
.pb{width:100%;max-width:1160px;margin:0 auto;padding:6px clamp(16px,4.5vw,48px) 96px;color:#1F2421}
.pb-by{display:flex;align-items:center;gap:10px;font-size:13px;color:#6B6F68;margin-bottom:30px}
.pb-by b{color:#1F2421;font-weight:600}
.pb-by .h{color:#9A9C94}
.pb-av{width:28px;height:28px;border-radius:50%;background:#33433B;color:#DDEBE2;font-size:10px;font-weight:700;display:grid;place-items:center}
.pb-grid{display:grid;grid-template-columns:minmax(220px,320px) minmax(0,1fr);gap:clamp(32px,5vw,56px);align-items:start}
.pb-cover .cover{width:100%}
.pb-meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:20px;margin:30px 0 0;padding:22px 0;border-top:1px solid #E4E0D6;border-bottom:1px solid #E4E0D6}
.pb-meta .k{display:block;font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;font-weight:700;color:#9A9C94;margin-bottom:8px}
.pb-meta .v{display:block;font-size:14px;font-weight:600}
.pb-loc{font-size:14px;color:#4A4E48;margin:24px 0 0}
.pb-loc b{color:#2F7A55;font-weight:600}
.pb-btns{display:flex;gap:12px;flex-wrap:wrap;margin-top:22px}
.pb-btn{font-family:inherit;cursor:pointer;display:inline-flex;align-items:center;gap:10px;height:50px;padding:0 24px;border:1px solid #CFC9BB;border-radius:10px;background:transparent;color:#1F2421;font-size:15.5px;font-weight:600;text-decoration:none}
.pb-btn:hover{border-color:#1F2421}
.pb-btn .ico{width:18px;height:18px}
.pb-btn.primary{background:#2F7A55;border-color:#2F7A55;color:#fff}
.pb-btn.primary:hover{background:#286B4A;border-color:#286B4A}
.pb-pop{position:relative}
.pb-pop-panel{position:absolute;z-index:20;top:calc(100% + 14px);left:0;width:340px;max-width:calc(100vw - 32px);padding:24px 24px 22px;background:#fff;border-radius:18px;box-shadow:0 18px 48px rgba(31,36,33,.18),0 2px 8px rgba(31,36,33,.06)}
.pb-pop-panel[hidden]{display:none}
.pb-pop-panel::before{content:"";position:absolute;top:-7px;left:34px;width:14px;height:14px;background:#fff;transform:rotate(45deg);border-radius:3px 0 0 0}
.pb-pop-panel h3{font-family:var(--font-display);font-weight:500;font-size:26px;line-height:1.15;color:#1F2421;margin:0 0 10px}
.pb-pop-panel p{font-size:14px;line-height:1.5;color:#6B6F68;margin:0 0 18px}
.pb-pop-btns{display:flex;gap:10px}
.pb-btn.sm{height:42px;padding:0 18px;font-size:14px;font-weight:700;border-radius:9px}
.pb-btn.sm:not(.primary){background:#fff}
.pb-h2{font-family:var(--font-display);font-weight:500;font-size:30px;color:#1F2421;margin:44px 0 18px}
@media (max-width:760px){.pb-grid{grid-template-columns:minmax(0,1fr)}.pb-cover{max-width:300px}.pb-meta{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* ---------- Public shared library ---------- */
.pl{width:100%;max-width:1160px;margin:0 auto;padding:10px clamp(16px,4.5vw,48px) 96px;color:#1F2421}
.pl-head{display:flex;align-items:center;gap:22px;margin-bottom:34px}
.pl-av{flex:none;width:100px;height:100px;border-radius:50%;background:#33433B;color:#DDEBE2;font-family:var(--font-display);font-size:34px;font-weight:600;display:grid;place-items:center}
.pl-handle{font-size:11.5px;letter-spacing:.18em;text-transform:uppercase;font-weight:700;color:#2F7A55}
.pl-title{font-family:var(--font-display);font-weight:500;font-size:clamp(38px,5vw,54px);line-height:1.05;margin:4px 0 6px;color:#1F2421}
.pl-sub{font-size:15px;color:#6B6F68}
@media (max-width:640px){.pl-av{width:68px;height:68px;font-size:24px}.pl-head{gap:14px}}
.book-list--pub .list-head,.book-list--pub .list-row{grid-template-columns:24px minmax(0,2.6fr) minmax(0,1.5fr) minmax(0,1.5fr) 56px 92px}
.book-list--pub .list-row{cursor:default}
.pl .toolbar{margin-top:0}

.settings-slug { display: flex; align-items: center; height: 44px; border: 1px solid var(--light-grey); border-radius: 8px; background: #fff; overflow: hidden; }
.settings-slug:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.settings-slug span { padding-left: 12px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.settings-form .fld .settings-slug input, .settings-form .fld .settings-slug input:focus { flex: 1; width: auto; min-width: 0; height: 100%; border: 0; border-radius: 0; box-shadow: none; outline: none; background: transparent; font-family: 'JetBrains Mono', monospace; font-size: 12px; padding: 0 12px 0 1px; }
.settings-pub { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; border-top: 1px solid var(--extra-light); }
.settings-pub b { display: block; font-size: 14px; color: var(--text-strong); }
.settings-pub small { font-size: 13px; color: var(--text-muted); }
.settings-pub small a { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.settings-pub small a:hover { text-decoration: underline; }
.settings-sw { position: relative; flex-shrink: 0; width: 42px; height: 24px; cursor: pointer; }
.settings-sw input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.settings-sw span { position: absolute; inset: 0; border-radius: 12px; background: var(--light-grey); transition: background .15s; }
.settings-sw span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.settings-sw input:checked + span { background: var(--primary); }
.settings-sw input:checked + span::after { transform: translateX(18px); }
.settings-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 9px 12px; border-radius: 8px; background: var(--extra-light); font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.settings-note .ico { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.settings-note b { color: var(--text-strong); font-family: 'JetBrains Mono', monospace; font-weight: 500; font-size: 11px; }
.settings-note.is-pending { background: rgba(230, 126, 34, .10); color: #8A4B14; }
.settings-note.is-pending b { color: #8A4B14; }
.settings-slug.is-disabled { background: var(--extra-light); }
.settings-slug.is-disabled span, .settings-form .fld .settings-slug.is-disabled input { color: var(--text-faint); cursor: not-allowed; }
.settings-slug.is-error, .settings-slug.is-error:focus-within { border-color: var(--error); box-shadow: 0 0 0 3px rgba(192, 57, 43, .12); }
.settings-section[id] { scroll-margin-top: 24px; }
.settings-initials { position: relative; }
.settings-form .fld .settings-initials input { padding-right: 56px; }
.settings-av { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 50%; background: #33433B; color: #DDEBE2; font-size: 11px; font-weight: 700; letter-spacing: .04em; display: grid; place-items: center; pointer-events: none; }

/* Settings: bookcases */
.bc-list { border-top: 1px solid #E4E0D6; }
.bc-row { padding: 18px 0; border-bottom: 1px solid #E4E0D6; }
.bc-row-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bc-row-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.bc-row-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text-strong); line-height: 1.1; }
.bc-row-count { font-size: 12.5px; color: var(--text-faint); }
.bc-row-actions { display: flex; gap: 16px; flex-shrink: 0; }
.bc-row-actions button { font-size: 13px; font-weight: 600; color: var(--text-faint); }
.bc-row-actions button:hover { color: var(--text-strong); }
.bc-row-actions button:last-child:not(.is-primary):hover { color: var(--error); }
.bc-row-actions .is-primary { color: var(--primary-dark); }
.settings-shelves { gap: 8px; margin: 0; padding: 0; border-top: 0; }
.settings-shelf-chip { cursor: grab; }
.bc-add { margin-top: 18px; }
.bc-add .settings-inline-input { padding: 11px 14px; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.tt-err{border-top-color:#C0392B}.tt-err .tt-ico{background:#C0392B}

/* Settings: shared links */
.sl-tabs { display: inline-flex; gap: 2px; padding: 4px; margin-bottom: 18px; border-radius: 12px; background: #EDE9DE; }
.sl-tabs button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: #6B6F68; }
.sl-tabs button i { font-style: normal; font-weight: 500; font-size: 12px; color: #9A9C94; }
.sl-tabs button.on { background: #fff; color: #1F2421; box-shadow: 0 1px 3px rgba(31,36,33,.12); }
.sl-tabs button.on i { color: #6B6F68; }
.sl-row { display: flex; align-items: flex-start; gap: 14px; }
.sl-row .sl-actions { align-self: center; flex: none; }
.sl-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; background: #E6EFE9; color: #2F7A55; display: grid; place-items: center; }
.sl-ico .ico { width: 19px; height: 19px; }
.sl-main { flex: 1; min-width: 0; }
.sl-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sl-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--text-strong); line-height: 1.15; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-state { flex: none; }
.sl-state { font-size: 11.5px; font-weight: 700; color: #8A4B14; background: rgba(230,126,34,.12); padding: 2px 8px; border-radius: 10px; }
.sl-url { margin-top: 5px; font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 500; color: var(--text-body); overflow-wrap: anywhere; }
.sl-meta { margin-top: 3px; font-size: 12.5px; color: var(--text-faint); }
.sl-actions { gap: 18px; }
.sl-actions form { margin: 0; display: inline-flex; }
.sl-empty { font-size: 14px; color: var(--text-muted); padding: 8px 0 0; }
@media (max-width: 760px) { .sl-row { flex-wrap: wrap; } .sl-actions { margin-left: 54px; } }
.sl-actions button:last-child:not(.is-primary):hover { color: var(--text-strong); }
.sl-actions .sl-revoke button:hover { color: var(--error); }
#shared-links .pager { margin-top: 0; padding-top: 20px; border-top: 0; }

/* Settings: import dropzone */
.imp-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.imp-drop { display: grid; place-items: center; min-height: 128px; padding: 24px; border: 1px dashed #CFC9BB; border-radius: 14px; background: #F5F3EE; text-align: center; transition: background .15s, border-color .15s; }
.imp-drop.over { border-color: var(--primary); background: var(--primary-tint); }
.imp-drop { cursor: pointer; }
.imp-drop:hover:not(.busy) { border-color: #B9B3A3; }
.imp-drop.attn { border-color: var(--primary); background: var(--primary-tint); box-shadow: 0 0 0 3px var(--primary-tint); }
.imp-drop:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.imp-drop.busy { opacity: .7; cursor: progress; }
.imp-lead { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--text-strong); }
.imp-browse { font: inherit; font-weight: 600; color: var(--primary); }
.imp-drop:hover .imp-browse { text-decoration: underline; }
.imp-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--text-faint); }
.imp-file-name { font-size: 15px; font-weight: 700; color: var(--text-strong); overflow-wrap: anywhere; }
.imp-file-actions { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }
.imp-clear { font-size: 13px; font-weight: 600; color: var(--text-faint); }
.imp-clear:hover { color: var(--text-strong); }

/* Import: match columns modal */
.imp-overlay { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 24px; background: rgba(31,36,33,.45); }
.imp-modal { display: flex; flex-direction: column; width: min(1060px, 100%); max-height: min(88vh, 760px); border-radius: 18px; background: #FCFBF8; border: 1px solid #E4E0D6; box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; }
.imp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 28px 32px 18px; }
.imp-title { margin: 0; font-family: var(--font-display); font-size: 32px; font-weight: 600; line-height: 1.1; color: #1F2421; }
.imp-sub { margin: 8px 0 14px; font-size: 13.5px; line-height: 1.5; color: #6B6F68; }
.imp-sub code { font-family: 'JetBrains Mono', monospace; font-size: 12.5px; font-weight: 500; color: #1F2421; overflow-wrap: anywhere; }
.imp-check { font-size: 13.5px; }
.imp-scroll { flex: 1; min-height: 0; overflow: auto; border-top: 1px solid #E4E0D6; border-bottom: 1px solid #E4E0D6; background: #fff; }
.imp-table { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; }
.imp-table th, .imp-table td { min-width: 150px; max-width: 220px; padding: 0 14px; border-right: 1px solid #ECE8DE; text-align: left; }
.imp-table thead th { position: sticky; top: 0; z-index: 2; padding: 12px 10px 10px; background: #F5F3EE; border-bottom: 1px solid #E4E0D6; font-weight: 400; vertical-align: top; }
.imp-table .imp-n { position: sticky; left: 0; z-index: 1; min-width: 40px; max-width: 40px; width: 40px; padding: 0; text-align: center; background: #F5F3EE; font-family: 'JetBrains Mono', monospace; font-size: 11px; color: #9A9C94; }
.imp-table thead .imp-n { z-index: 3; }
.imp-table td { height: 36px; border-bottom: 1px solid #ECE8DE; color: #1F2421; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp-table td.off { color: #B8B8AE; }
.imp-sel { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; height: 38px; padding: 0 11px 0 12px; border-radius: 9px; border: 1px solid #DCD7CC; background: #FCFBF8; font-size: 13.5px; font-weight: 500; color: #8A8D85; text-align: left; cursor: pointer; }
.imp-sel span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-sel svg { flex: none; transition: transform .15s; }
.imp-sel.open svg { transform: rotate(180deg); }
.imp-table th.on .imp-sel, .imp-sel.open { background: #E6EFE9; border-color: #2F7A55; color: #1F2421; font-weight: 600; }
.imp-sel.open { box-shadow: 0 0 0 3px rgba(47,122,85,.15); }
.imp-menu { position: fixed; z-index: 400; overflow-y: auto; padding: 6px; border-radius: 12px; border: 1px solid #C9DCCF; background: #EEF4F0; box-shadow: 0 18px 44px rgba(31,36,33,.25); scrollbar-width: thin; scrollbar-color: #9DB5A5 transparent; }
.imp-opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #1F2421; text-align: left; cursor: pointer; }
.imp-opt:hover { background: #DCE9E1; }
.imp-opt.sel { background: #D9E8DE; font-weight: 600; }
.imp-skip { color: #6B6F68; }
.imp-sep { height: 1px; margin: 6px 8px; background: #CFE0D5; }
.imp-tick { flex: none; color: #2F7A55; }
.imp-opt-c { flex: none; font-size: 11.5px; font-weight: 500; color: #7E8A84; }

.imp-col { display: block; margin-top: 6px; font-size: 11.5px; color: #8A8D85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.imp-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 32px; }
.imp-note { margin: 0; font-size: 13px; color: #6B6F68; }
.imp-note.warn { color: #9A3B33; font-weight: 600; }
.imp-foot-btns { display: flex; gap: 10px; }
.imp-foot-btns .sl-btn, .imp-foot-btns .btn { height: 44px; padding: 0 20px; }
.imp-progress { flex: 1; min-width: 220px; }
.imp-bar { height: 6px; margin-top: 8px; border-radius: 3px; background: #E4E0D6; overflow: hidden; }
.imp-bar i { display: block; height: 100%; border-radius: 3px; background: var(--primary); transition: width .2s; }
.imp-foot-btns .sl-btn:disabled { opacity: .5; cursor: not-allowed; }
.imp-result { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--primary-tint); }
.imp-result-head { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--primary-dark); }
.imp-result-head .ico { width: 15px; height: 15px; flex: none; }
.imp-result-line { margin: 6px 0 0; font-size: 13px; color: var(--text-body); }
.imp-result-errors { margin: 8px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--error); }

/* "Imported" tag until the book is first opened */
.book-cell { position: relative; }
.new-tag { position: absolute; top: 10px; left: 10px; z-index: 3; padding: 3px 9px; border-radius: 999px; background: #2F7A55; color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; box-shadow: 0 2px 6px rgba(31,36,33,.25); pointer-events: none; }
.new-tag.inline { position: static; display: inline-block; margin-left: 8px; vertical-align: middle; box-shadow: none; }

/* Settings: interface language cards */
.lang-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lang-cards form { margin: 0; }
.lang-card { display: flex; align-items: center; gap: 16px; width: 100%; padding: 18px 20px; border-radius: 12px; border: 1px solid #DCD7CC; background: #fff; text-align: left; cursor: pointer; transition: background .15s, border-color .15s; }
.lang-card:hover { border-color: #B9B3A3; }
.lang-card.on { background: #F1F6F2; border-color: #2F7A55; }
.lang-card-flag { flex: none; width: 40px; height: 40px; border-radius: 10px; overflow: hidden; box-shadow: 0 0 0 1px rgba(31,36,33,.12); }
.lang-card-flag svg { display: block; width: 100%; height: 100%; }
.lang-card-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lang-card-text b { font-size: 14.5px; font-weight: 700; color: #1F2421; }
.lang-card-text small { font-size: 12.5px; color: #8A8D85; }
.lang-card-radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #CFC9BB; background: #fff; position: relative; }
.lang-card.on .lang-card-radio { border-color: #2F7A55; background: #2F7A55; }
.lang-card.on .lang-card-radio::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
@media (max-width: 560px) { .lang-cards { grid-template-columns: 1fr; } }
/* Live typographic preview inside the book form's cover area */
.cover-live{position:absolute;inset:0;width:100%;height:100%;aspect-ratio:auto;border-radius:0;box-shadow:none;background:transparent}
.cover-live::before,.cover-live::after{display:none}
/* Hover flip to the spine in the book form */
.ed-book{perspective:900px;flex:none;width:140px;margin-left:12px}
.ed-book .book3d .cover-upload-area{width:100%}
.ed-book:hover .book3d{transform:translateX(calc(var(--spine-d) * .6)) rotateY(28deg)}
@media (hover:none),(prefers-reduced-motion:reduce){.ed-book:hover .book3d{transform:none}}
.ed-cover-btns{display:flex;gap:10px;flex-wrap:wrap}
.ed-outline{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:38px;padding:0 16px;border:1px solid #9CC5AE;border-radius:8px;background:#fff;color:#6B6F68;font:inherit;font-size:14px;font-weight:600;cursor:pointer;white-space:nowrap;border-color:#DCD7CC}
.ed-outline:hover{border-color:#C9A3A3;background:#FBF3F3;color:#8C3B3B}
/* Tags in the book form */
.ed .tag.modal-tag{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 4px 0 11px;border-radius:14px;background:rgb(232,228,218);font-size:12px;font-weight:600;color:rgb(74,78,72)}
.ed .tag.modal-tag:hover{background:#fdecea;color:var(--error)}
.ed .tag.modal-tag .ico{box-sizing:border-box;width:20px;height:20px;padding:5px;border-radius:50%;background:transparent;color:rgb(107,111,104);opacity:1;flex-shrink:0}
.ed .tag.modal-tag:hover .ico{color:var(--error)}
.ed-outline .ico{width:16px;height:16px}
/* Book detail: values that open the search with a filter */
.bk-find{padding:0;border:0;background:none;font:inherit;letter-spacing:inherit;text-transform:inherit;color:inherit;cursor:pointer;text-align:left}
.bk-find:hover{text-decoration:underline;text-decoration-thickness:1.5px;text-underline-offset:3px}
/* Search: one chip per key:value filter in the query */
.search-chips{display:flex;flex-wrap:wrap;gap:8px;padding:12px 18px;border-bottom:1px solid var(--extra-light)}
.search-chip{display:inline-flex;align-items:center;gap:8px;height:28px;padding:0 6px 0 12px;border-radius:14px;background:#E3EFE7;color:#1F5C3E;font-family:'JetBrains Mono',monospace;font-size:12px;font-weight:600}
.search-chip.neg{background:#F6E4E1;color:#8A3A3A}
.search-chip button{display:grid;place-items:center;width:18px;height:18px;padding:0;border:0;border-radius:50%;background:transparent;color:inherit;cursor:pointer;opacity:.7}
.search-chip button:hover{opacity:1;background:rgba(0,0,0,.08)}

/* ---------- Site banners (announcement, impersonation) ---------- */
.site-banner { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 20px; font-size: 13.5px; background: #E6EFE9; color: #1F4A35; border-bottom: 1px solid #D3E2D8; }
.site-banner.impersonating { background: #FBEBD7; color: #7A3F0E; border-bottom-color: #F1D5B0; }
.site-banner form { margin: 0; }
.site-banner button { font: inherit; font-weight: 700; text-decoration: underline; color: inherit; cursor: pointer; }

/* ---------- Admin area ---------- */
.adm .page-head { margin-bottom: 18px; }
.adm-nav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 26px; border-bottom: 1px solid #E4E0D6; }
.adm-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; margin-bottom: -1px; font-size: 14px; font-weight: 600; color: var(--text-muted); text-decoration: none; border-bottom: 2px solid transparent; }
.adm-nav a:hover { color: var(--text-strong); }
.adm-nav a.on { color: var(--primary-dark); border-bottom-color: var(--primary); }
.adm-nav i { font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--warning); color: #fff; }

.adm-alert { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 14px 18px; margin-bottom: 22px; border-radius: 12px; background: rgba(230,126,34,.10); border: 1px solid rgba(230,126,34,.28); color: #7A3F0E; font-size: 14px; }
.adm-alert a { font-weight: 700; color: inherit; text-decoration: underline; }
.adm-stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 22px; }
.adm-stats .stat-value { font-size: 34px; }
.adm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.adm-wide { grid-column: 1 / -1; }
.adm-card { padding: 22px 24px 24px; }
.adm-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.adm-card-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--text-strong); }
.adm-card-head a { font-size: 13px; font-weight: 600; color: var(--primary-dark); text-decoration: none; }
.adm-sub { display: block; font-size: 12.5px; color: var(--text-faint); }
.adm-lead { font-size: 14px; color: var(--text-muted); margin-bottom: 16px; }
.adm-mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-body); }
.adm-back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: 13.5px; font-weight: 600; color: var(--text-muted); text-decoration: none; }
.adm-back .ico { width: 14px; height: 14px; }

.adm-bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.adm-bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.adm-bar i { display: block; width: 100%; border-radius: 3px 3px 0 0; background: var(--primary); opacity: .85; }
.adm-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-faint); }
.adm-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n c" "bar bar"; align-items: baseline; gap: 6px 12px; padding: 8px 0; font-size: 13.5px; }
.adm-meter > span { grid-area: n; min-width: 0; color: var(--text-body); }
.adm-meter > div { grid-area: bar; height: 8px; border-radius: 4px; background: var(--extra-light); overflow: hidden; }
.adm-meter i { display: block; height: 100%; border-radius: 4px; }
.adm-meter b { grid-area: c; text-align: right; font-weight: 600; color: var(--text-muted); }

.adm-person { display: flex; align-items: center; gap: 12px; padding: 7px 0; text-decoration: none; color: inherit; }
.adm-person > span:nth-child(2) { flex: 1; min-width: 0; }
.adm-person b { display: block; font-weight: 600; color: var(--text-strong); }
.adm-person .avatar { width: 34px; height: 34px; font-size: 12px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; }
.adm-entry { display: flex; gap: 12px; padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--extra-light); }
.adm-entry:last-child { border-bottom: 0; }
.adm-entry-dot { flex: none; width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: var(--mid-grey); }
.adm-g-users { background: var(--primary); } .adm-g-content { background: var(--info); } .adm-g-lists { background: #6C5B7B; } .adm-g-site { background: var(--warning); }

.adm-chip { display: inline-block; font-style: normal; font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 10px; margin-right: 4px; background: var(--extra-light); color: var(--mid-grey); }
.adm-chip.ok { background: var(--primary-tint); color: var(--primary-dark); }
.adm-chip.warn { background: rgba(230,126,34,.13); color: #8A4B14; }
.adm-chip.off { background: rgba(192,57,43,.12); color: var(--error); }
.adm-chip.admin { background: rgba(41,128,185,.12); color: var(--info); }

.adm-bar-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.adm-tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 12px; background: #EDE9DE; flex-wrap: wrap; }
.adm-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: #6B6F68; text-decoration: none; }
.adm-tabs a i { font-style: normal; font-weight: 500; font-size: 12px; color: #9A9C94; }
.adm-tabs a.on { background: #fff; color: #1F2421; box-shadow: 0 1px 3px rgba(31,36,33,.12); }
.adm-search input, .adm textarea { padding: 9px 13px; border-radius: 9px; border: 1px solid var(--light-grey); font: inherit; font-size: 14px; background: #fff; color: var(--text-strong); }
.adm-search input { width: 280px; max-width: 100%; }
.adm-search input:focus, .adm textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.adm textarea { width: 100%; resize: vertical; }

.adm-listwrap { overflow: hidden; }
.adm-list { display: flex; flex-direction: column; font-size: 14px; }
.adm-lh, .adm-lr { display: grid; grid-template-columns: var(--cols); align-items: center; gap: 0 18px; padding: 0 20px; }
.adm-lh { padding-top: 12px; padding-bottom: 12px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--extra-light); }
.adm-lr { padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--extra-light); }
.adm-lr:last-child { border-bottom: 0; }
.adm-lr:hover { background: #FBFAF6; }
.adm-lr > div { min-width: 0; }
.adm-lr b { font-weight: 600; color: var(--text-strong); }
.adm-lr a { color: inherit; text-decoration: none; }
.adm-empty { text-align: center; color: var(--text-muted); padding: 28px 18px; }
.adm-rowacts { display: flex; gap: 16px; justify-content: flex-end; white-space: nowrap; }
.adm-rowacts form { margin: 0; }
.adm-rowacts button { font-size: 13px; font-weight: 600; color: var(--text-faint); cursor: pointer; }
.adm-rowacts button:hover { color: var(--text-strong); }
.adm-rowacts button.adm-danger:hover, .adm-danger:hover { color: var(--error); }
.adm-pager { margin-top: 20px; padding-top: 0; border-top: 0; }
a.pager-btn { text-decoration: none; }

.adm-facts { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 14px; }
.adm-facts dt { color: var(--text-faint); font-weight: 600; }
.adm-facts dd { color: var(--text-strong); overflow-wrap: anywhere; }
.adm-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.adm-actions form { margin: 0; }
.adm-actions .btn:disabled { opacity: .5; cursor: not-allowed; }
.adm-check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: 14px; }
.adm-check input { margin-top: 4px; width: 17px; height: 17px; accent-color: var(--primary); }
.adm-check b { display: block; font-weight: 600; color: var(--text-strong); }
.adm-lists { max-width: 720px; }

@media (max-width: 900px) {
  .adm-stats { grid-template-columns: repeat(2, 1fr); }
  .adm-grid { grid-template-columns: 1fr; }
  .adm-facts { grid-template-columns: 1fr; gap: 2px 0; }
  .adm-facts dd { margin-bottom: 8px; }
}
.adm-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.adm-tools form { margin: 0; }
.adm-tools a.btn { text-decoration: none; }
.adm-inline { display: flex; align-items: center; gap: 12px; margin: 0; }
.adm-inline input { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--light-grey); font: inherit; font-size: 14px; min-width: 220px; }
.adm-inline button { font-size: 13px; font-weight: 600; color: var(--text-faint); cursor: pointer; }
.adm-inline .is-primary { color: var(--primary-dark); }
.adm-mail { padding-bottom: 18px; border-bottom: 1px solid var(--extra-light); display: flex; flex-direction: column; gap: 12px; }
.adm-mail h3 { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.adm-mail input, .adm-mail textarea { width: 100%; }
.adm-dup { margin-bottom: 14px; }
.adm-dup-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 9px 0; border-top: 1px solid var(--extra-light); margin: 0; }
.adm-dup-row b { font-weight: 600; color: var(--text-strong); }
.adm-legal { gap: 18px; }
.adm-legal .adm-card { display: flex; flex-direction: column; gap: 14px; }
.adm-legal .adm-card-head { margin-bottom: 0; }
.adm-block { display: flex; flex-direction: column; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--extra-light); }
.adm-rowline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm-rowline > input[type=text] { flex: 1; min-width: 160px; }
.adm-legal input[type=text], .adm-legal input[type=email], .adm-legal select, .adm-legal textarea { width: 100%; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--light-grey); font: inherit; font-size: 14px; background: #fff; color: var(--text-strong); }
.adm-rowline select { width: auto; }
.adm-ph { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.adm-ph input { width: auto; accent-color: var(--primary); }
.adm-order { display: inline-flex; gap: 4px; }
.adm-order button { width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--light-grey); background: #fff; color: var(--text-muted); cursor: pointer; font-size: 13px; }
.adm-order button:hover { border-color: var(--mid-grey); color: var(--text-strong); }
.adm-savebar { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg-main) 40%); }
.adm-legal .btn.sm { align-self: flex-start; }

/* Content tab */
.adm-lead { max-width: 70ch; }
.adm-filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; min-height: 34px; }
.adm-seg { display: inline-flex; border: 1px solid var(--light-grey); border-radius: 9px; overflow: hidden; background: #fff; }
.adm-seg a { padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--text-muted); text-decoration: none; border-left: 1px solid var(--light-grey); }
.adm-seg a:first-child { border-left: 0; }
.adm-seg a:hover { color: var(--text-strong); }
.adm-seg a.on { background: var(--primary-tint); color: var(--primary-dark); }
.adm-filterchip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; border-radius: 16px; background: var(--primary-tint); color: var(--primary-dark); font-size: 13px; }
.adm-filterchip a { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: inherit; text-decoration: none; font-size: 11px; }
.adm-filterchip a:hover { background: rgba(47,122,85,.18); }
.adm-count { margin-left: auto; font-size: 13px; color: var(--text-faint); }
.adm-nowrap { white-space: nowrap; }
.adm-book { display: flex; align-items: center; gap: 12px; min-width: 0; }
.adm-swatch { flex: none; width: 8px; height: 38px; border-radius: 2px 3px 3px 2px; box-shadow: inset -2px 0 0 rgba(0,0,0,.18); }
.adm-book-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-book-main b, .adm-book-main .adm-sub { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-lr a.adm-owner { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.adm-lr a.adm-owner:hover { color: var(--primary-dark); }
.adm-owner .avatar { width: 24px; height: 24px; font-size: 10px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; }
.adm-lr .adm-sub { margin-top: 2px; }
.adm-lr .adm-chip + .adm-sub { margin-top: 4px; }
@media (max-width: 900px) {
  .adm-lh { display: none; }
  .adm-lr { grid-template-columns: 1fr; gap: 6px 0; padding: 14px 18px; }
  .adm-lr .adm-rowacts { justify-content: flex-start; margin-top: 4px; }
}
@media (max-width: 760px) { .adm-count { margin-left: 0; } .adm-book-main b, .adm-book-main .adm-sub { max-width: 200px; } }
.adm-selects { display: contents; }
.adm-sel { display: inline-flex; align-items: center; gap: 8px; }
.adm-sel-cap { font-size: 13px; color: var(--text-faint); }
.adm-sel .ed-sel { min-width: 150px; max-width: 220px; }
.adm-sel .ed-selbtn { height: 36px; padding: 0 11px; border-radius: 9px; font-size: 13px; font-weight: 600; }
.adm-sel .ed-selbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-sel .ed-menu { right: auto; min-width: 100%; width: max-content; max-width: 300px; max-height: 280px; top: calc(100% + 4px); }
.adm-sel .ed-menu button { height: 34px; font-size: 13px; }
.adm-clear { font-size: 13px; font-weight: 600; color: var(--primary-dark); text-decoration: none; }
.adm-clear:hover { text-decoration: underline; }
.adm-filters .adm-count { margin-left: auto; }
.adm-grid + .adm-grid { margin-top: 18px; }
.adm-grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
@media (max-width: 1100px) { .adm-grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .adm-grid3 { grid-template-columns: 1fr; } }

/* Language flags (SVG files in public/flags) */
.flag-img { display: inline-block; width: 1.3em; height: .975em; object-fit: cover; border-radius: 2px; box-shadow: 0 0 0 1px rgba(31,36,33,.14); vertical-align: -.12em; flex: none; }
.flag, .input-flag { display: inline-flex; align-items: center; justify-content: center; }
.lang-badge .flag .flag-img { width: 15px; height: 11px; }
.detail-statitem .lang-badge .flag .flag-img { width: 17px; height: 13px; }
.bk-langs i.flag .flag-img { width: 24px; height: 18px; border-radius: 3px; }
.input-flag-wrap .input-flag .flag-img { width: 22px; height: 16px; }
.ed-chip .flag .flag-img { width: 18px; height: 13px; }
.ed-menu button .flag .flag-img { width: 20px; height: 15px; }
.adm-flagcell { width: 26px; display: inline-flex; justify-content: center; flex: none; }
.adm-flagcell .flag-img { width: 22px; height: 16px; }
.adm-usage { margin-left: auto; margin-right: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-muted); background: var(--extra-light); padding: 2px 10px; border-radius: 10px; white-space: nowrap; flex: none; }
.adm-usage.zero { color: var(--text-faint); background: transparent; font-weight: 500; }

/* Lists page rows */
.adm-grip { color: var(--text-faint); cursor: grab; display: flex; }
.adm-grip .ico { width: 16px; height: 16px; }
.adm-lr[draggable="true"]:active { cursor: grabbing; }
.adm-namecell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-namecell b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; }
.adm-zero { color: var(--text-faint); }
.adm-colorpick { width: 36px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--light-grey); background: #fff; cursor: pointer; flex: none; }
.adm-inline .adm-flagcell { flex: none; }
.adm-lr .adm-inline { gap: 8px; }
.adm-lr .adm-inline input[type=text] { flex: 1; min-width: 0; }
.adm-inline input.adm-colorpick, .adm-addrow input.adm-colorpick { width: 36px; height: 36px; min-width: 0; flex: none; padding: 2px; }

/* Admin: edit book */
.adm-editform { grid-template-columns: 1fr 1fr; }
.adm-editform .fld input[type=text], .adm-editform .fld input[type=number], .adm-editform .fld textarea { width: 100%; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--light-grey); font: inherit; font-size: 14px; background: #fff; color: var(--text-strong); }
.adm-editform .fld input:focus, .adm-editform .fld textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.adm-formerrors { padding: 10px 14px; border-radius: 9px; background: rgba(192,57,43,.08); color: var(--error); font-size: 13px; font-weight: 600; }
.adm-chips { display: flex; flex-wrap: wrap; gap: 6px; max-height: 150px; overflow: auto; padding: 2px; }
.adm-chips button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 15px; border: 1px solid var(--light-grey); background: #fff; font: inherit; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.adm-chips button:hover { border-color: var(--mid-grey); }
.adm-chips button.on { background: var(--primary-tint); border-color: var(--primary); color: var(--primary-dark); font-weight: 600; }
.adm-chips .flag .flag-img { width: 16px; height: 12px; }
@media (max-width: 640px) { .adm-editform { grid-template-columns: 1fr; } }
.adm-sharedhint { padding: 10px 14px; border-radius: 9px; background: rgba(41,128,185,.10); color: #1f5f8b; font-size: 13px; }

/* "Already in BiblioIndex" suggestions under the title */
.ed-suggest { border: 1px solid #DCD7CC; border-radius: 10px; background: #fff; padding: 4px; box-shadow: 0 8px 22px rgba(31,36,33,.08); }
.ed-suggest-h { padding: 8px 10px 4px; font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: #6B6F68; }
.ed-suggest-h span { text-transform: none; letter-spacing: 0; font-weight: 500; color: #9A9C94; }
.ed-suggest-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.ed-suggest-row:hover { background: #F3F1EC; }
.ed-suggest-cover { flex: none; width: 30px; height: 44px; border-radius: 2px 3px 3px 2px; background: #E4E0D6; overflow: hidden; }
.ed-suggest-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ed-suggest-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ed-suggest-main b { font-size: 14px; font-weight: 600; color: #1F2421; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-suggest-main small { font-size: 12.5px; color: #6B6F68; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-suggest-use { flex: none; font-size: 13px; font-weight: 600; color: #2F7A55; }

/* Admin: user page */
.adm-userhead { display: flex; align-items: center; gap: 20px; padding: 22px 26px; margin-bottom: 18px; flex-wrap: wrap; }
.adm-userhead-av { width: 68px; height: 68px; font-size: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; }
.adm-userhead-main { flex: 1; min-width: 220px; }
.adm-userhead-main h2 { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.1; color: var(--text-strong); }
.adm-userhead-mail { margin-top: 3px; font-size: 14px; color: var(--text-muted); overflow-wrap: anywhere; }
.adm-userhead-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.adm-userhead-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.adm-userhead-actions form { margin: 0; }
.adm-alert form { margin: 0; }
.adm-linkbtn { font: inherit; font-size: 13px; font-weight: 700; color: var(--primary-dark); cursor: pointer; text-decoration: underline; background: none; border: 0; padding: 0 4px; }
.adm-card-head .adm-linkbtn { text-decoration: none; }
.adm-userlayout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.adm-usercol { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.adm-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.adm-tiles > * { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: 12px; background: #F7F5F0; border: 1px solid #ECE8DE; text-decoration: none; }
.adm-tiles a:hover { border-color: var(--primary); background: var(--primary-tint); }
.adm-tiles b { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1; color: var(--text-strong); }
.adm-tiles span { font-size: 13px; color: var(--text-muted); }
.adm-manage, .adm-danger-zone { display: flex; flex-direction: column; gap: 2px; }
.adm-manage form, .adm-danger-zone form { margin: 0; }
.adm-manage button, .adm-danger-zone button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 12px; margin: 0 -12px; width: calc(100% + 24px); border: 0; border-radius: 10px; background: none; text-align: left; font: inherit; cursor: pointer; transition: background .13s; }
.adm-manage button:hover { background: #F5F3EE; }
.adm-act-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: #EEF3EF; color: var(--primary-dark); }
.adm-act-ico .ico { width: 18px; height: 18px; }
.adm-act-ico.danger { background: rgba(192,57,43,.10); color: var(--error); }
.adm-act-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-act-text b { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.adm-act-text span { font-size: 12.5px; line-height: 1.4; color: var(--text-faint); }
.adm-act-go { flex: none; width: 16px; height: 16px; color: var(--light-grey); transition: transform .13s, color .13s; }
.adm-manage button:hover .adm-act-go { color: var(--mid-grey); transform: translateX(2px); }
.adm-danger-zone { margin: 22px -24px -24px; padding: 16px 24px 14px; gap: 2px; border-top: 1px solid rgba(192,57,43,.22); border-radius: 0 0 var(--radius-lg) var(--radius-lg); background: rgba(192,57,43,.04); }
.adm-danger-zone h3 { padding: 0 0 6px; font-family: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--error); }
.adm-danger-zone button { padding: 11px 12px; }
.adm-danger-zone button:hover { background: rgba(192,57,43,.07); }
.adm-danger-zone button:hover .adm-act-text b { color: var(--error); }
.adm-danger-zone button:hover .adm-act-go { color: var(--error); }
.adm-prefixed { display: flex; align-items: stretch; }
.adm-prefixed > span { display: grid; place-items: center; padding: 0 12px; border: 1px solid #DCD7CC; border-right: 0; border-radius: 8px 0 0 8px; background: #F3F1EC; color: #6B6F68; font-weight: 600; }
.adm-prefixed input { border-radius: 0 8px 8px 0 !important; }
@media (max-width: 900px) { .adm-userlayout { grid-template-columns: 1fr; } .adm-userhead-actions { width: 100%; } }

/* Account timeline */
.adm-timeline { list-style: none; margin: 20px 0 0; padding: 18px 0 0; border-top: 1px solid var(--extra-light); }
.adm-timeline li { position: relative; display: flex; gap: 14px; padding-bottom: 16px; }
.adm-timeline li:last-child { padding-bottom: 0; }
.adm-timeline li::before { content: ''; position: absolute; left: 6px; top: 16px; bottom: -2px; width: 2px; background: var(--primary); opacity: .35; }
.adm-timeline li:last-child::before { display: none; }
.adm-timeline li.now::before, .adm-timeline li.todo::before { background: var(--light-grey); opacity: 1; }
.adm-tl-dot { flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--primary); background: var(--primary); position: relative; z-index: 1; }
.adm-timeline li.now .adm-tl-dot { background: #fff; border-color: var(--warning); }
.adm-timeline li.todo .adm-tl-dot { background: #fff; border-color: var(--light-grey); }
.adm-timeline b { display: block; font-size: 14px; font-weight: 600; color: var(--text-strong); }
.adm-timeline li.todo b { color: var(--text-faint); font-weight: 500; }
.adm-tl-when { display: block; margin-top: 1px; font-size: 13px; color: var(--text-body); }
.adm-timeline .adm-sub { margin-top: 1px; }

/* The form rules above only cover text/number/date; e-mail and password fields look the same */
.ed .ed-f input[type=email], .ed .ed-f input[type=password], .ed .ed-f input[type=search], .ed .ed-f input[type=url] { width: 100%; height: 44px; padding: 0 13px; border: 1px solid #DCD7CC; border-radius: 8px; background: #fff; font: inherit; font-size: 14px; color: #1F2421; outline: none; box-shadow: none; }
.ed .ed-f input[type=email]:focus, .ed .ed-f input[type=password]:focus, .ed .ed-f input[type=search]:focus, .ed .ed-f input[type=url]:focus { border-color: #2F7A55; box-shadow: 0 0 0 3px rgba(47,122,85,.15); }
.ed .ed-f input::placeholder { color: #9A9C94; }

/* Select with a flag in front of the label */
.ed-selval { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ed-selval > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-selbtn .flag, .ed-menu button .flag { display: inline-flex; align-items: center; flex: none; }
.ed-selbtn .flag .flag-img { width: 20px; height: 15px; }

.adm-row-ini { grid-template-columns: 96px minmax(0, 1fr); }

.adm-extlink { display: inline-flex; align-items: center; gap: 5px; color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.adm-extlink:hover { text-decoration: underline; }
.adm-extlink .ico { width: 13px; height: 13px; opacity: .7; }

/* Public pages: preview switch for the owner and admins */
.pub-lens { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.pub-lens-label { color: #8E9A92; }
.pub-seg { display: inline-flex; border: 1px solid #3A463F; border-radius: 8px; overflow: hidden; }
.pub-seg a { margin: 0; padding: 4px 14px; color: #C3CBC5; font-weight: 600; text-decoration: none; }
.pub-seg a + a { border-left: 1px solid #3A463F; }
.pub-seg a.on { background: #2F7A55; color: #fff; }
.pub-lens-note { color: #8E9A92; }
.pub-lens-back { margin-left: 6px; }
.pub-loc { margin-top: 3px; font-size: 12px; font-weight: 600; color: #2F7A55; }
small.pub-loc { display: block; }
a.bc-link, .lr-title a, .bk-more a.bc-link { color: inherit; text-decoration: none; }
a.bc-link:hover, .lr-title a:hover { color: #2F7A55; text-decoration: underline; }
.pb-private { margin: 20px 0 6px; padding: 16px 18px; border: 1px dashed #BFD6C8; border-radius: 12px; background: #F1F7F3; }
.pb-private-h { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #2F7A55; margin-bottom: 10px; }
.pb-private-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin-bottom: 12px; }
.pb-private-grid .wide { grid-column: 1 / -1; }
.pb-private-grid .k { display: block; font-size: 12px; color: #6B6F68; }
.pb-private-grid .v { display: block; font-size: 14px; font-weight: 600; color: #1F2421; }

.pub-private { max-width: 520px; margin: 90px auto; padding: 0 24px; text-align: center; }
.pub-private-ico { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: #E6EFE9; color: #2F7A55; margin-bottom: 18px; }
.pub-private-ico .ico { width: 28px; height: 28px; }
.pub-private h1 { font-family: var(--font-display, 'Cormorant Garamond', serif); font-size: 40px; font-weight: 600; color: #1F2421; line-height: 1.1; }
.pub-private p { margin-top: 12px; font-size: 16px; color: #4A4E48; }
.pub-private .sub { font-size: 14px; color: #6B6F68; }

.adm-gdpr { margin: 0; padding: 10px 14px; border-radius: 9px; background: rgba(192,57,43,.06); color: #7A2A20; font-size: 13px; line-height: 1.5; }
.adm-gdpr .adm-linkbtn { color: var(--error); padding: 0; }

.adm-act-off { display: flex; align-items: center; gap: 14px; padding: 11px 0; opacity: .55; }

/* Admin: book popover */
.adm-booklink { display: block; min-width: 0; max-width: 100%; padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text-strong); text-align: left; cursor: pointer; }
.adm-booklink > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-book-main b:has(> .adm-booklink) { display: flex; align-items: center; gap: 6px; }
.adm-booklink:hover, .adm-booklink.on { color: var(--primary-dark); text-decoration: underline; text-underline-offset: 3px; }
.adm-pop { position: fixed; z-index: 250; font-size: 13.5px; }
.adm-pop-body { overflow: auto; padding: 18px 20px 16px; border: 1px solid #DCD7CC; border-radius: 14px; background: #fff; box-shadow: 0 18px 48px rgba(31,36,33,.2); }
.adm-pop-arrow { position: absolute; width: 14px; height: 14px; margin-left: -7px; background: #fff; border: 1px solid #DCD7CC; transform: rotate(45deg); }
.adm-pop-arrow.below { top: -8px; border-right: 0; border-bottom: 0; }
.adm-pop-arrow.above { bottom: -8px; border-left: 0; border-top: 0; }
.adm-pop-head { display: flex; gap: 14px; align-items: flex-start; }
.adm-pop-cover { flex: none; width: 56px; height: 84px; border-radius: 3px 5px 5px 3px; overflow: hidden; box-shadow: 0 4px 12px rgba(44,62,80,.22); }
.adm-pop-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.adm-pop-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-pop-title b { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.15; color: var(--text-strong); }
.adm-pop-sub { font-size: 13px; color: var(--text-muted); }
.adm-pop-by { font-size: 13px; font-weight: 600; color: var(--text-body); }
.adm-pop-x { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--text-faint); cursor: pointer; }
.adm-pop-x:hover { background: var(--extra-light); color: var(--text-strong); }
.adm-pop-x .ico { width: 14px; height: 14px; }
.adm-pop-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.adm-pop-chips span { padding: 2px 9px; border-radius: 10px; background: var(--primary-tint); color: var(--primary-dark); font-size: 12px; font-weight: 600; }
.adm-pop-chips.tags span { background: var(--extra-light); color: var(--mid-grey); }
.adm-pop-facts { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 5px 12px; margin-top: 12px; }
.adm-pop-facts dt { color: var(--text-faint); font-weight: 600; font-size: 12.5px; }
.adm-pop-facts dd { color: var(--text-strong); overflow-wrap: anywhere; }
.adm-pop-facts a { color: var(--primary-dark); font-weight: 600; text-decoration: none; }
.adm-pop-facts a:hover { text-decoration: underline; }
.adm-pop-desc { margin-top: 12px; color: var(--text-body); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.adm-pop-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--extra-light); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.adm-pop .adm-sub { margin-top: 10px; }
.adm-pop-foot { display: flex; justify-content: flex-end; margin-top: 14px; }

.adm-pop-wait { padding: 22px 20px; text-align: center; color: var(--text-muted); font-size: 13.5px; }
.adm-pop-wait.err { color: var(--error); }

/* Search box in a select's menu (also outside the .ed book form, e.g. the admin filters) */
.ed-sel .ed-menu-search { position: sticky; top: -4px; z-index: 1; display: flex; align-items: center; gap: 8px; height: 40px; margin: -4px -4px 4px; padding: 0 14px; border-bottom: 1px solid #DCD7CC; background: #fff; color: #6B6F68; font-weight: 400; }
.ed-sel .ed-menu-search input { flex: 1; width: auto; min-width: 0; height: 100%; padding: 0; border: 0; border-radius: 0; outline: 0; box-shadow: none; background: transparent; font: inherit; font-size: 13.5px; color: #1F2421; }
.adm-sel .ed-menu-search { height: 38px; }
.adm-sel .ed-menu { min-width: 220px; }

/* ISBN look-up: results from other sources under the shared record */
.lk-scroll { max-height: min(52vh, 440px); overflow: auto; padding-bottom: 6px; }
.lk-hit.pick { cursor: pointer; border-color: #E4E0D6; }
.lk-hit.pick:hover { border-color: #BFD6C8; }
.lk-hit.pick.on { border-color: #2F7A55; box-shadow: 0 0 0 3px rgba(47,122,85,.14); }
.lk-wait { display: flex; align-items: center; gap: 10px; margin: 0 24px 16px; font-size: 13.5px; color: #6B6F68; }
.lk-others { margin-top: 2px; }
.lk-others-h { margin: 0 24px 10px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6B6F68; }
.lk-others .lk-hit { margin-bottom: 12px; }

/* ISBN look-up: tidy buttons */
.lk-foot { flex-wrap: nowrap; }
.lk-btn { white-space: nowrap; }
.lk-foot .lk-btn { min-width: 0; }
/* ...and "Search other sources" as one more result under the shared record */
.lk-moreRow { cursor: pointer; align-items: center; border-style: dashed; border-color: #BFD6C8; background: transparent; transition: background .13s, border-color .13s; }
.lk-moreRow:hover, .lk-moreRow:focus-visible { background: #EEF5F0; border-color: #2F7A55; outline: none; }
.lk-moreRow.busy { cursor: progress; background: #F7F5F0; border-style: solid; border-color: #E4E0D6; }
.lk-more-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: #E6EFE9; color: #2F7A55; }
.lk-more-ico .ico { width: 20px; height: 20px; }
.lk-moreRow .lk-hit-title { font-size: 15px; }
.lk-moreRow .lk-hit-meta { margin-top: 3px; }
.lk-more-go { flex: none; width: 16px; height: 16px; color: #9A9C94; margin-left: auto; }

/* ISBN look-up cards: the title spans the top, the cover and the details sit under it */
.lk-hit:not(.lk-moreRow) { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "title title" "cover text" "rows rows"; gap: 10px 16px; align-items: start; }
.lk-hit:not(.lk-moreRow).nocover { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "text" "rows"; }
.lk-hit:not(.lk-moreRow) .lk-hit-title { grid-area: title; }
.lk-hit:not(.lk-moreRow) .lk-hit-cover { grid-area: cover; }
.lk-hit:not(.lk-moreRow) .lk-hit-text { grid-area: text; }
.lk-suggest .lk-moreRow { margin-bottom: 12px; }
.lk-fix { font-family: 'JetBrains Mono', monospace; font-size: 13.5px; color: #2F7A55; }

/* What a result would add to the shared record: one small tag each */
.lk-adds { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; }
.lk-adds-l { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8A4B14; margin-right: 2px; }
.lk-add { display: inline-flex; align-items: center; height: 21px; padding: 0 8px; border-radius: 6px; background: #FBEBD7; color: #8A4B14; font-size: 11.5px; font-weight: 600; }

/* Dashboard: empty states */
.dv-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 34px 24px 32px; border: 1.5px dashed #D3CFC3; border-radius: 14px; background: #FCFBF8; }
.dv-empty-ico { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 4px; border-radius: 14px; background: #E6EFE9; color: #2F7A55; }
.dv-empty-ico .ico { width: 26px; height: 26px; }
.dv-empty h3 { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 500; color: #1F2421; }
.dv-empty p { margin: 0; max-width: 46ch; font-size: 14px; line-height: 1.5; color: #6B6F68; }
.dv-empty-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.dv-empty.sm { padding: 22px 10px; border: 0; background: transparent; }
.dv-empty.sm h3 { font-size: 21px; }

/* Flags next to language names, everywhere a language is shown */
.lang-card-flag .flag-img { display: block; width: 100%; height: 100%; border-radius: 0; box-shadow: none; object-fit: cover; vertical-align: top; }
.ax-flag { display: block; width: 24px; height: 18px; }
.adm-langs { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.adm-langtag, .pb-lang { display: inline-flex; align-items: center; gap: 7px; }
.adm-langtag .flag, .pb-lang .flag { display: inline-flex; flex: none; }
.adm-langtag .flag-img, .pb-lang .flag-img { width: 18px; height: 13px; }
.pb-langs { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* Dashboard: one slim prompt instead of empty cards */
.dv-nudge { display: flex; align-items: center; gap: 16px; margin-top: 44px; padding: 16px 20px; border: 1.5px dashed #D3CFC3; border-radius: 14px; background: #FCFBF8; }
.dv-nudge-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: #E6EFE9; color: #2F7A55; }
.dv-nudge-ico .ico { width: 22px; height: 22px; }
.dv-nudge-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dv-nudge-text b { font-size: 15px; font-weight: 600; color: #1F2421; }
.dv-nudge-text span { font-size: 13.5px; color: #6B6F68; }
.dv-nudge .btn { flex: none; }
@media (max-width: 640px) { .dv-nudge { flex-wrap: wrap; } .dv-nudge .btn { width: 100%; justify-content: center; } }

.dv-nudge .modal-error { margin: 0; padding: 9px 12px; border-radius: 8px; background: rgba(192,57,43,.08); color: var(--error); font-size: 13px; font-weight: 600; }

.dv-nudge + .modal-overlay .modal-error, .dv-nudge ~ .modal-overlay .modal-error { margin: 0; padding: 9px 12px; border-radius: 8px; background: rgba(192,57,43,.08); color: var(--error); font-size: 13px; font-weight: 600; }

.adm-chip.you { margin: 0 0 0 7px; padding: 1px 8px; vertical-align: 1px; background: var(--primary-tint); color: var(--primary-dark); font-size: 11px; }

/* Shelves: add a shelf under the last one */
.shelf-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 46px; margin: 22px 0 18px; border: 1.5px dashed #CFC9BB; border-radius: 12px; background: transparent; color: #4A4E48; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .13s, border-color .13s, color .13s; }
.shelf-add:hover:not(:disabled) { background: #EEF5F0; border-color: #2F7A55; color: #2F7A55; }
.shelf-add:disabled { opacity: .6; cursor: progress; }
.shelf-add .ico { width: 16px; height: 16px; }
.shelf:target { animation: shelfFlash 1.8s ease-out; }
@keyframes shelfFlash { 0%, 35% { box-shadow: 0 0 0 3px rgba(47,122,85,.35); } 100% { box-shadow: 0 0 0 3px rgba(47,122,85,0); } }

/* Announcement icon picker (admin) and banner icon */
.adm-icons { display: flex; flex-wrap: wrap; gap: 6px; }
.adm-icons button { min-width: 40px; height: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #DCD7CC; border-radius: 10px; background: #fff; color: #6B6F68; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.adm-icons button:hover { border-color: #B9C9BF; }
.adm-icons button.on { border-color: #3F7A5C; background: #E6EFE9; color: #1F4A35; }
.adm-icons .ico { width: 18px; height: 18px; }
.site-banner > .ico { width: 18px; height: 18px; flex: none; }

/* First-run tour */
#bi-tour[hidden] { display: none; }
#bi-tour { position: fixed; inset: 0; z-index: 400; }
#bi-tour .bt-shade { position: absolute; inset: 0; background: rgba(20,28,24,.18); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#bi-tour .bt-ring { position: fixed; border-radius: 12px; outline: 2px solid #7FC9A1; pointer-events: none; transition: left .2s, top .2s, width .2s, height .2s; }
#bi-tour .bt-card { position: fixed; width: min(400px, calc(100vw - 24px)); background: #FCFBF8; border-radius: 14px; padding: 18px 20px 16px; box-shadow: 0 24px 60px -16px rgba(0,0,0,.5); }
#bi-tour .bt-count { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--text-faint); }
#bi-tour .bt-title { margin: 4px 0 6px; font-family: var(--font-display); font-size: 24px; font-weight: 600; color: var(--text-strong); }
#bi-tour .bt-text { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: var(--text-muted); }
#bi-tour .bt-nav { display: flex; align-items: center; gap: 8px; }
#bi-tour .bt-spacer { flex: 1; }
#bi-tour .bt-nav button { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; height: 36px; padding: 0 14px; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid #DCD7CC; background: #fff; color: var(--text-body); }
#bi-tour .bt-nav .bt-skip { border: 0; background: transparent; color: var(--text-muted); padding: 0; }
#bi-tour .bt-nav .bt-next { border-color: #2F7A55; background: #2F7A55; color: #fff; }

.settings-tour { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--extra-light); }
.settings-tour b { display: block; font-size: 14px; color: var(--text-strong); }
.settings-tour span { font-size: 13px; color: var(--text-muted); }
@media (max-width: 560px) { .settings-tour { flex-direction: column; align-items: flex-start; } }
#bi-tour .bt-nav .ico { width: 14px; height: 14px; }

a.site-banner { text-decoration: none; cursor: pointer; }
a.site-banner:hover > span { text-decoration: underline; }
.site-banner > .ico:last-child:not(:first-child) { width: 15px; height: 15px; }

.adm-icons .adm-tone { min-width: 54px; font-weight: 700; }
.adm-icons .adm-tone.on { outline: 2px solid #2F7A55; outline-offset: 2px; }

.adm-prev { margin-bottom: 4px; border: 1px solid #E4E0D6; border-radius: 10px; overflow: hidden; }
.adm-prev .site-banner { border-bottom-width: 0; }
.adm-prev .site-banner > span { display: inline-flex; align-items: center; }
.adm-prev .site-banner .ico { width: 18px; height: 18px; flex: none; }
.adm-prev .site-banner > span:last-child .ico { width: 15px; height: 15px; }
.adm-prev .site-banner.is-link { cursor: pointer; }
.adm-prev .site-banner.is-link:hover [x-text] { text-decoration: underline; }

.adm-series-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.adm-series-list li { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 8px; }
.adm-series-list li:hover { background: var(--bg-main); }
.adm-series-no { flex: none; width: 34px; font-size: 12px; font-weight: 700; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.adm-series-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.adm-series-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--text-strong); }
.adm-series-edit { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; color: var(--text-muted); cursor: pointer; }
.adm-series-edit:hover { background: #fff; color: var(--primary-dark); }
.adm-series-edit .ico { width: 15px; height: 15px; }

.adm-series-list { max-height: 280px; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.adm-series-list li { min-height: 64px; }
.adm-series-cover { flex: none; width: 36px; height: 52px; border-radius: 2px 4px 4px 2px; overflow: hidden; box-shadow: 0 3px 8px rgba(44,62,80,.22); }
.adm-series-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.adm-series-main { gap: 2px; }
.adm-series-main .adm-sub { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-series-main .adm-sub strong { font-weight: 700; color: var(--text-body); }

/* Info tooltip next to a collective author */
.bk-info { position: relative; display: inline-flex; vertical-align: -3px; margin-left: 6px; color: #9A9C94; cursor: help; outline: none; }
.bk-info .ico { width: 17px; height: 17px; }
.bk-info:hover, .bk-info:focus { color: #2F7A55; }
.bk-info-tip { position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translate(-50%, 4px); width: 240px; padding: 10px 12px; border-radius: 10px; background: #1F2421; color: #D9DED9; font-size: 12.5px; font-weight: 400; line-height: 1.45; text-align: left; box-shadow: 0 12px 28px rgba(0,0,0,.28); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 30; }
.bk-info.bk-etal { vertical-align: baseline; margin-left: 0; color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; }
.bk-info.bk-etal:hover, .bk-info.bk-etal:focus { color: #2F7A55; }
.bk-info-tip b { display: block; margin-bottom: 2px; color: #fff; font-size: 13px; font-weight: 700; }
.bk-info-tip::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top-color: #1F2421; }
.bk-info:hover .bk-info-tip, .bk-info:focus .bk-info-tip { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* Settings → Your data */
.settings-export { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-danger { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; padding: 18px 20px; border: 1px solid rgba(192,57,43,.28); border-radius: 12px; background: rgba(192,57,43,.04); }
.settings-danger > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.settings-danger b { color: var(--error); }
.settings-danger span, .settings-danger label { font-size: 13.5px; color: var(--mid-grey); line-height: 1.5; }
.settings-danger input { max-width: 380px; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #A93226; }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }

/* "Found a duplicate" on a book page */
.add-panel.cf.dup { max-width: 600px; }
.bk-dup-n { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 10px; background: #C0392B; color: #fff; font-size: 12px; font-weight: 700; }
.dup-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 50vh; overflow: auto; }
.dup-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid #E4E0D6; border-radius: 10px; background: #fff; }
.dup-info { min-width: 0; }
.dup-title { font-weight: 600; color: #1F2421; }
.dup-sub { font-size: 13px; color: #6B6F68; margin-top: 2px; }
.dup-list .bk-btn { height: 38px; padding: 0 14px; white-space: nowrap; }
.bk-dup-link { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 14px; padding-top: 14px; border-top: 1px solid #E4E0D6; font-size: 12.5px; }
.bk-dup-link .ico { width: 14px; height: 14px; }
.bk-textlink.bk-dup-link { color: var(--text-muted); font-weight: 500; text-decoration: none; }
.bk-textlink.bk-dup-link:hover { color: #2F7A55; text-decoration: underline; text-underline-offset: 3px; }
.dup-search { border-top: 1px solid #E4E0D6; padding-top: 18px; }
.dup-label { display: block; font-size: 13px; font-weight: 600; color: #4A4E48; margin-bottom: 8px; }
.dup-q { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #D9D4C7; border-radius: 8px; background: #fff; font: inherit; }
.dup-q:focus { outline: 2px solid #2F7A55; outline-offset: 1px; }
.dup-none { margin: 12px 0 0; font-size: 13px; color: #6B6F68; }
.dup-confirm { z-index: 1100; }

/* Open modals: the page behind stays put, and scrolling inside one never chains to it. */
html.modal-open { overflow: hidden; padding-right: var(--sbw, 0); }
.modal-overlay { overscroll-behavior: contain; }
.modal-overlay.popup-open { overflow: hidden; }
.lk-overlay { overscroll-behavior: contain; }

/* Light cloth: dark lettering on the front cover too (the spine already switches). */
.cover.is-light, .book3d.is-light .cover { color: #2a2a2a; }
.cover.is-light .cover-title, .book3d.is-light .cover-title { text-shadow: none; }
.cover.is-light .cover-rule, .book3d.is-light .cover-rule { background: rgba(0,0,0,.35); }
.cover.is-light::after, .book3d.is-light .cover::after { background: rgba(0,0,0,.12); }

/* Shelf chips in Settings: click the label to give the shelf a name of its own */
.settings-shelf-chip .chip-name { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: text; }
.settings-shelf-chip .chip-name .ico { width: 12px; height: 12px; opacity: .45; }
.settings-shelf-chip .chip-name:hover .ico { opacity: .9; }
.settings-shelf-chip .chip-edit { display: inline-flex; align-items: center; gap: 6px; }
.settings-shelf-chip .chip-edit-no { color: var(--text-muted); white-space: nowrap; }
.settings-shelf-chip .chip-input { width: 170px; font-weight: 400; border: 1px solid #D9D4C7; border-radius: 6px; padding: 2px 8px; font: inherit; background: #fff; }
.settings-shelf-chip .chip-name, .settings-shelf-chip .chip-name:hover { color: inherit; }

/* "Adds" chips on another source's result: click one to leave that detail out */
button.lk-add { border: 0; cursor: pointer; gap: 6px; font-family: inherit; }
.lk-add-box { display: inline-grid; place-items: center; width: 13px; height: 13px; border-radius: 3px; border: 1.5px solid currentColor; font-size: 10px; line-height: 1; }
.lk-add.off { background: #EEEBE3; color: #9A9C94; text-decoration: line-through; }
.lk-add.off .lk-add-box { opacity: .6; }
.lk-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Another source's result: two chips, a toggle, and the full list of changes in rows */
.lk-more-toggle { border: 0; background: none; padding: 0 4px; font: inherit; font-size: 11.5px; font-weight: 700; color: #8A4B14; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.lk-rows { display: flex; flex-direction: column; margin-top: 10px; border: 1px solid #EADFCB; border-radius: 8px; background: #FFFBF4; overflow: hidden; }
.lk-row { display: grid; grid-template-columns: 14px minmax(0, 1fr); column-gap: 9px; row-gap: 2px; align-items: start; padding: 8px 10px; font-size: 12.5px; color: #4A4E48; cursor: pointer; text-align: left; }
.lk-row + .lk-row { border-top: 1px solid #F0E6D3; }
.lk-row .lk-add-box { grid-row: 1 / span 2; margin-top: 2px; color: #8A4B14; }
.lk-row-l { grid-column: 2; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #8A4B14; }
.lk-row-v { grid-column: 2; display: flex; flex-direction: column; gap: 1px; min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.lk-row-from { color: #9A9C94; text-decoration: line-through; }
.lk-row-arrow { display: none; }
.lk-row-to { font-weight: 600; color: #1F2421; }
.lk-row-to::before { content: '→ '; font-weight: 400; color: #9A9C94; }
.lk-row.off { opacity: .6; }
.lk-row.off .lk-row-to { text-decoration: line-through; font-weight: 500; }
.lk-row.off .lk-row-from { text-decoration: none; }
.lk-hit:not(.lk-moreRow) .lk-rows { grid-area: rows; margin-top: 2px; }
.lk-hit-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lk-same { margin-top: 8px; font-size: 12px; color: #6B6F68; font-style: italic; }

/* Your data */
.data-block { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--extra-light); display: flex; flex-direction: column; gap: 12px; }
.data-head { display: flex; flex-direction: column; gap: 3px; }
.data-head b { font-size: 14px; color: var(--text-strong); }
.data-head span { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.settings-export .btn .ico { width: 16px; height: 16px; }
.settings-danger { gap: 14px; }
.settings-danger .danger-head { display: flex; flex-direction: row; gap: 12px; align-items: flex-start; }
.settings-danger .danger-head > .ico { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--error); }
.settings-danger .danger-head > div { display: flex; flex-direction: column; gap: 4px; }
.settings-danger .danger-confirm { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.settings-danger .danger-confirm input { flex: 1 1 260px; max-width: 380px; padding: 10px 13px; border-radius: 9px; border: 1px solid var(--light-grey); font-family: inherit; font-size: 14.5px; color: var(--text-strong); background: #fff; }
.settings-danger .danger-confirm input:focus { outline: none; border-color: var(--error); box-shadow: 0 0 0 3px rgba(192,57,43,.14); }
.settings-danger .danger-confirm .btn { flex: none; }

.adm-company .adm-card { display: flex; flex-direction: column; gap: 16px; }
.adm-company .adm-card-head { margin-bottom: 0; }
.adm-legal textarea.adm-md { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; line-height: 1.6; }
.adm-legal .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Admin, Legal: the cookie table */
.adm-table-wrap { border: 1px solid var(--extra-light); border-radius: 10px; }
@media (max-width: 820px) { .adm-table-wrap { overflow-x: auto; } }
.adm-cookies { width: 100%; border-collapse: collapse; min-width: 720px; }
.adm-cookies th { padding: 9px 10px; text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); background: var(--extra-light); }
.adm-cookies td { padding: 8px 10px; vertical-align: top; border-top: 1px solid var(--extra-light); }
.adm-cookies th:nth-child(2), .adm-cookies td:nth-child(2) { width: 18%; }
.adm-cookies th:nth-child(3), .adm-cookies td:nth-child(3) { width: 15%; }
.adm-cookies th:nth-child(4), .adm-cookies td:nth-child(4) { width: 15%; }
.adm-cookies .adm-col-act { width: 1%; white-space: nowrap; }
.adm-legal .adm-cookies input[type=text], .adm-legal .adm-cookies select, .adm-legal .adm-cookies textarea { padding: 7px 10px; font-size: 13.5px; }
.adm-legal .adm-cookies textarea { resize: vertical; min-height: 54px; }
.adm-cookies .adm-empty { padding: 18px 10px; text-align: center; color: var(--text-faint); font-style: italic; }
.adm-cookies .adm-col-grip { width: 1%; padding-right: 0; }
.adm-cookies td.adm-col-grip { padding-left: 8px; }
.adm-grip { display: inline-flex; padding: 6px 2px; color: var(--text-faint); cursor: grab; border-radius: 6px; }
.adm-grip:hover { color: var(--text-strong); }
.adm-cookies tr.is-dragging { opacity: .45; }
.adm-cookies tr.is-over td { border-top: 2px solid var(--primary); }
.adm-trash { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin-top: 3px; border-radius: 8px; border: 1px solid var(--light-grey); background: #fff; color: var(--text-muted); cursor: pointer; }
.adm-trash:hover { border-color: var(--error); color: var(--error); background: rgba(192,57,43,.06); }
.adm-preview { width: 100%; border-collapse: collapse; }
.adm-preview th, .adm-preview td { padding: 9px 12px; text-align: left; font-size: 13.5px; vertical-align: top; }
.adm-preview th { width: 32%; font-weight: 700; color: var(--text-muted); background: var(--extra-light); }
.adm-preview tr + tr th, .adm-preview tr + tr td { border-top: 1px solid var(--extra-light); }
.adm-preview tr + tr th { border-top-color: #fff; }
.adm-cookies .ed-sel { min-width: 140px; }
.ed-sel.sm .ed-selbtn { box-sizing: border-box; height: 36px; padding: 0 10px; font-size: 13.5px; border-radius: 9px; }
.ed-sel.sm .ed-selbtn .ico, .ed-sel.sm .ed-selbtn svg { width: 14px; height: 14px; }
.ed-sel.sm .ed-menu button { padding: 7px 10px; font-size: 13.5px; }
.adm-legal .adm-cookies input[type=text] { box-sizing: border-box; height: 36px; }
.adm-cookies .ed-menu { right: auto; min-width: 100%; width: max-content; max-width: 260px; top: calc(100% + 4px); }

/* WYSIWYG Markdown editor (Admin → Legal) */
.md-editor { border: 1px solid var(--light-grey); border-radius: 10px; background: #fff; }
.md-editor:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.md-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--extra-light); background: #faf8f3; border-radius: 10px 10px 0 0; }
.md-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 30px; height: 30px; padding: 0 7px; border: 0; border-radius: 7px; background: none; color: var(--text-muted); font: inherit; font-size: 12.5px; cursor: pointer; }
.md-btn:hover:not(:disabled) { background: var(--extra-light); color: var(--text-strong); }
.md-btn.on { background: var(--primary-tint); color: var(--primary-dark); }
.md-btn:disabled { opacity: .35; cursor: not-allowed; }
.md-btn-text span { font-weight: 600; }
.md-sep { width: 1px; height: 18px; margin: 0 6px; background: var(--light-grey); }
.md-editor .md-pop-wrap { position: relative; }
.md-editor .md-pop, .md-editor .md-pop * { box-sizing: border-box; }
.md-editor .md-pop { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; width: 360px; max-width: calc(100vw - 32px); padding: 12px; border: 1px solid var(--light-grey); border-radius: 12px; background: #fff; box-shadow: 0 12px 30px rgba(44,62,80,.16); }
.md-editor .md-pop[hidden] { display: none; }
.md-editor .md-pop .md-pop-h { padding: 0 10px 12px; font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
.md-editor .md-pop .md-pop-search { display: block; width: 100%; margin: 0 0 8px; padding: 10px 13px; border: 1px solid var(--light-grey); border-radius: 8px; font: inherit; font-size: 13.5px; background: #fff; }
.md-editor .md-pop .md-pop-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
.md-editor .md-pop .md-pop-list { max-height: min(52vh, 340px); overflow-y: auto; margin: 0; padding: 0 4px 0 0; scrollbar-width: thin; scrollbar-color: var(--light-grey) transparent; }
.md-editor .md-pop .md-pop-group { padding: 14px 10px 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.md-editor .md-pop .md-pop-group[hidden], .md-editor .md-pop .md-pop-item[hidden], .md-editor .md-pop .md-pop-empty[hidden] { display: none; }
.md-editor .md-pop .md-pop-item { display: flex; flex-direction: column; align-items: stretch; gap: 3px; width: 100%; margin: 0; padding: 10px 10px; border: 0; border-radius: 8px; background: none; text-align: left; font: inherit; cursor: pointer; }
.md-editor .md-pop .md-pop-item:hover, .md-editor .md-pop .md-pop-item:focus-visible { background: var(--extra-light); outline: none; }
.md-editor .md-pop .md-pop-item .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.md-editor .md-pop .md-pop-item .d { font-size: 13px; font-weight: 600; color: var(--text-strong); }
.md-editor .md-pop .md-pop-item code { padding: 2px 7px; border-radius: 6px; background: var(--primary-tint); color: var(--primary-dark); font-size: 11.5px; white-space: nowrap; }
.md-editor .md-pop .md-pop-item .v { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-editor .md-pop .md-pop-item .v.none { color: var(--text-faint); font-style: italic; }
.md-editor .md-pop .md-pop-empty { padding: 20px 10px 14px; text-align: center; font-size: 13px; color: var(--text-faint); }
.md-surface .md-content { min-height: 120px; max-height: 70vh; overflow: auto; padding: 12px 14px; outline: none; font-size: 14.5px; line-height: 1.65; color: var(--text-strong); }
.md-content p { margin: 0 0 10px; }
.md-content h2 { margin: 18px 0 8px; font-family: var(--font-display); font-size: 24px; font-weight: 500; }
.md-content h3 { margin: 14px 0 6px; font-size: 16px; font-weight: 700; }
.md-content ul, .md-content ol { margin: 0 0 10px; padding-left: 22px; }
.md-content blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 3px solid var(--light-grey); color: var(--text-muted); }
.md-content a { color: var(--primary-dark); text-decoration: underline; }
.md-editor > textarea.md-source { display: block; width: 100%; min-height: 260px; border: 0; border-radius: 0 0 10px 10px; box-shadow: none; }
.md-editor > textarea.md-source[hidden] { display: none; }
.md-content .md-tag { padding: 2px 7px; border-radius: 6px; background: var(--primary-tint); color: var(--primary-dark); font-family: ui-monospace, 'JetBrains Mono', SFMono-Regular, Menlo, monospace; font-size: 12px; }
.md-content .md-tag { position: relative; cursor: default; }
.md-content .md-tag::after { content: attr(data-tip); position: absolute; z-index: 20; left: 0; bottom: calc(100% + 6px); max-width: 320px; width: max-content; padding: 6px 10px; border-radius: 8px; background: #2c3e50; color: #fff; font-family: inherit; font-size: 12.5px; line-height: 1.4; white-space: normal; pointer-events: none; opacity: 0; transform: translateY(2px); transition: opacity .12s, transform .12s; }
.md-content .md-tag:hover::after { opacity: 1; transform: none; }
/* The wrapper can't clip (the select menus must overflow it), so the corner cells carry the radius */
.adm-preview tr:first-child th { border-top-left-radius: 9px; }
.adm-preview tr:last-child th { border-bottom-left-radius: 9px; }
.adm-cookies thead th:first-child { border-top-left-radius: 9px; }
.adm-cookies thead th:last-child { border-top-right-radius: 9px; }

/* Admin, Emails: a message as the recipient gets it */
.adm-mail { padding: 0; overflow: hidden; }
.adm-mail-head { margin: 0; padding: 16px 22px; border-bottom: 1px solid var(--extra-light); background: #faf8f3; display: flex; flex-direction: column; gap: 6px; }
.adm-mail-head > div { display: flex; gap: 14px; font-size: 14px; }
.adm-mail-head dt { width: 64px; flex: none; color: var(--text-faint); font-weight: 600; }
.adm-mail-head dd { margin: 0; color: var(--text-strong); min-width: 0; overflow-wrap: anywhere; }
.adm-mail-head small { color: var(--text-faint); }
.adm-mail-body { margin: 0; padding: 24px 22px 28px; font: 15px/1.65 -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--text-strong); white-space: pre-wrap; overflow-wrap: anywhere; }
.adm-mail-frame { display: block; width: 100%; height: 560px; border: 0; background: #f5f5f5; }

/* Admin → Emails: pick the message from a grouped list */
.adm-mailsel .ed-sel { width: 380px; min-width: 0; max-width: 100%; }
.adm-mailsel .ed-menu { max-height: min(560px, 70vh); }
.adm-mailsel .ed-menu a span:not(.adm-mailsel-no) { white-space: nowrap; }
.adm-mailsel-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #9A9C94; }
.adm-mailsel-group:first-child { padding-top: 6px; }
.adm-mailsel .ed-menu a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 6px; font-size: 14px; color: #1F2421; text-decoration: none; }
.adm-mailsel .ed-menu a svg { margin-left: auto; }
.adm-mailsel .ed-menu a:hover { background: #F3F1EC; }
.adm-mailsel .ed-menu a.on { background: #EEF5F0; font-weight: 600; }
.adm-mailsel-no { flex: none; min-width: 26px; font-size: 12px; font-weight: 700; color: #9A9C94; font-variant-numeric: tabular-nums; }
.adm-mailsel-tag { margin-left: auto; padding: 1px 7px; border-radius: 999px; background: #EDE9DE; font-style: normal; font-size: 11px; font-weight: 700; color: #6B6F68; }
.adm-mailsel .ed-menu a .adm-mailsel-tag + svg { margin-left: 8px; }

/* Announcement preview with nothing to show */
.adm-prev-empty { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 16px; border: 1.5px dashed #D3CEC2; border-radius: 10px; font-size: 13.5px; color: #9A9C94; text-align: center; }
.adm-prev.empty { border: 0; overflow: visible; }

/* Settings → Profile → Password */
.sidebar-foot a.profile { text-decoration: none; color: inherit; }
.nav-item .nav-count.nav-alert, .nav-item.active .nav-count.nav-alert { background: #D4A04A; color: #1B2420; font-weight: 700; padding: 1px 8px; font-size: 11.5px; }

/* ============================================================
   Phones (≤820px): bottom tab bar + "More" sheet instead of the
   sidebar's links, compact cookie bar, tidier pages
   ============================================================ */
.mnav-wrap { display: none; }

@media (max-width: 820px) {
  /* top bar: logo and search only; the links live in the tab bar */
  :root { --mtop: 56px; }   /* the height of the top bar, and of the search bar that replaces it */
  .sidebar { position: sticky; top: 0; z-index: 40; box-sizing: border-box; height: calc(var(--mtop) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0 16px; gap: 12px; overflow: visible; justify-content: space-between; }
  .sidebar-top { margin: 0; }   /* the desktop spacing under the logo would push it off the bar's centre */
  .sidebar .brand-mark { width: 30px; height: 30px; font-size: 17px; border-radius: 8px; }
  .sidebar .brand-name { font-size: 19px; }
  .sidebar .nav-group { display: none; }
  .sidebar .sb-search { flex: none; width: 40px; height: 40px; min-width: 0; margin: 0 0 0 auto; padding: 0; justify-content: center; }
  .sidebar .sb-search-text, .sidebar .sb-search-short { display: none; }
  .sidebar .sb-search .ico { width: 21px; height: 21px; }
  .sidebar .brand { flex: none; }
  .sidebar .sb-kbd { display: none; }
  .main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .page { padding: 22px 16px 40px; }

  .mnav-wrap { display: block; }
  .mnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 63; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); background: #1B2420; border-top: 1px solid rgba(255,255,255,.08); }
  .mnav a, .mnav > button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; padding: 4px 2px; border: 0; background: transparent; color: #8E9A93; font: inherit; font-size: 11px; font-weight: 600; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mnav .ico { width: 22px; height: 22px; }
  .mnav a.on, .mnav > button.on { color: #fff; }
  .mnav a.on .ico { color: #5FBF8C; }
  .mnav-add span { display: grid; place-items: center; width: 48px; height: 48px; margin-top: -18px; transform: translateY(-14px); border-radius: 16px; background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(47,122,85,.45); }
  .mnav-add .ico { width: 24px; height: 24px; }
  .mnav-dot { position: absolute; top: 6px; right: calc(50% - 20px); width: 9px; height: 9px; border-radius: 50%; background: #D4A04A; box-shadow: 0 0 0 2px #1B2420; }

  .msheet-bg { position: fixed; inset: 0; z-index: 61; background: rgba(15,20,17,.5); }
  .msheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 62; max-height: 82vh; overflow-y: auto; padding: 14px 14px calc(88px + env(safe-area-inset-bottom)); background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(15,20,17,.25); }
  .msheet > a, .msheet form button { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 50px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--text-strong); font: inherit; font-size: 16px; font-weight: 600; text-align: left; text-decoration: none; cursor: pointer; }
  .msheet > a .ico, .msheet form button .ico { width: 21px; height: 21px; color: var(--text-muted); }
  .msheet > a.on { background: #EEF5F0; color: var(--primary-dark); }
  .msheet form { margin: 0; }
  .msheet-me { margin-bottom: 6px; padding-bottom: 8px !important; border-bottom: 1px solid var(--extra-light) !important; border-radius: 0 !important; min-height: 62px !important; }
  .msheet-me .avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #33433B; color: #DDEBE2; font-size: 14px; flex: none; }
  .msheet-me b { display: block; font-size: 16px; }
  .msheet-me small { display: block; margin-top: 1px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
  .msheet-badge { margin-left: auto; padding: 1px 9px; border-radius: 999px; background: #D4A04A; color: #1B2420; font-style: normal; font-size: 12.5px; font-weight: 700; }
  .msheet-legal { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; padding: 14px 12px 0; border-top: 1px solid var(--extra-light); }
  .msheet-legal a { font-size: 13.5px; color: var(--text-muted); text-decoration: none; }

  /* cookie bar: compact, above the tab bar */
  #bi-cookie { left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; padding: 14px 14px 12px; border-radius: 12px; }
  #bi-cookie .t { font-size: 18px; }
  #bi-cookie p { margin: 4px 0 10px; font-size: 12.5px; line-height: 1.45; }
  #bi-cookie button { height: 36px; padding: 0 12px; font-size: 12.5px; }
}

@media (max-width: 640px) {
  /* book page: a modest cover, the title right under it */
  .bk-cover { max-width: 200px; margin: 0 auto 4px; }

  /* settings and admin tabs: one scrolling row instead of wrapping onto several lines */
  .settings-nav { position: static; flex-direction: row; flex-wrap: nowrap; width: auto; gap: 18px; overflow-x: auto; white-space: nowrap; margin: 0 -16px 14px; padding: 0 16px; scrollbar-width: none; border-bottom: 1px solid var(--extra-light); }
  .settings-layout { align-items: stretch; min-width: 0; }
  .settings-wrap { min-width: 0; width: 100%; }
  .settings-nav { min-width: 0; }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav a { padding: 10px 0; }
  .adm-nav { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 20px; padding: 0 12px; scrollbar-width: none; }
  .adm-nav::-webkit-scrollbar { display: none; }
  .adm-nav a { white-space: nowrap; padding: 10px 12px; }
  .settings-form .fld.two, .fld.two { grid-template-columns: 1fr; }

  /* Admin → Emails: the select takes the width instead of pushing the page wider */
  .adm-bar-row { align-items: stretch; }
  .adm-mailsel { flex: 1 1 100%; min-width: 0; max-width: 100%; }
  .adm-mailsel .ed-sel { width: 100%; }
  .adm-tools { margin-left: 0; width: 100%; }
  .adm-mail-frame { height: 480px; }
}

/* Search on a phone: the whole screen, the way a native search opens */
@media (max-width: 820px) {
  .search-overlay { padding: 0; align-items: stretch; overflow: hidden; background: #FCFBF8; backdrop-filter: none; }
  .search-panel { max-width: none; width: 100%; height: 100%; display: flex; flex-direction: column; border-radius: 0; box-shadow: none; animation: none; }
  .search-bar { flex: none; box-sizing: border-box; height: calc(var(--mtop) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0 16px; }
  .search-bar input { font-size: 17px; height: 40px; }
  .search-esc { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; padding: 0; border-radius: 10px; }
  .search-esc-text { display: none; }
  .search-esc-ico { display: block; width: 18px; height: 18px; margin: 0; color: var(--text-strong); }
  .search-chips { flex: none; }
  .search-body { flex: 1; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 6px 8px; }
  .search-body.blurred { min-height: 0; }
  .search-result { padding: 12px; }
  .search-foot { flex: none; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .search-foot .sf-hint { display: none; }
  .search-foot { justify-content: space-between; }
  .search-foot .sf-count { flex: 1; margin-left: 0; text-align: left; }
  .search-foot .sf-toggle kbd { display: none; }
  .search-foot .sf-pop-head span:last-child { display: none; }
  .search-foot .sf-pop { position: fixed; left: 10px; right: 10px; bottom: calc(60px + env(safe-area-inset-bottom)); width: auto; max-height: 55vh; overflow-y: auto; }
}

.search-esc-ico { display: none; }
@media (max-width: 820px) { .search-esc-ico { display: block; } }

/* Section links ("Browse library →"): the text on a desktop, only a chevron at the far right on a phone */
.dv-sechead a .cta-chev { display: none; }
@media (max-width: 640px) {
  .dv-sechead { align-items: center; }
  .dv-sechead a { justify-content: center; width: 40px; height: 40px; margin-right: -8px; border-radius: 10px; }
  .dv-sechead a .cta-text, .dv-sechead a .cta-arrow { display: none; }
  .dv-sechead a .cta-chev { display: block; width: 22px; height: 22px; }
  /* the whole heading row is the link, not just the chevron */
  .dv-sechead { position: relative; }
  .dv-sechead a::after { content: ''; position: absolute; inset: -6px -16px; }
  .dv-sechead a:active { background: rgba(31,36,33,.06); }
}

/* Dashboard "Recently added" is a carousel: 5 books on a wide screen, fewer as it narrows, 2 on a phone (with a hint of the next) */
/* the arrows sit on the left/right edge of the covers; the track has headroom so a book tilted on hover isn't cut off at the top */
.dv-trackwrap { position: relative; display: flow-root; container-type: inline-size; --n: 5; --pad-t: 26px; }
.dv-arrow { position: absolute; z-index: 3; top: calc(var(--pad-t) + (100cqw - (var(--n) - 1) * 22px) / var(--n) * .75); transform: translateY(-50%); display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #DCD7CC; border-radius: 50%; background: #fff; color: var(--text-strong); box-shadow: 0 4px 14px rgba(31,36,33,.18); cursor: pointer; }
.dv-arrow.prev { left: -19px; }
.dv-arrow.next { right: -19px; }
.dv-arrow:hover { border-color: var(--text-strong); }
.dv-arrow .ico { width: 16px; height: 16px; }
@media (max-width: 1180px) { .dv-trackwrap { --n: 4; } .dv-book { flex-basis: calc((100% - 3 * 22px) / 4); } }
@media (max-width: 900px) { .dv-trackwrap { --n: 3; } .dv-book { flex-basis: calc((100% - 2 * 22px) / 3); } }
@media (max-width: 640px) {
  /* the track runs to the screen's edge (the page's own 16px side padding is cancelled); the first book still lines up with the text */
  .dv-books { gap: 14px; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; scroll-padding-left: 36px; }
  .dv-book { flex-basis: calc((100vw - 32px - 14px) / 2.15); }
  .dv-arrow { display: none; }
}

/* Pagination: page numbers wrap on a wide screen; on a phone Prev, "2 / 11", Next — never wider than the screen */
.pager-btns { flex-wrap: wrap; }
@media (max-width: 640px) {
  .pager { justify-content: center; margin-top: 28px; padding-top: 20px; }
  .pager-info { width: 100%; text-align: center; }
  /* Prev and Next as chevrons, three page numbers around the current page */
  .pager-btns { width: 100%; flex-wrap: nowrap; justify-content: center; gap: 8px; }
  .pager-lbl, .pager-btn.pager-num.far { display: none; }
  .pager-btn { flex: none; width: 44px; height: 44px; padding: 0; }
  .pager-btn .ico { width: 18px; height: 18px; }
}

/* A phone's layout is never wider than the phone: anything that would stick out is clipped instead of widening the page.
   (clip, not hidden — hidden would break the sticky top bar) */
@media (max-width: 820px) {
  html, body { max-width: 100%; overflow-x: clip; }
  .app, .main, .page { min-width: 0; max-width: 100%; }
}

/* Library filters on a phone: search, then sort + view on one row, then the genres as ONE scrolling row instead of five wrapped lines */
@media (max-width: 640px) {
  .toolbar { gap: 10px; margin-bottom: 14px; }
  .toolbar .search { flex: 1 1 100%; height: 44px; }
  .toolbar .sort { flex: 1; min-width: 0; }
  .toolbar .sort-btn { width: 100%; min-width: 0; height: 44px; }
  .toolbar .viewtoggle { height: 44px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 14px !important; padding: 2px 16px 4px; scroll-padding: 0 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; height: 36px; white-space: nowrap; }
}

/* "Share collection" on a phone: just the share icon, a square button beside the title */
@media (max-width: 640px) {
  .page-head--split { align-items: flex-start; gap: 12px; }
  .page-head--split .btn { flex: none; width: 44px; height: 44px; padding: 0; justify-content: center; }
  .page-head--split .btn .btn-lbl { display: none; }
}

/* Genres: one row you drag (mouse) or swipe (finger), on every screen size, with a fade where it continues */
.chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; cursor: grab; -webkit-user-select: none; user-select: none; overscroll-behavior-x: contain; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chips.grabbing { cursor: grabbing; }
.chips.grabbing .chip { pointer-events: none; }
.chips .chip { flex: none; white-space: nowrap; }
.chips.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.chips.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.chips.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
@media (max-width: 640px) { .chips.fade-r, .chips.fade-l { -webkit-mask-image: none; mask-image: none; } }

/* Select menus on a phone open as a sheet from the bottom of the screen, over a dimmed page */
@media (max-width: 640px) {
  .modal-overlay { backdrop-filter: none; -webkit-backdrop-filter: none; }   /* a blur on an ancestor would make "fixed" relative to it */
  body .ed-menu, body .adm-sel .ed-menu, body .adm-cookies .ed-menu, body .adm-mailsel .ed-menu, body .sort-menu {
    position: fixed; left: 0; right: 0; top: auto; bottom: 0; width: auto; min-width: 0; max-width: none; max-height: min(68vh, 520px);
    margin: 0; padding: 6px 8px calc(14px + env(safe-area-inset-bottom)); border: 0; border-radius: 18px 18px 0 0;
    background: #fff; box-shadow: 0 -14px 44px rgba(15,20,17,.3); z-index: 140; overflow-y: auto; overscroll-behavior: contain;
  }
  .ed-menu::before, .sort-menu::before { content: ''; display: block; width: 40px; height: 4px; margin: 6px auto 10px; border-radius: 2px; background: #DCD7CC; }
  .ed-menu button, .ed-menu a, .sort-menu li { min-height: 48px; font-size: 16px; }
  .sort-menu li { padding: 0 14px; }
  .ed-menu-search { top: 0; margin: 0 0 6px; }
  /* the dimmed page behind an open menu; a tap on it closes the menu without reaching what is underneath */
  body:not(:has(.modal-overlay .ed-menu:not([style*="display: none"]):not([x-cloak]))):has(.ed-menu:not([style*="display: none"]):not([x-cloak]), .sort-menu:not([style*="display: none"]):not([x-cloak]))::before {
    content: ''; position: fixed; inset: 0; z-index: 139; background: rgba(15,20,17,.45);
  }
  /* inside a modal the page's own backdrop would sit above the modal (a separate stacking layer) and swallow the taps on the options;
     there the sheet dims everything around it with a huge shadow instead, and a tap outside it still closes it */
  body .modal-overlay .ed-menu { box-shadow: 0 -14px 44px rgba(15,20,17,.3), 0 0 0 200vmax rgba(15,20,17,.45); }
}

/* Sort button: the label stays on one line (cut with … if it must be), left-aligned, with the chevron at the right */
.sort-btn > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
@media (max-width: 640px) { .sort-btn { padding: 0 12px; gap: 8px; font-size: 14px; } }

/* Library list view on a phone: title, and the author(s) on a second line under it */
@media (max-width: 640px) {
  .list-row { grid-template-columns: 24px minmax(0, 1fr) auto; grid-template-rows: auto auto; gap: 2px 14px; height: auto; min-height: 64px; padding: 10px 16px; align-content: center; }
  .list-row .lr-mini { grid-row: 1 / 3; align-self: center; }
  .list-row .lr-title { grid-column: 2; grid-row: 1; align-self: end; }
  .list-row > .lr-text:nth-child(3) { display: block; grid-column: 2; grid-row: 2; align-self: start; font-size: 13px; }
  .list-row .lr-loc { grid-column: 3; grid-row: 1 / 3; align-self: center; max-width: 34vw; }
}

/* Modals on a phone fill the screen (small yes/no confirmations — .cf — stay as compact cards) */
@media (max-width: 640px) {
  .modal-overlay { padding: 0 !important; align-items: stretch !important; overflow: hidden; }
  /* the panel is exactly the screen: the header and the footer stay put, only the middle scrolls */
  .modal-overlay .add-panel:not(.cf) { max-width: none !important; width: 100%; height: 100%; max-height: none; border-radius: 0; box-shadow: none; animation: none; display: flex; flex-direction: column; overflow: hidden; }
  .modal-overlay .add-panel:not(.cf) > .add-head, .modal-overlay .add-panel:not(.cf) > .ed-head, .modal-overlay .add-panel:not(.cf) > .sh-foot { flex: none; }
  .modal-overlay .add-panel:not(.cf) > form, .modal-overlay .add-panel:not(.cf) > .ed-body, .modal-overlay .add-panel:not(.cf) > .add-body, .modal-overlay .add-panel:not(.cf) > .sh-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal-overlay .add-panel:not(.cf) .add-body > .add-foot, .modal-overlay .add-panel:not(.cf) form > .add-foot { position: sticky; bottom: 0; z-index: 4; margin: 0 -16px -20px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #FCFBF8; }
  /* the header is sticky; the close button sits exactly where the search bar's does (a 40px soft square, 8px from the top, 14px from the right edge) and stays there while the content scrolls */
  .modal-overlay .add-panel:not(.cf) .add-head, .modal-overlay .add-panel:not(.cf) .ed-head { position: sticky; top: 0; z-index: 6; display: block; box-sizing: border-box; min-height: calc(var(--mtop) + env(safe-area-inset-top)); padding: calc(12px + env(safe-area-inset-top)) 66px 12px 16px; background: #FCFBF8; }
  .modal-overlay .add-panel:not(.cf) .modal-x, .modal-overlay .add-panel:not(.cf) .ed-x { position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 14px; width: 40px; height: 40px; margin: 0; border-radius: 10px; background: var(--extra-light); color: var(--text-strong); display: inline-grid; place-items: center; }
  .modal-overlay .add-panel:not(.cf) .modal-x .ico, .modal-overlay .add-panel:not(.cf) .ed-x .ico { width: 18px; height: 18px; }
  .modal-overlay .add-panel:not(.cf) .add-title, .modal-overlay .add-panel:not(.cf) .ed-title { font-size: 26px; margin-top: 2px; }
  .modal-overlay .add-panel:not(.cf) .add-head .eyebrow, .modal-overlay .add-panel:not(.cf) .ed-eyebrow { display: none; }   /* the small line above the title has no room on a phone */
  .modal-overlay .add-panel:not(.cf) .add-head, .modal-overlay .add-panel:not(.cf) .ed-head { display: flex; align-items: center; min-height: calc(var(--mtop) + env(safe-area-inset-top)); }
  .add-body { grid-template-columns: 1fr; padding: 16px 16px 20px; }
  .add-body .fld-trio { grid-template-columns: 1fr 1fr; }
  .sh-body { flex: 1; padding: 16px 16px 24px; }   /* takes the free height, so the footer sits at the bottom of the screen */
  .sh-foot { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  .modal-overlay .add-panel.sh { max-width: none !important; border-radius: 0; }
  .ed-body { padding: 16px 16px 0; }
  .ed-foot { margin: 4px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
}

/* Share modal on a phone: the address and its button stacked, the expiry choices as a 2 × 2 grid, the actions full width */
@media (max-width: 640px) {
  /* the address with its copy button to the right of it: just the link icon (a check once copied) */
  .sh-url { gap: 8px; }
  .sh-url code { font-size: 13px; }
  .sh-copy { flex: none; display: inline-grid; place-items: center; width: 46px; padding: 0; }
  .sh-copy-text { display: none; }
  .sh-copy .sh-copy-ico { display: block; width: 20px; height: 20px; }
  /* views, last viewed, created: a tidy list — the label at the left, the value at the right */
  .sh-stats { grid-template-columns: 1fr; gap: 0; margin-top: 18px; padding-top: 4px; }
  .sh-stats > div { display: flex; flex-direction: row-reverse; justify-content: space-between; align-items: baseline; gap: 12px; padding: 13px 0; border-bottom: 1px solid #EEEAE1; }
  .sh-stats > div:last-child { border-bottom: 0; }
  .sh-stats b { font-size: 19px; text-align: right; }
  .sh-stats span { margin-top: 0; font-size: 14px; }
  .sh-exp-head { align-items: center; flex-wrap: wrap; gap: 2px 12px; }
  .sh-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .sh-pills button { height: 44px; padding: 0 12px; }
  .sh-actions { flex-direction: column; align-items: stretch; gap: 14px; }
  .sh-open { justify-content: center; height: 48px; }
  .sh-actions form { justify-content: center; }
}

.sh-copy .sh-copy-ico { display: none; }
@media (max-width: 640px) { .sh-copy .sh-copy-ico { display: block; } }

/* Shelves: a long bookcase name or count never pushes past the card — each is cut with … */
.bookcase-head { gap: 16px; min-width: 0; }
.bookcase-head .section-title { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookcase-count { flex: 0 1 auto; max-width: 46%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

/* Shelves on a phone: a full shelf scrolls sideways (the board runs the full length) and swiping scrolls instead of picking a book up */
@media (max-width: 820px) {
  .shelf-run { display: grid; grid-template-columns: minmax(max-content, 1fr); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .shelf-run::-webkit-scrollbar { display: none; }
  .spine { touch-action: pan-x pan-y; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }   /* touch-action:none (for dragging) would block swiping the shelf */
}

/* Shelf names sit under the shelf's board, like a label on the wood (desktop and phone alike) */
.shelf { display: flex; flex-direction: column; }
.shelf-run { order: 1; }
.shelf-head { order: 2; padding: 12px 0 20px; }

/* Shelves on a phone: when the books do not fit, the board runs out past the card to the screen's edges (page 16px + card border 1px + card padding 22px = 39px);
   the first book still lines up with the text */
@media (max-width: 820px) {
  .shelf-run.bleed { margin-left: -39px; margin-right: -39px; }
  .shelf-run.bleed .spines { padding-left: 39px; padding-right: 39px; }
  .shelf-run.bleed .shelf-board { margin-left: 39px; margin-right: 39px; }   /* the board is exactly as long as the books: it never runs on past the last (or before the first) one */
}

/* no hover on a touch screen: the book preview that follows the mouse over a spine is not shown there */
@media (hover: none) { .spine-tip { display: none !important; } }

/* Shelves on a phone: the sheet that a tap on a spine opens */
.spsheet-wrap { display: none; }
@media (max-width: 820px) {
  .spsheet-wrap { display: block; }
  .spsheet-bg { position: fixed; inset: 0; z-index: 130; background: rgba(15,20,17,.45); }
  .spsheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 131; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -14px 44px rgba(15,20,17,.3); }
  .spsheet-grip { display: block; width: 40px; height: 4px; margin: 4px auto 14px; border-radius: 2px; background: #DCD7CC; }
  .spsheet-book { display: flex; gap: 16px; align-items: flex-start; }
  .spsheet-cover { flex: none; width: 84px; }
  .spsheet-info { min-width: 0; flex: 1; }
  .spsheet-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; line-height: 1.15; color: var(--text-strong); overflow-wrap: anywhere; }
  .spsheet-author { margin-top: 4px; font-size: 14.5px; color: var(--text-muted); }
  .spsheet-meta { display: flex; gap: 10px; margin-top: 6px; font-size: 13px; color: var(--text-faint); }
  .spsheet-stars { margin-top: 8px; }
  .spsheet-go { display: flex; justify-content: center; width: 100%; height: 48px; margin-top: 18px; font-size: 15.5px; }
}

/* "Scroll for more" on a shelf that runs past the screen (phones; until someone has scrolled a shelf) */
.shelf-stage { position: relative; order: 1; }
.shelf-stage .shelf-run { order: 0; }
.shelf-hint { display: none; }
@media (max-width: 820px) {
  .shelf-hint { display: flex; position: absolute; right: -39px; top: 0; bottom: 9px; width: 120px; align-items: center; justify-content: flex-end; padding-right: 12px; pointer-events: none; background: linear-gradient(90deg, rgba(251,250,247,0), rgba(251,250,247,.45)); color: #fff; font-size: 11.5px; font-weight: 600; }
  .shelf-hint span { display: inline-flex; align-items: center; gap: 3px; padding: 5px 8px 5px 10px; border-radius: 999px; background: rgba(31,36,33,.5); box-shadow: none; white-space: nowrap; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .shelf-hint .ico { width: 12px; height: 12px; animation: shelf-nudge 1.3s ease-in-out infinite; }
}
@keyframes shelf-nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }

/* the unsorted pile's count on a phone: just "1 book" */
@media (max-width: 640px) { .bookcase-count .pile-off { display: none; } }

/* Book page on a phone, top to bottom: cover, title and authors, the buttons, status / rating / languages / added, the specs, where it stands, the synopsis, the rest.
   The two columns dissolve (display: contents) so their pieces can be put in this order. */
@media (max-width: 640px) {
  .bk-grid { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .bk-side, .bk-main { display: contents; }
  .bk-cover { order: 1; }
  .bk-main > * { order: 8; }
  .bk-main > .bk-eyebrow, .bk-main > .bk-title, .bk-main > .bk-subtitle, .bk-main > .bk-by { order: 2; }
  .bk-main > .bk-title { margin-top: 16px; }
  .bk-btns { order: 3; margin-top: 18px; }
  .bk-main > .bk-meta { order: 4; margin: 22px 0 0; padding-bottom: 22px; border-bottom: 0; }   /* the specs' first line is the divider */
  .bk-side > .bk-spec { order: 5; margin-top: 0; }
  .bk-side > .bk-dup-link { order: 6; margin: 14px 0 6px; align-self: flex-start; }
  .bk-side > .bk-loc { order: 7; margin: 18px 0 32px; }
}
}

/* "Further in this bookcase / See all (7) →" on a phone: only a chevron at the right, and the whole heading row is the link */
.bk-also a .cta-chev { display: none; }
@media (max-width: 640px) {
  .bk-also { position: relative; align-items: center; }
  .bk-also a { justify-content: center; width: 40px; height: 40px; margin-right: -8px; border-radius: 10px; }
  .bk-also a .cta-text, .bk-also a .cta-arrow { display: none; }
  .bk-also a .cta-chev { display: block; width: 22px; height: 22px; }
  .bk-also a::after { content: ''; position: absolute; inset: -6px -16px; }
  .bk-also a:active { background: rgba(31,36,33,.06); }
}

/* "Also on this shelf…" is a carousel: a mouse drags it, a finger swipes it; on a phone two books show, with a hint of the next one running out to the screen's edge */
.bk-more { display: flex; gap: 20px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; cursor: grab; padding: 2px 2px 6px; margin: -2px -2px 0; -webkit-user-select: none; user-select: none; }
.bk-more::-webkit-scrollbar { display: none; }
.bk-more.grabbing { cursor: grabbing; scroll-snap-type: none; }
.bk-more.grabbing a, .bk-more.grabbing > div { pointer-events: none; }
.bk-more > a, .bk-more > div { flex: 0 0 140px; min-width: 0; scroll-snap-align: start; }
@media (max-width: 640px) {
  .bk-more { gap: 14px; margin-left: -16px; margin-right: -16px; padding-left: 16px; padding-right: 16px; scroll-padding-left: 36px; scroll-snap-type: x mandatory; }
  .bk-more > a, .bk-more > div { flex-basis: calc((100vw - 32px - 14px) / 2.15); }
}

/* ISBN look-up in the add-book form on a phone: just the magnifier */
@media (max-width: 640px) { .ed-isbn .ed-tint .ed-tint-lbl { display: none; } .ed-isbn .ed-tint { flex: none; width: 44px; height: 44px; padding: 0; justify-content: center; } }   /* both buttons are 44px squares */

/* "Show as" for the authors in the add-book form: on a desktop the two choices sit next to the label; on a phone they are folded away
   behind one row ("Show as  List all ›") that opens them as a button group */
.ed-showas-toggle { display: none; }
@media (max-width: 640px) {
  .ed-showas { flex-wrap: wrap; gap: 8px 0; }
  .ed-showas .ed-showas-label { display: none; }
  .ed-showas .ed-showas-toggle { display: flex; align-items: center; gap: 8px; flex: 0 0 100%; height: 36px; padding: 0; border: 0; border-radius: 0; background: none; color: var(--text-muted); font: inherit; font-size: 13.5px; font-weight: 400; cursor: pointer; }
  .ed-showas .ed-showas-toggle b { color: var(--text-strong); font-weight: 600; }
  .ed-showas .ed-showas-chev { order: 1; width: 16px; height: 16px; margin: 0 0 0 -2px; transition: transform .15s; }   /* right after the label */
  .ed-showas .ed-showas-toggle b { display: none; }   /* only "Show as ›"; the choice itself shows when it is opened */
  .ed-showas.open .ed-showas-chev { transform: rotate(90deg); }
  .ed-showas > button:not(.ed-showas-toggle) { display: none; }
  .ed-showas.open > button:not(.ed-showas-toggle) { display: block; }
  /* the two choices are one button group: joined, rounded at the outer ends only */
  .ed-showas button:not(.ed-showas-toggle) { flex: 1 1 0; min-width: 0; height: 40px; padding: 0 10px; border-radius: 0; margin-left: -1px; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; }
  .ed-showas > button:not(.ed-showas-toggle):nth-of-type(2) { margin-left: 0; border-radius: 10px 0 0 10px; }
  .ed-showas > button:not(.ed-showas-toggle):last-of-type { border-radius: 0 10px 10px 0; }
  .ed-showas button.on { z-index: 1; }
}

/* Notes beside a field's name ("sets spine height", "optional" …) go on a second line on a phone */
@media (max-width: 640px) {
  .ed-f label .ed-sub, .ed-body label .ed-sub { display: block; margin: 2px 0 0; font-size: 12.5px; line-height: 1.35; }
}

/* Tags: on a phone the "+ Add" button is just a plus, a 44px square like the ISBN buttons */
.ed-tint .ed-add-ico { display: none; }
@media (max-width: 640px) {
  .ed-tint-add { flex: none; width: 44px; height: 44px; padding: 0; justify-content: center; }
  .ed-tint-add .ed-tint-lbl { display: none; }
  .ed-tint-add .ed-add-ico { display: block; width: 20px; height: 20px; }
}

/* Segmented choices ("On a shelf / Wishlist") fill the width on a phone, split evenly */
@media (max-width: 640px) {
  .ed-seg { display: flex; width: 100%; box-sizing: border-box; }
  .ed-seg button { flex: 1 1 0; min-width: 0; justify-content: center; gap: 6px; padding: 0 8px; font-size: 13.5px; white-space: nowrap; }
}

/* Colour swatches on a phone: big enough to hit (36px, was 20px) */
@media (max-width: 640px) {
  .ed-swatches { gap: 12px; }
  .ed-swatches button, .ed-swatches .ed-custom, .ed-swatches .ed-custom span { width: 36px; height: 36px; border-radius: 9px; }
  .ed-swatches .ed-custom span { display: grid; place-items: center; font-size: 22px; line-height: 1; }
  .ed-swatches button.on { box-shadow: 0 0 0 2px #FCFBF8, 0 0 0 4px #1F2421; }
}

/* Cover in the book form on a phone: bigger and centred, the buttons below it splitting the width 50 / 50 */
@media (max-width: 640px) {
  .ed-cover { flex-direction: column; align-items: center; gap: 18px; }
  .ed-cover .ed-book { width: min(210px, 62vw); margin-left: 0; }   /* the 3D book box sets the cover's width */
  .ed-cover-side { width: 100%; flex: none; }
  .ed-cover-btns { flex-wrap: nowrap; gap: 10px; }
  .ed-cover-btns > * { flex: 1 1 0; min-width: 0; height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 10px; text-align: center; }
}

/* Spine preview beside the cover — phones only (on a desktop the book turns on hover) */
.ed-cover-visual { display: contents; }
.ed-spine-prev { display: none; }
@media (max-width: 640px) {
  .ed-cover { --cover-w: min(200px, 58vw); }
  .ed-cover .ed-book { width: var(--cover-w); }
  .ed-cover-visual { display: flex; align-items: flex-end; justify-content: center; gap: 22px; width: 100%; }
  .ed-spine-prev { display: block; flex: none; }
  .ed-spine-prev .spine { pointer-events: none; cursor: default; height: calc(var(--cover-w) * 1.5); width: calc(var(--cover-w) * 1.5 * var(--ratio, .1)); min-width: 26px; padding: 14px 4px 10px; }
  .ed-spine-prev .spine-title { font-size: 12px; }
}

/* The description box in the book form is roomier on a phone: about ten lines, and it can still be dragged taller */
@media (max-width: 640px) { .ed .ed-f textarea, .ed-body .ed-f textarea { height: 220px; min-height: 220px; line-height: 1.5; padding-top: 12px; } }

/* Barcode scanner: the Back button is a solid, clearly visible button on the dark window (it looked see-through) */
.scan-foot .ed-tint { flex: none; min-width: 96px; height: 44px; background: #F4F1EA; border-color: #F4F1EA; color: #1F2421; font-weight: 700; opacity: 1; }
.scan-foot .ed-tint:hover { background: #fff; border-color: #fff; }
.scan-view { overflow: hidden; }   /* the frame's huge dimming shadow was painting over the footer buttons, so "Back" looked see-through */

/* A field the form still needs: red outline and a short message under it (shown after Save was pressed) */
.ed .ed-f input.invalid { border-color: var(--error); box-shadow: 0 0 0 3px rgba(192,57,43,.12); }
.ed .ed-f > .fld-error { display: block; margin-top: 6px; }

/* Footer of the book form on a phone: Cancel narrower, the main button twice as wide */
@media (max-width: 640px) {
  .ed-foot { flex-wrap: wrap; }
  .ed-foot .modal-error { flex: 0 0 100%; order: -1; margin: 0 0 4px; }
  .ed-foot .ed-cancel { flex: 1 1 0; min-width: 0; }
  .ed-foot .ed-save { flex: 2 1 0; min-width: 0; }
}

/* Settings sections on a phone: one row with the current section ("Section  Profile ⌄"), opening the list as a sheet from the bottom */
.settings-jump, .msheet-wrap-s { display: none; }
@media (max-width: 640px) {
  .settings-nav { display: none; }
  .settings-jump { display: flex; align-items: center; gap: 10px; width: 100%; height: 48px; padding: 0 14px; border: 1px solid #DCD7CC; border-radius: 12px; background: #fff; font: inherit; font-size: 15px; color: var(--text-muted); cursor: pointer; }
  .settings-jump b { color: var(--text-strong); font-weight: 700; }
  .settings-jump .ico { width: 18px; height: 18px; margin-left: auto; }
  .msheet-wrap-s { display: block; }
  .settings-section[id] { scroll-margin-top: 76px; }   /* below the sticky top bar (56px) */
}

/* Settings → public profile: a long address wraps instead of pushing the switch out of the card */
.settings-pub > div { min-width: 0; }
.settings-pub small { overflow-wrap: anywhere; }

/* Guided tour: a real (outlined) button; on a phone it sits under the text and fills the width */
.settings-tour .btn { flex: none; white-space: nowrap; }
@media (max-width: 640px) {
  .settings-tour { flex-direction: column; align-items: stretch; gap: 12px; }
  .settings-tour .btn { width: 100%; height: 44px; justify-content: center; }
}

/* Settings cards on a phone: less padding, so the fields get the width (16px around, was 28px) */
@media (max-width: 640px) {
  .settings-section { padding: 18px 16px 20px; border-radius: 14px; }
  .settings-section-title { font-size: 25px; }
  .settings-section-sub { margin-bottom: 16px; }
  .settings-wrap { gap: 14px; }
}

/* Settings → bookcases on a phone: the name gets most of the row (at least half), the count sits under it, the two actions are stacked at the right */
@media (max-width: 640px) {
  .bc-row-head { align-items: flex-start; }
  .bc-row-title { flex: 1 1 55%; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 50%; }
  .bc-row-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bc-row-head > .settings-inline-input { flex: 1 1 55%; min-width: 50%; }
}

/* Rename sheet (settings → bookcases) — phones only */
.rnsheet-wrap { display: none; }
@media (max-width: 640px) {
  .rnsheet-wrap { display: block; }
  .rnsheet-bg { position: fixed; inset: 0; z-index: 140; background: rgba(15,20,17,.45); }
  .rnsheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 141; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -14px 44px rgba(15,20,17,.3); }
  .rnsheet-title { font-family: var(--font-display); font-size: 24px; font-weight: 500; color: var(--text-strong); margin: 2px 0 14px; }
  .rnsheet-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-body); margin-bottom: 6px; }
  .rnsheet-input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid #DCD7CC; border-radius: 10px; background: #fff; font: inherit; font-size: 16px; color: var(--text-strong); box-sizing: border-box; }
  .rnsheet-input:focus { outline: none; border-color: #2F7A55; box-shadow: 0 0 0 3px rgba(47,122,85,.15); }
  .rnsheet-btns { display: flex; gap: 10px; margin-top: 16px; }
  .rnsheet-btns .btn { height: 48px; justify-content: center; }
  .rnsheet-btns .btn:first-child { flex: 1 1 0; }
  .rnsheet-btns .btn:last-child { flex: 2 1 0; }
}

/* Settings → bookcases on a phone: finger-sized controls. Rename / Remove are 44px icon buttons, each shelf is a full-width 48px row
   (tap the name to rename, the cross to remove), "Add bookcase" is a plus. */
.bc-act-ico, .bc-add-ico { display: none; }
@media (max-width: 640px) {
  .bc-row-actions { flex-direction: row; align-items: center; gap: 0; margin: -6px -8px 0 0; }
  .bc-row-actions button { display: inline-grid; place-items: center; min-width: 40px; height: 44px; padding: 0 6px; border-radius: 10px; }
  .bc-row-actions button:active { background: var(--extra-light); }
  .bc-row-actions .bc-act-txt { display: none; }
  .bc-row-actions .bc-act-ico { display: block; width: 20px; height: 20px; }
  .bc-row-actions .is-primary { background: var(--primary); color: #fff; padding: 0 14px; }

  .settings-shelves { flex-direction: column; gap: 8px; }
  .settings-shelf-chip { display: flex; width: 100%; height: 48px; padding: 0 4px 0 14px; border-radius: 12px; font-size: 15px; }
  .settings-shelf-chip .chip-name { flex: 1; min-width: 0; height: 100%; justify-content: space-between; text-align: left; }
  .settings-shelf-chip .chip-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .settings-shelf-chip .chip-name .ico { width: 16px; height: 16px; opacity: .5; margin-right: 2px; }
  .settings-shelf-chip > button:last-child { flex: none; width: 40px; height: 44px; justify-content: center; border-radius: 10px; }
  .settings-shelf-chip > button:last-child .ico { width: 16px; height: 16px; }
  .settings-shelf-chip .chip-edit { flex: 1; min-width: 0; }
  .settings-shelf-chip .chip-input { flex: 1; min-width: 0; width: auto; height: 36px; font-size: 16px; }
  .settings-shelf-add { width: 100%; height: 48px; justify-content: center; border-radius: 12px; font-size: 15px; }

  .bc-add-btn { flex: none; width: 48px; height: 48px; padding: 0; justify-content: center; }
  .bc-add-btn .bc-add-txt { display: none; }
  .bc-add-btn .bc-add-ico { display: block; width: 22px; height: 22px; }
}

/* Settings → shared links on a phone: icon, name, address (one line) and the figures on top; the four actions below as a 2 × 2 grid of real buttons */
@media (max-width: 640px) {
  .sl-row { flex-wrap: wrap; row-gap: 12px; }
  .sl-main { flex: 1 1 calc(100% - 56px); }
  .sl-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
  .bc-row-actions.sl-actions { flex: 0 0 100%; align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
  .bc-row-actions.sl-actions form { display: flex; width: 100%; margin: 0; }
  .bc-row-actions.sl-actions button { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-width: 0; height: 44px; padding: 0 10px; border: 1px solid #DCD7CC; border-radius: 10px; background: #fff; font-size: 14px; font-weight: 600; color: var(--text-strong); }
  .bc-row-actions.sl-actions button:active { background: var(--extra-light); }
  .bc-row-actions.sl-actions form:last-child button { color: var(--error); }
}

/* Settings → your data on a phone: export buttons and the delete-account field + button fill the width */
@media (max-width: 640px) {
  .settings-export { display: grid; grid-template-columns: 1fr; gap: 10px; }
  .settings-export .btn { width: 100%; height: 48px; justify-content: center; }
  .settings-danger .danger-confirm { flex-direction: column; align-items: stretch; }
  .settings-danger .danger-confirm input { flex: none; width: 100%; max-width: none; height: 48px; font-size: 16px; box-sizing: border-box; }
  .settings-danger .danger-confirm .btn { width: 100%; height: 48px; justify-content: center; }
}

/* Guided tour on a phone: the card spans the width, its buttons fit (Back and Continue share the row, Skip sits under them) */
@media (max-width: 640px) {
  #bi-tour .bt-card { width: auto; padding: 16px 16px 14px; }
  #bi-tour .bt-title { font-size: 22px; }
  #bi-tour .bt-nav { flex-wrap: wrap; gap: 8px; }
  #bi-tour .bt-spacer { display: none; }
  #bi-tour .bt-nav .bt-back { order: 1; flex: 1 1 0; justify-content: center; height: 44px; }
  #bi-tour .bt-nav .bt-next { order: 2; flex: 2 1 0; justify-content: center; height: 44px; }
  #bi-tour .bt-nav .bt-back[style*="hidden"] { display: none; }   /* the first step has no Back: Continue takes the whole row */
  #bi-tour .bt-nav .bt-skip { order: 3; flex: 0 0 100%; height: 36px; text-align: center; justify-content: center; }
}

/* Bookcase + Shelf side by side in one box (the last step of the add-book tour points at the pair) */
.ed-pair { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ed-pair .ed-f { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

/* Inputs with a suggestion list (series / edition): no browser arrow inside the field; the suggestions still appear as you type */
input[list]::-webkit-calendar-picker-indicator { display: none !important; opacity: 0; pointer-events: none; }
input[list] { -moz-appearance: none; appearance: none; }

/* Search results on a phone: the cover at the left, then the title (two lines at most), the author, and the place under them
   (the place used to sit at the right and squeezed the title into five lines) */
@media (max-width: 820px) {
  .search-result { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 14px; row-gap: 6px; align-items: start; padding: 12px; }
  .search-result .sr-cover { grid-row: 1 / span 2; width: 40px; align-self: start; }
  .search-result .sr-cover .cover { width: 40px; }
  .search-result .sr-main { grid-column: 2; grid-row: 1; }
  .search-result .sr-title { font-size: 19px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .search-result .sr-side { grid-column: 2; grid-row: 2; flex-direction: row; align-items: center; justify-content: flex-start; text-align: left; }
}

/* Public pages on a phone: the same slim dark top bar as in the app (logo, name), without search, and a single "Sign in" on the right */
@media (max-width: 820px) {
  .pub-head { position: sticky; top: 0; z-index: 40; background: var(--bg-sidebar, #1B2420); }
  .pub-head-in { height: calc(var(--mtop, 56px) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0 16px; gap: 12px; }
  .pub-head .ax-brand { gap: 10px !important; }
  .pub-head .ax-logo { width: 30px !important; height: 30px !important; font-size: 17px !important; }
  .pub-head .ax-wordmark { font-size: 19px !important; color: #fff !important; white-space: nowrap; }
  .pub-head .ax-wordmark span { color: var(--primary-light, #7FC9A1) !important; }
  .pub-actions { gap: 0; }
  .pub-actions .in { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 8px; background: #2F7A55; color: #fff; font-size: 14px; white-space: nowrap; }
  .pub-actions .in ~ .cta { display: none; }
  .pub-actions .cta { white-space: nowrap; }
}

/* The "Viewing as" bar on a phone: one slim row that stays at the top while scrolling (under the app's top bar, above the public header) */
@media (max-width: 820px) {
  .pub-lens { --lens-h: 48px; position: sticky; top: calc(var(--mtop, 56px) + env(safe-area-inset-top)); z-index: 39; flex-wrap: nowrap; justify-content: space-between; gap: 10px; height: var(--lens-h); padding: 0 14px 0 16px; }
  .main > .pub-lens { top: calc(var(--mtop, 56px) + env(safe-area-inset-top)); z-index: 39; }
  .pub-lens-label, .pub-lens-note { display: none; }
  .pub-seg { flex: none; }
  .pub-seg a { padding: 6px 14px; }
  .pub-lens-back { min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; }
  .pub-lens-back .pub-lens-back-lbl { overflow: hidden; text-overflow: ellipsis; }
}

/* Public pages: with the body fixed at the screen's height (html, body { height: 100% }) a sticky bar would leave with the first screenful; the body grows with its content instead */
body:has(> .pub-head), body:has(> .pub-lens) { height: auto; min-height: 100%; }

/* Public library list view on a phone: the same compact row as in the app (the desktop's six columns have no room) */
@media (max-width: 640px) {
  .book-list--pub .list-head { display: none; }
  .book-list--pub .list-row { grid-template-columns: 24px minmax(0, 1fr) auto; }
  .book-list--pub .list-row > .lr-text:nth-child(4), .book-list--pub .list-row > .lr-text:nth-child(5) { display: none; }
  .book-list--pub .list-row > .stars { grid-column: 3; grid-row: 1 / 3; align-self: center; }
}

/* Shared book on a phone: a little room between the bars and the "Shared by" line */
@media (max-width: 820px) { .pb-by { margin-top: 12px; } }

/* Shared book on a phone: the wide buttons fit the screen (the text wraps instead of pushing the page wider) */
@media (max-width: 760px) { .pb-btn { max-width: 100%; height: auto; min-height: 50px; padding: 10px 20px; justify-content: center; text-align: center; } }

/* No double-tap zoom on a touch screen (pinch zoom is switched off by the viewport tag and, on iOS Safari, by a gesturestart handler) */
@media (pointer: coarse) { html { touch-action: manipulation; } }

/* Add / edit book on a phone: "Acquired from" and "Date added" each take the full width */
@media (max-width: 640px) { .ed-two.ed-acq { grid-template-columns: minmax(0, 1fr); } }
