/* ============================================================
   MedPusher · 文献智能推送系统 · 全局样式
   清新简约学术风：低饱和静谧蓝 + 浅冷灰 + 柔和留白
   大号版：整体放大、内容铺满屏幕、减少留白
   ============================================================ */

:root {
  /* 色彩规范 */
  --bg: #f5f7fb;              /* 极浅冷灰白，页面底色 */
  --surface: #ffffff;         /* 卡片底色 */
  --line: #e9edf4;            /* 浅淡分割线/边框 */
  --line-strong: #dde4ee;

  --ink: #252d3a;             /* 主文字 */
  --ink-2: #4c5a6e;           /* 次级文字 */
  --ink-3: #8b96a8;           /* 弱化文字 */

  --brand: #5279c9;           /* 低饱和静谧蓝 */
  --brand-deep: #4669b3;
  --brand-soft: #eef3fb;

  --green: #2fa98a;           /* 浅薄荷绿 */
  --green-soft: #e5f6f0;
  --red: #c85c4e;             /* 柔和砖红 */
  --red-soft: #fbecea;
  --amber: #d99a2b;
  --amber-soft: #fbf3e2;

  --nav: #31383f;             /* 低饱和冷炭灰，导航栏 */
  --nav-ink: #d7dde5;

  --radius-card: 16px;
  --radius-ctrl: 10px;
  --shadow-card: 0 1px 2px rgba(23, 32, 46, .04), 0 6px 20px rgba(23, 32, 46, .06);
  --shadow-soft: 0 1px 2px rgba(23, 32, 46, .04);
  --shadow-pop: 0 10px 40px rgba(23, 32, 46, .16);

  --font: "Segoe UI", -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: Consolas, "Cascadia Mono", Menlo, monospace;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: .18s;
}

* { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 15.5px;
}

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

/* ===================== 顶部导航 ===================== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--nav);
  color: #fff;
  padding: 0 32px;
  height: 64px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 4px 14px rgba(20, 26, 34, .18);
}
.nav-brand {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
}
.nav-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 11px;
  flex: 0 0 auto;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .18);
}
.nav-sub { font-size: 13px; color: var(--nav-ink); margin-left: 8px; font-weight: 400; opacity: .75; }
.nav-links a {
  color: var(--nav-ink);
  margin-left: 20px;
  font-size: 15.5px;
  padding: 8px 14px;
  border-radius: 9px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-links a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav-links a.active { color: #fff; background: rgba(255, 255, 255, .12); font-weight: 600; }

/* ===================== 页面容器 ===================== */
.container {
  max-width: 1460px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 32px 56px;
}
.container-wide { max-width: 1800px; }
.users-table th, .users-table td { white-space: nowrap; }
.page-title {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 24px;
  letter-spacing: .2px;
  display: flex;
  align-items: center;
}
.page-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 26px;
  border-radius: 3px;
  background: var(--brand);
  margin-right: 14px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.page-head .page-title { margin-bottom: 8px; }

/* ===================== 卡片 ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--dur) var(--ease);
}
.card:hover { box-shadow: 0 1px 2px rgba(23, 32, 46, .04), 0 8px 26px rgba(23, 32, 46, .09); }
.card h2 {
  font-size: 19px;
  font-weight: 650;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  letter-spacing: .2px;
}
.card h3 {
  font-size: 16.5px;
  font-weight: 600;
  margin: 20px 0 12px;
  color: var(--ink-2);
}
.card hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 22px 0;
}

/* ===================== 按钮 ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctrl);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.btn:hover { background: #f3f6fb; border-color: #cdd6e3; box-shadow: var(--shadow-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }

.btn-danger { color: var(--red); border-color: #edc9c3; background: var(--surface); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }

.btn-warn { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn-warn:hover { background: #c8881f; border-color: #c8881f; }

.btn-sm { padding: 8px 16px; font-size: 14px; border-radius: 8px; }
.btn-block { display: block; width: 100%; margin-top: 10px; }

/* ===================== 提示条 ===================== */
.flash {
  padding: 14px 18px;
  border-radius: 11px;
  margin-bottom: 22px;
  font-size: 15px;
  box-shadow: var(--shadow-soft);
}
.flash.info { background: var(--brand-soft); color: var(--brand-deep); border: 1px solid #d6e3f7; }
.flash.error { background: var(--red-soft); color: var(--red); border: 1px solid #f2d4cf; }

/* ===================== 认证页 ===================== */
.auth-wrap { display: flex; justify-content: center; align-items: flex-start; padding: 56px 16px 48px; }
.auth-card {
  width: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 42px 46px;
  box-shadow: var(--shadow-card);
}
.auth-logo {
  display: block;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
  box-shadow: 0 4px 14px rgba(23, 32, 46, .18);
}
.auth-card h1 { margin: 0; text-align: center; font-size: 30px; letter-spacing: .5px; }
.auth-desc { text-align: center; color: var(--ink-3); margin: 8px 0 0; font-size: 14px; }
.tabs { display: flex; list-style: none; padding: 0; margin: 28px 0 22px; border-bottom: 1px solid var(--line); gap: 6px; }
.tab {
  flex: 1;
  text-align: center;
  padding: 12px 0;
  cursor: pointer;
  color: var(--ink-3);
  font-size: 15px;
  border-radius: 8px 8px 0 0;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tab.active { color: var(--brand); font-weight: 600; box-shadow: inset 0 -2px 0 var(--brand); }

/* ===================== 表单控件 ===================== */
label { display: block; margin: 16px 0 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctrl);
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(82, 121, 201, .16);
}
select { cursor: pointer; }

.check-label { display: block; margin-top: 14px; font-weight: 500; color: var(--ink-2); }
.check-row { display: flex; gap: 24px; margin: 16px 0; flex-wrap: wrap; }
.check-row label { margin: 0; display: flex; align-items: center; gap: 7px; font-weight: 500; }
input[type=checkbox] { accent-color: var(--brand); width: 17px; height: 17px; cursor: pointer; }
.form-row { display: flex; gap: 14px; align-items: flex-end; }
.form-col { flex: 1; }
.grow { flex: 1; }

.pt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 20px; margin: 10px 0 16px; }
.pt-grid label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; color: var(--ink-2); font-size: 14px; }

