/* ==============================
   全局变量与基础样式
   ============================== */
:root {
  --bg: #f5f7fb;
  --panel: rgba(255, 255, 255, 0.88);
  --text: #172033;
  --muted: #667085;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;
  --border: #e4e7ec;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 20px;
  --sidebar-width: 290px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 35%),
    radial-gradient(circle at 85% 10%, rgba(124, 58, 237, 0.14), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 45%, #eef3fb 100%);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

/* ==============================
   整体布局
   ============================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.main {
  min-width: 0;
  padding: 28px clamp(18px, 4vw, 48px) 48px;
}

/* ==============================
   左侧导航栏
   ============================== */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 100vh;
  padding: 24px 18px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.72);
  border-right: 1px solid rgba(228, 231, 236, 0.8);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 10px 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: #ffffff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  border-radius: 16px;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

.brand-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.nav-section-title {
  margin: 22px 10px 10px;
  color: #98a2b3;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 12px;
  color: #344054;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  transition: 0.2s ease;
}

.nav-btn:hover,
.nav-btn.active {
  color: var(--primary-dark);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.nav-label {
  display: flex;
  gap: 10px;
  align-items: center;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #f2f4f7;
  border-radius: 10px;
}

.nav-btn.active .nav-icon,
.nav-btn:hover .nav-icon {
  background: var(--primary-soft);
}

.count-badge {
  min-width: 26px;
  padding: 2px 8px;
  color: #475467;
  font-size: 12px;
  text-align: center;
  background: #f2f4f7;
  border-radius: 999px;
}

/* ==============================
   通用按钮与移动端顶部栏
   ============================== */
.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.menu-toggle,
.ghost-btn,
.primary-btn {
  padding: 10px 14px;
  color: #344054;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: 0.2s ease;
}

.menu-toggle:hover,
.ghost-btn:hover {
  color: var(--primary);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.primary-btn {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.18);
}

.primary-btn:hover {
  background: var(--primary-dark);
}

/* ==============================
   顶部宣传区
   ============================== */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 5vw, 46px);
  color: #ffffff;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.95), rgba(79, 70, 229, 0.9));
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 30px;
  box-shadow: var(--shadow);
}

/* 右上角光斑用于增强首页层次感。 */
.hero::after {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 320px;
  height: 320px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 50%;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 920px;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  padding: 7px 12px;
  color: #eff6ff;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.hero p {
  max-width: 760px;
  margin: 16px 0 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.hero-actions .ghost-btn {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.28);
}

/* ==============================
   统计卡片与玻璃面板
   ============================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.stat-card,
.toolbar,
.card,
.detail-panel,
.quick-card {
  background: var(--panel);
  border: 1px solid rgba(228, 231, 236, 0.86);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.055);
  backdrop-filter: blur(16px);
}

.stat-card {
  padding: 18px;
}

.stat-value {
  margin: 0;
  color: var(--primary-dark);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
}

/* ==============================
   搜索与筛选工具栏
   ============================== */
.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 180px auto;
  gap: 12px;
  align-items: center;
  margin: 24px 0;
  padding: 14px;
}

.search-box {
  position: relative;
}

.search-box input,
.toolbar select {
  width: 100%;
  height: 44px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 13px;
  outline: none;
  transition: 0.2s ease;
}

.search-box input {
  padding: 0 14px 0 42px;
}

.toolbar select {
  padding: 0 12px;
}

.search-box input:focus,
.toolbar select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  color: #98a2b3;
  transform: translateY(-50%);
}

/* ==============================
   主内容区与知识卡片
   ============================== */
.content-layout {
  display: block;
}

.section-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 18px 0 14px;
}

.section-header h2 {
  margin: 0;
  font-size: 24px;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 240px;
  padding: 18px;
  transition: 0.2s ease;
}

.card:hover {
  border-color: #bfdbfe;
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  color: #667085;
  font-size: 13px;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.card-actions button {
  flex: 1;
  padding: 10px 12px;
  border-radius: 12px;
}

/* ==============================
   标签、风险等级与收藏按钮
   ============================== */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px 9px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  background: #f2f4f7;
  border-radius: 999px;
}

.tag.category {
  color: #1d4ed8;
  background: #dbeafe;
}

.tag.risk-low {
  color: #15803d;
  background: #dcfce7;
}

.tag.risk-medium {
  color: #b45309;
  background: #fef3c7;
}

.tag.risk-high {
  color: #b91c1c;
  background: #fee2e2;
}

.fav-btn {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #98a2b3;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.fav-btn.active {
  color: #f59e0b;
  background: #fffbeb;
  border-color: #fde68a;
}

/* ==============================
   详情面板与右侧快捷卡片
   ============================== */
