.book-editor-page {
  min-width: 0;
  max-width: none;
  margin: 0 auto;
  height: calc(100dvh - var(--header-reserve, 0px) - var(--s-2));
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.book-editor-page-body,
.book-editor-page .book-editor-fields {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.book-editor-page .book-editor-fields {
  gap: var(--s-3);
}
.book-editor-table {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  min-width: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--glass-edge);
}
.book-editor-table-head {
  flex: none;
  z-index: 2;
  background: var(--bg-elev);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: 0 1px var(--border);
}
.book-editor-columns-head,
.book-editor-title-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}
.book-editor-columns-head {
  min-height: 52px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.book-editor-columns-head > span {
  padding-inline: calc(var(--s-2) + var(--s-1));
}
.book-editor-columns-head > label {
  min-width: 0;
  padding: var(--s-1) var(--s-2);
  border-left: 1px solid var(--border);
}
.book-editor-title-cell {
  min-width: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.book-editor-title-caption {
  display: block;
  padding: var(--s-1) var(--s-2) 0;
  color: var(--text-2);
  font-size: var(--fs-xs);
  line-height: 1.4;
}
.book-editor-title-cell:not([hidden]) ~ .book-editor-title-cell:not([hidden]) {
  border-left: 1px solid var(--border);
}
.book-editor-title-cell[hidden],
.book-editor-batch[hidden],
.book-editor-pagination[hidden],
.book-editor-page .book-editor-unit [hidden] {
  display: none;
}
.book-editor-title-cell .field {
  width: 100%;
  min-height: 40px;
  max-height: 120px;
  padding: var(--s-2) calc(var(--s-2) + var(--s-1));
  resize: none;
  overflow-y: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: transparent;
  font-weight: 600;
}
.book-editor-page .book-editor-units {
  min-width: 0;
  gap: 0;
  scroll-margin-top: calc(var(--header-reserve, 0px) + 120px);
}
.book-editor-page .book-editor-unit {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 0;
}
.book-editor-page .book-editor-unit:first-child {
  border-top: 0;
}
.book-editor-page .book-editor-cell {
  display: block;
  min-width: 0;
  padding: 0;
}
.book-editor-page .book-editor-cell:not([hidden]) ~ .book-editor-cell:not([hidden]) {
  border-left: 1px solid var(--border);
}
.book-editor-page .book-editor-unit textarea.field {
  width: 100%;
  min-height: 40px;
  padding: var(--s-2) calc(var(--s-2) + var(--s-1));
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: transparent;
}
.book-editor-table textarea.field {
  display: block;
  border-radius: 0;
  box-shadow: none;
}
.book-editor-table textarea.field:focus {
  outline: none;
  box-shadow: none;
}
.book-editor-table textarea.field:focus-visible {
  outline: none;
}
.book-editor-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  text-align: center;
}
.book-editor-pagination .btn {
  min-height: 44px;
  width: 40px;
  min-height: 40px;
  padding: 0;
}
.book-editor-page-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-3);
  margin-top: var(--s-2);
  padding: 0;
}
.book-editor-page-foot [role='status'] {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding-left: var(--s-2);
  font-size: var(--fs-sm);
}

.book-editor-table-rows {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
.book-editor-pagination,
.book-editor-page-foot {
  flex: none;
}
.main:has(.book-editor-host:not([hidden])) #workspace {
  overflow: hidden;
}
.main:has(.book-editor-host:not([hidden])) #booksScreen > .container {
  width: 100%;
  margin-inline: 0;
  padding-bottom: 0;
  padding-inline: var(--s-3);
}
@media (max-width: 859px) {
  .main:has(.book-editor-host:not([hidden])) #booksScreen > .container {
    padding-inline: var(--s-2);
  }
  .book-editor-page {
    height: calc(
      100dvh - var(--header-reserve, 0px) - var(--s-2) - env(safe-area-inset-bottom, 0px)
    );
  }
}

.book-editor-columns-head .account-select-language {
  line-height: 1;
}
.book-editor-columns-head .account-select-language img {
  display: block;
  align-self: center;
}

.book-editor-page .book-editor-cell:focus-within,
.book-editor-title-cell:focus-within {
  background: var(--bg-elev);
}

.book-editor-page-foot .book-editor-pagination {
  justify-content: flex-start;
  gap: var(--s-1);
}
.book-editor-page-foot [role='status']:empty {
  padding: 0;
}
@media (max-width: 640px) {
  .book-editor-page-foot {
    gap: var(--s-1);
    flex-wrap: wrap;
  }
  .book-editor-page-foot .book-editor-pagination {
    margin-right: auto;
    font-size: var(--fs-xs);
  }
  .book-editor-page-foot [role='status']:not(:empty) {
    flex-basis: 100%;
    order: 1;
  }
  .book-editor-page-foot [role='status']:empty {
    display: none;
  }
  .book-editor-pagination .btn {
    width: 32px;
  }
}
