@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Caslon+Display&display=swap');
:root {
  --paper: #ffffff;
  --ink: #233d35;
  --muted: #707d73;
  --line: #dfe5dc;
  --green: #285345;
  --pale: #f2f4f7;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    14px 'DM Sans',
    system-ui,
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #ba9655;
  outline-offset: 3px;
}
button:hover:not(:disabled) {
  filter: brightness(0.96);
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 235px;
  background: #f2f4f7;
  padding: 37px 23px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.brand {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -1px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-icon {
  font-size: 29px;
}
.library-label {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: var(--muted);
  margin: 55px 14px 15px;
}
.nav {
  border: 0;
  background: transparent;
  width: 100%;
  padding: 14px 12px;
  text-align: left;
  border-radius: 6px;
  display: flex;
  gap: 12px;
  color: #33476a;
  margin: 4px 0;
}
.nav.active {
  background: #e4edff;
  color: var(--green);
  font-weight: 700;
}
.nav span:last-child:not(:first-child) {
  flex: 1;
}
#nav-count {
  text-align: right;
}
.sidebar-note {
  margin: auto 12px 28px;
  padding-top: 45px;
}
.small-icon {
  font-size: 26px;
  color: #a28859;
}
.sidebar-note h3 {
  font-family: 'Libre Caslon Display', Georgia, serif;
  font-size: 23px;
  font-weight: 400;
  line-height: 1.1;
}
.sidebar-note p {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}
.local {
  font-size: 11px;
  padding-top: 22px;
  border-top: 1px solid #d5dfd0;
}
.local small {
  display: block;
  color: var(--muted);
  margin-top: 7px;
}
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #2949d5;
  border-radius: 50%;
  margin-right: 5px;
}
main {
  margin-left: 235px;
  padding: 0 48px;
  max-width: 1700px;
}
header {
  height: 104px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.breadcrumb {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.breadcrumb span {
  margin: 0 12px;
  color: #33476a;
}
.header-actions {
  display: flex;
  gap: 10px;
}
button.primary,
button.secondary,
button.quiet {
  border-radius: 6px;
  padding: 11px 16px;
  font-weight: 500;
  white-space: nowrap;
}
.primary {
  background: var(--green);
  color: white;
  border: 1px solid var(--green);
}
.secondary {
  background: transparent;
  border: 1px solid #c7d2c5;
  color: var(--ink);
}
.quiet {
  background: transparent;
  border: 0;
  color: var(--muted);
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 43px 0 33px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.6px;
  font-weight: 600;
  color: #33476a;
}
h1 {
  font:
    56px/1.06 'Libre Caslon Display',
    Georgia,
    serif;
  letter-spacing: -1px;
  margin: 13px 0 14px;
}
.intro p {
  color: var(--muted);
  font-size: 14px;
}
.shelf-art {
  display: flex;
  align-items: flex-end;
  border-bottom: 5px solid #cfb78c;
  padding: 8px 15px 0;
  margin-right: 28px;
  transform: rotate(-3deg);
}
.shelf-art i {
  width: 23px;
  height: 95px;
  background: #2949d5;
  margin: 0 2px;
  border-radius: 2px 4px 0 0;
  font: 12px Georgia;
  color: #ecdfbf;
  padding: 18px 7px;
  box-shadow: inset 4px 0 #ffffff18;
}
.shelf-art i:nth-child(2) {
  height: 113px;
  background: #2949d5;
}
.shelf-art i:nth-child(3) {
  height: 88px;
  background: #7d9092;
}
.shelf-art i:nth-child(4) {
  height: 105px;
  background: #914f3c;
}
.shelf-art i:last-child {
  transform: rotate(12deg);
  margin-left: 12px;
  background: #2949d5;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 22px 0;
  margin-bottom: 30px;
}
.stats > div {
  padding: 0 25px;
  border-right: 1px solid var(--line);
}
.stats > div:last-child {
  border: 0;
}
.stats span,
.stats small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.stats strong {
  font:
    38px 'Libre Caslon Display',
    Georgia,
    serif;
  display: block;
  margin: 8px 0 3px;
}
.stats small {
  font-size: 10px;
}
.welcome {
  border: 1px dashed #bccbb7;
  border-radius: 8px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.welcome p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 0;
}
.collection-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 30px 0 17px;
}
h2 {
  font:
    29px 'Libre Caslon Display',
    Georgia,
    serif;
  margin: 0;
}
.collection-title > span {
  font-size: 11px;
  color: var(--muted);
}
.view-toggle {
  margin-left: auto;
  background: #f2f4f7;
  border-radius: 5px;
  padding: 3px;
  display: flex;
}
.view-toggle button {
  border: 0;
  background: transparent;
  padding: 4px 10px;
  font-size: 20px;
  color: var(--muted);
}
.view-toggle button.selected {
  background: white;
  border-radius: 3px;
  color: var(--ink);
  box-shadow: 0 1px 3px #243d3515;
}
.toolbar {
  display: flex;
  gap: 10px;
}
.search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 13px;
}
.search span {
  font-size: 25px;
}
.search input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 13px 0;
  outline-offset: 0;
}
input,
select,
textarea {
  color: var(--ink);
}
select {
  background: #fff;
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: 5px;
  max-width: 100%;
}
input[type='checkbox'] {
  accent-color: var(--green);
  width: 15px;
  height: 15px;
}
.selection-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  padding: 13px 0;
}
.selection-row label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.selection-row .quiet {
  font-size: 11px;
  padding: 7px;
}
.books {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 19px;
}
.book {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.book-check {
  position: absolute;
  top: 11px;
  left: 10px;
  z-index: 1;
  background: #ffffffd9;
  border-radius: 4px;
  display: flex;
  padding: 3px;
}
.book-open {
  padding: 0;
  border: 0;
  text-align: left;
  width: 100%;
  height: 100%;
  background: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.cover-stage {
  width: 100%;
  height: 190px;
  background: #f2f4f7;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cover {
  width: 110px;
  height: 150px;
  background: var(--cover);
  color: #f9eed8;
  box-shadow:
    7px 8px 12px #27362820,
    inset 5px 0 #0002;
  border-radius: 1px 4px 4px 1px;
  padding: 15px 12px 12px 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid #0001;
}
.cover:before {
  content: '';
  width: 24px;
  border-top: 2px solid #eeddb8;
  margin-bottom: 12px;
  opacity: 0.7;
}
.cover .cover-title {
  font:
    17px/1.08 'Libre Caslon Display',
    Georgia,
    serif;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cover small {
  font-size: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: auto;
  padding-top: 8px;
  overflow: hidden;
  max-height: 22px;
}
.book-info {
  padding: 16px;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.book-info h3 {
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.author {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 17px;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.book-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  gap: 5px;
}
.badge {
  background: #f2f4f7;
  color: #6e7a68;
  font-size: 9px;
  border-radius: 4px;
  padding: 5px 7px;
  text-transform: capitalize;
}
.badge.reading {
  background: #f2f4f7;
  color: #3a6648;
}
.badge.finished {
  background: #e6edf1;
  color: #496776;
}
.format {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 55px 20px;
  border: 1px dashed var(--line);
  border-radius: 8px;
}
.empty h3 {
  font: 28px Georgia;
}
.empty p {
  color: var(--muted);
}
footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  margin-top: 45px;
  padding: 24px 0 30px;
  font-size: 10px;
  color: #33476a;
}
footer span:first-child {
  letter-spacing: 2px;
}
.table-wrap {
  grid-column: 1/-1;
  overflow: auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}
th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  background: #f2f4f7;
}
td,
th {
  padding: 14px 13px;
  border-bottom: 1px solid var(--line);
}
td button {
  background: none;
  border: 0;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  padding: 0;
}
dialog {
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(740px, 94vw);
  max-height: 90vh;
  padding: 30px;
  box-shadow: 0 25px 100px #1b332b40;
}
dialog::backdrop {
  background: #2949d575;
  backdrop-filter: blur(3px);
}
dialog.wide {
  width: min(960px, 96vw);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.modal-head .eyebrow {
  margin-bottom: 8px;
}
.icon-close {
  font-size: 28px;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 0 7px;
}
.muted {
  color: var(--muted);
  line-height: 1.6;
}
.small {
  font-size: 12px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
  margin-top: 23px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12px;
}
.field.wide {
  grid-column: 1/-1;
}
.field input,
.field textarea {
  width: 100%;
  border: 1px solid #cdd7c8;
  background: #fff;
  border-radius: 5px;
  padding: 11px;
}
.field textarea {
  resize: vertical;
  min-height: 80px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
  margin-top: 22px;
}
.error {
  color: #a02e2b;
  font-size: 13px;
}
.upload {
  border: 1px dashed #9caf94;
  background: #f2f4f7;
  border-radius: 8px;
  padding: 22px;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.upload label {
  font-weight: 600;
}
.upload small {
  color: var(--muted);
}
.import-options {
  display: flex;
  gap: 12px;
  margin: 10px 0;
}
details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
}
summary {
  cursor: pointer;
  color: var(--muted);
}
details textarea {
  display: block;
  width: 100%;
  margin: 12px 0;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 5px;
}
details select {
  margin-top: 12px;
}
.mode-label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 23px;
  font-size: 12px;
}
#preview {
  max-height: 300px;
  overflow: auto;
}
.preview-summary {
  padding: 14px;
  background: var(--pale);
  border-radius: 5px;
  margin-bottom: 12px;
}
.detail-top {
  display: flex;
  gap: 25px;
  align-items: center;
  margin: 23px 0;
}
.detail-top .cover {
  flex-shrink: 0;
}
.detail-top h2 {
  font-size: 35px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  border-top: 1px solid var(--line);
  padding-top: 23px;
}
.detail-grid div.full {
  grid-column: 1/-1;
}
.detail-grid dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 7px;
}
.detail-grid dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}
.bulk-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 20px 0;
}
.bulk-row .field {
  flex: 1;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: white;
  padding: 14px 23px;
  border-radius: 7px;
  box-shadow: 0 3px 25px #0002;
  display: none;
  z-index: 10;
}
@media (min-width: 1500px) {
  .books {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .cover-stage {
    height: 210px;
  }
}
@media (max-width: 1150px) {
  main {
    padding: 0 25px;
    margin-left: 210px;
  }
  .sidebar {
    width: 210px;
    padding: 30px 15px;
  }
  .books {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .search {
    flex-basis: 100%;
  }
  .shelf-art {
    display: none;
  }
  .breadcrumb {
    display: none;
  }
}
@media (max-width: 750px) {
  .sidebar {
    position: relative;
    width: 100%;
    padding: 18px;
    border-right: 0;
  }
  .library-label,
  .sidebar-note,
  .local {
    display: none;
  }
  .sidebar nav {
    display: flex;
    overflow: auto;
    margin-top: 15px;
  }
  .nav {
    white-space: nowrap;
    width: auto;
    font-size: 11px;
  }
  .brand {
    font-size: 23px;
  }
  main {
    margin: 0;
    padding: 0 18px;
  }
  header {
    height: 77px;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 5px;
  }
  .header-actions button {
    font-size: 11px;
    padding: 10px;
  }
  .intro {
    padding: 28px 0;
  }
  h1 {
    font-size: 42px;
  }
  .stats {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .stats > div:nth-child(2) {
    border: 0;
  }
  .stats strong {
    font-size: 32px;
  }
  .books {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .cover-stage {
    height: 177px;
  }
  .book-info {
    padding: 12px;
  }
  .toolbar select {
    flex: 1;
    font-size: 11px;
    min-width: 120px;
  }
  .welcome {
    flex-direction: column;
    align-items: flex-start;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.wide {
    grid-column: auto;
  }
  .detail-top {
    align-items: flex-start;
  }
  .detail-top h2 {
    font-size: 25px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .detail-grid div.full {
    grid-column: auto;
  }
  dialog {
    padding: 22px;
  }
  .selection-row {
    flex-wrap: wrap;
  }
  footer span:last-child {
    display: none;
  }
}
/* Mobile is the primary workspace: thumb-sized actions and a sticky bottom bar. */
.library-label {
  display: block;
}
.local a {
  color: var(--green);
  line-height: 2.4;
}
.member-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.member-row > span {
  flex: 1;
  overflow-wrap: anywhere;
}
#sharing .field {
  margin: 16px 0;
}
#sharing .field input {
  font-size: 12px;
}
#library-dialog .field {
  margin-top: 22px;
}
.header-actions {
  flex-wrap: wrap;
}
#library-select {
  width: 100%;
  font-size: 12px;
}
#new-library {
  text-align: left;
  font-size: 12px;
  padding-left: 0;
}
.sidebar-note {
  padding-top: 12px;
  margin-bottom: 12px;
}
#sync-status {
  font-size: 11px;
}
@media (max-width: 750px) {
  body {
    padding-bottom: 88px;
  }
  .sidebar {
    padding: 20px 18px 8px;
  }
  .sidebar .library-label {
    display: block;
    margin: 22px 0 8px;
  }
  .sidebar #library-select {
    width: calc(100% - 110px);
    font-size: 14px;
    min-height: 44px;
  }
  .sidebar #new-library {
    margin-left: 10px;
    padding: 12px 0;
  }
  .sidebar nav {
    gap: 5px;
  }
  .nav {
    min-height: 44px;
    align-items: center;
  }
  .sidebar .local {
    display: block;
    border: 0;
    padding: 3px 0;
    font-size: 11px;
  }
  .local small {
    display: none;
  }
  .local a {
    margin-left: 8px;
  }
  .sidebar-note {
    display: none;
  }
  header {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 3;
    background: #fffffff5;
    box-shadow: 0 -8px 24px #172f5514;
    height: auto;
    min-height: 76px;
    backdrop-filter: blur(12px);
    padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    border-bottom: 0;
  }
  .header-actions {
    gap: 4px;
    justify-content: space-between;
  }
  .header-actions button {
    font-size: 11px;
    min-height: 44px;
    padding: 9px;
  }
  .header-actions #export,
  .header-actions #refresh {
    display: none;
  }
  .intro {
    padding-top: 22px;
  }
  .intro .eyebrow {
    font-size: 9px;
  }
  .intro h1 {
    font-size: 43px;
  }
  .stats {
    padding: 17px 0;
    margin-bottom: 22px;
  }
  .stats small {
    display: none;
  }
  .stats > div {
    padding: 0 18px;
  }
  .toolbar input,
  .field input,
  .field select,
  .field textarea,
  details textarea {
    font-size: 16px;
    min-height: 44px;
  }
  .selection-row button,
  .view-toggle button {
    min-height: 44px;
  }
  .book-check {
    padding: 8px;
  }
  .book-check input {
    width: 19px;
    height: 19px;
  }
  .book-info h3 {
    font-size: 14px;
  }
  .badge,
  .format {
    font-size: 10px;
  }
  .book-info .author {
    font-size: 12px;
  }
  .collection-title {
    margin-top: 18px;
  }
  dialog {
    max-height: 88dvh;
  }
  .modal-foot {
    position: sticky;
    bottom: -22px;
    background: #ffffff;
    padding-bottom: 10px;
  }
  #toast {
    bottom: 95px;
    width: calc(100% - 36px);
  }
  .member-row {
    flex-wrap: wrap;
  }
  .member-row > span {
    flex-basis: 100%;
  }
}

