:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --ink: #1b1f24;
  --ink-2: #5b6672;
  --ink-3: #8d97a3;
  --line: #e4e8ee;
  --accent: #c8442e;
  --accent-dark: #a93623;
  --green: #157a4b;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

/* hidden 属性必须压过 .login-wrap/.drawer-mask 上的 display:flex */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 500px at 50% -10%, #fdeeea, transparent 70%), var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 32px 28px 24px;
}

.login-card h1 { margin: 0; font-size: 21px; letter-spacing: .02em; }
.login-card .sub { margin: 6px 0 22px; color: var(--ink-3); font-size: 13px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--ink-2); }
.login-card input {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  background: #fbfcfd;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200, 68, 46, .12);
}

/* ---------- 通用控件 ---------- */
.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 16px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  transition: background .15s, border-color .15s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.ghost { border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: #cfd6de; background: #fafbfc; }
.btn.block { width: 100%; margin-top: 6px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.err { color: var(--accent); font-size: 13px; min-height: 18px; margin: 8px 0 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.brand strong { display: block; font-size: 15px; }
.brand small { color: var(--ink-3); font-size: 12px; }
.topbar-actions { display: flex; gap: 8px; }

/* ---------- 列表 ---------- */
.wrap { max-width: 880px; margin: 0 auto; padding: 22px 20px 80px; }
.hint {
  background: #fff8f5;
  border: 1px solid #f6ded6;
  color: #8a4a3a;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.list { display: flex; flex-direction: column; gap: 10px; }

.row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.row-main { flex: 1; min-width: 0; }
.row-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  word-break: break-word;
}
.row-zh {
  color: var(--ink-2);
  font-size: 13px;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 11.5px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 8px;
  background: #fbfcfd;
}
.badge {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 500;
}
.badge.draft { background: #f1f3f6; color: #6b7784; }
.badge.live { background: #e7f5ee; color: var(--green); }
.badge.audio { background: #eef4ff; color: #2f5fd0; }

.row-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.row-actions .group { display: flex; gap: 6px; }

.icon-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-2);
  width: 30px; height: 30px;
  border-radius: 8px;
  line-height: 1;
  display: grid; place-items: center;
  font-size: 14px;
}
.icon-btn:hover { background: #fafbfc; border-color: #cfd6de; }
.icon-btn:disabled { opacity: .4; cursor: default; }

.empty { text-align: center; color: var(--ink-3); padding: 60px 0; }

/* ---------- 抽屉 ---------- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 22, 30, .38);
  display: flex;
  justify-content: flex-end;
  z-index: 50;
  animation: fade .16s ease-out;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes slide { from { transform: translateX(24px); opacity: .6 } to { transform: none; opacity: 1 } }

.drawer {
  width: min(620px, 100%);
  height: 100%;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(16, 24, 40, .18);
  animation: slide .18s ease-out;
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #fcfdfe;
}
.drawer-foot .err { flex: 1; margin: 0; }

.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.req { color: var(--accent); }

input[type=text], textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  font-size: 15px;
  background: #fbfcfd;
  outline: none;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
textarea { line-height: 1.7; }
input[type=text]:focus, textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200, 68, 46, .1);
}
.counter { text-align: right; font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.audio-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-btn { position: relative; overflow: hidden; }
.audio-name { font-size: 13px; color: var(--ink-3); word-break: break-all; }
#ed-audio-player { width: 100%; margin-top: 10px; height: 36px; }

.upload-bar {
  height: 4px;
  background: #eef0f4;
  border-radius: 99px;
  margin-top: 10px;
  overflow: hidden;
}
.upload-bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--ink-2);
  position: relative;
}
.tabs button.on { border-color: var(--accent); color: var(--accent); background: #fff5f2; font-weight: 500; }
.tabs button.filled::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button {
  border: 0;
  background: #fff;
  padding: 7px 18px;
  font-size: 14px;
  color: var(--ink-2);
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: #1b1f24;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  z-index: 99;
}

@media (max-width: 560px) {
  .topbar { padding: 10px 14px; }
  .wrap { padding: 16px 12px 72px; }
  .row { flex-direction: column; }
  .row-actions { flex-direction: row; align-items: center; width: 100%; justify-content: flex-end; }
  .drawer-body { padding: 14px; }
}
