/* ============ 后台布局 ============ */
.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
  align-items: start;
  padding-bottom: 40px;
}

.panel-title .spacer {
  flex: 1;
}

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

.row .btn {
  flex: 1;
  min-width: 120px;
}

code {
  background: #eef0fb;
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
}

/* ============ 工具条 ============ */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar .input {
  flex: 1;
}

.toolbar .btn {
  white-space: nowrap;
}

/* ============ 单词列表 ============ */
.word-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
}

.word-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fcfcff;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.word-item:hover {
  border-color: #cfcbf7;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.word-item.editing {
  border-color: var(--brand);
  background: #f7f5ff;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.12);
}

.word-item .idx {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
  background: #eef0fb;
}

.word-item .body {
  flex: 1;
  min-width: 0;
}

.word-item .w {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.word-item .p {
  font-size: 13px;
  font-weight: 400;
  color: #8b90b3;
}

.word-item .m {
  margin-top: 3px;
  font-size: 14px;
  color: var(--ink-soft);
}

.word-item .e {
  margin-top: 5px;
  font-size: 12.5px;
  color: #7d8aa5;
  line-height: 1.6;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.word-item .ops {
  flex: none;
  display: flex;
  gap: 6px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: #eef0fb;
  transition: background 0.2s, transform 0.15s;
}

.icon-btn:hover {
  background: #e0e3f8;
  transform: translateY(-1px);
}

.icon-btn.danger:hover {
  background: #fbdcd8;
}

/* ============ 课本管理 ============ */
.book-box {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.book-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #f4f6ff;
  border: 1px solid #e3e7fb;
}

.book-item-row b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-item-row .count {
  color: #8b90b3;
  font-size: 12px;
}

.book-item-row .ops {
  display: flex;
  gap: 4px;
}

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef1ff;
  color: #5a63c8;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .word-list {
    max-height: none;
  }

  .row .btn {
    min-width: 0;
  }
}
