/* Book planning shares Jotpad's paper, type, and touch-friendly controls. */
.writing-workspace {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 50px 70px;
}
.writing-workspace a.primary,
.writing-workspace a.secondary,
.bookshelf a.secondary,
.writing-workspace a.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
}
.writing-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 18px;
}
.writing-section-head h2 {
  font: 25px/1.2 var(--serif);
  margin: 0;
  letter-spacing: -0.4px;
}
.writing-section-head .secondary {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 14px;
  padding: 11px 16px;
}
.writing-section-head .secondary svg {
  width: 17px;
  height: 17px;
}
.writing-hint {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 8px 0;
}
.bookshelf {
  border-top: 1px solid var(--line);
  margin-bottom: 20px;
}
.book-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.book-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid #dcd8df;
  border-radius: 10px;
  min-width: 0;
}
.book-card:hover {
  border-color: var(--accent);
}
.book-card > span:nth-child(2) {
  min-width: 0;
  flex: 1;
}
.book-card strong {
  display: block;
  font: 23px/1.25 var(--serif);
  overflow-wrap: anywhere;
}
.book-card small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 6px;
}
.book-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eee7f1;
  color: #72567e;
  border-radius: 8px;
  height: 48px;
  width: 40px;
  flex-shrink: 0;
}
.book-mark svg {
  width: 23px;
  height: 23px;
}
#show-archived-books {
  font-size: 13px;
  min-height: 44px;
  margin-top: 4px;
}
.ideas-heading {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.ideas-heading .text-button {
  min-height: 44px;
  font-size: 13px;
}
.book-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 21;
  background: var(--paper);
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.book-toolbar .back-button {
  min-height: 44px;
}
.small-primary {
  font-size: 14px;
  padding: 12px 17px;
}
.small-primary svg {
  width: 17px;
  height: 17px;
}
.book-heading {
  margin: 32px 0 28px;
}
.book-heading .eyebrow {
  font-size: 11px;
  font-weight: 650;
  color: #755d80;
  letter-spacing: 1.8px;
}
.book-heading h1 {
  font: 46px/1.15 var(--serif);
  letter-spacing: -1px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.book-heading p {
  max-width: 650px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.book-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #eeede7;
  padding: 5px;
  border-radius: 10px;
  gap: 3px;
  margin-bottom: 27px;
}
.book-tabs a {
  text-align: center;
  padding: 13px 3px;
  font-size: 14px;
  color: #60665b;
  min-height: 44px;
  border-radius: 7px;
}
.book-tabs [aria-current] {
  background: var(--surface);
  color: #60496b;
  box-shadow: 0 1px 4px #35303d13;
  font-weight: 650;
}
.outline-chapter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 14px 0;
  overflow: hidden;
}
.outline-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 17px 14px;
}
.outline-link {
  display: flex;
  gap: 15px;
  flex: 1;
  min-width: 0;
  padding: 4px;
  min-height: 44px;
}
.outline-link > span:last-child {
  min-width: 0;
}
.outline-number {
  font: 18px var(--serif);
  color: #816b88;
  padding-top: 3px;
}
.outline-link strong {
  display: block;
  font: 24px/1.25 var(--serif);
  overflow-wrap: anywhere;
}
.outline-link small {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.planning-status {
  display: block;
  color: #715b7b;
  font-size: 11px;
  font-weight: 600;
  margin-top: 7px;
}
.outline-moves {
  display: flex;
  flex-shrink: 0;
}
.outline-moves .icon-button {
  width: 44px;
  height: 44px;
  color: #697360;
}
.outline-moves .icon-button:hover {
  color: #60496b;
  background: #eee7f1;
}
.outline-moves button:disabled {
  opacity: 0.25;
  cursor: default;
}
.outline-sections {
  margin: 0 18px;
  border-top: 1px solid var(--line);
}
.outline-sections summary {
  padding: 14px 2px;
  cursor: pointer;
  min-height: 44px;
  color: var(--muted);
  font-size: 13px;
}
.outline-sections .outline-row {
  border-top: 1px solid var(--line);
  padding: 12px 0 12px 8px;
}
.outline-sections .outline-link strong {
  font-size: 20px;
}
.outline-sections > .text-button {
  margin-bottom: 7px;
  font-size: 13px;
}
.chapter-idea-link {
  margin: 0 18px 8px;
  font-size: 12px;
}
.chapter-idea-link svg,
.outline-sections > .text-button svg {
  width: 16px;
  height: 16px;
}
.writing-empty {
  padding: 38px 22px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #d9d4dc;
  border-radius: 10px;
  line-height: 1.65;
  font-size: 14px;
}
.writing-empty .book-mark {
  margin-bottom: 14px;
}
.writing-empty h3 {
  font: 25px/1.3 var(--serif);
  color: var(--ink);
  margin: 0 0 12px;
}
.writing-note {
  display: block;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 20px;
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.writing-note strong {
  font: 24px/1.25 var(--serif);
}
.writing-note p {
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
  line-height: 1.6;
  margin: 10px 0;
}
.writing-note small {
  display: block;
  color: #715b7b;
  margin-top: 12px;
  font-size: 12px;
}
.overview-fields section {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.overview-fields h3 {
  font: 22px var(--serif);
  margin: 0 0 12px;
}
.overview-fields p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
  font-size: 16px;
}
.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  align-items: center;
}
.export-actions .text-button {
  min-height: 44px;
  font-size: 13px;
}
.archived-pages {
  margin-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.archived-pages summary {
  padding: 18px 0;
  min-height: 44px;
  cursor: pointer;
  color: var(--muted);
}
.archived-pages a {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 15px 0;
  min-height: 44px;
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.archived-pages small {
  color: var(--muted);
}
.writing-notice {
  background: #eee7f1;
  padding: 14px;
  border-radius: 8px;
  color: #60496b;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 20px;
}
.writing-notice a {
  text-decoration: underline;
}
.writing-link-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  margin: 0 0 20px;
}
.writing-link-panel > span {
  font-size: 12px;
  color: #715b7b;
  overflow-wrap: anywhere;
  min-width: 0;
}
.writing-link-panel button {
  font-size: 12px;
  white-space: nowrap;
  min-height: 44px;
}
.planning-intro {
  margin-bottom: 22px;
}
.planning-field {
  margin: 26px 0;
}
.planning-field label {
  display: block;
  font: 23px var(--serif);
  color: var(--ink);
  margin-bottom: 12px;
}
.planning-field textarea,
.planning-field input {
  display: block;
  width: 100%;
  line-height: 1.65;
  font-size: 16px;
}
.planning-field textarea {
  resize: vertical;
  min-height: 100px;
}
.planning-status-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 0;
  border-block: 1px solid var(--line);
}
.planning-status-field label {
  font-size: 14px;
  color: var(--muted);
}
select {
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #c6cbbf;
  border-radius: 8px;
  padding: 12px;
  min-height: 46px;
  max-width: 100%;
}
select:focus-visible {
  outline: 2px solid #779984;
  outline-offset: 2px;
}
.writing-dialog .field {
  margin-top: 22px;
}
.writing-dialog label {
  display: block;
  margin-bottom: 9px;
}
.writing-dialog select {
  width: 100%;
}
.history-dialog {
  width: min(700px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  overflow: auto;
}
.history-dialog .writing-section-head {
  margin-top: 0;
}
.history-dialog .icon-button {
  width: 44px;
  height: 44px;
}
.history-versions {
  display: grid;
  gap: 6px;
  margin: 20px 0 10px;
  max-height: 200px;
  overflow: auto;
}
.history-version {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  padding: 12px;
  min-height: 48px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
}
.history-version span {
  color: var(--muted);
  font-size: 12px;
}
.history-version[aria-pressed="true"] {
  border-color: #7d648b;
  background: #f2ecf5;
}
.history-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 15px/1.6 var(--sans);
  max-height: 260px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 16px;
  border-radius: 8px;
  margin: 18px 0;
}
.writing-dialog .dialog-actions {
  flex-wrap: wrap;
}
#book-action-error {
  margin-bottom: 16px;
}
#source-location {
  width: 100%;
}
.open-source-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 5px;
  font-size: 14px;
}
.chapter-linked {
  border-top: 1px solid var(--line);
  margin-top: 32px;
  padding-top: 10px;
}
.chapter-linked .writing-note strong {
  font-size: 21px;
}
.chapter-linked .secondary {
  margin-top: 12px;
}
@media (max-width: 1100px) {
  .writing-workspace {
    padding-inline: 30px;
  }
}
@media (max-width: 760px) {
  .writing-workspace {
    padding: 4px 21px 120px;
  }
  .book-heading {
    margin: 27px 0 23px;
  }
  .book-heading h1 {
    font-size: 36px;
  }
  .book-heading p {
    font-size: 14px;
  }
  .book-cards {
    grid-template-columns: 1fr;
  }
  .book-card {
    padding: 17px;
  }
  .book-card strong {
    font-size: 23px;
  }
  .book-tabs {
    margin-bottom: 23px;
  }
  .book-tabs a {
    font-size: 13px;
  }
  .writing-section-head {
    gap: 10px;
  }
  .writing-section-head h2 {
    font-size: 23px;
  }
  .writing-section-head .secondary {
    padding: 10px 12px;
    font-size: 13px;
  }
  .outline-row {
    padding: 14px 9px;
    gap: 2px;
  }
  .outline-link {
    gap: 9px;
  }
  .outline-link strong {
    font-size: 22px;
  }
  .outline-moves {
    flex-direction: column;
  }
  .outline-moves .icon-button {
    height: 44px;
    width: 44px;
  }
  .outline-sections {
    margin-inline: 13px;
  }
  .outline-sections .outline-row {
    padding-left: 0;
  }
  .chapter-idea-link {
    margin-inline: 13px;
  }
  .planning-status-field {
    align-items: flex-start;
    flex-direction: column;
  }
  .planning-status-field select {
    width: 100%;
  }
  .planning-field label {
    font-size: 22px;
  }
  .history-dialog {
    padding: 22px 18px;
  }
  .history-version {
    flex-direction: column;
    gap: 4px;
  }
}

