/* ========== 基础 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --primary-3: #a855f7;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(17, 24, 39, .08);
  --sidebar-w: 236px;
  font-size: 16px;
}

html { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
}

a { color: var(--primary); text-decoration: none; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9cede; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.btn svg { flex: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(99, 102, 241, .35);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(99, 102, 241, .45); }

.btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); background: #f5f6ff; }

.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #fef2f2; }

.btn-sm { padding: 6px 12px; border-radius: 8px; font-size: 13px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; border-radius: 12px; }

.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13.5px; font-family: inherit; padding: 4px 6px; border-radius: 6px; }
.link-btn:hover { background: #eef0ff; }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: #fef2f2; }

.lang-switch {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: .18s;
}
.lang-switch:hover { background: rgba(255, 255, 255, .22); }
.lang-switch.dark { background: #fff; border-color: var(--border); color: var(--text); }
.lang-switch.dark:hover { border-color: var(--primary); color: var(--primary); }

/* ========== 表单 ========== */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 7px;
}
.field label .opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.field label .req { color: var(--danger); margin-left: 3px; }

.input, .field input, .field textarea, .field select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.field input:focus, .field textarea:focus, .field select:focus, .input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px rgba(99, 102, 241, .13);
}
.field textarea { min-height: 84px; resize: vertical; }

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(5px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  overflow-y: auto;
  padding: 6vh 16px 4vh;
}
.modal-mask.show { display: flex; }

