/* 授权内容阅读台 —— 共享样式（前台 + 后台） */

:root {
  --bg: #f4f6fb;
  --bg-soft: #eef1f8;
  --card: #ffffff;
  --ink: #0f172a;
  --text: #1e293b;
  --muted: #64748b;
  --hint: #94a3b8;
  --line: #e6eaf2;
  --line-soft: #f1f4f9;

  --brand: #2f5fe0;
  --brand-dark: #2450c8;
  --brand-soft: #eef3fe;
  --violet: #7c5cf0;
  --cyan: #0e9aa7;

  --ok: #0f9d58;
  --ok-soft: #e9f8ef;
  --warn: #b45309;
  --warn-soft: #fdf4e3;
  --err: #dc2626;
  --err-soft: #fdecec;

  --radius: 14px;
  --radius-sm: 10px;
  --page: 1200px;
  --side-w: 216px;      /* 后台左侧导航宽度 */
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px -14px rgba(16, 24, 40, .16);
  --shadow-lg: 0 24px 60px -24px rgba(16, 24, 40, .28);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- 顶栏 */

.top {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.top-inner {
  max-width: var(--page);
  margin: 0 auto;
  min-height: 60px;
  padding: 0 clamp(16px, 3vw, 32px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; color: var(--ink); }
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
}

.top-right { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-soft); color: var(--brand);
  border: 1px solid #dbe6fd; border-radius: 999px;
  padding: 5px 12px 5px 10px; font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(15, 157, 88, .16); }
.pill.warn { background: var(--warn-soft); border-color: #f5e2c0; color: var(--warn); }
.pill.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(180, 83, 9, .16); }
.pill.err { background: var(--err-soft); border-color: #f7d4d4; color: var(--err); }
.pill.err .dot { background: var(--err); box-shadow: 0 0 0 3px rgba(220, 38, 38, .16); }

/* ---------------------------------------------------------------- 布局 */

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(16px, 2.4vw, 28px) clamp(16px, 3vw, 32px) 72px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card.flush { padding: 0; overflow: hidden; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title { font-size: 16px; font-weight: 650; color: var(--ink); margin: 0; display: flex; align-items: center; gap: 8px; }
.card-sub { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
/* 卡片标题右侧并排的按钮组（如「查看全部 + 刷新」），避免 space-between 把两个按钮拆到两边 */
.head-act { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

h1 { font-size: 22px; margin: 0 0 8px; font-weight: 700; color: var(--ink); letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 0 0 14px; font-weight: 650; color: var(--ink); }
h3 { font-size: 14px; margin: 20px 0 10px; font-weight: 650; color: var(--ink); }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; margin-top: 18px; }
.col-left { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.col-right { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 78px; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .grow { flex: 1 1 auto; min-width: 0; }
.row.end { align-items: flex-end; }

/* ---------------------------------------------------------------- Hero + 权益卡 */

.hero {
  border-radius: var(--radius);
  padding: clamp(20px, 2.6vw, 30px);
  background: linear-gradient(125deg, #23357a 0%, #3355c9 45%, #6d54e8 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero::after {
  content: ""; position: absolute; right: -80px; top: -120px; width: 340px; height: 340px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 68%);
}
.hero-inner { position: relative; display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-end; }
.hero h1 { color: #fff; font-size: clamp(21px, 2.4vw, 27px); margin-bottom: 10px; }
.hero p { margin: 0; color: rgba(255, 255, 255, .82); font-size: 13.5px; max-width: 620px; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hero-tags .tag {
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22);
  color: #fff; border-radius: 999px; padding: 4px 11px; font-size: 12px;
}

.rights { margin-top: 18px; }
.rights-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile {
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-width: 0;
}
.tile-k { font-size: 12px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.tile-v { font-size: 21px; font-weight: 700; color: var(--ink); line-height: 1.25; font-variant-numeric: tabular-nums; word-break: break-word; }
.tile-v small { font-size: 12.5px; font-weight: 500; color: var(--hint); }
.tile-hint { font-size: 11.5px; color: var(--hint); margin-top: 5px; }
.tile.primary { background: linear-gradient(135deg, #eef3fe, #f4f0ff); border-color: #dce5fb; }
.tile.primary .tile-v { color: var(--brand); }
.tile.tight .tile-v { font-size: 17px; }

.countdown { font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.countdown.urgent { color: var(--err); }
.countdown.soon { color: var(--warn); }

.card-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3);
  color: #fff; border-radius: 12px; padding: 10px 16px;
  font-size: 15px; font-weight: 650; backdrop-filter: blur(4px);
}
.card-badge .k { font-size: 11.5px; font-weight: 500; opacity: .8; display: block; }

/* ---------------------------------------------------------------- 表单与按钮 */

label { display: block; font-size: 12.5px; color: var(--muted); margin: 0 0 6px; font-weight: 500; }

input, textarea, select {
  width: 100%; padding: 10px 13px;
  border: 1px solid #dbe0ea; border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 95, 224, .12); }
input::placeholder, textarea::placeholder { color: var(--hint); }
input.mono, textarea.mono { font-family: var(--mono); font-size: 13px; }
textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
.field { margin-bottom: 14px; }

.input-group { display: flex; gap: 10px; align-items: stretch; }
.input-group input { flex: 1 1 auto; min-width: 0; }
/* 下拉也要占满剩余宽度，否则「登录凭据」那一行只显示半截 */
.input-group select { flex: 1 1 auto; min-width: 0; }

button {
  padding: 10px 18px; font-size: 13.5px; font-family: inherit; font-weight: 550;
  border: 1px solid #dbe0ea; border-radius: var(--radius-sm);
  background: #fff; color: var(--text); cursor: pointer;
  white-space: nowrap; transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
/* 只有「白底默认按钮」hover 才换浅底。
   带品牌底色的变体（primary / soft / danger / link）必须排除在外：
   `button:hover:not(:disabled)` 比 `button.primary` 更具体，会把它原本的渐变底
   盖成近白色，而文字还是 #fff —— 看着就是「按钮 hover 上去变白了」。 */
button:hover:not(:disabled):not(.primary):not(.soft):not(.danger):not(.link) {
  border-color: #c3cbdb; background: #fbfcfe;
}
button:disabled { opacity: .55; cursor: not-allowed; }

button.primary {
  background: linear-gradient(135deg, var(--brand), var(--violet));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px -8px rgba(47, 95, 224, .8);
}
/* 这里显式写回 background：本选择器比上面那条更具体，hover 时底色不会被顶掉 */
button.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--brand), var(--violet));
  border-color: transparent; filter: brightness(1.07);
}
button.lg { padding: 12px 26px; font-size: 14.5px; border-radius: 12px; }
button.block { width: 100%; }
button.soft { background: var(--brand-soft); border-color: #dbe6fd; color: var(--brand); }
button.soft:hover:not(:disabled) { background: #e4ecfd; }
button.ghost { background: transparent; }
button.danger { color: var(--err); border-color: #f3cfcf; background: #fff; }
button.danger:hover:not(:disabled) { background: var(--err-soft); }
button.tiny { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
button.link { border: none; background: none; color: var(--brand); padding: 4px 6px; }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  animation: spin .7s linear infinite; flex: 0 0 auto;
}
.spinner.dark { border-color: rgba(47, 95, 224, .3); border-top-color: var(--brand); }
@keyframes spin { to { transform: rotate(360deg); } }

.hint { font-size: 12.5px; color: var(--hint); margin: 10px 0 0; line-height: 1.7; }

.msg { border-radius: var(--radius-sm); padding: 11px 14px; font-size: 13px; margin-top: 14px; display: none; line-height: 1.7; }
.msg.show { display: block; }
.msg.ok { background: var(--ok-soft); color: #0b7a45; }
.msg.err { background: var(--err-soft); color: var(--err); }
.msg.info { background: var(--brand-soft); color: var(--brand-dark); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 550;
  background: var(--brand-soft); color: var(--brand);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.off { background: #f1f3f7; color: var(--muted); }
.chip.err { background: var(--err-soft); color: var(--err); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.tiny { font-size: 11px; padding: 2px 7px; }

/* ---------------------------------------------------------------- 进度条 */

.progress { margin-top: 16px; display: none; }
.progress.show { display: block; }
.progress-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; margin-bottom: 7px; gap: 10px; }
.progress-stage { color: var(--brand); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.progress-pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.progress-track {
  height: 8px; border-radius: 999px; background: var(--line-soft);
  overflow: hidden; position: relative; border: 1px solid var(--line);
}
.progress-fill {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--violet));
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
  position: relative; overflow: hidden;
}
.progress-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: shimmer 1.4s linear infinite;
}
.progress-fill.done::after { display: none; }
.progress-fill.failed { background: linear-gradient(90deg, #ef4444, #f87171); }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.progress-steps { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.step {
  font-size: 11.5px; color: var(--hint); background: var(--line-soft);
  border-radius: 999px; padding: 3px 10px; border: 1px solid var(--line);
}
.step.on { background: var(--brand-soft); color: var(--brand); border-color: #dbe6fd; font-weight: 600; }
.step.done { background: var(--ok-soft); color: var(--ok); border-color: #d3efdf; }

/* ---------------------------------------------------------------- 最近阅读 */

.recent { display: flex; flex-direction: column; }
.recent-item {
  padding: 15px 4px; border-bottom: 1px solid var(--line-soft);
  display: grid; grid-template-columns: 1fr auto; gap: 10px 16px;
}
.recent-item:last-child { border-bottom: none; }
.recent-item.is-new { animation: flashIn .9s ease; }
@keyframes flashIn { from { background: #f2f7ff; } to { background: transparent; } }
.recent-main { min-width: 0; }
.recent-title {
  font-size: 14.5px; font-weight: 600; color: var(--ink);
  margin: 0 0 5px; line-height: 1.5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.recent-title.pending { color: var(--muted); font-weight: 550; }
.recent-url {
  font-family: var(--mono); font-size: 11.5px; color: var(--hint);
  word-break: break-all; line-height: 1.55;
}
.recent-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.recent-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.recent-bar { grid-column: 1 / -1; margin-top: 4px; }

.skeleton {
  height: 14px; border-radius: 6px; margin: 7px 0;
  background: linear-gradient(90deg, #eef1f7 25%, #f6f8fc 37%, #eef1f7 63%);
  background-size: 400% 100%; animation: sk 1.3s ease infinite;
}
@keyframes sk { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

.empty { text-align: center; color: var(--hint); padding: 46px 12px; font-size: 13.5px; line-height: 1.9; }
.empty strong { color: var(--muted); display: block; margin-bottom: 6px; font-size: 14px; }

/* ---------------------------------------------------------------- 阅读视图 */

.view[hidden] { display: none; }

.reader-view { display: flex; flex-direction: column; min-height: 100vh; }

.reader-toolbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 60px; z-index: 30;
}
.reader-toolbar-inner {
  max-width: var(--page); margin: 0 auto;
  padding: 10px clamp(16px, 3vw, 32px);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.reader-toolbar .title {
  flex: 1 1 260px; min-width: 0; font-size: 14px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.reader-meta-bar {
  background: var(--brand-soft); border-bottom: 1px solid #dbe6fd;
  font-size: 12px; color: var(--brand-dark);
}
.reader-meta-bar .in {
  max-width: var(--page); margin: 0 auto; padding: 8px clamp(16px, 3vw, 32px);
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
}
.reader-frame {
  flex: 1 1 auto; background: #fff;
  max-width: var(--page); width: 100%; margin: 0 auto;
  border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
}
.reader-frame iframe { display: block; width: 100%; border: 0; height: 76vh; background: #fff; }
.reader-frame.full iframe { height: calc(100vh - 190px); }

.reader-loading { padding: 60px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* 阅读态：整页就是这篇文章本身（和直接打开阅读页一样）。
   顶栏、阅读工具栏、说明条全部隐去，只在最右上角留一枚剩余时间提示。 */
body.reading { background: #fff; }
body.reading .top { display: none; }
body.reading .reader-toolbar,
body.reading .reader-meta-bar { display: none; }
body.reading .reader-view { min-height: 100vh; }
body.reading .reader-frame { max-width: none; border: 0; border-radius: 0; }
body.reading .reader-frame iframe { height: 100vh; }

.read-badge {
  position: fixed; right: 12px; top: 12px; z-index: 60;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px 5px 12px; white-space: nowrap;
  font: 12px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #334155;
  background: rgba(255, 255, 255, .93);
  border: 1px solid rgba(148, 163, 184, .55);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .12);
}
.read-badge[hidden] { display: none; }
.read-badge .t { color: #64748b; }
.read-badge .v { font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.read-badge.over .v { color: #dc2626; }
.read-badge .x {
  width: 20px; height: 20px; padding: 0; display: grid; place-items: center;
  font-size: 13px; line-height: 1; color: #94a3b8; cursor: pointer;
  background: transparent; border: 0; border-radius: 50%;
}
.read-badge .x:hover { background: #f1f5f9; color: #475569; }

/* ---------------------------------------------------------------- 侧栏小卡 */

.side-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.side-card h3 { margin: 0 0 12px; font-size: 13.5px; font-weight: 650; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.side-card .kv { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.side-card .kv:last-child { border-bottom: none; }
.side-card .kv .k { color: var(--muted); flex: 0 0 auto; }
.side-card .kv .v { color: var(--text); font-weight: 550; text-align: right; word-break: break-all; font-variant-numeric: tabular-nums; }
.side-card ol, .side-card ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--muted); line-height: 1.9; }
.side-card li + li { margin-top: 2px; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.bar-row .lab { flex: 0 0 74px; color: var(--muted); }
.bar-track { flex: 1 1 auto; height: 7px; background: var(--line-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--violet)); border-radius: 999px; }
.bar-row .num { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- 弹窗 */

.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, .48);
  display: none; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal.show { display: flex; }
.modal-card {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 470px; max-height: 88vh; overflow: auto;
  animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 22px 22px; }
.modal-close { border: none; background: none; font-size: 20px; color: var(--hint); cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-close:hover { color: var(--text); }

/* 通用提示弹窗的正文：一句话说错在哪，下面一条底色块说该怎么办。
   分开是有意的 —— 混成一段，读者只会记住「出错了」。 */
.tip-text { margin: 0; font-size: 14px; line-height: 1.75; color: var(--text); }
.tip-sub {
  margin: 14px 0 0; padding: 11px 13px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand-dark);
  font-size: 13px; line-height: 1.75;
}
.tip-act { margin-top: 18px; display: flex; justify-content: flex-end; }

/* ---------------------------------------------------------------- 提示条 */

.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, 92vw); }
.toast {
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 10px; padding: 12px 15px; font-size: 13px; box-shadow: var(--shadow-lg);
  animation: slideIn .22s ease; line-height: 1.6;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast b { display: block; margin-bottom: 3px; color: var(--ink); }
.toast.fade { opacity: 0; transform: translateX(12px); transition: all .3s; }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 表格 / 后台 */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 10px 16px; font-size: 13.5px; cursor: pointer;
  border: none; background: none; border-bottom: 2px solid transparent;
  color: var(--muted); border-radius: 0; white-space: nowrap; font-weight: 550;
}
.tab:hover { color: var(--text); background: none; border-color: transparent; }
.tab.on { color: var(--brand); border-bottom-color: var(--brand); font-weight: 650; }

.panel { display: none; }
.panel.on { display: block; }

/* 后台列表里的来源地址：做成可点链接，但不抢眼（表格里到处都是），
   长链接要能在窄列里折行，不然会把整张表撑破。 */
.ext-link { color: var(--brand); text-decoration: none; word-break: break-all; }
.ext-link:hover { text-decoration: underline; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfe; white-space: nowrap; }
tbody tr:hover { background: #fafbfe; }
td.mono, th.mono { font-family: var(--mono); font-size: 12px; }
td.actions { white-space: nowrap; }
td.actions button { margin-right: 5px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.table-wrap table { min-width: 640px; }

/* 解析任务表（概览卡片的「最近的解析任务」+ 解析记录全量列表）的列宽计划。
   不给列定宽时，浏览器会把剩余空间全给进度列，进度条就成了一条横贯整行的长条，
   而标题列被挤到只剩一小截。这里把「标题 / 链接」定成一半宽度，其余列按内容定宽，
   进度条另外加 max-width 兜底，免得窗口一宽又跟着拉长。 */
.table-wrap.jobs-overview table { min-width: 820px; }
.table-wrap.jobs-full table { min-width: 1000px; }
.jobs-table th.c-time,   .jobs-table td.c-time   { width: 116px; }
.jobs-table th.c-key,    .jobs-table td.c-key    { width: 160px; }
.jobs-table th.c-title,  .jobs-table td.c-title  { width: 50%; }
.jobs-table th.c-status, .jobs-table td.c-status { width: 82px; }
.jobs-table th.c-prog,   .jobs-table td.c-prog   { width: 178px; }
.jobs-table th.c-ms,     .jobs-table td.c-ms     { width: 64px; }
.jobs-table .progress-track { max-width: 160px; }
/* 进度格下面那行「阶段 · 失败原因」默认继承 td 的 nowrap：
   一段 60 字的失败原因会把整列顶到 700px 宽，进度条反而成了背景板。
   这里允许折行并最多显示两行，完整文案走 title。 */
body.admin td.c-prog .cellsub {
  white-space: normal; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; max-width: 160px;
}
/* 标题格是宽文本，不受 .wrapcell 那条 360px 上限的约束 */
body.admin td.c-title.wrapcell { max-width: none; }
/* 全量列表多一列「说明」：标题让出一点，保证整句失败原因还有地方放 */
.jobs-full th.c-title, .jobs-full td.c-title { width: 40%; }
.jobs-full th.c-msg,   .jobs-full td.c-msg   { min-width: 220px; }

/* 访问记录表：同样把「链接」定成一半宽度——之前它被 .wrapcell 的 360px 上限
   卡着，再加上单元格里预先截断成 44 字，长链接根本看不出是哪篇文章。
   其余列按内容定宽，「说明」给一个下限，免得整句被挤扁。 */
.table-wrap.logs-table table { min-width: 1000px; }
.logs-table th.c-time,  .logs-table td.c-time  { width: 152px; }
.logs-table th.c-key,   .logs-table td.c-key   { width: 158px; }
.logs-table th.c-act,   .logs-table td.c-act   { width: 78px; }
.logs-table th.c-url,   .logs-table td.c-url   { width: 45%; }
.logs-table th.c-ip,    .logs-table td.c-ip    { width: 112px; }
.logs-table th.c-res,   .logs-table td.c-res   { width: 78px; }
.logs-table th.c-note,  .logs-table td.c-note  { min-width: 160px; }
.logs-table th.c-left,  .logs-table td.c-left  { width: 62px; }
body.admin td.c-url.wrapcell { max-width: none; }

/* 凭据保险箱：加了「有效性」列后列数变多，给表格一个下限，
   窄屏宁可横向滚动，也不要把每列挤成一列一个字 */
.table-wrap.vault-table table { min-width: 980px; }
.vault-table th.c-chk, .vault-table td.c-chk { width: 96px; white-space: nowrap; }

/* 批量勾选列（下载管理等带多选的表格）：固定窄列，表头与行的复选框对齐 */
th.pick, td.pick { width: 38px; text-align: center; padding-left: 0; padding-right: 0; }
th.pick input[type="checkbox"], td.pick input[type="checkbox"] {
  width: auto; margin: 0; vertical-align: middle; cursor: pointer;
}

/* 解析记录的「说明」是整句失败原因：宽屏单独成列，窄屏折进「标题 / 链接」格下方，
   免得整句被挤成一列一个字；折叠时表格也就不必横向滚动了 */
.msg-inline { display: none; }
@media (max-width: 1300px) {
  .table-wrap.jobs-table table { min-width: 640px; }
  .jobs-table .msg-col { display: none; }
  .jobs-table .msg-inline { display: block; }
}

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 15px 16px; box-shadow: var(--shadow); }
.stat .k { font-size: 12px; color: var(--muted); margin-bottom: 7px; }
.stat .v { font-size: 23px; font-weight: 700; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12.5px; font-weight: 500; color: var(--hint); }

/* 资源下载 · 下载规则（单文件上限可配）。左边输入框、右边说明，窄屏自动折行。
   虚线框是为了跟上面四张实心统计卡区分开：「这几张是看数，下面是改」。 */
.dl-rules {
  display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; padding: 14px 16px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: #fbfcfe;
}
.dl-rules .field { margin-bottom: 0; flex: 0 0 220px; }
.dl-rules .hint { flex: 1 1 320px; margin: 0 0 2px; min-width: 240px; }
.dl-rules .msg { flex: 1 1 100%; margin-top: 2px; }

/* 概览的时间口径切换：今日 / 昨日 / 近七天 / 本月 / 全部。
   放在统计卡片上方，跟着它变的只有卡片（下面「最近的解析任务」固定只看今天）。 */
.ov-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.ov-range button {
  padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 13px; font-family: inherit;
  cursor: pointer; transition: background .15s, color .15s;
}
.ov-range button:hover { background: var(--bg-soft); }
.ov-range button.on {
  background: var(--brand-soft); border-color: transparent; color: var(--brand); font-weight: 600;
}
.ov-range .ov-note { font-size: 12px; color: var(--hint); margin-left: 2px; }

/* 本次生成密钥的标题行：标题 + 复制按钮 + 计数说明 */
.code-hd {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 8px;
}
.code-hd h3 { margin: 0; }

.code-list {
  font-family: var(--mono); font-size: 12px;
  background: #fafbfe; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 15px; max-height: 280px; overflow: auto;
  white-space: pre; line-height: 1.9; color: var(--text);
}

.foot { text-align: center; color: var(--hint); font-size: 12px; margin-top: 34px; line-height: 1.95; }

/* ---------------------------------------------------------------- 开发者工具遮罩 */

.shield {
  position: fixed; inset: 0; z-index: 200; background: rgba(15, 23, 42, .95);
  color: #fff; display: none; align-items: center; justify-content: center; text-align: center; padding: 30px;
}
.shield.show { display: flex; }
.shield .in { max-width: 480px; }
.shield h3 { color: #fff; font-size: 17px; margin: 0 0 12px; }
.shield p { color: rgba(255, 255, 255, .72); font-size: 13.5px; line-height: 1.8; margin: 0; }

@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
  .col-right { position: static; flex-direction: row; flex-wrap: wrap; }
  .col-right > * { flex: 1 1 260px; }
}

@media (max-width: 900px) {
  .rights-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .input-group { flex-direction: column; }
  .input-group button { width: 100%; }
  .recent-item { grid-template-columns: 1fr; }
  .recent-side { justify-content: flex-start; }
  .card { padding: 17px 16px; }
  .reader-toolbar { top: 0; }
  .reader-toolbar .title { flex-basis: 100%; }
}

/* =================================================================
   后台专用：左导航 + 右主体，宽高整屏自适应
   全部挂在 body.admin 下，前台 index.html 不受影响
   ================================================================= */

body.admin { height: 100vh; height: 100dvh; overflow: hidden; background: var(--bg-soft); }

/* ---------------- 登录 ---------------- */
.admin-login {
  height: 100vh; overflow: auto; padding: 24px;
  display: flex; align-items: center; justify-content: center;
}
.login-card { width: 100%; max-width: 392px; }
.login-card h1 { font-size: 20px; }

/* ---------------- 外壳 ---------------- */
.admin-shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100vh;
  transition: grid-template-columns .18s ease;
}

/* 折叠态：只留图标，右侧主体拿到更多宽度。
   类挂在 body 上，用更近的层叠位置覆盖 :root 的 --side-w，
   所以下面的窄屏媒体查询（它改 :root）不会把它顶回去。 */
body.admin.side-collapsed { --side-w: 64px; }
body.admin.side-collapsed .side-brand { justify-content: center; padding: 14px 0; gap: 0; }
body.admin.side-collapsed .side-brand .mark { display: none; }
body.admin.side-collapsed .side-brand-txt { display: none; }
body.admin.side-collapsed .side-toggle { margin-left: 0; }
body.admin.side-collapsed .side-toggle svg { transform: rotate(180deg); }
/* 导航项只留图标：文字是裸文本节点，font-size:0 让它不显示，
   SVG 自己有宽高，不受影响；data-t 在 JS 里同步成 title 提示 */
body.admin.side-collapsed .nav-item { justify-content: center; font-size: 0; gap: 0; padding: 9px 0; }
body.admin.side-collapsed .side-actions { display: none; }
body.admin.side-collapsed .admin-nav { padding: 10px 8px; }

/* ---------------- 左：导航 ---------------- */
.admin-side {
  display: flex; flex-direction: column; min-height: 0; height: 100vh;
  background: #fff; border-right: 1px solid var(--line);
}
.side-brand {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
}
/* 折叠 / 展开导航：右上角一个小箭头，方向随状态翻转 */
.side-toggle {
  margin-left: auto; flex: 0 0 auto;
  width: 26px; height: 26px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--muted); cursor: pointer;
}
.side-toggle:hover { border-color: #ccd5e4; color: var(--text); background: var(--line-soft); }
/* body.admin button 的 padding(8px 13px) 比 .side-toggle 更具体，会把 padding:0 顶掉，
   内容区被压成 0 宽后箭头 svg 直接被挤没（表现为只剩一个白框）——这里必须同权重压回来 */
body.admin .side-toggle { padding: 0; }
.side-toggle:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.side-toggle svg { width: 14px; height: 14px; display: block; transition: transform .18s ease; }
.side-brand-txt { min-width: 0; line-height: 1.35; }
.side-brand-txt b { display: block; font-size: 13.5px; color: var(--ink); font-weight: 650; }
.side-brand-txt span { font-size: 11.5px; color: var(--hint); }

.admin-nav {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  padding: 10px; display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  width: 100%; justify-content: flex-start; gap: 9px;
  padding: 9px 11px; border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 550;
}
.nav-item:hover:not(:disabled) { background: var(--line-soft); border-color: transparent; color: var(--text); }
.nav-item.on { background: var(--brand-soft); color: var(--brand); border-color: #dbe6fd; font-weight: 650; }
/* 选中的导航 hover 时也要保持选中态，否则看着像「鼠标一放上去就取消了选中」 */
.nav-item.on:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand); border-color: #dbe6fd; }
.nav-ico { flex: 0 0 auto; display: inline-flex; }
.nav-ico svg { width: 16px; height: 16px; display: block; }

.side-foot {
  flex: 0 0 auto; padding: 11px 12px; border-top: 1px solid var(--line-soft);
  display: flex; flex-direction: column; gap: 8px;
}
.side-user { font-size: 12px; color: var(--ok); font-weight: 600; }
.side-actions { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.side-link { font-size: 12.5px; color: var(--muted); }
.side-link:hover { color: var(--brand); }

/* ---------------- 右：主体 ---------------- */
.admin-main { display: flex; flex-direction: column; min-width: 0; height: 100vh; }
.admin-topbar {
  flex: 0 0 auto; min-height: 60px;
  display: flex; align-items: center; gap: 14px;
  padding: 9px clamp(16px, 1.8vw, 26px);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-txt { min-width: 0; }
.topbar-title { font-size: 16.5px; margin: 0; font-weight: 700; color: var(--ink); letter-spacing: -.2px; }
.topbar-sub { margin: 2px 0 0; font-size: 12px; color: var(--hint); }
/* 顶部栏右侧动作区：靠右对齐，窄屏只留图标 */
.topbar-act { margin-left: auto; flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.go-front {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 550;
  border: 1px solid #dbe6fd; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand);
  text-decoration: none; white-space: nowrap; transition: all .15s;
}
.go-front:hover { background: #e4ecfd; border-color: #cfe0fc; }
.go-front:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.go-front svg { width: 13px; height: 13px; flex: 0 0 auto; }
.admin-body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: clamp(14px, 1.6vw, 22px) clamp(16px, 1.8vw, 26px) 40px;
}
.admin-body .card { box-shadow: 0 1px 2px rgba(16, 24, 40, .03); }

/* ---------------- 文章类型（免费 / 登录会员 / VIP会员） ---------------- */
/* 归档列表里的类型下拉：就地改，配色按类型区分 */
.type-sel {
  width: auto; max-width: 108px;
  padding: 3px 6px; font-size: 12px; font-weight: 550; border-radius: 7px;
  color: var(--muted); cursor: pointer;
}
.type-sel.free  { color: var(--ok);   border-color: #d3efdf; background: var(--ok-soft); }
.type-sel.login { color: var(--warn); border-color: #f0dcb4; background: var(--warn-soft); }
.type-sel.vip   { color: var(--err);  border-color: #f3cfcf; background: var(--err-soft); }
.type-sel:disabled { opacity: .6; cursor: progress; }
/* 批量抓取那行的类型下拉：跟旁边的复选框同高 */
.check .type-pick { width: auto; padding: 4px 8px; font-size: 12.5px; border-radius: 8px; }

/* ---------------- 模块内 tab（单个 / 批量抓取等） ---------------- */
.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin: 0 0 16px;
}
.tabs .tab {
  padding: 7px 15px; margin-bottom: -1px;
  border: 1px solid transparent; border-bottom: 0;
  border-radius: 9px 9px 0 0;
  background: transparent; color: var(--muted);
  font-weight: 550; font-size: 13px;
  cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.tabs .tab:hover:not(.on) { color: var(--text); background: var(--line-soft); }
.tabs .tab.on {
  color: var(--brand); background: var(--card);
  border-color: var(--line);
}
.pane { display: none; }
.pane.on { display: block; }

/* 模块说明：标题后的说明按钮 + 悬浮说明 */
.card-title .info-btn,
.topbar-title .info-btn {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  padding: 0; margin-left: 3px;
  border: 1px solid #ccd5e4;
  border-radius: 50%;
  background: var(--bg-soft); color: var(--muted);
  cursor: help;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
.card-title .info-btn svg,
.topbar-title .info-btn svg { width: 12px; height: 12px; display: block; }
.card-title .info-btn:hover, .card-title .info-btn:focus-visible,
.topbar-title .info-btn:hover, .topbar-title .info-btn:focus-visible {
  border-color: var(--brand); color: var(--brand); background: var(--brand-soft); outline: none;
}
.topbar-title { display: flex; align-items: center; gap: 8px; }

/* 说明文字收进悬浮提示后，正文里不再重复占位 */
.is-tip { display: none !important; }

.gw-tip {
  position: fixed; z-index: 999; left: 0; top: 0;
  max-width: 320px; padding: 9px 12px;
  background: #0f172a; color: #fff;
  border-radius: 9px; font-size: 12.5px; line-height: 1.65;
  box-shadow: 0 14px 32px -12px rgba(15, 23, 42, .5);
  opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
  pointer-events: none;
}
.gw-tip.on { opacity: 1; visibility: visible; transform: translateY(0); }
.gw-tip.up { transform: translateY(3px); }
.gw-tip.up.on { transform: translateY(0); }

/* ---------------- 后台整体紧凑化 ---------------- */
body.admin .card { padding: 15px 17px; border-radius: 12px; }
body.admin .card + .card { margin-top: 14px; }
body.admin .card-head { margin-bottom: 12px; }
body.admin .card-title { font-size: 15px; }
body.admin .card-sub { font-size: 12.5px; margin-top: 4px; }
body.admin label { font-size: 12px; margin-bottom: 5px; }
body.admin input, body.admin textarea, body.admin select { padding: 8px 10px; font-size: 13px; border-radius: 8px; }
body.admin button { padding: 8px 13px; font-size: 13px; border-radius: 8px; }
body.admin button.tiny { padding: 4px 8px; font-size: 12px; border-radius: 7px; }
body.admin .field { margin-bottom: 12px; }
body.admin .hint { font-size: 12px; margin-top: 7px; }
body.admin .msg { margin-top: 11px; padding: 9px 12px; font-size: 12.5px; }
body.admin .stat { padding: 12px 14px; }
body.admin .stat .v { font-size: 20px; }
body.admin .stats { gap: 10px; }
body.admin .code-list { max-height: 220px; padding: 11px 13px; }
body.admin .table-wrap { border-radius: 9px; }

/* ---------------- 表格：一律不折行，长文本单元格显式放开 ---------------- */
body.admin table { font-size: 12.5px; }
body.admin th, body.admin td { padding: 8px 10px; white-space: nowrap; }
body.admin td.wrapcell { white-space: normal; overflow-wrap: anywhere; max-width: 360px; }
body.admin td.empty { white-space: normal; padding: 32px 12px; }
body.admin td.actions button { margin-right: 4px; }
body.admin td.actions button:last-child { margin-right: 0; }
body.admin .sel-col { width: 34px; padding-left: 12px; }

.num { font-variant-numeric: tabular-nums; }
.q-left { font-size: 14px; font-weight: 700; color: var(--ink); }
.q-left.zero { color: var(--err); }
.cellsub { font-size: 11px; color: var(--hint); margin-top: 2px; line-height: 1.45; }
.muted-txt { color: var(--hint); }
/* 「这篇是用哪份登录凭据抓下来的」——低调但能一眼认出来 */
.cred-chip {
  display: inline-block; padding: 1px 7px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); font-size: 11px;
  border: 1px solid #dbe6fd;
}
/* 解析记录里同时有「文章解析」和「资源下载」两条线，资源下载任务挂个灰标区分 */
.cred-chip.kind-dl {
  background: var(--bg-soft); color: var(--muted); border-color: var(--line);
}

/* ---------------- 发卡：压成一条紧凑栏 ---------------- */
.gen-bar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.gen-bar .field { margin-bottom: 0; }
.gen-bar input[type="number"] { text-align: left; }
/* 非「自定义卡」时额度/有效期由卡类型决定，置灰只读，避免改出与卡类型不符的参数 */
body.admin .gen-bar input[readonly] {
  background: var(--bg-soft); color: var(--muted); cursor: default;
}
.gen-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 13px; }
.check {
  display: inline-flex; align-items: center; gap: 7px; margin: 0;
  font-size: 12.5px; color: var(--muted); font-weight: 500; cursor: pointer;
}
.check input[type="checkbox"] { width: auto; margin: 0; flex: 0 0 auto; cursor: pointer; }
.field .check + .check { margin-top: 7px; }

/* 弹性栅格：按可用宽度自动分配，宽屏一行放完，窄屏自动换行 */
.gen-bar .f-card { flex: 1 1 186px; max-width: 280px; }
.gen-bar .f-grow { flex: 1 1 152px; max-width: 260px; }
.gen-bar .f-num  { flex: 0 1 86px;  min-width: 74px; }
.gen-bar .f-num2 { flex: 0 1 106px; min-width: 92px; }
.gen-bar .f-pre  { flex: 0 1 90px;  min-width: 74px; }

/* 筛选栏：每个控件固定宽度，不随剩余空间拉伸，只换行 */
.filter-bar .f-xs { flex: 0 0 88px; }
.filter-bar .f-sm { flex: 0 0 130px; }
.filter-bar .f-md { flex: 0 0 168px; }
.filter-bar .f-xl { flex: 0 0 200px; }
.filter-bar .field { max-width: 100%; }

/* ---------------- 筛选栏 / 工具条 ---------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; }
.filter-bar .field { margin-bottom: 0; }
.filter-bar select, .filter-bar input { width: 100%; }
/* 筛选栏里的控件统一锁高（含「密钥」这类加了 .mono 的框）：
   换成等宽字体后行盒比普通输入框高，不锁高就会出现「密钥框比旁边高一截」。
   36px 与时间区间胶囊（.dr-input）一致，一行里的控件下沿齐平。 */
body.admin .filter-bar input,
body.admin .filter-bar select { height: 36px; padding: 0 10px; }
body.admin .filter-bar .fbar-act button { height: 36px; padding: 0 13px; }
.fbar-act { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 10px; }
.toolbar .bar-note { margin-left: 3px; }

.sel-col { width: 36px; }
.sel-col input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; }
.rowPick { cursor: pointer; }
tr.picked { background: var(--brand-soft); }
tr.picked:hover { background: #e6eefd; }

.bar-note { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
.bar-note b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bar-note .warn-txt { color: var(--warn); }

.pager { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pager .now { font-family: var(--mono); font-size: 12.5px; color: var(--muted); min-width: 70px; text-align: center; }

/* 每页条数跟着分页走，放在分页按钮后面 */
.pg-size {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 4px;
  flex: 0 0 auto;                       /* 别被分页行的其它元素挤扁 */
  font-size: 12.5px; color: var(--muted); white-space: nowrap;
}
/* 注意：`body.admin select`（0,1,2）比 `.pg-size select`（0,1,1）更具体，
   会把这里的 padding 顶回 8px 10px，而高度只有 30px —— 内容区只剩 12px，
   下拉里的「20 条」上下就被切掉了。所以这里必须用同样具体度的选择器写回。 */
.pg-size select,
body.admin .pg-size select {
  width: auto; min-width: 86px; height: 30px; padding: 0 26px 0 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font: inherit; font-size: 12.5px; color: var(--text); cursor: pointer;
  flex: 0 0 auto;
}
.pg-size select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
body.admin .pager { margin-top: 11px; }

.del-summary {
  background: #fbfcfe; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 15px; font-size: 13px; line-height: 1.9; margin: 2px 0 12px;
}
.del-summary .n { color: var(--err); font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.del-summary .k { color: var(--muted); }
.del-guard {
  background: var(--warn-soft); border: 1px solid #f0dcb4; border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 12.5px; line-height: 1.8; color: #8a6412; margin-bottom: 12px;
}

/* ---------------- 时间区间选择器 ---------------- */
.dr { display: block; }
.filter-bar .f-lg { flex: 0 0 268px; }

/* 收起态：左边一个时钟图标的胶囊输入框 */
.dr-input {
  display: flex; align-items: center; gap: 7px;
  width: 100%; height: 36px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--hint);
  font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.dr-input:hover { border-color: #ccd5e4; }
.dr-input:focus-visible, .dr-input.on {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.dr-input .dr-ico { flex: 0 0 auto; width: 15px; height: 15px; color: var(--hint); }
.dr-input.on .dr-ico { color: var(--brand); }
.dr-input .dr-txt {
  flex: 1 1 auto; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.dr-input .dr-v { color: var(--text); font-variant-numeric: tabular-nums; }
.dr-input .dr-sep { flex: 0 0 auto; color: var(--hint); }
.dr-input .dr-ph { flex: 1 1 auto; }

/* 展开态：左侧快捷项 + 右侧双月日历 */
.dr-pop {
  position: fixed; z-index: 90;
  display: flex; align-items: flex-start;
  padding: 12px;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  /* 关键：固定定位元素默认是「收缩适应」宽度，会被「右边还剩多少空间」挤窄，
     两个月历跟着压缩，看着就是「结束日期那一半被切掉、要左右滑」。
     用 max-content 按内容取宽，再用 max-width 兜住屏幕边界，就不再看人下菜了。 */
  width: max-content; max-width: calc(100% - 16px);
  max-height: calc(100vh - 20px); overflow: auto;
}
.dr-pop[hidden] { display: none; }

.dr-quick {
  flex: 0 0 82px; display: flex; flex-direction: column; gap: 3px;
  padding: 0 10px 0 2px; border-right: 1px solid var(--line-soft);
}
.dr-quick button {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  width: 100%; padding: 8px 9px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-size: 13px;
  text-align: left; cursor: pointer;
}
.dr-quick button:hover { background: var(--bg-soft); }
.dr-quick button.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.dr-quick .dr-badge { font-size: 11.5px; color: var(--hint); font-variant-numeric: tabular-nums; }
.dr-quick button.on .dr-badge { color: var(--brand); }

.dr-main { display: flex; flex-direction: column; padding-left: 12px; min-width: 0; }

/* 双月并排。宽度写在 .dr-cal 上、并留一点可收缩余地，
   这样弹层宽度稳定（不会随窗口右边剩多少空间而变），窄屏也有退路。 */
.dr-cals { display: flex; gap: 16px; min-width: 0; }
.dr-cal { flex: 0 1 auto; width: 232px; min-width: 176px; }
.dr-cal-h { display: flex; align-items: center; height: 30px; margin-bottom: 4px; }
.dr-cal-h .dr-title {
  flex: 1 1 auto; text-align: center; font-size: 13.5px; font-weight: 600; color: var(--ink);
}
.dr-nav {
  flex: 0 0 auto; width: 24px; height: 24px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: none;
  color: var(--muted); font: inherit; font-size: 14px; line-height: 1; cursor: pointer;
}
.dr-nav:hover { background: var(--bg-soft); color: var(--ink); }
.dr-navsp { flex: 0 0 24px; width: 24px; height: 24px; }
.dr-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dr-w {
  height: 28px; display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; color: var(--muted);
}
.dr-w.we { color: #c2410c; }

.dr-d {
  height: 34px; padding: 0; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 0; background: none; cursor: pointer;
  color: var(--text); font: inherit; font-size: 13.5px; font-variant-numeric: tabular-nums;
}
.dr-d:hover { background: var(--bg-soft); border-radius: 8px; }
.dr-d.out { color: #cbd5e1; }
.dr-d.in { background: var(--brand-soft); }
.dr-d.ed {
  background: var(--brand); color: #fff; border-radius: 8px; font-weight: 600;
}
.dr-d.ed:hover { background: var(--brand-dark); border-radius: 8px; }
.dr-d.today { color: var(--brand); font-weight: 600; }
.dr-d.today.ed { color: #fff; }

.dr-foot {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft);
}
/* 去掉日期/时间输入框后，用这行把「已选中的区间」讲清楚 */
.dr-sel {
  flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--hint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.dr-sel.on { color: var(--text); }
.dr-foot button {
  height: 32px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
  flex: 0 0 auto;
}
.dr-foot button:hover { border-color: #ccd5e4; }
.dr-foot .dr-clear { color: var(--muted); }
.dr-foot .dr-ok { border-color: var(--brand); background: var(--brand); color: #fff; }
.dr-foot .dr-ok:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

/* 后台有一批 `body.admin button/select`（0,1,2）的全局收缩规则，
   比上面这些 `.dr-*`（0,1,0 / 0,1,1）更具体，会把胶囊、日历格子、底部按钮的
   内边距整体顶掉 —— 内边距一大，34px 高格子里的字就被裁一半。
   这里用同样具体度的选择器把设计值写回去，别删。 */
body.admin .dr-input { height: 36px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
body.admin .dr-quick button { padding: 8px 9px; font-size: 13px; border-radius: 8px; }
body.admin .dr-nav { width: 24px; height: 24px; padding: 0; font-size: 14px; border-radius: 7px; }
body.admin .dr-d { height: 34px; padding: 0; font-size: 13.5px; border-radius: 0; }
body.admin .dr-foot button { height: 32px; padding: 0 16px; font-size: 13px; border-radius: 8px; }

/* ---------------- 后台响应式：侧栏收窄 → 顶部横排 ---------------- */
@media (max-width: 1180px) {
  :root { --side-w: 184px; }
  .filter-bar .f-md { flex-basis: 152px; }
  .filter-bar .f-xl { flex-basis: 176px; }
}

/* 时间区间选择器的窄屏形态：双月 + 快捷列大约需要 560px 才放得下，
   所以到 640px 才降级成「快捷项横排 + 单月」。窗口更窄时先让两个月历
   一起收窄（.dr-cal 允许收缩），而不是溢出弹层逼用户左右滑动。 */
@media (max-width: 640px) {
  .dr-pop { flex-direction: column; }
  .dr-quick {
    flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; gap: 4px;
    padding: 0 0 7px; border-right: 0; border-bottom: 1px solid var(--line-soft);
  }
  .dr-quick button { width: auto; padding: 5px 10px; border-radius: 999px; }
  .dr-main { padding: 8px 0 0; }
  .dr-cal { flex: 0 1 208px; }
  .dr-cal.alt { display: none; }
}

@media (max-width: 860px) {
  /* 仍是「整屏外壳 + 内部滚动」，只是把侧栏横过来放到顶部：
     这样文档本身不滚动，#p-keys 之类的片段锚点就不会把导航滚出视野 */
  .admin-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .admin-side { height: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .side-brand { padding: 10px 14px; }
  .admin-nav {
    flex: 0 0 auto; flex-direction: row;
    overflow-x: auto; overflow-y: hidden; padding: 8px 10px; gap: 6px;
  }
  .nav-item { width: auto; flex: 0 0 auto; padding: 7px 12px; border-radius: 999px; }
  .nav-ico { display: none; }
  .side-foot { flex-direction: row; align-items: center; justify-content: space-between; padding: 8px 12px; }
  .admin-main { height: auto; min-height: 0; }
  .admin-body { overflow-y: auto; }
  .filter-bar .f-lg { flex: 1 1 220px; }
}

@media (max-width: 640px) {
  .fbar-act { margin-left: 0; width: 100%; }
  .fbar-act button { flex: 1 1 auto; }
  .filter-bar .f-sm, .filter-bar .f-md, .filter-bar .f-xl { flex: 1 1 120px; }
  .toolbar { gap: 6px; }
  .toolbar .grow { display: none; }
  .login-card { padding: 18px 16px; }
  /* 顶栏「访问前台」在窄屏收成图标，给标题让出宽度 */
  .go-front { padding: 6px 9px; }
  .go-front .go-txt { display: none; }
}

/* ---------------------------------------------------------------- 资源下载 */
/* 前台「资源下载」结果区：资源信息 + 状态标签 + 取回按钮。
   与阅读区的 .recent 行呼应，但单独成一区，避免和「最近阅读」的列表混淆。 */

.dl-result {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 14px; padding: 14px;
  background: var(--ok-soft); border: 1px solid #cdebd9;
  border-radius: var(--radius-sm);
}
/* 本文件末尾的规则会盖掉前面的 [hidden]{display:none}（同为 0,1,0 比源码顺序），
   所以这里自己再声明一次，否则「未出结果」时这块会一直显形。 */
.dl-result[hidden] { display: none; }
.dl-info { flex: 1 1 260px; min-width: 0; }
.dl-title {
  font-weight: 600; color: var(--ink); font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dl-meta {
  margin-top: 3px; font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dl-tags { display: flex; flex-wrap: wrap; gap: 6px; }
/* 倒计时那枚标签跟着其它 chip 一起摆，绝不换行单独占一行 */
.dl-tags .chip.dl-cd { white-space: nowrap; }
.dl-result button.primary { flex: 0 0 auto; }

/* 提交中：按钮转圈并锁住，防止连点提交出两个任务 */
.primary.loading, button.primary.loading {
  position: relative; pointer-events: none; opacity: .82;
}
.primary.loading::after {
  content: ""; display: inline-block; vertical-align: -2px;
  width: 11px; height: 11px; margin-left: 7px;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  border-radius: 50%; animation: dl-spin .7s linear infinite;
}
@keyframes dl-spin { to { transform: rotate(360deg); } }

/* 下载进度条：与阅读进度同构，但配色走靛蓝→青，跟「下载」这件事区分开 */
#dlProg .progress-fill { background: linear-gradient(90deg, #6366f1, #22d3ee); }

/* 后台「下载管理」列表里的小标签 */
.dl-flag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 550;
  background: var(--line-soft); color: var(--muted);
}
.dl-flag.ok { background: var(--ok-soft); color: var(--ok); }
.dl-flag.warn { background: var(--warn-soft); color: var(--warn); }
.dl-flag.err { background: var(--err-soft); color: var(--err); }

@media (max-width: 640px) {
  .dl-result { flex-direction: column; align-items: stretch; }
  .dl-result button.primary { width: 100%; }
}
