:root {
  color-scheme: light;
  --ink: #1c1917;
  --muted: #57534e;
  --paper: #faf7f2;
  --card: #ffffff;
  --line: #e7e0d6;
  --accent: #9a3412;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: Georgia, 'Iowan Old Style', serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}
header,
main,
#login-panel {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}
header p,
.muted,
.status {
  color: var(--muted);
}
a {
  color: var(--accent);
}
.grid {
  display: grid;
  gap: 0.9rem;
}
.card {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.9rem;
  padding: 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  text-decoration: none;
  color: inherit;
}
.cover,
.cover-lg {
  background: #efe7dc;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
}
.cover {
  width: 5.5rem;
  height: 8rem;
}
.cover-lg {
  width: min(12rem, 40vw);
  height: 18rem;
  margin: 0 0 1rem;
}
.cover img,
.cover-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
label {
  display: block;
  margin: 0.5rem 0;
}
input {
  width: 100%;
  padding: 0.45rem 0.5rem;
  font: inherit;
}
button {
  font: inherit;
  padding: 0.45rem 0.8rem;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 0.25rem;
}
.ratings {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.2rem 1rem;
  font-size: 0.95rem;
}
.missing {
  color: var(--muted);
  font-style: italic;
}
section {
  margin-top: 1.4rem;
}
h1,
h2 {
  line-height: 1.2;
}
.session-bar {
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.5rem 1rem 0;
  text-align: right;
}

/* ---------- Editorial Studio v1 ---------- */
main {
  max-width: 60rem;
}
header,
#login-panel {
  max-width: 60rem;
}
.small {
  font-size: 0.85rem;
}
button.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.6rem;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.filter {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  padding: 0.3rem 0.6rem;
}
.filter.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.bulk {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
label.check {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  margin: 0;
  font-size: 0.9rem;
}
label.check input,
.pick input {
  width: auto;
}
.book-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.book-row {
  display: grid;
  grid-template-columns: 1.8rem 1fr;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.4rem;
}
.book-row.focus {
  outline: 2px solid var(--accent);
}
.pick {
  display: flex;
  justify-content: center;
}
.row-link {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.7rem;
  padding: 0.45rem 0.7rem 0.45rem 0;
  text-decoration: none;
  color: inherit;
}
.cover-sm {
  width: 2.6rem;
  height: 3.8rem;
  background: #efe7dc;
  border-radius: 0.2rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cover-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.row-head strong {
  font-size: 1rem;
}
.row-head .muted {
  font-size: 0.9rem;
}
.blurb {
  margin: 0.1rem 0 0.2rem;
  font-size: 0.88rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-meta {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: system-ui, sans-serif;
}
.badge-pending {
  background: #fef3c7;
  border-color: #f2d58a;
  color: #78350f;
}
.badge-approved {
  background: #e0f2fe;
  border-color: #a5d3f2;
  color: #0c4a6e;
}
.badge-published {
  background: #dcfce7;
  border-color: #9ad9b0;
  color: #14532d;
}
.badge-withdrawn {
  background: #f5f5f4;
  color: var(--muted);
}
.comment-icon {
  font-size: 0.78rem;
  color: var(--muted);
}
.pager {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: center;
  margin: 1rem 0;
}
.notice {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid #15803d;
  padding: 0.5rem 0.8rem;
  margin: 0.6rem 0;
  font-size: 0.92rem;
}
.notice p {
  margin: 0.15rem 0;
}
.notice-warn {
  border-left-color: #b45309;
}

/* book page */
.book-page main {
  padding-bottom: 5.5rem;
}
.book-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.2rem;
  align-items: start;
  margin-top: 0;
}
.book-head h1 {
  margin: 0.2rem 0;
}
.byline {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: var(--muted);
}
.cover-lg {
  width: 9rem;
  height: 13.5rem;
  margin: 0;
}
section h2 {
  font-size: 1.25rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.25rem;
  margin: 1.8rem 0 0.8rem;
}
section h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.25rem;
  font-family: system-ui, sans-serif;
}
.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem 1.6rem;
}
.text-block p {
  margin: 0;
}
.text-block ol {
  margin: 0;
  padding-left: 1.2rem;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem !important;
}
.chip {
  font-size: 0.8rem;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0 0.5rem;
}
.fit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.8rem;
}
.fit-box ul {
  margin: 0;
  padding-left: 1.1rem;
}
.param-group {
  margin-bottom: 1.2rem;
}
.param-group > h3,
#category-params {
  margin-top: 0.6rem;
}
.param {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.4rem;
}
.param-head {
  display: grid;
  grid-template-columns: minmax(10rem, 1.3fr) minmax(8rem, 1fr) auto;
  gap: 0.6rem;
  align-items: baseline;
}
.param-name {
  font-weight: 600;
}
.param-reason {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}
.strength {
  font-family: system-ui, sans-serif;
  font-size: 0.75rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.strength-strong {
  background: #dcfce7;
  border-color: #9ad9b0;
}
.strength-fair {
  background: #ecfccb;
  border-color: #c7e39a;
}
.strength-weak {
  background: #ffedd5;
  border-color: #f5c08a;
}
.strength-none {
  background: #f5f5f4;
  color: var(--muted);
}
details.evidence {
  margin-top: 0.3rem;
  font-size: 0.9rem;
}
details summary {
  cursor: pointer;
  color: var(--accent);
}
details summary h2,
details summary h3 {
  display: inline;
  border: 0;
}
.claims {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
}
.claims li {
  margin-bottom: 0.4rem;
}
.sources-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-top: 0.5rem;
}
.sources-table th,
.sources-table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.3rem 0.4rem;
  vertical-align: top;
}
.sources-table td.yes {
  color: #15803d;
}
.edition {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1rem;
  font-size: 0.92rem;
}
.edition dt {
  color: var(--muted);
}
.edition dd {
  margin: 0;
}
.comments {
  list-style: none;
  padding: 0;
}
.comment {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.4rem;
}
.comment-body {
  margin: 0;
  white-space: pre-wrap;
}
.comment p.small {
  margin: 0.2rem 0 0;
}
textarea {
  width: 100%;
  font: inherit;
  padding: 0.45rem 0.5rem;
}
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 0.7rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  background: rgba(250, 247, 242, 0.97);
  border-top: 1px solid var(--line);
}
@media (max-width: 40rem) {
  .param-head {
    grid-template-columns: 1fr auto;
  }
  .param-head .strength {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .book-head {
    grid-template-columns: 1fr;
  }
}