.modal {
  width: min(560px, 100%);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .3);
  animation: pop .25s ease;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close {
  background: #f3f4f6;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
}
.modal-close:hover { background: #e5e7eb; color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 4px 24px 22px;
}
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ========== 表格 ========== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: .02em;
}
td { padding: 13px 16px; border-bottom: 1px solid #f1f3f8; font-size: 14px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: #f8f9ff; }
tbody tr:last-child td { border-bottom: none; }
.td-actions { white-space: nowrap; }
.td-desc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.td-muted { color: var(--muted); font-size: 13px; white-space: nowrap; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.on { background: #ecfdf5; color: #059669; }
.badge.off { background: #f3f4f6; color: #9ca3af; }
.badge.role { background: #eef2ff; color: #4f46e5; }
.badge.video { background: #fef3c7; color: #b45309; margin-right: 6px; }

/* ========== 分页 ========== */
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--muted);
}
.pager .btn { padding: 6px 14px; }
.pager-info b { color: var(--text); }

/* ========== Toast ========== */
.toast-wrap {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: #111827;
  color: #fff;
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
  animation: pop .25s ease;
  max-width: 82vw;
}
.toast.success { background: linear-gradient(135deg, #059669, #10b981); }
.toast.error { background: linear-gradient(135deg, #dc2626, #f43f5e); }

/* ========== 进度条 ========== */
.progress {
  height: 9px;
  background: #eef0f6;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
  display: none;
}
.progress.show { display: block; }
.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--grad);
  border-radius: 999px;
  transition: width .2s ease;
}
.progress-text { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: none; }
.progress-text.show { display: block; }

/* ========== 文件选择区 ========== */
.file-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1.5px dashed #c7cbe0;
  border-radius: 12px;
  padding: 14px 16px;
  transition: .18s;
  cursor: pointer;
  background: #fafbff;
}
.file-pick:hover { border-color: var(--primary); background: #f5f6ff; }
.file-pick .fp-icon { color: var(--primary); flex: none; }
.file-pick .fp-text { font-size: 14px; color: var(--muted); }
.file-pick.has-file .fp-text { color: var(--text); font-weight: 500; }

/* ========== 登录页 ========== */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e1b4b, #312e81 45%, #4c1d95);
  position: relative;
  overflow: hidden;
  padding: 24px;
}
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; }
.blob-1 { width: 440px; height: 440px; background: #6366f1; top: -140px; left: -120px; animation: float 14s ease-in-out infinite; }
.blob-2 { width: 380px; height: 380px; background: #a855f7; bottom: -140px; right: -100px; animation: float 18s ease-in-out infinite reverse; }
.blob-3 { width: 260px; height: 260px; background: #ec4899; top: 55%; left: 60%; animation: float 16s ease-in-out infinite; opacity: .35; }
@keyframes float { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(44px) scale(1.08); } }

.auth-card {
  position: relative;
  z-index: 1;
  width: min(430px, 94vw);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 44px 40px 38px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .35);
  animation: pop .4s ease;
}
.auth-top { display: flex; justify-content: flex-end; margin: -44px -40px 26px 0; padding: 16px 20px 0; }

.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth-logo {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--grad);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 12px 28px rgba(99, 102, 241, .45);
}
.auth-brand h1 { font-size: 21px; font-weight: 800; letter-spacing: .02em; }
.auth-brand p { font-size: 13.5px; color: var(--muted); margin-top: -8px; }

.auth-error {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
}
.auth-error.show { display: block; }
.auth-tip { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 20px; }

/* ========== 后台布局 ========== */
.layout { min-height: 100vh; }

.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #171a33 0%, #101223 100%);
  color: #c7cbe8;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; color: #fff; font-weight: 700; font-size: 16.5px; padding: 2px 10px 24px; }
.brand-logo {
  width: 36px; height: 36px;
  border-radius: 11px;
  background: var(--grad);
  display: grid; place-items: center;
  color: #fff;
  flex: none;
  box-shadow: 0 6px 16px rgba(99, 102, 241, .45);
}
.nav { flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 11px;
  border: none;
  background: none;
  color: #a9aed2;
  font-size: 14.5px;
  font-family: inherit;
  cursor: pointer;
  transition: .18s;
  text-align: left;
  margin-bottom: 6px;
}
.nav-item svg { flex: none; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(99, 102, 241, .95), rgba(168, 85, 247, .95));
  box-shadow: 0 8px 20px rgba(99, 102, 241, .35);
}
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 14px; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 11px;
  margin-bottom: 8px;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  display: grid; place-items: center;
  font-size: 14px;
  font-weight: 700;
  flex: none;
}
.sidebar-user .su-name { color: #fff; font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.sidebar-user .su-role { color: #8b90b5; font-size: 11.5px; }
.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 11px;
  background: none;
  color: #a9aed2;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: .18s;
}
.logout-btn:hover { color: #fca5a5; background: rgba(239, 68, 68, .1); }
.sidebar .lang-wrap { padding: 0 12px 10px; }
.sidebar .lang-switch { width: 100%; justify-content: center; display: inline-flex; background: rgba(255, 255, 255, .08); }

.main { margin-left: var(--sidebar-w); padding: 26px 30px 40px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h2 { font-size: 21px; font-weight: 800; }
.page-head .sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.search-box { position: relative; }
.search-box input {
  width: 240px;
  padding: 9px 13px 9px 36px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: .18s;
  background: #fff;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3.5px rgba(99, 102, 241, .13); }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* ========== 时间轴页 ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 24px;
  gap: 12px;
}
.topbar .brand { padding: 0; font-size: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar .lang-switch { background: #fff; border-color: var(--border); color: var(--text); }
.topbar .lang-switch:hover { border-color: var(--primary); color: var(--primary); }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f6ff;
  border: 1px solid #e0e3ff;
  padding: 5px 14px 5px 6px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: #3730a3;
}
.user-chip .avatar { width: 26px; height: 26px; font-size: 12px; }
.topbar .logout-btn { width: auto; color: var(--muted); padding: 8px 10px; }
.topbar .logout-btn:hover { background: #fef2f2; color: var(--danger); }

.hero { text-align: center; padding: 64px 20px 30px; }
.hero h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: .01em;
}
.hero p { color: var(--muted); font-size: 15px; margin-top: 12px; }
.hero-line { width: 64px; height: 4px; border-radius: 4px; background: var(--grad); margin: 22px auto 0; }

.timeline { position: relative; max-width: 940px; margin: 0 auto; padding: 26px 0 80px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(99, 102, 241, .55), rgba(168, 85, 247, .2));
}
.tl-item { position: relative; width: 50%; padding: 0 46px 42px 0; }
.tl-item:nth-child(even) { left: 50%; padding: 0 0 42px 46px; }
.tl-dot {
  position: absolute;
  top: 24px;
  right: -8px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 3.5px solid var(--primary);
  box-shadow: 0 0 0 5px rgba(99, 102, 241, .14);
  z-index: 1;
}
.tl-item:nth-child(even) .tl-dot { right: auto; left: -8px; }

.tl-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}
.tl-card:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(17, 24, 39, .13); }
.tl-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  background: #eef2ff;
  border: 1px solid #e0e3ff;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.tl-date .tz-tag {
  font-style: normal;
  font-weight: 700;
  font-size: 11.5px;
  padding-right: 6px;
  margin-right: 2px;
  border-right: 1px solid rgba(99, 102, 241, .35);
}
.tl-date.tz-sub {
  color: #b45309;
  background: #fef3e2;
  border-color: #fde2c0;
  margin-top: -6px;
}
.tl-date.tz-sub .tz-tag { border-right-color: rgba(180, 83, 9, .35); }
.tl-card h3 { font-size: 17.5px; font-weight: 700; margin-bottom: 8px; }
.tl-card .tl-desc { font-size: 14px; color: var(--muted); line-height: 1.7; margin-bottom: 14px; }
.tl-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
  flex-wrap: wrap;
}
.tl-file { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.tl-file .fname { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-btns { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.tl-empty { text-align: center; padding: 90px 20px 120px; color: var(--muted); }
.tl-empty svg { color: #c3c8dd; margin-bottom: 18px; }
.tl-empty p { font-size: 15px; }

/* ========== 其他 ========== */
.empty-row { text-align: center; color: var(--muted); padding: 46px 0 !important; font-size: 14px; }
.batch-result { max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 4px; }
.batch-result table td { padding: 8px 14px; font-size: 13.5px; font-family: ui-monospace, Consolas, monospace; }
.batch-result table td:last-child { text-align: right; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* 弹窗内静态文本行 */
.static-text {
  font-size: 14px;
  color: var(--text);
  background: #fafbfe;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  word-break: break-all;
}

/* 危险的幽灵按钮（移除视频等） */
.btn-ghost.danger { color: #dc2626; border-color: #fecaca; }
.btn-ghost.danger:hover:not(:disabled) { border-color: #dc2626; color: #dc2626; background: #fef2f2; }

/* 角色-资料勾选列表 */
.file-check-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  background: #fafbfe;
}
.file-check-list .fc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s;
}
.file-check-list .fc-item:hover { background: #eef2ff; }
.file-check-list .fc-item input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; flex: none; }
.file-check-list .fc-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.file-check-list .fc-sub { font-size: 12px; color: var(--muted); margin-left: auto; padding-left: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }

@media (max-width: 860px) {
  :root { --sidebar-w: 200px; }
  .main { padding: 20px 16px 32px; }
  .timeline::before { left: 16px; }
  .tl-item, .tl-item:nth-child(even) { width: 100%; left: 0; padding: 0 0 32px 44px; }
  .tl-dot, .tl-item:nth-child(even) .tl-dot { left: 9px; right: auto; }
  .tl-file .fname { max-width: 160px; }
}