/* ===================== 统计卡片 ===================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 22px; margin-bottom: 28px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 28px 24px 22px;
  text-align: center;
  box-shadow: var(--shadow-soft);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-card); transform: translateY(-3px); }
.stat-num {
  font-size: 44px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: .5px;
  color: var(--brand);
}
.stat-label { color: var(--ink-3); margin-top: 8px; font-size: 14.5px; font-weight: 500; }
.stat-card:nth-child(2) .stat-num { color: var(--green); }
.stat-card:nth-child(3) .stat-num { color: var(--amber); }
.stat-card:nth-child(4) .stat-num { color: var(--red); }

/* ===================== 表格 ===================== */
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 14px;
  text-align: left;
  vertical-align: middle;
}
.table th {
  color: var(--ink-3);
  font-weight: 600;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: #f8fafd;
}
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table tbody tr { transition: background var(--dur) var(--ease); }
.table tbody tr:hover { background: #f8fafd; }

/* ===================== 徽章 / 标签 ===================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: #eef1f6;
  color: var(--ink-2);
  border: 1px solid transparent;
}
.badge.success { background: var(--green-soft); color: var(--green); }
.badge.danger { background: var(--red-soft); color: var(--red); }

/* ===================== 通用文字 ===================== */
.empty { color: var(--ink-3); text-align: center; padding: 40px 0; }
.muted { color: var(--ink-3); font-size: 14px; }

/* ===================== 检索策略页 ===================== */
.strategy-card { transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.strategy-card:hover { border-color: #d4deec; }
.strategy-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.strategy-name { font-size: 18px; font-weight: 700; color: var(--ink); }
.strategy-head .badge { margin-left: 10px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.strategy-query {
  font-family: var(--mono);
  background: #f6f8fc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 14.5px;
  color: #34405a;
  line-height: 1.7;
  word-break: break-word;
}
.strategy-meta { font-size: 14px; color: var(--ink-3); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.strategy-meta .sep { color: var(--line-strong); }

/* ===================== 文献库页 ===================== */
.lit-layout { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }
.sidebar { position: sticky; top: 216px; margin: 26px 0 0 -6px; }
.sidebar .card h3 { font-size: 15.5px; margin-top: 6px; }
.sidebar .card label { margin-top: 16px; }

.kw-chip {
  display: inline-flex;
  align-items: center;
  background: var(--brand-soft);
  color: var(--brand-deep);
  border-radius: 18px;
  padding: 5px 14px;
  margin: 4px 4px 0 0;
  font-size: 14px;
  transition: background var(--dur) var(--ease);
}
.kw-chip a { color: var(--brand-deep); margin-left: 5px; opacity: .7; }
.kw-chip a:hover { opacity: 1; text-decoration: none; }
.kw-add { display: flex; gap: 10px; margin-top: 12px; }

.lit-card {
  display: flex;
  flex-direction: column;
  padding: 40px 42px;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.lit-card:hover { border-color: #d4deec; }
.lit-head { display: flex; align-items: flex-start; gap: 14px; }
.lit-checkbox { flex: 0 0 auto; width: 22px; height: 22px; margin-top: 5px; accent-color: var(--brand); cursor: pointer; }
.lit-title { font-weight: 700; font-size: 21px; line-height: 1.45; color: var(--ink); }

.lit-sticky {
  position: sticky;
  top: 64px;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 16px -12px rgba(23, 32, 46, .25);
}
.lit-sticky-inner {
  max-width: calc(1460px - 64px);
  margin: 0 auto;
  padding: 6px 40px 20px;
}
.lit-sticky .page-title { margin-bottom: 14px; }
.lit-sticky .lit-toolbar { margin-bottom: 0; }

.lit-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 14px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
  flex-wrap: wrap;
}
.lit-toolbar .select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
}
.lit-toolbar .select-all input { width: 19px; height: 19px; accent-color: var(--brand); cursor: pointer; }
.lit-toolbar .toolbar-actions { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; align-items: center; }
.lit-toolbar .page-size-label { display: inline-flex; align-items: center; white-space: nowrap; color: var(--ink-3); font-size: 14px; font-weight: 500; margin: 0 2px 0 6px; }
.lit-toolbar .page-size-sel { width: 76px; padding: 8px 10px; font-size: 14px; }
.lit-meta { color: var(--ink-3); font-size: 15.5px; margin: 12px 0 14px; display: flex; gap: 24px; flex-wrap: wrap; }
.lit-meta span { display: inline-flex; align-items: center; gap: 6px; }
.lit-abs { font-size: 19.5px; color: var(--ink-2); line-height: 1.65; }

.ai-inline {
  margin: 18px 0 10px;
  padding: 16px 22px;
  background: var(--brand-soft);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
}
.ai-label { font-weight: 700; font-size: 14px; color: var(--brand-deep); margin-right: 8px; }
.ai-stars { color: var(--amber); font-size: 17px; letter-spacing: 2px; }
.ai-text { font-size: 18px; color: #36455c; margin-top: 6px; white-space: pre-wrap; }
.ai-error { font-size: 14px; color: var(--red); }

.lit-actions { margin-top: 20px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.lit-actions .rating { width: auto; padding: 9px 12px; font-size: 14px; }
.rating { width: auto; padding: 9px 12px; }
.lit-actions .btn-sm { font-size: 14px; padding: 9px 18px; }

.lit-list { display: flex; flex-direction: column; gap: 26px; }
.pagination { display: flex; align-items: center; gap: 16px; justify-content: center; margin: 30px 0 10px; }
.page-info { color: var(--ink-3); font-size: 14px; }
mark { background: #fbeeb8; border-radius: 3px; padding: 0 2px; }

/* ===================== 系统设置页 ===================== */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; margin-bottom: 18px; }
.field label { margin: 0 0 8px; }
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 12px; margin-bottom: 14px; }
.field-hint { display: block; margin-top: 7px; font-size: 12.5px; color: var(--ink-3); line-height: 1.55; }
.guide-list { margin: 12px 0 0; padding-left: 22px; color: var(--ink-2); line-height: 1.9; font-size: 14.5px; }
.guide-list li { margin-bottom: 6px; }

.quota-bar { width: 140px; height: 10px; background: #e8ecf2; border-radius: 6px; overflow: hidden; margin: 3px 0 5px; }
.quota-bar-fill { height: 100%; border-radius: 6px; transition: width .3s ease; }
.quota-bar-fill.ok { background: #34a853; }
.quota-bar-fill.warn { background: #f5a623; }
.quota-bar-fill.danger { background: #e5484d; }

.gauge-wrap { position: relative; width: 150px; height: 150px; margin: 6px auto 4px; }
.gauge-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gauge-pct { font-size: 30px; font-weight: 700; color: #34a853; line-height: 1.1; }
.gauge-label { font-size: 12px; color: var(--ink-3); }

/* 流量监控 */
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; }
.trend-chart h3 { font-size: 15px; margin: 0 0 10px; }
.trend-chart .bars { display: flex; align-items: flex-end; gap: 4px; height: 140px; }
.trend-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; }
.trend-chart .bar { width: 100%; max-width: 22px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .3s ease; }
.trend-chart .bar-date { font-size: 10px; color: var(--ink-3); writing-mode: horizontal-tb; }
.stats-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 920px) { .stats-grid-2 { grid-template-columns: 1fr; } }

.test-result { padding: 14px 16px; border-radius: 10px; font-size: 14px; margin-top: 14px; white-space: pre-wrap; word-break: break-word; }.test-result.loading { background: #f4f6fa; color: var(--ink-2); border: 1px solid var(--line); }
.test-result.success { background: var(--green-soft); color: var(--green); border: 1px solid #cdeee2; }
.test-result.error { background: var(--red-soft); color: var(--red); border: 1px solid #f2d4cf; }

/* ===================== 弹窗 ===================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 40, .46);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-box {
  background: var(--surface);
  border-radius: 18px;
  padding: 30px 34px;
  width: 580px;
  max-width: 96vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-pop);
  animation: modalIn .22s var(--ease);
}
.modal-lg { width: 820px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 22px; }
.ann-content { white-space: pre-wrap; word-break: break-word; line-height: 1.8; font-size: 14.5px; color: var(--ink-2); max-height: 46vh; overflow-y: auto; }
textarea#ann_content { width: 100%; box-sizing: border-box; resize: vertical; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ===================== 响应式 ===================== */
@media (max-width: 1100px) {
  .lit-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .container { padding: 20px 16px 48px; }
  .lit-sticky-inner { padding: 6px 24px 18px; }
  .topnav { padding: 0 16px; }
  .nav-links a { margin-left: 8px; padding: 8px 10px; font-size: 14px; }
  .field-grid { grid-template-columns: 1fr; }
  .pt-grid { grid-template-columns: 1fr; }
  .row-actions { width: 100%; }
}