.mobile-utility {
  display: none;
}
@media (max-width: 750px) {
  .mobile-utility {
    display: inline-block;
    min-height: 44px;
    padding: 8px !important;
    font-size: 11px;
  }
  .local a {
    font-size: 11px;
  }
  .sidebar {
    padding-top: 16px;
  }
  .sidebar .library-label {
    margin-top: 14px;
  }
  .sidebar nav {
    margin-top: 8px;
    scrollbar-width: none;
  }
  .sidebar #new-library {
    font-size: 11px;
  }
  .sidebar #library-select {
    width: calc(100% - 106px);
  }
  .local {
    display: flex !important;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
  }
  .local small,
  .local .dot {
    display: none;
  }
  .local a {
    margin-left: 3px;
  }
  #sync-status {
    font-size: 10px;
  }
  .intro {
    padding: 20px 0 14px;
  }
  .intro .eyebrow,
  .intro p {
    display: none;
  }
  .intro h1 {
    font-size: 35px;
    margin: 0;
  }
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 13px 0;
    margin-bottom: 16px;
  }
  .stats > div {
    padding: 0 10px;
  }
  .stats span {
    font-size: 9px;
    min-height: 25px;
  }
  .stats strong {
    font-size: 27px;
    margin: 0;
  }
  .collection-title h2 {
    font-size: 26px;
  }
  .collection-title {
    margin: 12px 0;
  }
  .selection-row {
    padding: 5px 0;
  }
  .book-check {
    min-height: 44px;
    min-width: 44px;
    align-items: center;
    justify-content: center;
  }
  .icon-close {
    min-width: 44px;
    min-height: 44px;
  }
}

