:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --line: #e6e8f0;
  --line-soft: #eff1f7;
  --text: #1a1d29;
  --text-soft: #5b6072;
  --text-mute: #8b90a3;
  --accent: #4f46e5;
  --accent-soft: #eef0ff;
  --ok: #0f9d58;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 20, 40, .05), 0 8px 24px rgba(16, 20, 40, .06);
}

* { box-sizing: border-box; }

/* 关键：.loading/.empty/.notice 都设了 display，会盖掉 [hidden] 的浏览器默认样式，
   导致 hidden 属性失效、遮罩永远显示。这里强制 hidden 优先。 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- topbar ---------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #7c6cf5);
  color: #fff;
  display: grid; place-items: center;
  font-size: 19px; font-weight: 700;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .28);
}

.brand-text h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: .2px; }
.brand-text p { margin: 1px 0 0; font-size: 12px; color: var(--text-mute); }

.top-actions { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fafbff;
  color: var(--text-soft);
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.pill--ok { color: var(--ok); border-color: #cde9d9; background: #f2fbf6; }
.pill--warn { color: var(--warn); border-color: #f3e0bd; background: #fffaf0; }
.pill--danger { color: var(--danger); border-color: #f4cfcf; background: #fdf3f3; }
.pill--muted { color: var(--text-mute); }

/* ---------------- buttons ---------------- */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  background: #eef0f7;
  color: var(--text);
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: #e4e7f2; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #4338ca; }

.btn--ghost { background: transparent; border-color: var(--line); color: var(--text-soft); }
.btn--ghost:hover { background: #f3f4fa; color: var(--text); }

.iconbtn {
  border: 0; background: transparent; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--text-mute);
  padding: 2px 6px; border-radius: 6px;
}
.iconbtn:hover { background: #f1f2f8; color: var(--text); }

/* ---------------- tabs ---------------- */

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-soft);
  padding: 11px 14px 10px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------------- toolbar ---------------- */

