/* Shared panels for the reader and author workspaces. */
.dashboard-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: clamp(20px, 3vw, 36px);
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--subtle);
}
.dashboard-banner h1 {
  margin: 5px 0 6px;
  font: var(--weight-heading) clamp(1.96rem, 4vw, 3.7rem)/1.09 var(--sans);
  letter-spacing: -.05em;
  overflow-wrap: anywhere;
}
.dashboard-banner p { color: var(--muted); }
.dashboard-banner .dashboard-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-ink);
  font-size: .86rem;
  font-weight: var(--weight-strong);
}
.dashboard-avatar, .studio-banner-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: clamp(52px, 8vw, 84px);
  aspect-ratio: 1;
  margin-right: clamp(4px, 2vw, 30px);
  border-radius: var(--radius-panel);
  color: var(--accent-ink);
  background: var(--tint);
  font: var(--weight-heading) clamp(1.5rem, 3vw, 2.9rem)/1 var(--sans);
}
.studio-banner-icon svg { width: 52%; height: 52%; }

.studio-topbar .studio-byline { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .9rem; font-weight: var(--weight-label); }
.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);
  border-radius: var(--radius-panel);
  background: var(--surface);
}
.workspace-tabs :is(a, button) {
  display: inline-flex;
  align-items: center;
  min-height: 39px;
  flex: none;
  padding: 5px 14px;
  border: 0;
  border-radius: var(--radius-control);
  color: var(--muted);
  background: transparent;
  font-size: .875rem;
  font-weight: var(--weight-strong);
}
.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);
  border-radius: var(--radius-panel);
  background: var(--surface);
}
.metric-icon {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: none;
  border-radius: var(--radius-control);
  color: var(--accent-ink);
  background: var(--tint);
}
.metric dt { grid-area: 1 / 1 / 2 / 3; display: grid; gap: 8px; color: var(--muted); font-size: .81rem; }
.metric dd { grid-area: 1 / 2; align-self: start; justify-self: end; margin: 0; letter-spacing: -.03em; font: var(--weight-heading) 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);
  border-radius: var(--radius-panel);
  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 :is(h2, h3) { font-size: .95rem; font-weight: var(--weight-strong); overflow-wrap: anywhere; }
.history-info :is(h2, 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: var(--weight-strong); }
.meter { display: block; flex: 1 1 auto; height: 6px; border-radius: var(--radius-detail); background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--accent); }
.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 var(--control-line); color: var(--muted); font-size: .84rem; overflow-wrap: anywhere; }
.author-bio { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.author-bio p { color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }

.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: var(--control-line); background: var(--tint); }
.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; }
.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 var(--control-line); background: var(--subtle); color: var(--muted); 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 var(--line);
  border-radius: var(--radius-control);
  background: var(--subtle);
  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: var(--surface); }
.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: var(--subtle); }
.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: var(--weight-strong);
}
.chapter-summary-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; font-weight: var(--weight-strong); }
.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(--focus); }
.chapter-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.chapter-actions .remove-chapter { margin-inline-start: 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: var(--weight-heading) 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; }
  .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; }
}
