.connection-note { margin: 0 0 14px; padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--subtle); color: var(--muted); font-size: .83rem; }
.startup-label { display: grid; place-items: center; min-height: 65vh; color: var(--muted); }

.auth-callout, .import-local {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 17px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--subtle);
}
.auth-callout p, .import-local p { color: var(--muted); font-size: .85rem; }
.auth-callout .row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.import-local { margin: 17px 0 0; }

.card-footer, .card-community, .book-rating, .book-readers {
  display: flex;
  align-items: center;
}
.card-footer { gap: 5px 7px; justify-content: space-between; flex-wrap: wrap; margin-top: 7px; }
.card-community { gap: 6px; font-size: .75rem; color: var(--muted); }
.book-rating, .book-readers { gap: 4px; white-space: nowrap; color: var(--muted); }
.book-rating svg { color: var(--rating-ink); fill: var(--rating-tint); }
.book-rating strong { color: var(--ink); }
.book-rating small { font-size: .86em; }
.book-readers svg { color: var(--accent-ink); }

.review-section { max-width: 820px; margin-top: 32px; scroll-margin-top: 16px; }
.review-section .section-head { align-items: center; }
.review-summary { color: var(--muted); font-size: .84rem; margin-top: 3px; }
.review-list { display: grid; gap: 10px; }
.review-card, .review-empty {
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.review-empty { color: var(--muted); font-size: .9rem; }
.review-author { display: flex; align-items: center; gap: 9px; }
.review-author > div { flex: 1; min-width: 0; }
.review-author .avatar { flex: none; }
.review-author strong { display: block; overflow-wrap: anywhere; font-size: .88rem; }
.review-author time { display: block; color: var(--muted); font-size: .76rem; }
.review-card p { margin-top: 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .94rem; }
.review-more { margin-top: 12px; }
.rating-input { border: 0; margin: 0; padding: 0; min-width: 0; }
.rating-input legend { padding: 0; font-size: .86rem; font-weight: var(--weight-strong); }
.rate-stars { display: flex; gap: 3px; padding: 3px 0 7px; }
.rate-stars label { cursor: pointer; }
.rate-stars span {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  color: var(--rating-ink);
}
.rate-stars label:has(input:checked) svg,
.rate-stars label:has(~ label input:checked) svg { fill: #f1ce78; }
.rate-stars input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -1px; }
.rate-stars label:hover span { background: var(--rating-tint); }
.rating-input .text-link { font-size: .77rem; }
#book-review-form .dialog-actions { margin-top: 0; }

@media (max-width: 570px) {
  .book-rating small { display: none; }
  .review-section .section-head { align-items: flex-start; }
  .review-section .section-head .button { min-height: 35px; padding: 6px 8px; font-size: .77rem; flex: 0 1 auto; }
}

.catalog-byline { color: var(--muted); margin-top: 2px; font-size: .81rem; line-height: 1.45; overflow-wrap: anywhere; }
.author-byline:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }

.writer-avatar { width: clamp(54px, 8vw, 96px); margin: 0; }
.writer-name { flex: 1 1 auto; min-width: 0; }
.writer-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 13px; margin-top: 9px; color: var(--muted); font-size: .9rem; font-weight: var(--weight-label); }
.writer-metrics > span { display: inline-flex; align-items: center; gap: 5px; }
.writer-bio {
  max-width: 820px;
  padding: 15px 18px;
  margin: 0 0 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.writer-bio h2 { margin-bottom: 6px; font: var(--weight-heading) 1.33rem/1.2 var(--sans); }
.writer-bio p { color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.followed-author .avatar { flex: none; }
.followed-author .button[aria-pressed="true"]:hover { border-color: var(--focus); }
.editor-byline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 9px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--subtle);
  font-size: .86rem;
}
.editor-byline span { color: var(--muted); }
.editor-byline strong { overflow-wrap: anywhere; }
.editor-byline a { margin-left: auto; font-size: .82rem; }
.studio-public-link { margin-top: 12px; }

