:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #687384;
  --line: #dde3ea;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --warn: #b45309;
  --danger: #b91c1c;
  --soft: #eef7f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

.topbar p,
.panelHead span,
.url,
.meta,
.backLink {
  color: var(--muted);
}

.backLink {
  display: inline-block;
  margin-bottom: 8px;
  text-decoration: none;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button,
input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}

button {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.panelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.booklistRows {
  display: grid;
}

.booklistRow {
  border-bottom: 1px solid var(--line);
}

.booklistButton {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr auto;
  gap: 16px;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--text);
  text-align: left;
  height: auto;
  padding: 16px 18px;
}

.booklistButton:hover {
  background: #f8fbfb;
}

.remark {
  font-weight: 700;
  font-size: 17px;
}

.source {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 28px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 13px;
}

.source.commission {
  background: #fff7ed;
  color: var(--warn);
}

.url {
  word-break: break-all;
}

.stats {
  display: none;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  padding: 0 18px 18px;
}

.booklistRow.open .stats {
  display: grid;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfd;
  min-height: 74px;
}

.statLink {
  display: block;
  color: var(--text);
  text-decoration: none;
  border-color: rgba(15, 118, 110, 0.4);
  background: var(--soft);
}

.statLink:hover {
  border-color: var(--brand);
  background: #e2f3f1;
}

.statLabel {
  color: var(--muted);
  margin-bottom: 6px;
}

.statValue {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.statHint {
  margin-top: 7px;
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 700;
}

.remarkEditor {
  display: none;
  gap: 10px;
  padding: 0 18px 18px;
}

.booklistRow.open .remarkEditor {
  display: flex;
}

.remarkEditor input {
  flex: 1;
  min-width: 180px;
}

.emptyState {
  display: none;
  padding: 34px 18px;
  text-align: center;
  color: var(--muted);
}

.emptyState.show {
  display: block;
}

.tableWrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcfd;
}

td:first-child {
  font-weight: 700;
}

@media (max-width: 760px) {
  .shell {
    padding: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .booklistButton {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .remarkEditor {
    flex-direction: column;
  }
}
