:root {
  --bg: #f2eee6;
  --panel: rgba(255, 251, 245, 0.96);
  --primary: #2f5d50;
  --primary-deep: #24473d;
  --accent: #c97a2b;
  --danger: #b4543e;
  --text: #241f1a;
  --muted: #6f675d;
  --border: #e4d8c5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(201, 122, 43, 0.16), transparent 24%),
    linear-gradient(180deg, #f6f1e8, #f3ede3);
  color: var(--text);
}

input,
select,
button,
textarea {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: inherit;
}

input,
select,
textarea {
  background: var(--panel);
  border: 1px solid var(--border);
}

input,
select {
  min-width: 240px;
}

button {
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: rgba(255, 251, 245, 0.9);
  border: 1px solid rgba(228, 216, 197, 0.88);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(63, 45, 20, 0.14);
}

.auth-copy {
  padding: 52px 40px;
  background:
    radial-gradient(circle at top left, rgba(201, 122, 43, 0.18), transparent 32%),
    linear-gradient(160deg, #2a4f44, #3f6d60);
  color: #fff7eb;
}

.auth-copy h1 {
  margin: 18px 0 12px;
  font-size: 42px;
}

.auth-copy p {
  margin: 0;
  max-width: 380px;
  color: rgba(255, 247, 235, 0.84);
  line-height: 1.8;
}

.auth-tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 247, 235, 0.14);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-form {
  padding: 44px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.field-label {
  color: var(--muted);
  font-size: 14px;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 36px 28px;
  background: linear-gradient(180deg, var(--primary-deep), #3b6559);
  color: #fff7eb;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.sidebar h1 {
  margin: 0;
  font-size: 34px;
}

.sidebar p {
  color: rgba(255, 247, 235, 0.8);
  line-height: 1.7;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  background: rgba(255, 247, 235, 0.12);
  color: #fff7eb;
}

.nav-btn.active {
  background: #fff0db;
  color: var(--primary-deep);
}

.sidebar-tip {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 247, 235, 0.12);
  line-height: 1.7;
}

.sidebar-tip strong,
.sidebar-tip span {
  display: block;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.current-admin {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.current-admin span {
  color: rgba(255, 247, 235, 0.72);
  font-size: 13px;
}

.full-width {
  width: 100%;
}

.env-chip {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 247, 235, 0.18);
  color: #fff7eb;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-all;
}

.main {
  padding: 28px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 30px;
}

.hero p,
.panel-desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.module-section {
  animation: fadeIn 0.24s ease;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(228, 216, 197, 0.75);
  border-radius: 22px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(86, 66, 38, 0.08);
  margin-bottom: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.search-box,
.import-actions,
.cover-upload-row,
.action-cluster {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.code-input {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  background: #fbf7f0;
  font-family: "SFMono-Regular", "Menlo", monospace;
  line-height: 1.6;
}

.meta-description {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  background: #fbf7f0;
  line-height: 1.6;
  margin-bottom: 14px;
}

.submit-row {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.ghost-btn,
.file-btn {
  background: #efe3d1;
  color: #3e3429;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 16px;
  border-radius: 14px;
  cursor: pointer;
}

.file-btn input {
  display: none;
}

.status-text {
  color: var(--primary);
  line-height: 1.7;
}

.status-text.error {
  color: var(--danger);
}

.cover-preview-wrap {
  margin-bottom: 14px;
}

.cover-preview {
  width: 112px;
  height: 148px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid #dfd3c2;
  box-shadow: 0 12px 24px rgba(75, 54, 27, 0.12);
  background: #f7f1e7;
}

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

th,
td {
  padding: 16px 10px;
  text-align: left;
  border-bottom: 1px solid #eee3d1;
}

th {
  color: var(--muted);
  font-size: 14px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #efe5d7;
}

.avatar-wrap {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: #efe5d7;
}

.avatar-wrap-fallback {
  background: #4e7d70;
}

.avatar-fallback {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.action-btn {
  margin-right: 8px;
  margin-bottom: 6px;
  background: #e7ded1;
  color: #3a3128;
}

.action-btn.primary {
  background: var(--accent);
  color: #fff;
}

.action-btn.danger {
  background: #f4d9d1;
  color: #7b2f1f;
}

.log-list,
.chapter-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}

.log-item,
.chapter-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px dashed #e3d8c7;
}

.chapter-item {
  align-items: center;
}

.log-type,
.chapter-title {
  color: var(--primary);
  font-weight: 700;
}

.books-header {
  align-items: flex-end;
}

.book-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.detail-editor {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: #fcf8f2;
  border: 1px solid #eadfce;
}

.meta-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: #f7f1e7;
  border: 1px solid #e6d8c3;
}

.meta-card span,
.chapter-meta,
.empty-state,
.empty-cell {
  color: var(--muted);
}

.meta-card strong {
  display: block;
  margin-top: 6px;
  line-height: 1.6;
}

.meta-card.full {
  grid-column: 1 / -1;
}

.empty-state {
  padding: 10px 0;
}

.empty-cell {
  text-align: center;
  padding: 28px 10px;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .auth-card,
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding-bottom: 28px;
  }

  .hero,
  .panel-header,
  .submit-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel {
    overflow-x: auto;
  }

  .import-grid,
  .book-meta {
    grid-template-columns: 1fr;
  }

  input,
  select {
    min-width: 100%;
  }
}