.cover {
  position: relative;
  overflow: hidden;
}
.cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f2f4f7;
}

#preview td:last-child {
  min-width: 220px;
  max-width: 360px;
  overflow-wrap: anywhere;
}
#preview .cover {
  width: 70px;
  height: 100px;
  margin: 10px 0;
}
#preview dd {
  margin: 0 0 8px;
  max-height: 110px;
  overflow: auto;
}
#preview dt {
  font-weight: 600;
}
.mode-label input[type='checkbox'] {
  width: auto;
}

.metadata-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}
.metadata-toggle input {
  width: auto;
}

#match-review {
  width: min(660px, calc(100vw - 24px));
}
#match-review label {
  display: block;
  margin: 12px 0;
}
#match-review input {
  width: 100%;
  box-sizing: border-box;
}
.match-candidate {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid #ddd;
}
.match-candidate .cover {
  width: 72px;
  height: 104px;
  flex: none;
}
.match-candidate button {
  display: block;
  margin-top: 10px;
}
.match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
#match-suggestions dd {
  margin: 0 0 14px;
  overflow-wrap: anywhere;
}
#match-suggestions .cover {
  width: 90px;
  height: 130px;
}

#match-review input {
  padding: 12px;
  border: 1px solid #ccd5ce;
  border-radius: 5px;
  background: #fff;
  font: inherit;
  min-height: 44px;
}
.match-candidate > div:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
#match-review a {
  color: #29594a;
}

