/* 337背单词管理后台样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  display: flex; min-height: 100vh; background: #f2f4f8; color: #2a3040; font-size: 14px;
}

/* 侧栏 */
.side {
  width: 200px; flex: none; background: #232842; color: #aab; display: flex; flex-direction: column;
}
.logo { color: #fff; font-weight: 700; font-size: 16px; padding: 20px 18px 14px; display: flex; align-items: center; gap: 8px; }
.logo-img { width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover; }
.side nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; }
.side nav a {
  color: #aab; text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.side nav a:hover { background: #2e3454; color: #fff; }
.side nav a.on { background: #6a74f0; color: #fff; }
.side .logout { margin-top: auto; padding: 16px 20px; color: #7a80a0; font-size: 13px; text-decoration: none; }
.side .logout:hover { color: #fff; }

/* 登录页 */
#login-root {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: #f2f4f8;
}
#login-root[hidden] { display: none; }
.login-box {
  background: #fff; border-radius: 14px; padding: 34px 36px 30px; width: 340px; max-width: 92vw;
  box-shadow: 0 12px 40px rgba(20, 30, 80, 0.12);
}
.login-box h2 { font-size: 18px; }
.login-box .sub { margin: 6px 0 18px; }
.login-box input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-err { color: #c0392b; font-size: 12px; min-height: 18px; margin: 8px 0 4px; }
.login-box button { width: 100%; padding: 10px; font-size: 14px; }

/* 主区：随窗口宽度自适应铺满 */
.main { flex: 1; min-width: 0; padding: 24px 28px; }
h1 { font-size: 20px; margin-bottom: 6px; }
.sub { color: #7a8194; margin-bottom: 18px; font-size: 13px; }

.cards { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.stat {
  background: #fff; border-radius: 12px; padding: 16px 20px; min-width: 140px;
  box-shadow: 0 2px 8px rgba(60, 80, 160, 0.06);
}
.stat .num { font-size: 26px; font-weight: 700; color: #4a5cf0; }
.stat .label { color: #7a8194; font-size: 12px; margin-top: 4px; }

/* 工具条 / 表格 */
.toolbar { display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap; align-items: center; }
input, select, textarea {
  border: 1px solid #d5dae4; border-radius: 8px; padding: 8px 10px; font-size: 13px;
  font-family: inherit; background: #fff; color: inherit; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #b9bef7; border-color: #6a74f0; }
button {
  border: none; border-radius: 8px; padding: 8px 14px; font-size: 13px; cursor: pointer;
  background: #6a74f0; color: #fff; font-family: inherit;
}
button:hover { filter: brightness(1.06); }
button.ghost { background: #eef0f6; color: #444c66; }
button.danger { background: #fdecec; color: #c0392b; }
button.mini { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(60, 80, 160, 0.06); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eef0f5; font-size: 13px; }
th { background: #f8f9fc; color: #68708a; font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8f9ff; }
td .ops { display: flex; gap: 6px; }
.mono { font-family: Consolas, monospace; font-size: 12px; color: #68708a; }
.muted { color: #98a1ad; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.measured { background: #e5f7ee; color: #12805c; }
.badge.generated { background: #e8ecfd; color: #3d49c0; }
.badge.empty { background: #fdf3e5; color: #b06a12; }
.badge.ready { background: #e5f7ee; color: #12805c; }
.badge.retired { background: #ececec; color: #777; text-decoration: line-through; }
.badge.cat { background: #eef0f6; color: #55607a; margin-right: 4px; }
.count-line { color: #7a8194; font-size: 12px; margin: 0 0 6px 2px; }
.ck { margin-right: 12px; font-size: 13px; color: #444c66; white-space: nowrap; }
.ck input { margin-right: 4px; }
.kind-tag { color: #98a1ad; font-size: 12px; }
.swatch { display: inline-block; width: 28px; height: 18px; border-radius: 4px; vertical-align: middle; }
.cover-img { width: 34px; height: 46px; object-fit: cover; border-radius: 4px; vertical-align: middle; background: #eef0f6; }
.cover-img.big { width: 64px; height: 86px; }

/* 词库详情 */
.crumb { margin-bottom: 14px; }
.crumb a { color: #4a5cf0; text-decoration: none; }
.panel { background: #fff; border-radius: 12px; padding: 16px 18px; margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(60, 80, 160, 0.06); }
.panel h2 { font-size: 15px; margin-bottom: 12px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.form-row label { font-size: 13px; color: #68708a; }
.unit-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.unit-tab {
  padding: 6px 12px; border-radius: 8px; background: #eef0f6; color: #444c66; cursor: pointer; font-size: 13px;
}
.unit-tab.on { background: #6a74f0; color: #fff; }

/* 设置页 tab */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid #e4e7f2; margin-bottom: 16px; }
.tab {
  padding: 9px 18px; font-size: 14px; color: #68708a; text-decoration: none; cursor: pointer;
  border-radius: 8px 8px 0 0; margin-bottom: -2px; border: none; background: transparent;
}
.tab:hover { background: #eef0f6; color: #444c66; }
.tab.on { color: #4a5cf0; font-weight: 600; background: #fff; box-shadow: inset 0 -2px 0 #4a5cf0; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 24, 40, 0.45); display: flex;
  align-items: flex-start; justify-content: center; padding-top: 8vh; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; padding: 20px 22px; width: 560px; max-width: 94vw;
  max-height: 80vh; overflow: auto; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.modal h3 { margin-bottom: 14px; font-size: 16px; }
.modal .form-row { margin-bottom: 12px; }
.modal .form-row input, .modal .form-row textarea { flex: 1; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.empty-tip { color: #98a1ad; padding: 30px; text-align: center; background: #fff; border-radius: 12px; }
.toast {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: #232842; color: #fff;
  padding: 9px 18px; border-radius: 20px; font-size: 13px; z-index: 99; box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

/* 单词配图 / 发音 */
.asset-cell { display: inline-flex; align-items: center; gap: 8px; }
.word-thumb {
  width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: #f6f7fb;
  border: 1px solid #e8ebf2; cursor: zoom-in;
}
.word-thumb.big { width: 64px; height: 64px; cursor: default; }
button.snd { font-size: 11px; padding: 3px 9px; }

/* 教材管理右侧教材版本筛选栏 */
.tb-layout { display: flex; gap: 16px; align-items: flex-start; }
.tb-main { flex: 1; min-width: 0; }
.pub-side {
  width: 190px; flex: none; background: #fff; border-radius: 12px; padding: 12px 10px;
  box-shadow: 0 2px 8px rgba(60, 80, 160, 0.06);
  position: sticky; top: 16px; max-height: calc(100vh - 48px); overflow: auto;
}
.pub-side h2 { font-size: 13px; color: #68708a; padding: 2px 10px 8px; }
.pub-group { font-size: 12px; color: #98a1ad; padding: 10px 10px 4px; }
.pub-item {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: #444c66;
  white-space: nowrap;
}
.pub-item > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.pub-item:hover { background: #eef0f6; }
.pub-item.on { background: #6a74f0; color: #fff; }
.pub-item.on:hover { background: #6a74f0; }
.pub-item .cnt {
  flex: none; font-size: 11px; color: #98a1ad; background: #f2f4f8;
  border-radius: 9px; padding: 1px 7px;
}
.pub-item.on .cnt { color: #fff; background: rgba(255, 255, 255, 0.25); }

/* 已选筛选条件 chips */
.filter-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px;
  background: #e8ecfd; color: #3d49c0; border-radius: 14px; font-size: 12px;
}
.chip-x {
  cursor: pointer; width: 16px; height: 16px; line-height: 15px; text-align: center;
  border-radius: 50%; background: rgba(61, 73, 192, 0.15); font-size: 10px; user-select: none;
}
.chip-x:hover { background: #3d49c0; color: #fff; }

/* 窄屏自适应：侧栏转为顶部导航，表格改为容器内横向滚动 */
@media (max-width: 860px) {
  body { flex-direction: column; }
  .side { width: auto; flex-direction: row; align-items: center; padding: 0 10px; }
  .logo { padding: 14px 10px; font-size: 15px; white-space: nowrap; }
  .side nav { flex-direction: row; flex: 1; overflow-x: auto; padding: 8px 4px; gap: 4px; }
  .side nav a { white-space: nowrap; padding: 8px 12px; }
  .main { padding: 14px 14px 28px; }
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .modal { max-width: 96vw; }
  .tb-layout { flex-direction: column-reverse; }
  .pub-side { position: static; width: auto; max-height: none; }
}
