:root {
  --paper: #f6f2e9;
  --card: #fffdf8;
  --ink: #20292b;
  --muted: #6b7785;
  --brand: #21504c;
  --brand-soft: #2c6661;
  --gold: #b8862f;
  --gold-soft: #f0e4c8;
  --line: #e4dcca;
  --green: #2e7d5b;
  --amber: #b8862f;
  --red: #b5462f;
  --slate: #6b7785;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(32, 41, 43, .06), 0 6px 18px rgba(32, 41, 43, .05);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  --serif: Georgia, "Times New Roman", "Songti SC", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }
h1, h2, h3 { margin: 0 0 .4em; font-weight: 650; }
small { color: var(--muted); }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--brand); color: #fff;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand .mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: radial-gradient(circle at 50% 38%, var(--gold) 0 36%, transparent 38%),
              conic-gradient(from 0deg, var(--gold-soft), #fff, var(--gold-soft));
  flex: none;
}
.topbar .user { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.topbar .user .role-tag {
  background: rgba(255,255,255,.16); padding: 2px 8px; border-radius: 99px; font-size: 12px;
}

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: calc(100vh - 54px); }
.sidebar {
  width: 200px; flex: none; background: var(--card);
  border-right: 1px solid var(--line); padding: 16px 10px;
}
.sidebar button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 10px 12px; margin-bottom: 2px; border-radius: 8px; cursor: pointer;
  color: var(--ink); font-size: 14.5px; font-family: inherit;
}
.sidebar button:hover { background: var(--paper); }
.sidebar button.active { background: var(--gold-soft); color: #6e4f12; font-weight: 600; }
.content { flex: 1; padding: 22px 26px; max-width: 980px; }

.container { max-width: 760px; margin: 0 auto; padding: 22px 18px; }

/* ---------- 卡片/表格 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 16px;
}
.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat { text-align: left; }
.stat .num { font-size: 30px; font-weight: 700; color: var(--brand); }
.stat .label { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: none; }
tr:last-child td { border-bottom: 0; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); outline-offset: 0; border-color: var(--brand-soft); }
textarea { resize: vertical; min-height: 90px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 14px;
  font-family: inherit; font-weight: 550;
}
.btn:hover { background: var(--paper); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn.primary:hover { background: #a5762a; }
.btn.brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.brand:hover { background: var(--brand-soft); }
.btn.ghost { background: none; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 徽标/状态 ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.tag.green { background: #e3f1ea; color: var(--green); }
.tag.amber { background: #f6ecd4; color: var(--amber); }
.tag.slate { background: #eceef1; color: var(--slate); }
.tag.red { background: #f6e0da; color: var(--red); }
.tag.teal { background: #dcebe9; color: var(--brand); }

.muted { color: var(--muted); }
.hr { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; z-index: 50;
}
.toast.show { opacity: 1; }
.hidden { display: none !important; }

/* ---------- 背单词卡片（签名元素） ---------- */
.flashcard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 30px 26px; text-align: center; margin-bottom: 16px;
}
.flashcard .word { font-family: var(--serif); font-size: 42px; font-weight: 700; letter-spacing: .01em; }
.flashcard .phonetic { color: var(--gold); font-size: 17px; margin: 6px 0 2px; }
.flashcard .reveal {
  margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line);
  text-align: left; min-height: 60px;
}
.flashcard .reveal.blurred { filter: blur(6px); cursor: pointer; user-select: none; }
.flashcard .reveal p { margin: 4px 0; }
.flashcard .reveal .ex { color: var(--muted); font-style: italic; }
.cardbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.progressbar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progressbar > span { display: block; height: 100%; background: var(--green); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 30px 26px; }
.login-card .brand { color: var(--brand); justify-content: center; font-size: 20px; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.login-card .btn { width: 100%; margin-top: 16px; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin-top: 8px; }
.demo-hint { margin-top: 16px; font-size: 12.5px; color: var(--muted); background: var(--paper);
  border-radius: 8px; padding: 10px 12px; line-height: 1.7; }

.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.empty { text-align: center; color: var(--muted); padding: 30px; }

@media (max-width: 720px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-2 { grid-template-columns: 1fr; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar button { white-space: nowrap; width: auto; }
  .content { padding: 16px; }
}

/* 打印（用于导出 PDF：浏览器打印为 PDF） */
@media print {
  .topbar, .sidebar, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ccc; }
}