#photo-open {
  margin: 8px 0 18px;
}
#photo-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  touch-action: none;
  margin: 14px auto;
  border: 1px solid #d1d8d2;
}
#photo-canvas[hidden] {
  display: none;
}
.photo-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
#photo-text {
  width: 100%;
  box-sizing: border-box;
}
#photo-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr));
  gap: 12px;
}
#photo-rows fieldset {
  border: 1px solid #ccd5ce;
  border-radius: 8px;
  min-width: 0;
  padding: 14px;
}
#photo-rows label {
  display: block;
  margin: 8px 0;
}
#photo-rows input[type='text'] {
  box-sizing: border-box;
  width: 100%;
  padding: 12px;
  font: inherit;
  border: 1px solid #ccd5ce;
  border-radius: 4px;
}
#photo-rows input[type='checkbox'] {
  width: auto;
}
.photo-tools button {
  min-height: 44px;
}

#vision-preview {
  display: block;
  max-width: 100%;
  max-height: 260px;
  margin: 16px auto;
}
#vision-preview:not([src]) {
  display: none;
}
#vision-photo label {
  display: block;
  margin: 14px 0;
}
#vision-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 16px;
}
#vision-rows fieldset {
  min-width: 0;
  border: 1px solid #ccd5ce;
  padding: 16px;
  border-radius: 8px;
}
#vision-rows input[type='text'],
#vision-rows input:not([type]) {
  width: 100%;
  padding: 12px;
  box-sizing: border-box;
  font: inherit;
}
#vision-rows input[type='checkbox'] {
  width: auto;
}
#vision-rows img {
  max-height: 150px;
  max-width: 100px;
}
#vision-rows dd {
  margin: 4px 0 12px;
  max-height: 120px;
  overflow: auto;
  overflow-wrap: anywhere;
}
#vision-rows button {
  display: block;
  margin: 8px 0;
  max-width: 100%;
  white-space: normal;
}
#vision-rows dt {
  text-transform: capitalize;
  font-weight: 600;
}

