/* Shared panels for the reader and author workspaces. */
.dashboard-banner {
  position: relative;
  isolation: isolate;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  min-height: 191px;
  overflow: hidden;
  padding: clamp(21px, 3.5vw, 42px);
  margin-bottom: 22px;
  border: 1px solid #e0d4f2;
  background: radial-gradient(ellipse at 90% 35%, #e3d7f8, #f3eefb 66%);
}
.dashboard-banner::after {
  position: absolute;
  z-index: -1;
  top: 50%;
  right: -47px;
  width: 380px;
  height: 270px;
  transform: translateY(-50%) rotate(-18deg);
  border: 1px solid #ab8ed768;
  border-radius: 50%;
  box-shadow: inset 0 0 0 22px #ffffff30, 0 0 0 24px #ffffff40, 0 0 0 25px #bda5e259;
  content: '';
  pointer-events: none;
}
.dashboard-banner h1 {
  margin: 5px 0 6px;
  font: 690 clamp(1.96rem, 4vw, 3.7rem)/1.09 var(--sans);
  letter-spacing: -.05em;
  overflow-wrap: anywhere;
}
.dashboard-banner p { color: #605474; }
.dashboard-banner .dashboard-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-ink);
  font-size: .86rem;
  font-weight: 800;
}
.dashboard-avatar, .studio-banner-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(57px, 9vw, 106px);
  aspect-ratio: 1;
  margin-right: clamp(4px, 2vw, 30px);
  border: 1px solid #ece2fb;
  color: #58319f;
  background: linear-gradient(150deg, #faf4ff, #bfa9ed);
  box-shadow: 0 7px 24px #5934a42d;
  font: 690 clamp(1.5rem, 3vw, 2.9rem)/1 var(--sans);
}
.author-banner {
  color: #fff5fa;
  border-color: #422d61;
  background: radial-gradient(ellipse at 87% 29%, #624888, #39294f 61%, #312344);
}
.author-banner h1 { color: #fff7fc; }
.author-banner p { color: #eddef6; }
.author-banner .dashboard-kicker { color: #e0c5fd; }
.author-banner::after { border-color: #ba98df6b; box-shadow: inset 0 0 0 22px #ddd1f211, 0 0 0 24px #e3d4ff12, 0 0 0 25px #bda5e24f; }
.studio-banner-icon { color: #f1dfff; background: #765599; border-color: #9678b4; transform: rotate(8deg); }
.studio-banner-icon svg { width: 52%; height: 52%; }

.reader-layout .nav-link[href="#author"] { color: var(--accent-ink); }
.studio-topbar .studio-byline { display: inline-flex; align-items: center; gap: 7px; color: #5e477d; font-size: .9rem; font-weight: 800; }
.studio-byline:hover { text-decoration: underline; }
.studio-topbar .topbar-inner > .text-link { margin-left: auto; }

.workspace-tabs {
  display: flex;
  gap: 6px;
  padding: 5px;
  margin-bottom: 20px;
  width: fit-content;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}
.workspace-tabs :is(a, button) {
  display: inline-flex;
  align-items: center;
  min-height: 39px;
  flex: none;
  padding: 5px 14px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: .875rem;
  font-weight: 800;
}
.workspace-tabs :is(a, button):hover,
.workspace-tabs [aria-current="page"],
.workspace-tabs [aria-pressed="true"] { color: var(--accent-ink); background: var(--tint); }
.workspace-tabs :focus-visible { outline-offset: 0; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin: 0; }
.metric {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 9px 7px;
  min-height: 107px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.metric-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: none;
  color: var(--accent-ink);
  background: #efe7fb;
}
.metric:nth-child(2) .metric-icon { color: #365843; background: #e8f1e6; }
.metric:nth-child(3) .metric-icon { color: #86522c; background: #f7eddf; }
.metric:nth-child(4) .metric-icon { color: #69426c; background: #f4e9f3; }
.metric dt { grid-area: 2 / 1 / 3 / 3; color: var(--muted); font-size: .81rem; }
.metric dd { grid-area: 1 / 2; margin: 0; letter-spacing: -.03em; font: 700 1.75rem/1.15 var(--sans); }
.dashboard-section { margin-top: 24px; }
.dashboard-section .section-head { align-items: center; }
.workspace-empty { padding-block: 30px; }

.history-list { display: grid; gap: 9px; }
.history-row {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.history-cover { display: block; flex: none; width: 47px; }
.history-row .history-cover .cover { width: 100%; }
.history-info { flex: 1 1 0; min-width: 0; }
.history-info h3 { font-size: .95rem; font-weight: 800; overflow-wrap: anywhere; }
.history-info h3 a:hover { color: var(--accent-ink); }
.history-info p { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.history-row .history-info p .badge { margin-right: 4px; }
.history-row .work-next { display: flex; align-items: center; gap: 5px; margin-top: 4px; }
.history-meter { display: flex; align-items: center; gap: 8px; margin-top: 6px; max-width: 310px; color: var(--accent-ink); font-size: .75rem; font-weight: 800; }
.meter { display: block; flex: 1 1 auto; height: 6px; background: #ebe3f5; overflow: hidden; }
.meter span { display: block; height: 100%; background: #7951ca; }
.history-row .row-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.bookmark-row blockquote { margin: 4px 0 0; padding-inline-start: 8px; border-inline-start: 2px solid #e1d4f6; color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.detail-meter { display: grid; gap: 6px; width: min(100%, 330px); margin-top: 17px; color: var(--accent-ink); font-size: .83rem; font-weight: 800; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 17px; }
.detail-tags .chip { min-height: 32px; padding: 3px 10px; }
.detail-copy .detail-actions { margin-top: 16px; }
.author-bio { padding: 16px; border: 1px solid var(--line); background: var(--surface); }
.author-bio p { color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }

.account-preferences { display: grid; align-items: start; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 900px; }
.account-preferences .form-panel > .button, .studio-profile-form .button, .dialog-form .button { justify-self: start; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.profile-list { display: grid; gap: 6px; }
.profile-choice {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  font-size: .88rem;
}
.profile-choice[aria-pressed="true"], .profile-choice:hover { border-color: #e3d6f2; background: #f8f2fc; }
.profile-choice strong { flex: 1; overflow-wrap: anywhere; }
.profile-choice .avatar { width: 32px; height: 32px; flex: none; }
.dialog-form.form-panel { padding: 8px 0 0; border: 0; }
.studio-profile-form { max-width: 620px; }

.studio-form { max-width: 960px; }
.studio-form .editor-tabs { position: sticky; top: 7px; z-index: 3; margin: 0; }
.editor-panel { gap: 18px; }
.editor-panel > .section-head { align-items: center; }
.book-card-fields { display: grid; grid-template-columns: minmax(100px, 162px) minmax(0, 1fr); align-items: start; gap: 17px; }
.cover-editor, .book-text-fields { min-width: 0; display: grid; gap: 11px; align-content: start; }
.cover-editor .file-label { font-size: .75rem; padding: 4px; }
.cover-editor .text-link { justify-self: center; font-size: .8rem; }
.cover-editor .local-note { text-align: center; line-height: 1.25; font-size: .75rem; }
.studio-placeholder { display: grid; place-items: center; border: 1px dashed #baabd1; background: #f2ebf8; color: #8363ad; box-shadow: none; }
.studio-placeholder::after { display: none; }
.studio-access-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.studio-access-options .access-choice { min-height: 91px; padding: 9px; align-items: flex-start; gap: 7px; }
.studio-access-options .metric-icon { width: 30px; height: 30px; }
.studio-access-options .metric-icon svg { width: 16px; height: 16px; }
.studio-access-options small { margin-top: 2px; }
.import-book {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid #e7ddef;
  background: #faf5fc;
  font-size: .88rem;
}
.import-book p { color: var(--muted); font-size: .79rem; }
.import-book .file-label { min-width: max-content; padding-inline: 8px; }
.studio-form #chapter-fields { display: grid; gap: 8px; }
.studio-form .chapter-fields { display: block; margin: 0; padding: 0; background: #fdfbfc; }
.chapter-fields summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 7px 10px;
  list-style: none;
  cursor: pointer;
}
.chapter-fields summary:hover { background: #f5edf9; }
.chapter-fields summary::-webkit-details-marker { display: none; }
.chapter-fields[open] summary { border-bottom: 1px solid var(--line); }
.chapter-fields[open] summary > svg { transform: rotate(180deg); }
.chapter-order {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--accent-ink);
  background: var(--tint);
  font-size: .8rem;
  font-weight: 800;
}
.chapter-summary-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; font-weight: 800; }
.chapter-summary-status { color: var(--muted); font-size: .76rem; }
.chapter-edit-body { display: grid; gap: 12px; padding: 12px; }
.form-panel .studio-check { display: flex; align-items: center; gap: 7px; }
.studio-check input { width: 17px !important; min-height: 0 !important; height: 17px; margin: 0; accent-color: var(--accent); }
.chapter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.chapter-actions .remove-chapter { margin-inline-start: auto; }
.editor-save {
  position: sticky;
  bottom: 7px;
  z-index: 2;
  display: grid;
  gap: 9px;
  padding: 9px;
  border: 1px solid #e5dbed;
  background: #fffdfa;
  box-shadow: 0 7px 22px #47296e12;
}
.editor-save .form-error { margin: 3px 4px; }
.editor-save .remove-chapter { margin-right: auto; }
.studio-preview { white-space: pre-line; font: 1.04rem/1.65 var(--serif); overflow-wrap: anywhere; }
.studio-preview p + p { margin-top: .85em; }
.studio-preview-note { margin-top: 14px; }
.reader-note {
  margin-top: 30px;
  padding: 13px;
  border: 1px solid var(--reading-edge);
  color: var(--reading-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.reader-note h2 { margin-bottom: 5px; font: 680 1.22rem/1.2 var(--sans); color: var(--reading-ink); }

@media (max-width: 800px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  .studio-topbar .studio-byline { display: none; }
}
@media (max-width: 570px) {
  .dashboard-banner { min-height: 144px; gap: 7px; padding: 16px 13px; }
  .dashboard-banner h1 { font-size: clamp(1.7rem, 7.5vw, 2.1rem); }
  .dashboard-banner p:not(.dashboard-kicker) { font-size: .86rem; }
  .dashboard-banner::after { right: -150px; opacity: .6; }
  .dashboard-avatar, .studio-banner-icon { width: 51px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .metric { min-height: 77px; padding: 8px 10px; gap: 4px; }
  .metric-icon { width: 30px; height: 30px; }
  .metric dd { font-size: 1.48rem; }
  .workspace-tabs { gap: 2px; }
  .workspace-tabs :is(a, button) { min-height: 36px; padding-inline: 10px; font-size: .82rem; }
  .account-preferences, .studio-access-options { grid-template-columns: 1fr; }
  .history-row { padding: 8px; gap: 8px; }
  .history-row .button { min-height: 36px; padding: 6px 8px; font-size: .76rem; }
  .history-cover { width: 38px; }
  .bookmark-row, .work-row { flex-wrap: wrap; }
  .bookmark-row .row-actions, .work-row .row-actions { margin-left: auto; }
  .bookmark-row .history-info, .work-row .history-info { flex: 1 1 70%; }
  .studio-access-options .access-choice { min-height: 57px; }
  .book-card-fields { grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
  .book-text-fields .fields-row, .chapter-publication { grid-template-columns: 1fr; }
  .import-book { flex-wrap: wrap; }
  .editor-save .button { min-height: 37px; padding: 7px 9px; font-size: .81rem; }
  .editor-save .remove-chapter { font-size: .8rem; }
  .chapter-summary-status { max-width: 86px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
  .reader-tools { gap: 0; }
  .reader-tools .icon-button { width: 33px; min-height: 36px; }
  .reader-bar-inner { grid-template-columns: 38px minmax(0, 1fr) auto; }
}