@media (max-width: 570px) {
  .writer-metrics { font-size: .8rem; gap: 4px 9px; }
  .writer-metrics svg { width: 15px; height: 15px; }
  .writer-bio { padding: 12px; }
}

.author-photo-field { display: flex; align-items: center; gap: 14px; min-width: 0; }
.author-photo-field .writer-avatar { flex: none; width: 74px; }
.author-photo-controls { display: grid; justify-items: start; gap: 6px; }
.author-photo-controls .file-label { padding-inline: 9px; min-height: 36px; }
.writer-avatar, .followed-author .avatar { overflow: hidden; }
.writer-avatar img, .followed-author .avatar img { width: 100%; height: 100%; object-fit: cover; }
.import-status:empty { display: none; }

.studio-view-tabs { display: none; }
.insight-overview, .insight-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.insight-preview, .insight-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
}
.insight-preview > div:first-child { display: flex; align-items: center; gap: 8px; color: var(--accent-ink); }
.insight-overview-value { margin-top: 6px; font: var(--weight-heading) 1.72rem/1.15 var(--sans); overflow-wrap: anywhere; }
.insight-preview p { margin: 5px 0 9px; color: var(--muted); font-size: .87rem; }
.insight-filters { display: flex; flex-wrap: wrap; gap: 9px 13px; margin-bottom: 15px; }
.insight-filters label { display: grid; gap: 4px; min-width: 0; font-size: .87rem; font-weight: var(--weight-strong); }
.insight-filters select {
  max-width: min(100%, 360px);
  min-height: 42px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: .9rem;
}
.insight-secondary { margin-top: 11px; color: var(--muted); font-size: .86rem; }
.chart-panel h3 { margin-bottom: 9px; font-size: .92rem; }
.history-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  height: 108px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0 25px, var(--line) 25px 26px);
}
.chart-day { display: flex; align-items: flex-end; justify-content: stretch; min-width: 0; }
.chart-day span { width: 100%; height: var(--bar); min-height: 2px; border-radius: 2px 2px 0 0; background: var(--accent); }
.chart-panel:nth-child(2) .chart-day span { background: var(--positive-ink); }
.chart-dates { display: flex; justify-content: space-between; margin-top: 4px; color: var(--muted); font-size: .79rem; }

.insight-table-panel { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.insight-table { width: 100%; border-collapse: collapse; text-align: right; font-size: .86rem; }
.insight-table :is(th, td) { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.insight-table th:first-child { max-width: 275px; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.insight-table thead th { color: var(--muted); background: var(--subtle); font-size: .79rem; }
.insight-table tbody tr:last-child :is(th, td) { border-bottom: 0; }
.insight-table th small { display: block; color: var(--muted); margin-top: 2px; font-size: .72rem; }
.insight-table td:last-child { font-weight: var(--weight-strong); }
.balance-banner { min-height: 163px; }
.balance-banner h2 { margin: 3px 0 5px; font: var(--weight-heading) clamp(2rem, 5vw, 3.6rem)/1.07 var(--sans); }
.ledger-amount { flex: none; }
.ledger-amount.credit { color: var(--positive-ink); }
.ledger-amount.debit { color: var(--danger-ink); }

@media (max-width: 800px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  .studio-navigation a:is([href="#author/stats"], [href="#author/balance"], [href="#edit"]) { display: none; }
  .studio-view-tabs { display: flex; }
}
@media (max-width: 570px) {
  .insight-overview, .insight-charts { grid-template-columns: 1fr; gap: 8px; }
  .insight-filters label, .insight-filters select { width: 100%; }
  .insight-table :is(th, td) { padding: 8px; }
  .insight-table th:first-child { min-width: 123px; }
  .balance-banner { min-height: 131px; flex-wrap: wrap; }
  .balance-banner .button { min-height: 36px; }
}