#vision-rows .photo-match-candidate {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  text-align: left;
  white-space: normal;
}
#vision-rows .photo-match-candidate > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.candidate-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 72px;
  width: 72px;
  min-height: 104px;
  background: #f2f4f7;
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
}
.candidate-cover > span {
  padding: 6px;
}
#vision-rows .candidate-cover img {
  width: 72px;
  height: 104px;
  object-fit: contain;
}

.cover-review-row {
  border-top: 1px solid #d8dfd9;
  padding: 18px 0;
}
.cover-choices {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 2px;
}
.cover-choice {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 150px;
  white-space: normal;
  text-align: left;
  padding: 12px;
  border: 2px solid transparent;
  background: #f2f4f7;
  color: #203d33;
}
.cover-choice.chosen {
  border-color: #285345;
}
.cover-choice img {
  width: 110px;
  height: 155px;
  object-fit: contain;
  align-self: center;
}
.cover-choice span,
.cover-choice small {
  font-size: 12px;
}
.cover-review-row h3 {
  margin-bottom: 4px;
}

#instagram-rows fieldset {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 0;
}
#instagram-rows label {
  display: block;
  margin: 10px 0;
}
#instagram-rows input:not([type='checkbox']):not([type='radio']) {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
#wish-dialog > .field {
  margin: 16px 0;
}
#instagram-status {
  overflow-wrap: anywhere;
}

#instagram-rows select {
  width: 100%;
  padding: 10px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
#instagram-rows input[type='radio'] {
  width: auto;
}

.series-related {
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.series-related button {
  display: block;
  margin-top: 10px;
}
.series-position {
  font-size: 11px;
  color: var(--muted);
}
#series-dialog .field {
  margin: 14px 0;
}
#series-rows fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 14px 0;
}
#series-rows label {
  display: block;
  margin: 10px 0;
}
#series-rows input {
  display: block;
  width: 100%;
  padding: 10px;
  min-height: 44px;
}
#series-sources a {
  display: inline-block;
  margin: 10px;
}

.format-copies {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}
.format-copies > div {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0;
}
.format-copies span {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.format-copies > .secondary {
  margin-top: 12px;
}

#screenshot-wish-dialog {
  width: min(960px, calc(100% - 36px));
}
#screenshot-wish-rows {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 16px;
  margin: 20px 0;
}
#screenshot-wish-rows fieldset {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
#screenshot-wish-rows .field {
  margin: 12px 0;
}
#screenshot-wish-rows button {
  display: block;
  margin: 12px 0;
  max-width: 100%;
  white-space: normal;
}
#screenshot-wish-rows img {
  max-height: 140px;
  object-fit: contain;
}
#screenshot-wish-rows input[type='checkbox'] {
  width: auto;
  margin-right: 8px;
}
#screenshot-wish-rows details {
  margin: 14px 0;
}
#screenshot-wish-preview {
  display: block;
  margin: 16px auto;
}
#screenshot-wish-preview[hidden] {
  display: none;
}
#screenshot-wish-status {
  overflow-wrap: anywhere;
}

/* Library discovery controls */
.sidebar {
  overflow-y: auto;
}
.sidebar .library-label {
  margin: 26px 0 10px;
}
.sidebar-note {
  display: none;
}
.sidebar-filters {
  margin: 24px 0;
  display: grid;
  gap: 14px;
}
.filter-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.filter-heading h2 {
  font-size: 23px;
}
.filter-heading small {
  color: var(--muted);
  font-size: 11px;
}
.sidebar-filters label {
  font-size: 12px;
  font-weight: 600;
  display: grid;
  gap: 7px;
}
.sidebar-filters input,
.sidebar-filters select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px;
  border: 1px solid #c7d2c5;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
}
.sidebar-filters .quiet {
  padding: 6px 0;
  text-align: left;
  font-size: 12px;
}
.local {
  margin-top: auto;
}
.filter-help {
  margin: 0;
  flex: 1;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 750px) {
  .sidebar {
    overflow: visible;
  }
  .sidebar-filters {
    grid-template-columns: 1fr 1fr;
    margin: 16px 0 10px;
    gap: 12px;
  }
  .filter-heading {
    grid-column: 1/-1;
  }
  .sidebar-filters input,
  .sidebar-filters select {
    font-size: 16px;
  }
  .sidebar-filters .quiet {
    grid-column: 1/-1;
  }
  .sidebar #library-select {
    width: 100%;
  }
  .sidebar #new-library {
    margin-left: 0;
  }
  .filter-help {
    display: none;
  }
  .toolbar {
    justify-content: space-between;
  }
  .toolbar select {
    flex: 1;
    min-width: 0;
    font-size: 13px;
  }
}

