* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f4f8; color: #1f2937;
  display: flex; flex-direction: column; overflow: hidden;
}

/* 顶栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px; background: linear-gradient(135deg, #0f4c81, #1a6fb5);
  color: #fff; position: sticky; top: 0; z-index: 50; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.brand { display: flex; align-items: center; }
.topbar h1 { font-size: 19px; font-weight: 600; }
.subtitle { font-size: 12px; opacity: .8; margin-top: 2px; }

.actions { display: flex; align-items: center; }
.topbar-stat {
  font-size: 13px; color: #fff; background: rgba(255,255,255,.14);
  padding: 7px 14px; border-radius: 20px; margin-right: 14px; white-space: nowrap;
}
.topbar-stat b { font-size: 15px; font-weight: 700; }

.btn-primary {
  background: #ffb020; color: #1f2937; border: none; border-radius: 8px;
  padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: .2s;
}
.btn-primary:hover { background: #ffc44d; transform: translateY(-1px); }
.btn-primary:disabled { background: #94a3b8; color: #fff; cursor: wait; transform: none; }
.btn-secondary {
  background: #0f4c81; color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 14px; cursor: pointer;
}

/* 布局 */
.layout {
  display: flex; max-width: 1400px; width: 100%; margin: 0 auto;
  gap: 20px; padding: 20px; flex: 1; min-height: 0;
}
.sidebar {
  width: 250px; flex-shrink: 0; background: #fff; border-radius: 12px;
  padding: 14px; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.sidebar h3 { font-size: 14px; margin: 4px 0 6px; color: #475569; }
.sidebar h3 + .filter-list, .sidebar h3 + .calendar { margin-top: 0; }
.sidebar h3:not(:first-child) { margin-top: 10px; }
.calendar {
  border: 1px solid #e2e8f0; border-radius: 10px; padding: 8px;
  background: #fbfdff; user-select: none;
}
.cal-head { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px; }
.cal-head span { font-size: 13.5px; font-weight: 600; color: #0f3a63; }
.cal-head button {
  border: none; background: #eef4fa; color: #0f4c81; width: 26px; height: 26px;
  border-radius: 6px; cursor: pointer; font-size: 15px; line-height: 1;
}
.cal-head button:hover { background: #dbebfa; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { text-align: center; font-size: 11px; color: #94a3b8; padding: 2px 0; }
.cal-day {
  position: relative; text-align: center; font-size: 12px; color: #334155;
  padding: 4px 0; border-radius: 6px; cursor: pointer; line-height: 1.2;
}
.cal-day:hover { background: #e8f1fb; }
.cal-day.has-data { font-weight: 600; color: #0f4c81; }
.cal-day.has-data::after {
  content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%; background: #1a6fb5;
}
.cal-day.today { outline: 1px dashed #94a3b8; outline-offset: -1px; }
.cal-day.sel { background: #0f4c81; color: #fff; }
.cal-day.sel::after { background: #ffb020; }
.cal-day.dim { color: #cbd5e1; cursor: default; background: none; }
.calendar .btn-clear { width: 100%; margin-top: 8px; padding: 6px 0; }
.btn-clear {
  border: 1px solid #dbe3ec; background: #f8fafc; color: #64748b;
  border-radius: 8px; padding: 0 12px; font-size: 13px; cursor: pointer;
}
.btn-clear:hover { background: #eef2f7; color: #334155; }
.filter-list { list-style: none; flex: 0 1 auto; min-height: 48px; overflow-y: auto; margin-bottom: 4px; }
.filter-list li {
  display: flex; justify-content: space-between; padding: 5px 10px;
  border-radius: 8px; font-size: 13px; cursor: pointer; color: #334155;
}
.filter-list li:hover { background: #f1f5f9; }
.filter-list li.active { background: #0f4c81; color: #fff; }
.filter-list .count { font-size: 12px; opacity: .7; }

/* 主区 */
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.toolbar {
  display: flex; gap: 10px; align-items: center; background: #fff;
  padding: 12px 16px; border-radius: 12px; margin-bottom: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); flex-shrink: 0;
}
.toolbar input[type=search] { flex: 1; padding: 9px 14px; border: 1px solid #dbe3ec;
  border-radius: 8px; font-size: 14px; outline: none; }
.toolbar input[type=date] { padding: 8px 10px; border: 1px solid #dbe3ec;
  border-radius: 8px; font-size: 13px; color: #475569; }
.toolbar input:focus { border-color: #1a6fb5; }

.article-list {
  display: flex; flex-direction: column; gap: 12px;
  flex: 1; min-height: 0; overflow-y: auto; padding: 4px 6px 10px 4px;
}
.card {
  background: #fff; border-radius: 12px; padding: 16px 20px; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); transition: .15s;
  border-left: 4px solid transparent;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,76,129,.12);
  border-left-color: #1a6fb5; }
.card-title { font-size: 16px; font-weight: 600; color: #0f3a63; line-height: 1.5; }
.card-summary { font-size: 13.5px; color: #64748b; margin-top: 6px; line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.tag { font-size: 12px; padding: 2px 10px; border-radius: 20px; background: #e8f1fb;
  color: #0f4c81; font-weight: 500; }
.tag.src { background: #f3f0ff; color: #6d28d9; }
.tag.star { background: #fef3c7; color: #b45309; font-weight: 600; }
.tag.mid { background: #f1f5f9; color: #64748b; }
.star-toggle { display: flex; align-items: center; gap: 5px; font-size: 13.5px;
  color: #b45309; font-weight: 600; cursor: pointer; white-space: nowrap; }
.star-toggle input { accent-color: #f59e0b; width: 15px; height: 15px; cursor: pointer; }
.m-guidance {
  display: none; background: #fffbeb; border-left: 4px solid #f59e0b; margin: 12px 0;
  padding: 12px 16px; border-radius: 0 8px 8px 0; font-size: 14px; color: #78350f;
  line-height: 1.7;
}
.date { font-size: 12px; color: #94a3b8; margin-left: auto; }

.empty { text-align: center; padding: 80px 0; color: #94a3b8; }
.pagination { display: flex; justify-content: center; gap: 8px; margin: 14px 0 0; flex-shrink: 0; }
.pagination button {
  border: 1px solid #dbe3ec; background: #fff; border-radius: 8px;
  padding: 6px 14px; cursor: pointer; font-size: 13px;
}
.pagination button.cur { background: #0f4c81; color: #fff; border-color: #0f4c81; }
.pagination button:disabled { opacity: .4; cursor: default; }

/* Toast */
.toast {
  position: fixed; top: 76px; right: 24px; z-index: 100;
  background: #10b981; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2);
  transition: opacity .3s, transform .3s;
}
.toast.err { background: #ef4444; }
.toast.info { background: #0f4c81; }
.hidden { display: none !important; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 90; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,23,42,.55); }
.modal-body {
  position: relative; background: #fff; width: min(860px, 92vw);
  max-height: 86vh; margin: 5vh auto; border-radius: 14px;
  padding: 30px 36px 22px;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-right: 6px; }
.modal-footer {
  flex-shrink: 0; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid #e2e8f0; background: #fff;
}
.modal-close { position: absolute; top: 14px; right: 16px; border: none;
  background: #f1f5f9; width: 32px; height: 32px; border-radius: 50%;
  cursor: pointer; font-size: 14px; }
#mTitle { font-size: 21px; color: #0f3a63; line-height: 1.5; padding-right: 40px; }
.m-meta { display: flex; gap: 8px; margin: 12px 0; align-items: center; }
.m-summary { background: #f0f7ff; border-left: 4px solid #1a6fb5; padding: 12px 16px;
  border-radius: 0 8px 8px 0; font-size: 14px; color: #334155; line-height: 1.8; }
.m-content { margin-top: 18px; font-size: 15px; color: #1f2937; }
.m-content p { line-height: 2; text-indent: 2em; margin: 0 0 6px; }
.m-content p.sec-head { text-indent: 0; font-weight: 700; color: #0f3a63; margin: 14px 0 4px; }
/* 富文本正文（服务端净化 HTML） */
.m-content.rich p { line-height: 2; text-indent: 2em; margin: 0 0 6px; }
.m-content.rich h1, .m-content.rich h2, .m-content.rich h3,
.m-content.rich h4, .m-content.rich h5 {
  text-indent: 0; color: #0f3a63; margin: 18px 0 8px; line-height: 1.6;
  font-size: 16.5px; font-weight: 700;
}
.m-content.rich p:has(> strong:only-child), .m-content.rich p:has(> b:only-child) {
  text-indent: 0; margin: 14px 0 4px; font-size: 15.5px;
}
.m-content.rich strong, .m-content.rich b { color: #0f3a63; }
.m-content.rich ul, .m-content.rich ol { padding-left: 2.2em; margin: 6px 0; }
.m-content.rich li { line-height: 1.9; margin: 2px 0; }
.m-content.rich table {
  width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 13.5px;
}
.m-content.rich td, .m-content.rich th {
  border: 1px solid #dbe3ec; padding: 6px 10px; line-height: 1.6;
}
.m-content.rich th { background: #f0f4f8; }
.m-content.rich blockquote {
  border-left: 3px solid #cbd5e1; margin: 10px 0; padding: 6px 14px;
  color: #475569; background: #f8fafc;
}
.m-link { display: inline-block; text-decoration: none; }
.m-attach {
  display: none; margin-top: 22px; border: 1px solid #dbe3ec; border-radius: 8px;
  background: #f8fafc; padding: 12px 18px;
}
.m-attach-title { font-size: 13px; font-weight: 600; color: #475569;
  border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; margin-bottom: 4px; }
.m-attach a {
  display: block; color: #1a6fb5; font-size: 14px; padding: 6px 0;
  text-decoration: none; line-height: 1.6;
}
.m-attach a:hover { text-decoration: underline; color: #0f4c81; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .layout { flex-direction: column; flex: none; }
  .sidebar { width: 100%; overflow: visible; }
  .sidebar .filter-list { flex: none; max-height: none; overflow: visible; }
  .article-list { overflow: visible; }
}
