/* ============================================================
   小木薯 3.0 —— 「书房」设计系统
   暖纸底 / 焙茶主色 / 衬线标题 / 卡片层级 / 右侧抽屉
   ============================================================ */
:root {
  --bg: #f6f3ee;
  --bg-deep: #efeae1;
  --card: #ffffff;
  --ink: #2b2721;
  --ink-2: #4d463c;
  --sub: #8d8577;
  --brand: #b45f3c;
  --brand-dark: #93492c;
  --brand-soft: #f6e8df;
  --ok: #2f8f63;
  --ok-soft: #e8f4ed;
  --bad: #c8564d;
  --bad-soft: #fbeceb;
  --line: #e8e2d7;
  --line-soft: #f0ebe2;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(43, 39, 33, .05);
  --shadow-md: 0 1px 3px rgba(43, 39, 33, .06), 0 10px 28px -12px rgba(43, 39, 33, .12);
  --shadow-lg: 0 24px 60px -18px rgba(43, 39, 33, .28);
  --serif: "Noto Serif SC", Georgia, "STSong", "SimSun", serif;
  --sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  /* 间距阶梯 / 灰阶（书房精修批次 v9） */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --ink-3: #6d6558;
  --brand-glow: 0 6px 18px -6px rgba(147, 73, 44, .35);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  background:
    radial-gradient(1200px 500px at 85% -10%, #fbf7f0 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }

/* ---------- 顶栏（sticky 毛玻璃） ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar .wrap { display: flex; align-items: center; gap: 14px; height: 58px; }
.brand {
  font-family: var(--serif); font-weight: 700; font-size: 19px;
  color: var(--brand); text-decoration: none; letter-spacing: .5px;
  display: flex; align-items: center; gap: 2px;
}
.topbar nav { display: flex; gap: 2px; flex: 1; }
.topbar nav a {
  padding: 7px 13px; border-radius: 9px; color: var(--ink-2);
  text-decoration: none; font-size: 13.5px; transition: all .15s;
}
.topbar nav a:hover { background: var(--bg-deep); color: var(--ink); }
.topbar nav a.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; position: relative; }
.topbar nav a.on::after {
  content: ''; position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%);
  width: 16px; height: 2px; border-radius: 2px; background: var(--brand);
}
/* 窄屏：导航换行成第二条，横向可滑，右上账号区收尾 */
@media (max-width: 860px) {
  .topbar .wrap { height: auto; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; row-gap: 4px; }
  .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { white-space: nowrap; padding: 6px 11px; }
  .right { margin-left: auto; }
  .chip { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
.right { display: flex; align-items: center; gap: 10px; }
.gear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px;
  font-size: 17px; text-decoration: none; color: var(--ink-2);
  transition: all .15s; border: 1px solid transparent;
}
.gear:hover { background: var(--bg-deep); color: var(--brand-dark); border-color: var(--line-soft); }
.chip {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 13px; font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.chip b { color: var(--brand-dark); font-family: var(--serif); font-size: 14px; }

/* ---------- 卡片 ---------- */
main { padding: 28px 20px 12px; }
.card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); padding: 24px 26px; margin-bottom: 18px;
  box-shadow: var(--shadow-md);
}
.card h1 {
  font-family: var(--serif); font-size: 21px; margin: 0 0 8px; letter-spacing: .3px;
}
.card h2 { font-family: var(--serif); font-size: 16px; margin: 0; }
.sub { color: var(--sub); font-size: 13px; margin: 0 0 14px; }
.notice {
  background: #fdf7ec; border: 1px solid #f0e0c4; border-radius: 10px;
  padding: 9px 13px; font-size: 13px; color: #8a6a35;
}
label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 12px; }
input, textarea, select {
  width: 100%; margin-top: 5px; padding: 10px 13px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fcfbf8;
  font-family: inherit; color: var(--ink); transition: border .15s, box-shadow .15s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
                    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
  cursor: pointer;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(180, 95, 60, .14); background: #fff;
}
input[type=checkbox] {
  width: 15px; height: 15px; padding: 0; margin: 0 4px 0 0;
  accent-color: var(--brand); vertical-align: middle; cursor: pointer;
}

/* ---------- 按钮 ---------- */
.btn {
  background: var(--brand); border: none; color: #fff; font-size: 14.5px;
  padding: 10px 26px; border-radius: 10px; cursor: pointer; font-family: inherit;
  box-shadow: 0 2px 8px -2px rgba(147, 73, 44, .4);
  transition: all .15s;
}
.btn:hover { background: var(--brand-dark); transform: translateY(-1px); box-shadow: var(--brand-glow); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: .62; transform: none; cursor: default; }
.btn-sm { padding: 5px 14px; font-size: 13px; border-radius: 8px; }
.btn-ghost {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink-2); padding: 6px 13px; font-size: 13px; cursor: pointer;
  text-decoration: none; display: inline-block; transition: all .15s;
  font-family: inherit; line-height: 1.6;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); background: #fff; }