.personal-rating {
  color: #8b651e;
  letter-spacing: 2px;
  margin: 6px 0;
  font-size: 16px;
}

.danger {
  background: #ffffff;
  color: #9f3026;
  border: 1px solid #c77970;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
}
.danger:disabled {
  opacity: 0.5;
  cursor: wait;
}

.active-search {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 8px 0 18px;
  padding: 16px;
  background: #f2f4f7;
  border: 1px solid #d3ddd0;
  border-radius: 10px;
}
.active-search strong {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
}
.active-search > button {
  flex-shrink: 0;
}
#active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.filter-chip {
  border: 1px solid #a9bfb0;
  border-radius: 20px;
  padding: 9px 12px;
  background: #fff;
  color: #245345;
  cursor: pointer;
  font-size: 13px;
}
.filter-chip:hover {
  background: #f2f4f7;
}
.filter-chip span {
  margin-left: 8px;
  font-size: 16px;
}
.sidebar-filters #search-now {
  width: 100%;
}
@media (max-width: 750px) {
  .sidebar-filters #search-now {
    grid-column: 1/-1;
  }
  .active-search {
    padding: 12px;
    gap: 10px;
  }
  .active-search > button {
    padding: 10px;
    font-size: 13px;
  }
}

#search-result-summary {
  font-size: 16px;
  font-weight: 600;
  color: #245345;
  margin: 0 0 10px;
}

.todo-item {
  padding: 16px 0;
  border-bottom: 1px solid #d5ddd2;
}
.todo-item > label {
  font-weight: 600;
  display: flex;
  gap: 10px;
  align-items: start;
}
.todo-item p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.todo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.todo-actions button {
  padding: 9px 12px;
}
#todo-form {
  margin-top: 20px;
}
#todo-form[hidden] {
  display: none;
}

.sale-details {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #dce3ee;
  text-align: left;
  color: #24334c;
}
.sale-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 10px;
  font-size: 0.85rem;
}
.sale-details dt {
  font-weight: 600;
}
.sale-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.sale-description {
  font-size: 0.88rem;
  line-height: 1.5;
  white-space: pre-wrap;
}
.for-sale-page .ai-coming,
.for-sale-page #reading-stats,
.for-sale-page #borrowed-overview,
.for-sale-page #lent-overview {
  display: none !important;
}

.for-sale-page .books {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  align-items: start;
}

#sold-history .cover {
  width: 90px;
  height: 130px;
  margin: 0 0 16px;
}
#sell-options {
  max-height: 40vh;
  overflow: auto;
}
#sell-options button {
  text-align: left;
}

.prerelease-label {
  margin: 8px 0;
}
.prerelease-label .badge {
  display: inline-block;
  background: #e3ebff;
  color: #243b64;
  border: 1px solid #8099cd;
  font-weight: 700;
}

/* Kindle import keeps the book review scrollable beside its actions. */
dialog.kindle-import {
  width: min(960px, 94vw);
}
.kindle-import > label {
  display: block;
  margin: 12px 0;
}
.kindle-import > label > input:not([type='checkbox']) {
  display: block;
  margin-top: 5px;
  max-width: 100%;
}
#ki-rows {
  max-height: 34vh;
  overflow: auto;
  margin: 16px 0;
}
#ki-rows table {
  width: 100%;
}
#ki-rows input:not([type='checkbox']) {
  width: 100%;
  min-width: 140px;
  box-sizing: border-box;
}
#ki-next {
  margin: 8px;
}

.import-source-picker {
  width: min(620px, 94vw);
}
.import-source-picker .field {
  display: block;
  margin: 18px 0;
}
.import-source-picker select {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 44px;
}
#import-source-status {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.loan-dialog {
  width: min(560px, 94vw);
}
.loan-dialog .field {
  display: block;
  margin: 16px 0;
}
.loan-dialog input,
.loan-dialog select,
.loan-dialog textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
}
.loan-history {
  margin: 20px 0;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.loan-history li {
  padding: 6px 0;
}

/* Compact loan actions wrap as separate controls, without inline baseline collisions. */
.borrowed-card .loan-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.borrowed-card .loan-card-actions > button.secondary,
.borrowed-card .loan-card-actions > a.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: static;
  flex: 0 1 auto;
  min-height: 34px;
  height: auto;
  max-width: 100%;
  margin: 0;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  border-radius: 6px;
  white-space: normal;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
}

.library-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 24px;
  scroll-margin-top: 90px;
}
.library-view-tabs button {
  padding: 9px 14px;
  border: 1px solid #bdcae5;
  border-radius: 7px;
  background: #fff;
  color: #20365b;
  font-size: 14px;
  line-height: 1.4;
}
.library-view-tabs button[aria-pressed='true'] {
  background: #2949d5;
  color: #fff;
  border-color: #2949d5;
  box-shadow: 0 3px 0 #172e88;
  font-weight: 700;
}
#library-catalog[hidden],
#borrowed-overview[hidden],
#lent-overview[hidden] {
  display: none !important;
}