.toolbar {
  padding: 16px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 5px 13px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: #c9cde0; color: var(--text); }
.chip.is-active {
  background: var(--accent-soft);
  border-color: #c7c9f7;
  color: var(--accent);
  font-weight: 600;
}
.chip .count { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.field { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.field--grow { flex: 1 1 220px; min-width: 200px; }
.field > span { font-size: 11.5px; color: var(--text-mute); padding-left: 2px; }

.field input {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field input:focus {
  border-color: #b9b8f2;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field input::placeholder { color: #b3b7c8; }

.filters-end { display: flex; gap: 8px; margin-left: auto; }

/* ---------------- notice ---------------- */

.notice {
  margin: 0 24px 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  border: 1px solid #f3e0bd;
  background: #fffaf0;
  color: #8a5a12;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.notice--error { border-color: #f4cfcf; background: #fdf3f3; color: #a12626; }

/* ---------------- table ---------------- */

.tablewrap {
  position: relative;
  margin: 0 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: calc(100vh - 300px);
  min-height: 260px;
}

table { width: 100%; border-collapse: separate; border-spacing: 0; }

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fbfcff;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th:hover { color: var(--accent); }
thead th .arrow { opacity: .35; font-size: 10px; margin-left: 3px; }
thead th.is-sorted .arrow { opacity: 1; color: var(--accent); }

tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  vertical-align: top;
  color: var(--text);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8f9ff; }

td.name { font-weight: 600; min-width: 180px; }
td.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; color: var(--text-soft); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.date { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.company { min-width: 200px; color: var(--text-soft); }
td.muted { color: var(--text-mute); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  background: #f0f1f7;
  color: #4a4f63;
}
.tag--p_tv { background: #eef2ff; color: #4338ca; }
.tag--p_short { background: #fdf2f8; color: #be185d; }
.tag--p_anim { background: #ecfdf5; color: #047857; }
.tag--p_movie_net { background: #fff7ed; color: #c2410c; }
.tag--p_movie_cin { background: #fef2f2; color: #b91c1c; }

.tag--f_regular { background: #eff6ff; color: #1d4ed8; }
.tag--f_mid { background: #f5f3ff; color: #6d28d9; }
.tag--f_short_series { background: #ecfeff; color: #0e7490; }
.tag--f_season { background: #f0fdfa; color: #0f766e; }
.tag--f_interactive { background: #fdf4ff; color: #a21caf; }
.tag--f_webfilm { background: #fffbeb; color: #b45309; }
.tag--f_short { background: #fdf2f8; color: #db2777; }
.tag--f_anim_tv { background: #f7fee7; color: #4d7c0f; }
.tag--f_anim_net { background: #ecfdf5; color: #047857; }
.tag--f_movie { background: #fef2f2; color: #b91c1c; }
.tag--f_movie_net { background: #fff7ed; color: #c2410c; }

.tag--p_other, .tag--f_other { background: #f0f1f7; color: #4a4f63; }
.tag--filing { background: #f1f5f9; color: #475569; }
.tag--publicity { background: #eef2ff; color: #4338ca; }

/* ---------------- states ---------------- */

.empty, .loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--text-mute);
  background: rgba(255, 255, 255, .82);
  font-size: 13px;
}
.empty-icon { font-size: 30px; opacity: .55; }
.empty p { margin: 0; }

/* 加载遮罩只做视觉提示，绝不能挡住点击（万一状态没同步也不会卡死页面） */
.loading { pointer-events: none; background: rgba(255, 255, 255, .72); }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid #d9dcec;
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
  margin-right: 6px;
  vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- pager ---------------- */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px 28px;
  flex-wrap: wrap;
}
.summary { font-size: 12.5px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.pager-btns { display: flex; align-items: center; gap: 8px; }
.pageinfo { font-size: 12.5px; color: var(--text-soft); min-width: 68px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------------- 访问口令 ---------------- */

.gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #f5f7ff 0%, #eef1fa 55%, #f7f8fc 100%);
  padding: 20px;
}
.gate-card {
  width: min(340px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(16, 20, 40, .10);
}
.gate-logo {
  width: 46px; height: 46px;
  margin: 0 auto 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #fff; font-size: 22px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.gate-card h2 { margin: 0 0 6px; font-size: 17px; }
.gate-sub { margin: 0 0 18px; font-size: 12.5px; color: var(--text-mute); }
.gate-card input {
  width: 100%; height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  letter-spacing: .12em;
  text-align: center;
  outline: none;
}
.gate-card input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}
.gate-btn { width: 100%; height: 42px; margin-top: 14px; justify-content: center; }
.gate-err { margin: 10px 0 0; font-size: 12.5px; color: #dc2626; }

/* ---------------- 页脚 ---------------- */

.site-foot {
  padding: 4px 24px 30px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.9;
}
.site-foot p { margin: 0; }
.foot-brand { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }

/* ---------------- 微信登录弹窗 ---------------- */

.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(16, 20, 40, .42);
  padding: 20px;
}
.modal-card {
  position: relative;
  width: min(360px, 100%);
  background: var(--surface);
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(16, 20, 40, .24);
  text-align: center;
}
.modal-x {
  position: absolute; top: 8px; right: 10px;
  border: 0; background: transparent;
  font-size: 24px; line-height: 1;
  color: var(--text-mute); cursor: pointer;
}
.modal-card h2 { margin: 0 0 6px; font-size: 17px; }
.modal-sub { margin: 0 0 16px; font-size: 12.5px; color: var(--text-mute); line-height: 1.5; }

.qrbox {
  position: relative;
  width: 208px; height: 208px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.qrbox img { width: 100%; height: 100%; object-fit: contain; display: block; }
.qr-mask {
  position: absolute; inset: 0;
  background: rgba(255, 255, 255, .93);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  font-size: 13px; color: var(--text-soft);
}
.modal-tip { margin: 14px 0 0; font-size: 13px; color: var(--text-soft); min-height: 20px; }

/* ---------------- responsive ---------------- */

@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; padding: 12px 14px; }
  .tabs { padding: 0 14px; overflow-x: auto; }
  .toolbar { padding: 12px 14px 8px; }
  .tablewrap { margin: 0 14px; max-height: calc(100vh - 340px); }
  .notice { margin: 0 14px 10px; }
  .pager { padding: 12px 14px 24px; }
  .filters-end { margin-left: 0; width: 100%; }
  .filters-end .btn { flex: 1; }
  thead th, tbody td { padding: 8px 9px; }
}