/* Compact planning: content first, secondary controls on demand. */
.book-heading {
  margin: 18px 0 16px;
}
.book-heading h1 {
  font-size: 34px;
  margin: 0;
}
.book-tabs {
  position: sticky;
  top: 65px;
  z-index: 20;
  margin-bottom: 16px;
}
.outline-heading {
  margin: 12px 0;
}
.outline-count {
  font: 13px var(--sans);
  color: var(--muted);
  vertical-align: middle;
}
.outline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.outline-actions button {
  min-height: 44px;
  font-size: 13px;
}
.outline-chapter {
  position: relative;
  margin: 8px 0;
}
.outline-row {
  padding: 12px 78px 12px 12px;
  align-items: center;
}
.outline-link {
  gap: 10px;
}
.outline-link strong {
  font-size: 22px;
}
.planning-status {
  margin-top: 4px;
}
.outline-moves {
  display: none;
}
.is-reordering .outline-moves {
  display: flex;
  flex-direction: row;
}
.is-reordering .outline-row {
  flex-wrap: wrap;
}
.is-reordering .outline-link {
  flex-basis: 140px;
}
.outline-sections {
  margin: 0 14px;
  border: 0;
}
.outline-sections > summary {
  position: absolute;
  top: 17px;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 60px;
  text-align: center;
  padding: 0;
  border-radius: 7px;
  background: var(--paper);
  list-style: none;
}
.outline-sections > summary::-webkit-details-marker {
  display: none;
}
.outline-sections > summary small {
  display: block;
  font-size: 9px;
  line-height: 1.3;
}
.section-chevron {
  font-size: 20px;
  line-height: 1;
}
.outline-sections[open] .section-chevron {
  transform: rotate(180deg);
}
.outline-sections .outline-row {
  padding: 10px 0;
}
.outline-sections .outline-link strong {
  font-size: 19px;
}
.outline-sections > .text-button {
  margin: 0 10px 8px 0;
  font-size: 13px;
}
.chapter-editor .entry-title {
  margin-bottom: 8px;
}
.planning-status-field {
  padding: 0;
  border: 0;
  margin: 0 0 10px;
  flex-direction: row;
}
.planning-status-field select {
  width: auto;
  font-size: 13px;
  min-height: 44px;
  padding: 8px 12px;
  color: #60496b;
  background: #f2ecf5;
  border-color: #dcd3e1;
}
.chapter-editor .planning-field {
  margin: 16px 0;
}
.chapter-editor .planning-field label {
  font-size: 22px;
  margin-bottom: 10px;
}
.planning-fold {
  border-top: 1px solid var(--line);
}
.planning-fold > summary {
  cursor: pointer;
  padding: 15px 0;
  font-size: 16px;
  min-height: 48px;
}
.planning-fold small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 5px;
}
.planning-fold[open] small {
  display: none;
}
.chapter-ideas-bar {
  position: relative;
  border-block: 1px solid var(--line);
}
.chapter-linked {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.chapter-linked > summary {
  cursor: pointer;
  padding: 14px 105px 14px 0;
  min-height: 44px;
  font-size: 13px;
  color: #60496b;
}
#chapter-ideas-count {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
#chapter-capture {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-height: 46px;
  font-size: 13px;
}
#chapter-capture svg {
  width: 16px;
  height: 16px;
}
.chapter-linked .writing-note {
  padding: 12px;
}
.chapter-linked .writing-note strong {
  font-size: 19px;
}
.chapter-linked .writing-note p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.continue-writing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  margin-bottom: 12px;
  background: #f2ecf5;
  border: 1px solid #dcd3e1;
  border-radius: 9px;
  overflow-wrap: anywhere;
}
.continue-writing > span:first-child {
  min-width: 0;
}
.continue-writing small {
  display: block;
  font-size: 12px;
  color: #715b7b;
  line-height: 1.5;
}
.continue-writing strong {
  display: block;
  font: 21px/1.4 var(--serif);
}
.book-shelf-options {
  position: relative;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}