#library-view-tabs button[aria-pressed='false'] {
  background: #fff !important;
  color: #20365b !important;
  border: 1px solid #bdcae5 !important;
  box-shadow: none !important;
}
#library-view-tabs button[aria-pressed='true'] {
  background: #2949d5 !important;
  color: #fff !important;
  border: 2px solid #172e88 !important;
}

body:not(.for-sale-page) #reading-stats {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
@media (max-width: 750px) {
  body:not(.for-sale-page) #reading-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

#reading-stats .summary-drill {
  display: block;
  width: 100%;
  padding: 8px 0;
  text-align: left;
  background: transparent !important;
  color: #20365b !important;
  border: 0 !important;
  border-radius: 5px;
  white-space: normal;
}
#reading-stats .summary-drill:hover {
  background: #edf2ff !important;
}
#reading-stats .summary-drill:focus-visible {
  outline: 3px solid #2949d5;
  outline-offset: 4px;
}
#section-title,
#borrowed-overview {
  scroll-margin-top: 90px;
}
#reading-stats .summary-drill {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  min-width: 0;
}
#reading-stats .summary-drill > span,
#reading-stats .summary-drill > strong,
#reading-stats .summary-drill > small {
  display: block !important;
  white-space: normal !important;
  margin: 0;
}
#reading-stats > div {
  padding: 0 16px;
}

.book-identity {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  width: 100%;
}
.book-identity-fields {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}
.book-identity-fields > label:first-child {
  grid-column: 1/-1;
}
.book-identity-cover {
  flex: 0 0 120px;
  max-width: 120px;
}
.book-identity-cover img {
  width: 100%;
  height: auto;
}
@media (max-width: 550px) {
  .book-identity {
    gap: 12px;
  }
  .book-identity-cover {
    flex-basis: 85px;
    max-width: 85px;
  }
  .book-identity-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}
.book-provider-choice {
  width: 100%;
  min-width: 0;
  border: 1px solid #cdd7c8;
  background: #fff;
  border-radius: 5px;
  padding: 11px;
  color: #233d35;
}
.book-provider-custom[hidden] {
  display: none;
}

/* Phones: the filter form folds behind one button so the library shows first. */
#filters-toggle {
  display: none;
}
@media (max-width: 750px) {
  #filters-toggle {
    display: block;
    width: 100%;
    min-height: 44px;
    margin: 14px 0 6px;
  }
  .sidebar-filters:not(.open) {
    display: none;
  }
}

/* Under the image: one Add books menu, then the library views joined to their counts. Older phone rules use !important, so these must too. */
body:has(.add-books) main > header {
  display: none;
}
/* The ＋ Add books button opens one panel: five ways to add, each opening its own options. Ids beat the shared button rules in accessibility.css. */
:root body main button#add.add-books {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 12px 0 !important;
  padding: 9px 18px !important;
  border-radius: 8px !important;
  border-color: #294c9d !important;
  background: #294c9d !important;
  color: #fff !important;
  font-weight: 600;
}
:root body main button#add.add-books:hover {
  background: #203f84 !important;
  color: #fff !important;
}
dialog#add-books-panel {
  width: min(880px, 94vw);
  padding: 24px 28px 28px;
}
#add-books-panel h2 {
  margin: 0 0 16px;
}
/* accessibility.css turns every tablist into a wrapping chip row; this one is a five-column grid. */
:root body #add-books-panel .add-ways {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px !important;
  align-items: stretch;
}
:root body #add-books-panel .add-way {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 112px;
  margin: 0 !important;
  padding: 14px 12px !important;
  border-radius: 12px !important;
  text-align: left;
  color: #172f55 !important;
}
.add-way > span {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.add-way svg {
  flex: none;
  color: #294c9d;
}
.add-way strong {
  font-size: 15px;
  line-height: 1.25;
}
.add-way small {
  font-size: 13px;
  line-height: 1.3;
  color: #33476a;
}
:root body #add-books-panel .add-way[aria-selected='true'] {
  background: #294c9d !important;
  border: 2px solid #294c9d !important;
  color: #fff !important;
}
#add-books-panel .add-way[aria-selected='true'] :is(svg, small) {
  color: #fff;
}
/* The shared ✓ for a selected tab sits in the corner so the tile keeps its size. */
:root body #add-books-panel .add-way[aria-selected='true']::before {
  position: absolute;
  top: 10px;
  right: 12px;
  margin: 0;
}
.add-hint,
.add-pane {
  margin: 16px 0 0;
  padding-top: 16px;
  border-top: 1px solid #dfe5ef;
}
.add-pane {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.add-pane[hidden],
.add-hint[hidden] {
  display: none;
}
.add-pane p {
  margin: 0;
}
.add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.add-dest,
.add-choice {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.add-dest {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 18px;
}
.add-dest legend {
  float: left;
  padding: 0;
  margin-right: 4px;
  font-weight: 700;
}
.add-dest label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.add-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.add-choice legend {
  padding: 0;
  margin-bottom: 8px;
  font-weight: 700;
}
.add-choice label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid #7788a6;
  border-radius: 12px;
  cursor: pointer;
}
.add-choice label:has(input:checked) {
  padding: 13px;
  border: 2px solid #294c9d;
}
.add-choice span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.add-choice small {
  font-size: 13px;
  color: #33476a;
}
.add-title-find label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}
.add-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.add-title-row input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  font-size: 16px;
}
:root body #add-books-panel .add-voice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 48px;
  min-width: 48px;
  height: 48px;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 50% !important;
}
:root body #add-books-panel .add-title-row button[type='submit'] {
  margin: 0 !important;
  min-height: 48px;
}
:root body #add-books-panel .add-link {
  align-self: flex-start;
  min-height: 44px;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
  text-decoration: underline;
}
#add-title-status:empty {
  display: none;
}
.add-sources {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
:root body #add-books-panel .add-sources button {
  margin: 0 !important;
  min-height: 52px;
}
/* Phones: the five ways stack, and each one's options open directly under it. */
@media (max-width: 750px) {
  dialog#add-books-panel {
    width: calc(100vw - 16px);
    max-height: 92vh;
    padding: 16px;
  }
  dialog#add-books-panel[open] {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  #add-books-panel > :first-child {
    order: -1;
  }
  :root body #add-books-panel .add-ways {
    display: contents !important;
  }
  :root body #add-books-panel .add-way {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    min-height: 56px;
    padding: 8px 12px !important;
  }
  .add-way svg {
    width: 24px;
    height: 24px;
  }
  #add-way-photo {
    order: 1;
  }
  #add-pane-photo {
    order: 2;
  }
  #add-way-shelf {
    order: 3;
  }
  #add-pane-shelf {
    order: 4;
  }
  #add-way-title {
    order: 5;
  }
  #add-pane-title {
    order: 6;
  }
  #add-way-import {
    order: 7;
  }
  #add-pane-import {
    order: 8;
  }
  #browse-books {
    order: 9;
  }
  #add-pane-browse {
    order: 10;
  }
  .add-hint {
    order: 11;
  }
  .add-pane {
    margin: 0 0 8px;
    padding: 4px 4px 8px;
    border-top: 0;
  }
  .add-choice {
    grid-template-columns: 1fr;
  }
  .add-sources {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.library-views {
  border: 1px solid #d9e1ef;
  border-radius: 14px;
  margin: 0 0 24px;
  overflow: hidden;
}
:root body #library-view-tabs {
  margin: 0;
  padding: 8px;
  gap: 6px;
  border-bottom: 1px solid #d9e1ef;
}
:root body #library-view-tabs button {
  margin: 0 !important;
  min-height: 40px !important;
  padding: 6px 12px !important;
  font-size: 14px !important;
}
:root body .library-views #reading-stats {
  margin: 0 !important;
  padding: 10px 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