.btn-ghost:active { transform: translateY(1px); }
.btn-ghost:disabled { opacity: .62; pointer-events: none; }
.auth-card { max-width: 410px; margin: 48px auto; }
.alt { font-size: 13px; color: var(--sub); text-align: center; margin-top: 14px; }
.alt a { color: var(--brand-dark); }

/* ---------- 登录/注册：左品牌区 + 右表单卡（仿老客户端登录窗） ---------- */
.auth-split {
  display: flex; gap: 0; max-width: 880px; margin: 46px auto 0;
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-md);
}
.auth-hero {
  flex: 1.1; min-width: 0; position: relative; overflow: hidden;
  background: linear-gradient(155deg, #93492c 0%, #b45f3c 55%, #c97a4e 100%);
  color: #fff; padding: 44px 38px;
  display: flex; flex-direction: column; justify-content: center;
}
.hero-title {
  font-family: var(--serif); font-size: 30px; font-weight: 700;
  letter-spacing: 1px;
}
.hero-slogan { font-size: 15px; opacity: .92; margin: 10px 0 26px; letter-spacing: 2px; }
.hero-dots { display: flex; gap: 7px; margin-bottom: 24px; }
.hero-dots i {
  width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.85);
}
.hero-dots i:nth-child(2) { width: 13px; height: 13px; margin-top: -2px; }
.hero-dots i:nth-child(3) { width: 7px; height: 7px; margin-top: 3px; background: rgba(255,255,255,.55); }
.hero-feats { list-style: none; margin: 0; padding: 0; font-size: 13.5px; line-height: 2.1; opacity: .95; }
.hero-feats li::before { content: '✔'; margin-right: 9px; font-size: 12px; opacity: .8; }
.auth-form { flex: 1; border: none; border-radius: 0; margin: 0; box-shadow: none; }
.btn.wide { width: 100%; padding: 12px 26px; font-size: 15px; margin-top: 4px; }
@media (max-width: 720px) {
  .auth-split { flex-direction: column; }
  .auth-hero { padding: 30px 26px; }
  .hero-feats { display: none; }
}
.row { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.hint { font-size: 12px; color: var(--sub); }

/* ---------- 提示条 ---------- */
.flash {
  border-radius: 10px; padding: 10px 15px; font-size: 13.5px; margin-bottom: 14px;
  border: 1px solid transparent;
}
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: #cbe6d8; }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: #f0cfcb; }
.flash.ann { background: #fdf7ec; color: #96690f; border-color: #f0e0c4; }

/* ---------- 查询区 ---------- */
.search-bar select { width: 170px; flex: none; }
.search-bar { display: flex; gap: 10px; align-items: flex-start; }
.search-bar textarea { min-height: 96px; resize: vertical; }

/* ---------- 结果卡片 ---------- */
details.result {
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  margin: 10px 0; background: var(--card); padding: 0;
  box-shadow: var(--shadow-sm); transition: box-shadow .18s;
}
details.result[open] { box-shadow: var(--shadow-md); }
details.result > summary {
  list-style: none; cursor: pointer; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; font-size: 14px;
  border-radius: var(--radius);
}
details.result > summary::-webkit-details-marker { display: none; }
details.result > summary::before {
  content: ''; flex: none; width: 7px; height: 7px;
  border-right: 2px solid var(--sub); border-bottom: 2px solid var(--sub);
  transform: rotate(-45deg); margin-right: 2px; transition: transform .18s;
}
details.result[open] > summary::before { transform: rotate(45deg); }
details.result > summary:hover { background: var(--bg); }
.thumb, .thumb.ph {
  flex: none; width: 52px; height: 69px; object-fit: cover;
  border: 1px solid var(--line-soft); border-radius: 6px; background: #fff;
  box-shadow: var(--shadow-sm);
}
.thumb.ph, .bcov.ph {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 20px; color: #d3c6ab;
  background: linear-gradient(150deg, #f7f0e3, #efe5d1);
}
.sumbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sumline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sumline.btitle {
  font-family: var(--serif); font-size: 15px; font-weight: 700; color: var(--ink);
}
.sumline.btitle .sub { font-weight: 400; font-size: 12px; color: var(--sub); font-family: var(--sans); }
.rhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.key { font-family: Consolas, "Courier New", monospace; font-weight: 700; font-size: 14px; }
.bookinfo { font-size: 13px; color: var(--ink-2); }
.tag { font-size: 12px; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.tag.cost { background: var(--brand-soft); color: var(--brand-dark); }
.tag.free { background: var(--ok-soft); color: var(--ok); }
.tag.miss { background: #f1efe9; color: var(--sub); }
/* 「盘里有，但所在库 Cookie 失效、暂时取不出来」——和「可取」必须一眼分开，
   否则用户按「可取」扣了积分才发现拿不到 */
.tag.wait { background: #fdf3e3; color: #a9761f; }
/* 「盘里有同名文件」：只按书名撞上的，可能是这本，也可能是同名的别的书/相关著作。
   必须和「可取」在视觉上分得很开，绝不能让人以为这就是那本书 */
.tag.name { background: #eef1f5; color: #5a6b7a; }
.stk { font-size: 12px; color: var(--sub); white-space: nowrap; }
/* 书表页「库存状态说明」折叠块 */
.hintexp { display: inline-block; font-size: 12.5px; }
.hintexp summary {
  cursor: pointer; color: var(--brand-dark); user-select: none;
  border-bottom: 1px dashed var(--brand-dark); list-style: none;
}
.hintexp summary::before { content: 'ⓘ '; }
.hintexp[open] summary { border-bottom: none; }
.hintexp .hintbody {
  background: #fbf6ee; border: 1px solid #f0e4cd; border-radius: 10px;
  padding: 8px 14px; margin-top: 8px; line-height: 1.9;
}
.hintexp .hintbody p { margin: 0; }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.hit { background: var(--ok-soft); color: var(--ok); }
/* 导航「通知」上的未读红点 */
nav .badge {
  display: inline-block; min-width: 16px; text-align: center;
  background: var(--bad, #d64545); color: #fff; border-radius: 999px;
  font-size: 11px; line-height: 16px; padding: 0 4px; vertical-align: 2px;
}
/* 通知列表未读态 */
.ntf-unread td { background: var(--brand-soft, #faf0e6); font-weight: 600; }
/* 表格里内联的取书小表单：别撑开行高 */
form.inline { display: inline; margin: 0; }
form.inline button { margin-right: 4px; }
table.files, table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.files tr.fhead th {
  text-align: left; font-size: 11.5px; font-weight: normal; color: var(--sub);
  padding: 0 8px 4px; letter-spacing: .5px;
}
table.files td { padding: 6px 8px; border-top: 1px dashed var(--line); vertical-align: top; }
td.ck { width: 26px; }
td.ck input { width: auto; margin: 0; }
td.fname { word-break: break-all; }
/* ★最优：该书副本里排第一的那个（PDF优先、同格式取最大） */
.best {
  font-size: 11px; color: var(--brand); background: #f7e8dc;
  border: 1px solid #ecd2bc; border-radius: 5px; padding: 1px 6px;
  margin-right: 6px; white-space: nowrap; vertical-align: 1px;
}
/* 库名标签：显示文件来源盘（A盘/B盘/C盘） */
.libtag {
  font-size: 11px; color: #6b7a8c; background: #eef1f4;
  border: 1px solid #dde3e9; border-radius: 5px; padding: 1px 6px;
  margin-left: 6px; white-space: nowrap; vertical-align: 1px;
}
td.fmeta { color: var(--sub); white-space: nowrap; width: 200px; text-align: right; }
table.list th, table.list td { padding: 10px 8px; border-bottom: 1px solid var(--line-soft); text-align: left; font-size: 13px; }
table.list th { color: var(--sub); font-weight: normal; font-size: 12px; border-bottom: 1px solid var(--line); letter-spacing: .5px; }
table.list tbody tr:not(.ntf-unread):hover td { background: #faf8f4; }
td.empty { text-align: center; color: var(--sub); padding: 26px; }
/* 窄屏：宽表横向滑动（书表 9 列），不压缩列宽 */
@media (max-width: 640px) {
  table.list { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  td.fname { white-space: normal; }
}
.bookfull {
  margin: 2px 16px 14px; padding: 12px 14px; font-size: 13px;
  background: #fbf6ee; border: 1px solid #f0e4cd; border-radius: 10px;
  color: var(--ink-2); line-height: 1.75;
}
.bookfull.withcover { display: flex; gap: 15px; align-items: flex-start; }
.bookfull .bcov {
  flex: none; width: 96px; min-height: 122px; object-fit: cover;
  border: 1px solid #eadfc9; border-radius: 7px; background: #fff;
  box-shadow: var(--shadow-sm);
}
.bookfull .binfo { flex: 1; min-width: 0; }
/* 书表列表的封面缩略图列（未登录/无图显示首字占位） */
th.covth { width: 52px; }
td.covtd { padding: 6px 8px !important; }
.bthumb {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 54px; object-fit: cover;
  border: 1px solid var(--line-soft); border-radius: 5px;
  background: #fff; box-shadow: var(--shadow-sm);
  font-size: 16px; color: #d3c6ab;
}
.bthumb.ph { background: linear-gradient(150deg, #f7f0e3, #efe5d1); }
button.star {
  background: none; border: none; cursor: pointer; font-size: 15px;
  padding: 0 2px; margin-left: auto; transition: transform .15s;
}
button.star:hover { transform: scale(1.25); }
button.mini {
  background: none; border: 1px solid var(--line); border-radius: 7px;
  color: var(--sub); font-size: 11px; padding: 1px 7px; cursor: pointer;
  margin-left: 6px; font-family: inherit;
}
button.mini:hover { color: var(--brand-dark); border-color: var(--brand); }

/* ---------- 查询结果表格（仿老客户端图书目录） ---------- */
.rtable { border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.rrow {
  display: grid; align-items: center;
  grid-template-columns: 40px 116px 1fr 86px 64px 44px;
  gap: 8px; padding: 9px 14px; font-size: 13.5px;
}
.rrow.rhead {
  background: var(--bg-deep); color: var(--sub); font-size: 12px;
  padding: 8px 14px; letter-spacing: .5px;
}
.rwrap { border-top: 1px solid var(--line-soft); }
.rwrap:first-of-type { border-top: none; }
details.rwrap > summary { list-style: none; cursor: pointer; transition: background .12s; }
details.rwrap > summary::-webkit-details-marker { display: none; }
details.rwrap > summary:hover { background: var(--bg); }
.rrow .key { font-family: Consolas, "Courier New", monospace; font-weight: 700; }
.rrow .c-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .c-title i { color: var(--sub); font-style: normal; font-size: 12px; }
.rrow .c-title .nosub { color: var(--sub); font-size: 12px; }
.rrow .c-price b { color: var(--brand-dark); font-family: var(--serif); font-size: 14.5px; }
.rrow .c-price b.free { color: var(--ok); }
.rrow .c-price .miss { color: var(--sub); font-size: 12px; }
.rrow .c-hit { color: var(--ink-2); font-size: 12.5px; }
.rrow .c-op { text-align: right; }
.rrow .c-ck input { margin: 0; }
.rdetail { padding: 4px 16px 16px; background: #fdfcf9; border-top: 1px dashed var(--line-soft); }
@media (max-width: 640px) {
  .rrow { grid-template-columns: 34px 1fr 76px 54px 40px; }
  .rrow .key, .rrow > span:nth-child(2) { display: none; }
}

/* ---------- 分享结果 ---------- */
.sharebox {
  background: #fbfaf7; border: 1px solid var(--line-soft); border-left: 4px solid var(--brand);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px;
}
.sline { display: flex; align-items: center; gap: 10px; margin: 7px 0; flex-wrap: wrap; }
.sline.linkline { background: #fff; border: 1px solid var(--line-soft); border-radius: 10px; padding: 9px 13px; }
.sline code { flex: 1; word-break: break-all; font-size: 13.5px; min-width: 200px; color: #5b7a9d; }
.pwd {
  font-size: 22px; letter-spacing: 5px; color: var(--brand-dark);
  font-family: var(--serif); background: var(--brand-soft);
  border: 1px solid #ecd5c6; border-radius: 8px; padding: 3px 14px;
}

.foot { color: var(--sub); font-size: 12px; padding: 20px 16px 34px; text-align: center; }

/* ============================================================
   页内抽屉面板（设置 / 下载与转换）—— 替代独立窗口
   ============================================================ */
.drawer-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(38, 33, 27, .38);
  opacity: 0; pointer-events: none; transition: opacity .22s;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95;
  width: min(430px, 94vw); background: var(--card);
  border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(102%); transition: transform .25s cubic-bezier(.3,.9,.3,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px; border-bottom: 1px solid var(--line-soft);
}
.drawer-head h3 {
  margin: 0; font-family: var(--serif); font-size: 16px; color: var(--ink);
}
.drawer-close {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--sub); padding: 2px 8px; border-radius: 8px;
}
.drawer-close:hover { background: var(--bg); color: var(--ink); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.dcard {
  background: #fbfaf7; border: 1px solid var(--line-soft);
  border-radius: 11px; padding: 14px 15px; margin-bottom: 13px;
}
.dcard h4 { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
/* 账号信息卡（仿老客户端设置页顶部） */
.dcard.account {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #fbf3ec, #f6e8df);
  border-color: #ecd5c6;
}
.dcard.account .avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand); color: #fff; font-family: var(--serif);
  font-size: 20px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px -1px rgba(147,73,44,.45);
}
.dcard.account .ainfo { flex: 1; min-width: 0; }
.dcard.account .aname { font-weight: 600; font-size: 14px; }
.dcard.account .asub { font-size: 12px; color: var(--ink-2); margin-top: 1px; }
.dcard.account .asub b { color: var(--brand-dark); font-family: var(--serif); font-size: 14px; }
.drow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 9px; }
.drow:last-child { margin-bottom: 0; }
.drow input.path {
  flex: 1; min-width: 160px; padding: 6px 10px; font-size: 12.5px;
  border-radius: 8px; margin-top: 0;
}
.drow textarea {
  flex: 1; min-width: 160px; padding: 6px 10px; font-size: 12px;
  border-radius: 8px; margin-top: 0; resize: vertical;
}
.dbtn {
  background: var(--brand); color: #fff; border: none; border-radius: 8px;
  font-size: 12.5px; padding: 7px 14px; cursor: pointer; font-family: inherit;
}
.dbtn:hover { background: var(--brand-dark); }
.dbtn.ghost {
  background: #fff; color: var(--brand-dark); border: 1px solid var(--brand);
}
.dbtn.ghost:hover { background: var(--brand-soft); }
.dmsg { font-size: 12px; color: var(--sub); min-height: 16px; }
.dmsg.ok { color: var(--ok); }
/* 任务条目 */
.dtask {
  background: #fff; border: 1px solid var(--line-soft); border-radius: 10px;
  padding: 9px 12px; margin-bottom: 8px; font-size: 12.5px;
}
.dtask.done { border-left: 3px solid var(--ok); }
.dtask.error { border-left: 3px solid var(--bad); }
.dtask .tname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dtask .tmsg { color: var(--sub); margin-top: 2px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; word-break: break-all; }
.dtask .pct { height: 5px; background: var(--bg-deep); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.dtask .pct > div { height: 100%; background: var(--brand); width: 0; transition: width .3s; }
/* 等待密码行（加密包字典探不到 → 用户补输继续转换）+ 进行中任务的取消按钮 */
.dtask.needpwd { border-left: 3px solid #c9922a; }
.dtask .pwdrow { display: flex; gap: 6px; margin: 6px 0 2px; }
.dtask .pwdrow input { flex: 1; margin: 0; }
.dtask .tcancel { margin: 5px 0 2px; padding: 2px 12px; font-size: 12px; }
table.ddiff { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 8px; }
table.ddiff td { border-bottom: 1px solid var(--line-soft); padding: 4px 6px; word-break: break-all; }
.noclient {
  background: var(--brand-soft); border: 1px solid #ecd5c6; color: var(--brand-dark);
  border-radius: 10px; padding: 10px 13px; font-size: 12.5px; margin-bottom: 12px;
  display: none;
}

/* ============================================================
   书房精修 v9 —— 工作台首页 / 空状态 / 统一页头分页
   ============================================================ */

/* ---------- 首页问候区 ---------- */
.hello {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  padding: 14px 4px 18px;
}
.hello .h-title {
  font-family: var(--serif); font-size: 24px; font-weight: 700;
  color: var(--ink); letter-spacing: .5px; margin: 0;
}
.hello .h-title small { font-size: 14px; color: var(--ink-3); font-family: var(--sans); font-weight: normal; }
.hello .h-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.fen-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--brand-soft); border: 1px solid #ecd5c6; color: var(--brand-dark);
  border-radius: 999px; padding: 4px 14px; font-size: 13px;
}
.fen-badge b { font-family: var(--serif); font-size: 15px; }

/* ---------- 查询类型分段控件（radio 胶囊） ---------- */
.seg {
  display: inline-flex; background: var(--bg-deep); border-radius: 10px;
  padding: 3px; gap: 2px; margin-bottom: 10px;
}
.seg label {
  margin: 0; padding: 6px 16px; font-size: 13px; color: var(--ink-2);
  border-radius: 8px; cursor: pointer; transition: all .15s; user-select: none;
  white-space: nowrap;
}
.seg input { display: none; width: 0; margin: 0; }
.seg input:checked + label,
.seg label.on {
  background: var(--card); color: var(--brand-dark); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 640px) {
  .seg { width: 100%; }
  .seg label { flex: 1; text-align: center; padding: 6px 4px; }
}

/* ---------- 快捷入口卡 ---------- */
.quick-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 4px 0 18px;
}
.quick-card {
  display: flex; flex-direction: column; gap: 4px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 16px 16px 14px; box-shadow: var(--shadow-sm);
  transition: all .18s; position: relative; overflow: hidden;
}
.quick-card:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: #ecd5c6;
}
.quick-card .q-ico { font-size: 22px; line-height: 1; margin-bottom: 4px; }
.quick-card .q-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.quick-card .q-sub { font-size: 12px; color: var(--sub); }
.quick-card .q-num {
  position: absolute; top: 14px; right: 14px; font-size: 11.5px; color: var(--brand);
  background: var(--brand-soft); border-radius: 999px; padding: 1px 8px;
}
@media (max-width: 640px) { .quick-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- 最近查询 ---------- */
.recent-card { padding-top: 18px; }
.recent-card h2 { font-family: var(--serif); font-size: 16px; margin: 0 0 10px; }
.recent-list { display: flex; flex-direction: column; }
.recent-item {
  display: grid; grid-template-columns: 110px 1fr auto auto; gap: 10px; align-items: center;
  padding: 9px 6px; border-bottom: 1px dashed var(--line-soft); font-size: 13px;
  color: var(--ink); text-decoration: none; transition: background .12s;
}
.recent-item:last-child { border-bottom: none; }
.recent-item:hover { background: #faf8f4; border-radius: 8px; }
.recent-item .r-key { font-family: Consolas, "Courier New", monospace; font-weight: 700; }
.recent-item .r-title {
  color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-item .r-tag { font-size: 12px; border-radius: 999px; padding: 1px 9px; white-space: nowrap; }
.recent-item .r-tag.hit { background: var(--ok-soft); color: var(--ok); }
.recent-item .r-tag.miss { background: #f1efe9; color: var(--sub); }
.recent-item .r-time { font-size: 11.5px; color: var(--sub); white-space: nowrap; }
@media (max-width: 640px) {
  .recent-item { grid-template-columns: 1fr auto; }
  .recent-item .r-title, .recent-item .r-time { display: none; }
}

/* ---------- 精致空状态 ---------- */
.empty-state {
  text-align: center; padding: 44px 20px 40px; color: var(--sub);
}
.empty-state .e-ico { font-size: 40px; line-height: 1; display: block; margin-bottom: 12px; opacity: .85; }
.empty-state .e-main { font-size: 15px; color: var(--ink-2); font-weight: 600; margin: 0 0 6px; }
.empty-state .e-sub { font-size: 13px; margin: 0; }
.empty-state .e-sub a { color: var(--brand-dark); }

/* ---------- 统一页头（列表页 h1 + 副标题 + 右侧操作） ---------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.page-head .ph-main h1 { margin: 0 0 4px; }
.page-head .ph-main .sub { margin: 0; }
.page-head .ph-act { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stat-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--ink-3); background: var(--bg);
  border: 1px solid var(--line-soft); border-radius: 999px; padding: 2px 10px;
}
.stat-chip b { color: var(--brand-dark); font-family: var(--serif); font-size: 13px; }

/* ---------- 统一分页条 ---------- */
.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 16px 0 4px; flex-wrap: wrap;
}
.pager a, .pager span {
  border-radius: 8px; font-size: 13px; padding: 6px 14px;
}
.pager a {
  border: 1px solid var(--line); color: var(--ink-2); text-decoration: none;
  background: var(--card); transition: all .15s;
}
.pager a:hover { border-color: var(--brand); color: var(--brand-dark); }
.pager .pg-cur {
  background: var(--brand); color: #fff; font-weight: 600; padding: 6px 14px;
  border-radius: 8px;
}
.pager .pg-info { color: var(--sub); font-size: 12.5px; }

/* ---------- 登录 hero 精修 ---------- */
.auth-hero { padding: 48px 42px; }
.hero-title { font-size: 32px; }
.hero-feats li { display: flex; align-items: center; }
.hero-feats li::before {
  content: '📖'; margin-right: 10px; font-size: 14px; opacity: .9;
  background: rgba(255,255,255,.16); border-radius: 7px; padding: 2px 5px;
}
.auth-hero .hero-line {
  height: 1px; background: rgba(255,255,255,.25); margin: 20px 0;
}

/* ---------- 抽屉卡片小色条 ---------- */
.dcard h4 {
  display: flex; align-items: center; gap: 7px; margin: 0 0 10px;
}
.dcard h4::before {
  content: ''; width: 3px; height: 12px; border-radius: 2px;
  background: var(--brand); flex: none;
}
.drawer-head h3 { display: flex; align-items: center; gap: 6px; }