.book-shelf-options summary {
  cursor: pointer;
  min-height: 44px;
  padding: 14px 0;
}
.book-shelf-options button {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0 12px;
  border-radius: 8px;
}
[data-category="ideas"] .empty-illustration {
  display: none;
}
[data-category="ideas"] .empty-state {
  padding: 18px 16px;
  min-height: 0;
}
[data-category="ideas"] .empty-state h2 {
  font-size: 22px;
  margin: 0;
}
[data-category="ideas"] .ideas-heading {
  margin-top: 16px;
  padding-top: 12px;
}
@media (max-width: 760px) {
  .book-heading h1 {
    font-size: 29px;
  }
  .outline-heading h2 {
    font-size: 22px;
  }
  .outline-actions {
    gap: 8px;
  }
  .outline-link strong {
    font-size: 21px;
  }
  .book-card {
    padding: 13px;
  }
}

/* A chapter is a plan with ordered ideas and references. */
#chapter-tools {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 4px;
}
#chapter-tools .writing-section-head {
  margin: 18px 0 10px;
}
#chapter-tools h2 {
  font-size: 23px;
}
#chapter-ideas-count {
  color: var(--muted);
  margin-left: 5px;
  font: 13px var(--sans);
}
.chapter-tool-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}
#chapter-tools button,
#chapter-tools a.text-button {
  min-height: 44px;
  font-size: 13px;
}
#chapter-tools #chapter-capture {
  position: static;
}
.chapter-idea-row {
  display: flex;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.chapter-idea-row .writing-note {
  min-width: 0;
  flex: 1;
  margin: 0;
  border: 0;
  background: transparent;
  padding: 14px 0;
}
.chapter-idea-row .writing-note strong {
  font-size: 21px;
}
.chapter-idea-row .writing-note p {
  margin: 6px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chapter-idea-row .outline-moves {
  display: flex;
  flex-direction: column;
}
#chapter-sources .writing-note,
#chapter-sections .writing-note {
  padding: 14px;
}
#chapter-sources .writing-note strong,
#chapter-sections .writing-note strong {
  font-size: 20px;
}
#attach-search {
  width: 100%;
  margin: 12px 0;
  font-size: 16px;
}
#attach-results {
  max-height: 42dvh;
  overflow: auto;
}
.attach-option {
  display: flex !important;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  margin: 0 !important;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.attach-option input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.attach-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.attach-option strong,
.attach-option small {
  display: block;
}
.attach-option small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}
#idea-scope {
  font-size: 13px;
  padding: 9px;
  min-height: 44px;
}
#move-section-parent {
  width: 100%;
  margin-top: 10px;
}
#plan-plan {
  min-height: 125px;
}
/* Compact planning and inbox chrome. */
.writing-workspace {
  padding: 12px 24px 28px;
}
.writing-section-head {
  margin: 12px 0 10px;
  gap: 8px;
}
.writing-section-head h2 {
  font: 600 18px/1.3 var(--sans);
  letter-spacing: 0;
}
.book-cards {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}
.book-card {
  padding: 8px 10px;
  border-radius: 0;
  gap: 8px;
}
.book-card strong {
  font: 600 16px/1.3 var(--sans);
}
.book-card small {
  -webkit-line-clamp: 1;
  margin-top: 2px;
}
.book-mark {
  display: none;
}
.bookshelf {
  margin-bottom: 10px;
}
.ideas-heading {
  margin-top: 10px;
  padding-top: 10px;
}
.book-heading h1 {
  font: 600 26px/1.3 var(--sans);
  letter-spacing: 0;
}
.planning-field {
  margin-bottom: 12px;
}
@media (max-width: 760px) {
  .writing-workspace {
    padding: 4px 16px 90px;
  }
  .book-heading h1 {
    font-size: 24px;
  }
}