:root body .library-views #reading-stats strong {
  font-size: 34px;
  margin: 2px 0;
}
.nav-phone-only {
  display: none !important;
}
@media (max-width: 750px) {
  body.has-app-nav .sidebar {
    display: none;
  }
  .sidebar .local {
    display: none !important;
  }
  body.has-app-nav .sidebar:has(.sidebar-filters.open) {
    display: block;
  }
  .sidebar:has(.sidebar-filters.open) .sidebar-links {
    display: none;
  }
  #nav-phone-tools {
    display: block !important;
    border-bottom: 1px solid #e6ebf5;
    padding-bottom: 6px;
    margin-bottom: 6px;
  }
  body:has(.add-books) {
    padding-bottom: 0;
  }
  :root body main button#add.add-books {
    display: flex;
    width: 100%;
    justify-content: center;
  }
  :root body #library-view-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
  }
  :root body #library-view-tabs button {
    flex: none !important;
    min-height: 36px !important;
    padding: 4px 10px !important;
    font-size: 13px !important;
  }
  :root body:not(.for-sale-page) #reading-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 2px !important;
    padding: 6px 4px !important;
  }
  :root body #reading-stats > div {
    padding: 0 !important;
    border: 0 !important;
  }
  :root body #reading-stats .summary-drill {
    display: flex !important;
    flex-direction: column-reverse !important;
    align-items: center !important;
    justify-content: flex-end !important;
    width: 100%;
    min-height: 52px !important;
    margin: 0 !important;
    padding: 4px 2px !important;
    border: 0 !important;
    background: transparent !important;
  }
  :root body #reading-stats strong {
    font-size: 24px !important;
    margin: 0 !important;
    line-height: 1.1 !important;
  }
  :root body #reading-stats span {
    font-size: 11px !important;
    min-height: 0 !important;
    text-align: center;
    line-height: 1.2 !important;
  }
  :root body #reading-stats small {
    display: none !important;
  }
}
/* Phones: label beside value so book details are not one tall column of two-line rows. */
@media (max-width: 750px) {
  .detail-grid {
    gap: 10px;
    padding-top: 14px;
  }
  .detail-grid > div:not(.full) {
    display: grid;
    grid-template-columns: 40% 1fr;
    gap: 12px;
    align-items: baseline;
  }
  .detail-grid > div:not(.full) dt {
    margin: 0;
  }
  .detail-grid dd {
    line-height: 1.45;
  }
}
