:root {
  color-scheme: light;
  --download-accent: #273142;
  --download-hover: #11141a;
  --download-text: #ffffff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #24211d;
  background: #f5f1e8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: #24211d;
  background: #f5f1e8;
}

.app-shell {
  width: min(1050px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

h1 { margin: 0; font: 750 clamp(2rem, 5vw, 3rem)/1.05 system-ui, sans-serif; white-space: nowrap; }
.branding h1 a, .branding h1 a:visited {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.branding h1 a:hover { color: var(--download-accent); }
.branding h1 a:focus-visible { outline: 3px solid #8a623b; outline-offset: .2rem; }
.subtitle { margin: .35rem 0 0; color: #6a6359; }
.account-actions { display: flex; align-items: center; flex: none; column-gap: .65rem; row-gap: .65rem; }
.social-header .account-actions { column-gap: .5rem; }
#sign-in-button { background: var(--download-accent); }
#sign-in-button:not(:disabled):hover { background: var(--download-hover); }
.account-actions > .search-icon-button, .account-actions > .notification-controls, .account-actions > .user-controls { margin: 0; }
.account-actions > .search-icon-button { margin-right: -.15rem; }
.account-actions > .notification-controls { margin-right: .35rem; }
.user-controls { position: relative; }
.avatar-button {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
  overflow: hidden;
}
.avatar-button img { width: 100%; height: 100%; object-fit: cover; }
.avatar-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + .55rem);
  right: 0;
  left: auto;
  width: max-content;
  min-width: 360px;
  max-width: calc(100vw - 2rem);
  border: 1px solid #d6c9b8;
  border-radius: .65rem;
  padding: .4rem;
  background: #fffdf9;
  box-shadow: 0 10px 32px rgb(45 32 20 / 20%);
}
.account-identity { min-width: 0; }
.account-identity-link {
  display: block;
  width: 100%;
  padding: .65rem .7rem;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 650;
  text-align: left;
  text-decoration: none;
}
.account-identity-link strong, .account-identity-link span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.account-identity-link strong { font-size: 1rem; }
.account-identity-link span { margin-top: .18rem; color: #756b60; font-size: .8rem; font-weight: 400; }
.account-identity-link:hover { background: #f2eadf; }
.account-identity-link:focus-visible { outline: 2px solid #8a623b; outline-offset: -2px; }
.account-identity-link:hover span { color: inherit; }
.avatar-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: .65rem .7rem;
  color: #342c24;
  background: transparent;
  text-align: left;
  white-space: nowrap;
}
.avatar-menu button:not(:disabled):hover, .avatar-menu button:not(:disabled):focus, .avatar-menu-link:hover, .avatar-menu-link:focus-visible { background: #f2eadf; }
.avatar-menu button:disabled { cursor: default; background: transparent; opacity: .55; }
.avatar-menu small { margin-left: .75rem; color: #756b60; font-weight: 400; }
.avatar-menu hr { margin: .35rem .5rem; border: 0; border-top: 1px solid #e5dbce; }
.avatar-menu .account-menu-separator { margin-top: .55rem; border-top-color: #cdbbab; }
.avatar-menu .sign-out-menu-item { color: #8a2923; }

button {
  border: 0;
  border-radius: .45rem;
  padding: .7rem 1rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  color: white;
  background: #684629;
}

/* Keep these prominent actions consistent with the book download button. */
#retry-button,
.avatar-button,
.indexing-continuation-button {
  color: var(--download-text);
  background: var(--download-accent);
}

#retry-button:not(:disabled):hover,
.avatar-button:not(:disabled):hover,
.indexing-continuation-button:not(:disabled):hover {
  background: var(--download-hover);
}

button.secondary { color: #4f3825; background: #e4d7c5; }
button.danger { background: #9a342d; }
button.compact { padding: .2rem .55rem; font-size: 1.25rem; }
button:disabled { cursor: wait; opacity: .6; }

.status-panel, .error-panel, #library-panel {
  border: 1px solid #ded5c8;
  border-radius: .7rem;
  padding: 1rem 1.15rem;
  background: #fffdf9;
  box-shadow: 0 2px 10px rgb(70 52 31 / 6%);
}

.status-panel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.library-navigation-row { display: flex; align-items: center; gap: .75rem; min-width: 0; margin-bottom: 1rem; }
.friend-libraries-status { flex: none; max-width: 18rem; margin: 0; color: #746b60; font-size: .9rem; }
.library-tabs { display: flex; align-items: start; gap: .4rem; margin-bottom: 0; min-width: 0; flex: 0 1 auto; }
.library-tabs[hidden], .settings-page-open .library-tabs { display: none !important; }
.library-navigation-row:has(.library-tabs[hidden]) { margin-bottom: 0; }
@media (max-width: 650px) { .library-navigation-row { align-items: flex-start; flex-wrap: wrap; } .friend-libraries-status { max-width: 100%; } .library-tabs { flex-basis: 100%; } }
.library-tab-strip { display: flex; flex: 1; min-width: 0; gap: .4rem; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.library-tab-strip::-webkit-scrollbar { display: none; }
.library-tabs button { min-height: 44px; flex: none; }
.library-tabs > button:not(.library-tab) {
  color: var(--download-text);
  background: var(--download-accent);
}
.library-tabs > button:not(.library-tab):not(:disabled):hover {
  color: var(--download-text);
  background: var(--download-hover);
}
.library-tab-strip .library-tab { white-space: nowrap; background: #e4d7c5; color: var(--download-accent); opacity: 1; }
.library-tab-strip .library-tab:hover { background: #d2bea4; color: #000; }
.library-tab-strip .library-tab[aria-selected="true"] { background: var(--download-accent); color: var(--download-text); opacity: 1; box-shadow: none; }
.library-tab-strip .library-tab[aria-selected="true"]:hover { background: var(--download-accent); color: var(--download-text); }
.library-tabs button:focus-visible { outline: 3px solid #8b592e; outline-offset: 2px; }
.library-tab-strip.dragging { cursor: grabbing; user-select: none; }
.library-tab-strip.dragging button { cursor: grabbing; }
.library-tabs.expanded .library-tab-strip { flex-wrap: wrap; overflow: visible; }
#library-selection-message { margin: .8rem 0; }
.status-panel:has(#indexing-errors:not([hidden])) { flex-wrap: wrap; }
#indexing-errors { flex-basis: 100%; min-width: 0; font-size: .85rem; }
#indexing-errors button { padding: .35rem .55rem; margin: .2rem; }
#indexing-errors ul { max-height: min(65vh, 36rem); overflow: auto; padding: 0; list-style: none; overflow-wrap: anywhere; }
#indexing-errors .indexing-error-entry { display: grid; gap: .5rem; padding: .8rem 0; border-bottom: 1px solid #ded5c8; }
#indexing-errors .indexing-error-drive { display: inline-flex; align-items: center; justify-content: center; justify-self: start; min-height: 44px; padding: .5rem .85rem; border-radius: .45rem; background: #e4d7c5; color: #4f3825; text-decoration: none; }
#indexing-errors .indexing-error-filter { display: grid; gap: .4rem; margin-top: .75rem; }
#indexing-errors select { min-height: 44px; max-width: 100%; width: 100%; }
#indexing-errors summary { min-height: 44px; padding: .65rem 0; cursor: pointer; }
#indexing-errors pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: inherit; max-width: 100%; }
#indexing-errors textarea { width: 100%; min-height: 10rem; }
.status-panel > p { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.status-panel dl, .stop-button { flex: none; }
.status-panel p, .error-panel p { margin: 0; }
.error-panel { margin-top: 1rem; border-color: #cf847d; color: #7c211b; }
.error-panel button { margin-top: .8rem; }

dl { display: flex; gap: 1.5rem; margin: 0; }
dl div { text-align: right; }
dt { color: #746b60; font-size: .78rem; }
dd { margin: 0; color: #000; font-weight: 400; font-variant-numeric: tabular-nums; }
#stats dd { font-weight: 700; }

#library-panel { margin-top: 1rem; overflow: auto; }
.library-tree { min-width: 0; }
.tree-list { list-style: none; margin: 0; padding-left: 1.25rem; }
.library-tree > .tree-list { padding-left: 0; }
.tree-row { display: flex; align-items: center; width: 100%; max-width: 100%; min-width: 0; min-height: 1.9rem; flex-wrap: nowrap; overflow: hidden; }
.folder-toggle {
  padding: .2rem .35rem;
  color: inherit;
  background: transparent;
  font-weight: 650;
  text-align: left;
}
.folder-toggle::before { content: "▸"; display: inline-block; width: 1.2rem; color: #8a623b; }
.folder-toggle[aria-expanded="true"]::before { content: "▾"; }
.folder-toggle.empty::before { content: "·"; }
.folder-toggle:not(:disabled):hover { background: #f4eee5; }
.avatar-menu-link { display: block; padding: .65rem .7rem; color: inherit; font: inherit; font-weight: 650; text-align: left; white-space: nowrap; text-decoration: none; }
.avatar-menu-link:hover { background: #f2eadf; }
.avatar-menu-link:focus-visible { outline: 2px solid #8a623b; outline-offset: -2px; }
.folder-content-count, .folder-note { color: #8b8379; font-size: .88em; }
.folder-content-count { flex: none; margin-left: .45rem; color: #000; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.folder-note-edit { flex: none; padding: .15rem .32rem; margin-left: .28rem; color: #746b60; background: transparent; font-size: .9rem; line-height: 1; }
.folder-note-edit:hover { background: #f4eee5; }
.folder-note-viewport { position: relative; flex: 1 1 0; min-width: 0; max-width: 100%; margin-left: .32rem; overflow: hidden; white-space: nowrap; cursor: grab; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.folder-note-viewport:active { cursor: grabbing; }
.folder-note { display: inline-block; min-width: max-content; overflow: hidden; text-overflow: ellipsis; vertical-align: top; user-select: none; -webkit-user-select: none; }
.folder-note-viewport.truncated:not(.scrolled)::after { content: "…"; position: absolute; right: 0; top: 0; padding-left: .2rem; color: #8b8379; background: #fffdfa; pointer-events: none; }
.empty-library { color: #746b60; }

.book-grid-item { margin: .45rem 0 .9rem; }
.book-grid {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}
.book-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  margin-top: .85rem;
  flex-wrap: wrap;
}
.book-pagination-button {
  border-radius: 0;
  min-width: 2rem;
  min-height: 2rem;
  padding: .3rem .5rem;
  font-size: .8rem;
  line-height: 1;
  color: #4f3825;
  background: transparent;
}
.book-pagination-button:not(:disabled):hover,
.book-pagination-button:not(:disabled):focus-visible,
.book-pagination-button:not(:disabled):active {
  color: var(--download-text);
  background: var(--download-hover);
}
.book-pagination-button:not(:disabled):focus-visible {
  outline: 3px solid var(--download-accent);
  outline-offset: 2px;
}
.book-pagination-button[aria-current="page"] {
  color: var(--download-text);
  background: var(--download-accent);
  cursor: default;
}
.book-pagination-button[aria-current="page"]:hover,
.book-pagination-button[aria-current="page"]:focus-visible,
.book-pagination-button[aria-current="page"]:active { background: var(--download-hover); }
.book-pagination-button:disabled {
  color: #746b60;
  background: transparent;
  cursor: default;
  opacity: .6;
}
.book-pagination-ellipsis { min-width: 1.5rem; color: #746b60; text-align: center; }
.book-card {
  --book-cover-height: 180px;
  --book-cover-width: 135px;
  --book-download-height: 34px;
  display: grid;
  grid-template-columns: var(--book-cover-width) minmax(0, 1fr);
  height: calc(var(--book-cover-height) + var(--book-download-height) + 2px);
  min-height: calc(var(--book-cover-height) + var(--book-download-height) + 2px);
  max-height: calc(var(--book-cover-height) + var(--book-download-height) + 2px);
  min-width: 0;
  border: 1px solid #e0d6c8;
  border-radius: .6rem;
  overflow: hidden;
  background: #fffaf3;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.book-card:hover { border-color: #cdbbab; background: #fffdf9; box-shadow: 0 3px 12px rgb(70 52 31 / 10%); }
.book-card:focus-visible { outline: 3px solid #8a623b; outline-offset: 2px; }
.book-card-media { display: flex; width: var(--book-cover-width); min-height: 0; flex-direction: column; }
.book-cover-frame {
  width: var(--book-cover-width);
  height: var(--book-cover-height);
  aspect-ratio: 3 / 4;
  flex: none;
  overflow: hidden;
}
.book-cover-placeholder, .book-cover-image { width: 100%; height: 100%; }
.book-cover-image {
  display: block;
  object-fit: cover;
  object-position: center top;
}
.book-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .35rem;
  color: #756858;
  background: linear-gradient(145deg, #e7dccd, #f5ede2);
  text-align: center;
}
.book-cover-placeholder span { font-size: 2rem; }
.book-cover-placeholder small { font-size: .7rem; }
.book-card-body { position: relative; display: flex; min-width: 0; min-height: 0; overflow: hidden; padding: .9rem 1rem; flex-direction: column; }
.book-card-author, .book-card-genre { margin: 0; color: #746b60; }
.book-card-author { font-size: 16px; font-weight: 650; }
.book-card-metadata-warning { margin: 0 0 .25rem; color: #8a4b08; font-size: .78rem; line-height: 1.25; }
.book-card-author, .book-card-genre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-card-title {
  display: -webkit-box;
  margin: .15rem 0 .35rem;
  overflow: hidden;
  font-size: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.book-card-genre { font-size: 15px; }
.book-metadata-link {
  appearance: none;
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: inherit;
  vertical-align: baseline;
  cursor: pointer;
}
.book-metadata-link:hover { color: black; background: transparent; }
.book-metadata-link:focus-visible {
  color: black;
  outline: 2px solid black;
  outline-offset: -2px;
}
.book-card-annotation-block { display: flex; height: 0; min-height: 0; margin-top: .55rem; flex: 1; overflow: hidden; flex-direction: column; }
.book-card-annotation {
  display: block;
  margin: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  color: #000000;
  font-size: 16px;
  line-height: 1.55;
  white-space: pre-line;
}
.book-card-annotation.truncated {
  display: -webkit-box;
  height: var(--annotation-height);
  min-height: var(--annotation-height);
  max-height: var(--annotation-height);
  flex: none;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--annotation-lines, 1);
  line-clamp: var(--annotation-lines, 1);
}
.book-download-button {
  width: var(--book-cover-width);
  height: var(--book-download-height);
  min-height: var(--book-download-height);
  max-height: var(--book-download-height);
  flex: none;
  border-radius: 0;
  padding: 0 .3rem;
  font-size: .8rem;
  line-height: 1;
  white-space: nowrap;
  color: var(--download-text);
  background: var(--download-accent);
}
.book-download-button:not(:disabled):hover { background: var(--download-hover); }

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(35 27 20 / 55%);
}
.annotation-modal {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: 950px;
  max-width: 100%;
  max-height: min(80vh, 720px);
  overflow: hidden;
  border-radius: .7rem;
  background: #fffdf9;
  box-shadow: 0 12px 45px rgb(20 14 9 / 30%);
}
.annotation-modal-cover {
  position: relative;
  width: auto;
  height: 100%;
  min-height: 0;
  align-self: stretch;
  overflow: hidden;
  border-radius: .7rem 0 0 .7rem;
  background: #e7dccd;
}
.annotation-modal-cover img {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  object-fit: initial;
}
.annotation-modal-cover-placeholder {
  display: grid;
  width: 150px;
  height: 100%;
  place-items: center;
  padding: 1rem;
  color: #756858;
  text-align: center;
}
.annotation-modal-content {
  display: flex;
  min-width: 0;
  min-height: 0;
  max-height: min(80vh, 720px);
  overflow: hidden;
  padding: 1.1rem 1.2rem;
  flex-direction: column;
}
.modal-header { display: block; flex: 0 0 auto; }
.modal-header h2 { margin: 0; padding-right: 3.25rem; font-size: 18px; font-weight: 400; overflow-wrap: anywhere; }
.annotation-modal-book-title { font-size: 18px; font-weight: 600; }
.annotation-modal-authors { font-size: 16px; font-weight: 400; }
#annotation-modal-close, .root-folder-close { position: absolute; z-index: 2; top: 14px; right: 16px; bottom: auto; width: 2rem; height: 2rem; min-width: 2rem; min-height: 2rem; max-height: 2rem; padding: 0; display: grid; place-items: center; align-self: start; justify-self: end; aspect-ratio: 1; line-height: 1; }
#annotation-modal-close:hover, .root-folder-close:hover { background: #d2bea4; color: inherit; }
#annotation-modal-close > span, .root-folder-close > span { position: relative; top: -4px; display: block; line-height: 1; }
.annotation-modal-genres { margin: .45rem 0 0; flex: 0 0 auto; color: #756b60; font-size: 15px; }
.annotation-modal-content > #annotation-modal-text {
  min-height: 0;
  margin: .7rem 0 0;
  padding: .7rem .35rem 0 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  border-top: 1px solid #ded5c8;
  font-size: 17px;
  line-height: 1.6;
  white-space: pre-wrap;
}

[hidden] { display: none !important; }

.search-icon-button {
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  padding: 0;
  flex: none;
  color: #746b60;
  background: transparent;
}
.search-icon-button:not(:disabled):hover { color: black; cursor: pointer; }
.search-icon-button:focus-visible, .advanced-search-link:focus-visible {
  outline: 2px solid #8a623b;
  outline-offset: 2px;
}
.quick-search-form {
  position: absolute;
  z-index: 10;
  right: 6.7rem;
  top: 50%;
  width: 260px;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-50%) scaleX(.85);
  transform-origin: right center;
  transition: opacity .18s ease, transform .18s ease;
}
.quick-search-open .quick-search-form {
  visibility: visible;
  opacity: 1;
  transform: translateY(-50%) scaleX(1);
}
.quick-search-form input, .book-search-form input, .book-search-form select {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid #cdbbab;
  border-radius: .25rem;
  padding: .5rem .6rem;
  color: inherit;
  background: #fffdf9;
  font: inherit;
}
.quick-search-form input { border-color: #ded5c8; }
.quick-search-form input:focus-visible {
  outline: none;
  box-shadow: none;
  border-color: #b9afa2;
}
.book-search-form input:focus-visible, .book-search-form select:focus-visible {
  outline: 2px solid #8a623b;
  outline-offset: 2px;
}
.advanced-search-link {
  position: absolute;
  top: 100%;
  left: 0;
  padding: .2rem 0;
  font-size: .8rem;
  font-weight: 400;
  color: #746b60;
  background: transparent;
}
.advanced-search-link:hover { color: black; }
.book-search-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem 1rem;
  margin-bottom: 1.2rem;
}
.book-search-form label { display: grid; gap: .3rem; min-width: 0; }
.search-submit-button {
  justify-self: start;
  min-width: 135px;
  height: 34px;
  border: 0;
  border-radius: 0;
  padding: 0 .3rem;
  font-size: .8rem;
  line-height: 1;
  color: var(--download-text);
  background: var(--download-accent);
}
.search-submit-button:not(:disabled):hover { background: var(--download-hover); }
.sharing-folder-list { display: grid; gap: .65rem; margin: 1rem 0 1.25rem; }
.sharing-folder-list label { display: flex; align-items: baseline; gap: .55rem; cursor: pointer; }
.sharing-folder-list input { flex: none; accent-color: var(--download-accent); }
.sharing-folder-list span { overflow-wrap: anywhere; min-width: 0; }
.sharing-folder-list input:focus-visible, .settings-save-button:focus-visible {
  outline: 2px solid #8a623b;
  outline-offset: 2px;
}
.settings-save-button {
  min-width: 135px;
  height: 34px;
  border: 0;
  border-radius: 0;
  padding: 0 .3rem;
  font-size: .8rem;
  line-height: 1;
  color: var(--download-text);
  background: var(--download-accent);
}
.settings-save-button:not(:disabled):hover { background: var(--download-hover); }
.notifications-panel .notification-share-button { padding-inline: calc(.3rem + 7px); }
.social-header .quick-search-form { right: 10.05rem; }
.notification-controls { position: relative; flex: none; }
.notification-button { position: relative; }
.notification-badge { position: absolute; top: 0; right: 0; min-width: 1.05rem; height: 1.05rem; padding: 0 .15rem; border-radius: 50%; background: #8a623b; color: white; font-size: .65rem; line-height: 1.05rem; text-align: center; }
.notifications-panel { position: absolute; z-index: 25; right: 0; top: calc(100% + .55rem); width: min(360px, calc(100vw - 4rem)); max-height: min(440px, 65vh); overflow-y: auto; padding: .85rem; background: #fffdf9; border: 1px solid #cdbbab; border-radius: .25rem; }
.notifications-panel h3 { margin: 0 0 .75rem; }
.notifications-panel ul { padding: 0; margin: 0; list-style: none; }
.notifications-panel li + li { margin-top: 1rem; border-top: 1px solid #e5dbce; padding-top: .75rem; }
.notifications-panel p { overflow-wrap: anywhere; }
.notifications-panel small, .friends-table small { color: #6a6359; }
.app-footer { display: flex; justify-content: center; gap: 1.25rem; flex-wrap: wrap; margin-top: 2rem; color: #6a6359; font-size: .9rem; }
.app-footer a { color: inherit; text-underline-offset: .15em; }
.app-footer a:hover { color: #342c24; }

.social-section { margin-top: 2rem; }
.social-share-form { display: grid; grid-template-columns: minmax(0, 280px) auto; align-items: start; gap: .25rem .75rem; }
.social-share-form label { grid-column: 1; grid-row: 1; }
.social-share-form .invitation-send-status { grid-column: 1 / -1; grid-row: 2; width: 100%; max-width: 100%; min-width: 0; margin: 0; font: inherit; color: inherit; overflow-wrap: anywhere; }
.social-share-form button[type="submit"] { grid-column: 2; grid-row: 1; justify-self: start; }
@media (max-width: 420px) { .social-share-form { grid-template-columns: minmax(0, 1fr); } .social-share-form button[type="submit"] { grid-column: 1; grid-row: 3; justify-self: start; } }
.invitation-send-status a { color: #684629; text-decoration: underline; }

.social-section [data-social-retry] { padding-inline: 1rem; white-space: nowrap; }
.social-share-form label { display: grid; gap: .3rem; width: 280px; flex: 0 1 280px; max-width: 100%; box-sizing: border-box; }
.invitation-send-status { margin: 0; max-width: 100%; font-size: .9rem; overflow-wrap: anywhere; }
.invitation-send-status:empty { display: none; }
.invitation-send-status[role="status"] { min-height: 0; }
.social-share-form input { width: 280px; max-width: 100%; padding: .5rem .6rem; border: 1px solid #cdbbab; border-radius: .25rem; font: inherit; color: inherit; background: #fffdf9; }
.social-share-form input:focus, .social-share-form input:focus-visible { outline: none; box-shadow: none; }
.friends-table-container { overflow-x: auto; }
.friends-table { width: 100%; border-collapse: collapse; }
.friends-table th, .friends-table td { text-align: left; padding: .6rem .35rem; border-bottom: 1px solid #e5dbce; }
.friends-table small { display: block; overflow-wrap: anywhere; }
.friends-table .settings-save-button { height: auto; min-height: 34px; padding: 0 1.8rem; white-space: nowrap; }
.friends-table td:first-child { padding: 0; }
.sent-invitations-table-container { overflow-x: auto; }
.sent-invitations-table { width: 100%; border-collapse: collapse; }
.sent-invitations-table th, .sent-invitations-table td { text-align: left; padding: .6rem .35rem; border-bottom: 1px solid #e5dbce; vertical-align: middle; }
.sent-invitation-user { overflow-wrap: anywhere; }
.sent-invitations-table .settings-save-button { height: auto; min-height: 34px; padding: 0 1.8rem; white-space: nowrap; }
.sent-invitations-table td:last-child { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.invitation-resend-tooltip { display: inline-block; }
.sent-invitations-message:empty { display: none; }
.friend-library-button { display: block; width: 100%; min-height: 100%; padding: .6rem .35rem .6rem calc(.35rem + 5px); color: inherit; background: transparent; font: inherit; font-weight: 650; text-align: left; overflow-wrap: anywhere; border-radius: 0; }
.friend-library-button:hover { color: inherit; background: #f2eadf; text-decoration: none; }
.friend-library-button:focus-visible { outline: 2px solid #8a623b; outline-offset: -2px; }
.friend-library-button small { display: block; font-size: .85em; font-weight: 400; }
.friend-status-mark { display: inline-block; min-width: 1.4em; font-size: 1.25rem; font-weight: 750; line-height: 1; text-align: center; }
.friend-status-mark.is-yes { color: #21833b; }
.friend-status-mark.is-no { color: #c62828; }
/* Keep every action on the settings page the same height as the email field. */
.settings-page-open .social-share-form input { height: 42px; box-sizing: border-box; }
.settings-page-open .settings-save-button { height: 42px; min-height: 42px; box-sizing: border-box; }
@media (max-width: 1000px) {
  .social-header .quick-search-form { right: 0; }
  .app-header.quick-search-open { padding-bottom: 4.5rem; }
  .quick-search-form { right: 0; left: 0; top: auto; bottom: 0; width: auto; transform: translateY(-.3rem); }
  .quick-search-open .quick-search-form { transform: translateY(0); }
  .advanced-search-link { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  .quick-search-form { transition: none; }
}

@media (max-width: 650px) {
  .book-search-form { grid-template-columns: minmax(0, 1fr); }
  .account-actions > .search-icon-button { padding: 0; }
  .app-shell { width: min(100% - 1rem, 1050px); padding-top: 1rem; }
  .app-header { align-items: center; gap: .75rem; }
  h1 { font-size: clamp(1.45rem, 7vw, 2rem); }
  .subtitle { font-size: .85rem; }
  .account-actions { gap: .4rem; }
  .social-header .account-actions { gap: .4rem; }
  .account-actions > button { padding: .55rem .7rem; }
  .status-panel { align-items: flex-start; flex-wrap: wrap; }
  .status-panel > p { flex-basis: 100%; }
  dl div { text-align: left; }
  .annotation-modal { grid-template-columns: auto minmax(0, 1fr); }
  .annotation-modal-cover-placeholder { width: 90px; }
  .annotation-modal-content { padding: .9rem; }
  .avatar-menu { min-width: min(360px, calc(100vw - 1rem)); max-width: calc(100vw - 1rem); }
  .avatar-menu button { white-space: normal; }
}

@media (max-width: 520px) {
  .app-header { align-items: flex-start; flex-direction: column; }
  .account-actions { align-self: flex-end; }
}

.root-folder-dialog {
  position: relative;
  display: flex;
  width: min(620px, 100%);
  max-height: min(720px, 90vh);
  flex-direction: column;
  gap: .75rem;
  padding: 1.2rem;
  border: 1px solid #d6c9b8;
  border-radius: .7rem;
  background: #fffdf9;
  box-shadow: 0 10px 32px rgb(45 32 20 / 20%);
}
.root-folder-dialog h2, .root-folder-dialog .root-folder-description { text-align: center; }
.root-folder-link-description, .root-folder-emails, .root-folder-copy-message { margin: 0; color: #6a6359; text-align: left; overflow-wrap: anywhere; }
.root-folder-link-description a {
  overflow-wrap: anywhere;
  color: var(--download-accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .15em;
  transition: color .15s ease;
}
.root-folder-link-description a:hover { color: #687487; }
.root-folder-link-description a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.root-folder-email { display: inline; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.root-folder-email:hover, .root-folder-email:focus-visible { font-weight: 700; }
.root-folder-copy-message { text-align: left; }
/* The notice popup explains consequences in full sentences, so its text is justified. */
.root-folder-dialog .root-folder-description-justify { text-align: justify; }
.root-folder-dialog header, .root-folder-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.root-folder-dialog h2 { margin: 0; font-size: 1.2rem; }
.root-folder-description, .root-folder-status { margin: 0; color: #6a6359; }
.root-folder-breadcrumb { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.root-folder-crumb { padding: .2rem .35rem; color: #4f3825; background: transparent; }
.root-folder-crumb:disabled { color: #746b60; cursor: default; }
.root-folder-list { min-height: 7rem; max-height: 48vh; overflow: auto; margin: 0; padding: .25rem; list-style: none; border: 1px solid #e5dbce; border-radius: .4rem; }
.root-folder-entry { width: 100%; padding: .65rem .75rem; color: #342c24; background: transparent; text-align: left; font-weight: 500; overflow-wrap: anywhere; }
.root-folder-entry:hover, .root-folder-entry:focus-visible { background: #f2eadf; }
.root-folder-dialog footer { justify-content: center; flex-wrap: wrap; margin-top: 7px; }
/* The popup button is centered with 10px more horizontal padding than the settings-page buttons. */
.root-folder-dialog footer .settings-save-button { padding-inline: calc(.3rem + 10px); }
.root-folder-dialog button:focus-visible { outline: 2px solid #8a623b; outline-offset: 2px; }

/* Keep text-entry controls neutral; avoid brown borders and focus frames. */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"]),
textarea,
select {
  border-color: #c8c8c8;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="file"]):focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: #888;
  outline: 2px solid #aaa;
  outline-offset: 1px;
  box-shadow: none;
}

.root-folder-status-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.root-folder-status-row .root-folder-status { flex: 1; }