.side-column {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 16px;
}

.detail-panel,
.quick-card {
  padding: 18px;
}

.detail-panel h2,
.quick-card h3 {
  margin: 0 0 10px;
}

.detail-empty {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 16px;
}

.detail-panel h4 {
  margin: 18px 0 8px;
  font-size: 15px;
}

.detail-panel ol,
.detail-panel ul {
  margin: 8px 0 0;
  padding-left: 22px;
  color: #344054;
}

.detail-panel li + li {
  margin-top: 7px;
}

.copy-area {
  width: 100%;
  min-height: 112px;
  padding: 12px;
  color: #344054;
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 12px;
  resize: vertical;
}

.quick-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quick-list button {
  width: 100%;
  padding: 10px 12px;
  color: #344054;
  text-align: left;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.quick-list button:hover {
  color: var(--primary-dark);
  background: #eff6ff;
  border-color: #bfdbfe;
}

/* ==============================
   空状态、提示与页脚
   ============================== */
.empty-state {
  display: none;
  padding: 42px;
  color: var(--muted);
  text-align: center;
  background: rgba(255, 255, 255, 0.68);
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  padding: 12px 16px;
  color: #ffffff;
  pointer-events: none;
  background: #111827;
  border-radius: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(18px);
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.footer {
  margin-top: 30px;
  padding: 20px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ==============================
   响应式适配
   ============================== */
/* ==============================
   详情弹窗
   ============================== */
body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  padding: 28px;
}

.modal.show {
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.26);
}

.modal-close {
  position: sticky;
  top: 14px;
  z-index: 2;
  float: right;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 14px 14px 0 0;
  color: #475467;
  font-size: 26px;
  line-height: 1;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.modal-close:hover {
  color: var(--primary-dark);
  background: #eff6ff;
  border-color: #bfdbfe;
}

.modal .detail-panel {
  padding: 28px;
  background: #ffffff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

/* ==============================
   优化后的详情弹窗模板
   ============================== */
.modal-dialog {
  width: min(940px, 100%);
}

.modal-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 6px 52px 22px 0;
  border-bottom: 1px solid var(--border);
}

.modal-detail-header h2 {
  margin: 10px 0 8px;
  font-size: 28px;
  line-height: 1.25;
}

.modal-detail-header p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

.detail-meta.compact {
  margin: 0;
}

.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.detail-info-item {
  padding: 14px;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 14px;
}

.detail-info-item span {
  display: block;
  margin-bottom: 4px;
  color: #98a2b3;
  font-size: 12px;
}

.detail-info-item strong {
  color: #344054;
  font-size: 14px;
}

.detail-section {
  margin-top: 16px;
  padding: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.warning-section {
  background: #fffaf0;
  border-color: #fde68a;
}

.template-section {
  background: #f8fbff;
  border-color: #bfdbfe;
}

.detail-section-title,
.template-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-section-title {
  justify-content: flex-start;
}

.detail-section-title h3 {
  margin: 0;
  font-size: 18px;
}

.section-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  color: var(--primary-dark);
  font-size: 14px;
  font-weight: 800;
  background: var(--primary-soft);
  border-radius: 10px;
}

.section-icon.warning {
  color: #b45309;
  background: #fef3c7;
}

.section-icon.template {
  color: #7c3aed;
  background: #ede9fe;
}

.step-list,
.notice-list {
  margin: 14px 0 0;
  padding-left: 22px;
  color: #344054;
}

.step-list li,
.notice-list li {
  padding-left: 4px;
}

.step-list li + li,
.notice-list li + li {
  margin-top: 9px;
}

.template-tip {
  margin: 10px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.template-area {
  min-height: 170px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  line-height: 1.75;
  background: #ffffff;
}

.compact-btn {
  padding: 8px 12px;
  white-space: nowrap;
}

@media (max-width: 920px) {
  .detail-info-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 620px) {
  .modal .detail-panel {
    padding: 22px 16px;
  }

  .modal-detail-header {
    padding-right: 44px;
  }

  .detail-info-grid {
    grid-template-columns: 1fr;
  }

  .template-title-row {
    display: block;
  }

  .compact-btn {
    width: 100%;
    margin-top: 12px;
  }
}

@media (max-width: 1180px) {
  .content-layout {
    grid-template-columns: 1fr;
  }

  .side-column {
    position: static;
  }

  .detail-panel {
    order: -1;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, var(--sidebar-width));
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .stats-grid,
  .articles-grid {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar .search-box {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 18px 14px 34px;
  }

  .hero {
    border-radius: 22px;
  }

  .stats-grid,
  .articles-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .section-header {
    display: block;
  }
}

