:root {
  --ink: #17253a;
  --muted: #617087;
  --navy: #10263f;
  --navy-2: #17395b;
  --blue: #2374a6;
  --cyan: #dff3f6;
  --green: #2d7b65;
  --green-bg: #e7f4ef;
  --amber: #a56718;
  --amber-bg: #fff3dc;
  --red: #a33d3d;
  --red-bg: #fbe9e7;
  --line: #dbe2e8;
  --paper: #ffffff;
  --canvas: #f3f6f8;
  --sidebar: 250px;
  --topbar: 72px;
  --shadow: 0 8px 24px rgba(15, 38, 63, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  height: var(--topbar); display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; color: #fff; background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 226px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: var(--navy); background: #b9e3df; font-weight: 800; font-size: 13px; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 16px; }
.brand small { color: #aebed0; font-size: 11px; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.search-box { width: min(440px, 42vw); height: 42px; display: flex; align-items: center; gap: 9px; padding: 0 12px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); }
.search-box:focus-within { border-color: #b9e3df; background: rgba(255,255,255,.13); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; color: #fff; background: transparent; }
.search-box input::placeholder { color: #b6c4d3; }
kbd { padding: 1px 6px; border: 1px solid rgba(255,255,255,.2); color: #b6c4d3; font-size: 11px; }
.icon-btn, .back-top { border: 0; cursor: pointer; }
.icon-btn { width: 42px; height: 42px; color: #fff; background: rgba(255,255,255,.09); font-size: 20px; }
.icon-btn:hover { background: rgba(255,255,255,.16); }

.sidebar {
  position: fixed; top: var(--topbar); bottom: 0; left: 0; z-index: 10;
  width: var(--sidebar); display: flex; flex-direction: column; padding: 20px 14px;
  background: #e8edf1; border-right: 1px solid var(--line); overflow-y: auto;
}
.nav-group { margin-bottom: 18px; }
.nav-group > span { display: block; padding: 0 11px 6px; color: #7c8999; font-size: 11px; font-weight: 700; }
.nav-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 11px; margin: 2px 0; border-left: 3px solid transparent; color: #42536a; font-size: 13px; }
.nav-link:hover { color: var(--navy); background: rgba(255,255,255,.65); }
.nav-link.active { color: var(--navy); background: #fff; border-left-color: var(--blue); font-weight: 700; box-shadow: 0 2px 8px rgba(15,38,63,.05); }
.nav-icon { width: 22px; color: var(--blue); font-size: 12px; text-align: center; }
.sidebar-note { margin-top: auto; padding: 14px 12px; border-top: 1px solid #cfd8df; color: #748195; font-size: 11px; }
.sidebar-note span { color: var(--ink); font-weight: 700; }
.sidebar-note p { margin: 4px 0 0; }

main { margin: var(--topbar) 0 0 var(--sidebar); min-height: calc(100vh - var(--topbar)); padding: 38px 42px 70px; }
.home, .module-page, .search-page { max-width: 1280px; margin: 0 auto; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-family: Georgia, "Times New Roman", serif; font-size: 11px; font-weight: 700; letter-spacing: 1.8px; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: 0; }
h1 { color: var(--navy); font-family: SimSun, "Songti SC", serif; font-size: 34px; }
h2 { color: var(--navy); font-family: SimSun, "Songti SC", serif; font-size: 24px; }
h3 { font-size: 17px; }

.home-heading { display: flex; justify-content: space-between; gap: 30px; align-items: flex-end; margin-bottom: 28px; }
.home-heading > div:first-child { max-width: 700px; }
.home-heading h1 { font-size: 40px; }
.home-heading p:not(.eyebrow) { margin: 12px 0 0; color: var(--muted); }
.metric-chain { display: flex; align-items: center; gap: 8px; padding: 13px 16px; color: var(--navy); background: var(--cyan); border-bottom: 3px solid #5eb0b4; font-size: 12px; font-weight: 700; white-space: nowrap; }
.metric-chain i { color: #6c8795; font-style: normal; }

.entry-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.entry-card { position: relative; min-height: 190px; padding: 22px; overflow: hidden; color: #fff; background: var(--navy); border: 1px solid transparent; transition: transform .18s ease, box-shadow .18s ease; }
.entry-card:nth-child(2) { background: #174d63; }
.entry-card:nth-child(3) { color: var(--ink); background: #bfe2dd; }
.entry-card:nth-child(4) { color: var(--ink); background: #f1c56f; }
.entry-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.entry-card .number { display: block; margin-bottom: 28px; opacity: .65; font-family: Georgia, serif; font-size: 13px; }
.entry-card h2 { color: inherit; font-family: "Microsoft YaHei UI", sans-serif; font-size: 19px; }
.entry-card p { margin: 9px 0 0; opacity: .78; font-size: 12px; }
.entry-card b { position: absolute; right: 18px; bottom: 12px; font-size: 25px; font-weight: 400; }

.today-strip { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; margin: 18px 0 42px; padding: 17px 20px; color: #fff; background: var(--navy-2); }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; background: #74d0a8; border-radius: 50%; box-shadow: 0 0 0 4px rgba(116,208,168,.15); }
.today-strip ol { display: flex; margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.today-strip li { counter-increment: steps; color: #c9d5e0; font-size: 12px; white-space: nowrap; }
.today-strip li::before { content: counter(steps); display: inline-grid; place-items: center; width: 20px; height: 20px; margin: 0 6px 0 12px; color: #fff; border: 1px solid #66819d; font-size: 10px; }
.today-strip a { color: #a9e2d9; font-size: 12px; font-weight: 700; }

.home-section { margin-top: 36px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.section-heading > p { margin: 0; color: var(--muted); font-size: 12px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick-card, .template-card { display: flex; justify-content: space-between; gap: 14px; padding: 18px; background: var(--paper); border: 1px solid var(--line); transition: border-color .16s, box-shadow .16s; }
.quick-card:hover, .template-card:hover { border-color: #94b8c9; box-shadow: var(--shadow); }
.quick-card h3, .template-card h3 { font-size: 14px; }
.quick-card p, .template-card p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.quick-card span, .template-card span { color: var(--blue); font-size: 18px; }
.template-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.template-card { min-height: 112px; flex-direction: column; }

.module-header { display: flex; justify-content: space-between; gap: 30px; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line); }
.module-header > div:first-child { max-width: 760px; }
.module-summary { margin: 10px 0 0; color: var(--muted); }
.module-meta { min-width: 210px; align-self: flex-end; padding: 14px 16px; background: #e6edf2; border-left: 3px solid var(--blue); font-size: 12px; }
.module-meta span { display: block; color: var(--muted); }
.module-meta strong { display: block; margin-top: 2px; color: var(--ink); }

.section-block { margin: 0 0 28px; scroll-margin-top: 92px; }
.block-title { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.block-title .index { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; color: #fff; background: var(--blue); font-family: Georgia, serif; font-size: 12px; }
.block-title p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sop-card { background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--navy-2); }
.sop-card.full { grid-column: 1 / -1; }
.sop-card > header { display: flex; justify-content: space-between; gap: 15px; padding: 17px 19px 13px; border-bottom: 1px solid #e8edf1; }
.sop-card > header h3 { color: var(--navy); }
.badge { align-self: flex-start; padding: 3px 7px; color: var(--green); background: var(--green-bg); font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge.warn { color: var(--amber); background: var(--amber-bg); }
.badge.risk { color: var(--red); background: var(--red-bg); }
.card-fields { display: grid; grid-template-columns: 122px 1fr; }
.field-label, .field-content { padding: 11px 15px; border-bottom: 1px solid #edf0f2; }
.field-label { color: #6d7988; background: #f8fafb; font-size: 11px; font-weight: 700; }
.field-content { color: #2e3c4e; font-size: 13px; }
.field-content ul, .field-content ol { margin: 0; padding-left: 20px; }
.field-content li + li { margin-top: 4px; }
.field-content strong { color: var(--navy); }
.field-content .decision { display: block; padding: 7px 9px; margin: 3px 0; background: #f2f6f8; border-left: 2px solid #7db1c3; }

.diagnostic-chain { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; margin-bottom: 18px; background: var(--line); border: 1px solid var(--line); }
.diagnostic-chain span { position: relative; padding: 14px 8px; text-align: center; background: #fff; font-size: 11px; font-weight: 700; }
.diagnostic-chain span:not(:last-child)::after { content: "→"; position: absolute; right: -8px; z-index: 1; color: var(--blue); }

.data-table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; font-size: 12px; }
.data-table th { padding: 11px 12px; color: #fff; background: var(--navy-2); text-align: left; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tr:nth-child(even) td { background: #f7f9fa; }
.data-table .blank { min-width: 110px; height: 42px; }
.callout { padding: 14px 16px; margin: 12px 0; color: #46566a; background: var(--amber-bg); border-left: 4px solid #d49a3d; font-size: 12px; }
.callout.risk { color: #713434; background: var(--red-bg); border-left-color: #c25454; }
.callout.info { color: #315a66; background: var(--cyan); border-left-color: #5eb0b4; }

.search-page h1 { margin-bottom: 8px; }
.search-summary { color: var(--muted); }
.search-results { display: grid; gap: 10px; margin-top: 24px; }
.search-result { display: grid; grid-template-columns: 150px 1fr auto; gap: 18px; align-items: center; padding: 16px 18px; background: #fff; border: 1px solid var(--line); }
.search-result:hover { border-color: #84aebf; }
.search-result .result-module { color: var(--blue); font-size: 11px; font-weight: 700; }
.search-result h3 { margin-bottom: 4px; }
.search-result p { margin: 0; color: var(--muted); font-size: 12px; }
.search-empty { padding: 50px 20px; text-align: center; background: #fff; border: 1px solid var(--line); color: var(--muted); }
mark { color: inherit; background: #ffe49a; }
.back-top { position: fixed; right: 24px; bottom: 22px; width: 42px; height: 42px; color: #fff; background: var(--navy); opacity: 0; pointer-events: none; transition: opacity .2s; }
.back-top.visible { opacity: 1; pointer-events: auto; }

@media (max-width: 1050px) {
  :root { --sidebar: 210px; }
  main { padding: 30px 25px 60px; }
  .entry-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .template-grid { grid-template-columns: repeat(3, 1fr); }
  .today-strip { grid-template-columns: 1fr auto; }
  .today-strip ol { grid-column: 1 / -1; order: 3; flex-wrap: wrap; }
}

@media (max-width: 760px) {
  :root { --topbar: 64px; }
  .topbar { padding: 0 12px; }
  .brand { min-width: auto; }
  .brand strong { font-size: 14px; }
  .brand small, kbd { display: none; }
  .brand-mark { width: 36px; height: 36px; }
  .search-box { width: 44vw; }
  .sidebar { position: static; width: auto; height: 48px; margin-top: var(--topbar); padding: 0; overflow-x: auto; overflow-y: hidden; display: block; white-space: nowrap; border: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; }
  .nav-group { display: contents; }
  .nav-group > span, .sidebar-note { display: none; }
  .nav-link { display: inline-flex; height: 48px; margin: 0; padding: 0 13px; border-left: 0; border-bottom: 3px solid transparent; }
  .nav-link.active { border-bottom-color: var(--blue); box-shadow: none; }
  .nav-icon { display: none; }
  main { margin: 0; min-height: auto; padding: 25px 14px 55px; }
  .home-heading, .module-header { display: block; }
  .metric-chain { margin-top: 18px; overflow-x: auto; }
  .home-heading h1 { font-size: 32px; }
  h1 { font-size: 29px; }
  .entry-grid, .quick-grid, .template-grid, .card-grid { grid-template-columns: 1fr; }
  .entry-card { min-height: 145px; }
  .entry-card .number { margin-bottom: 18px; }
  .today-strip { display: block; }
  .today-strip ol { margin: 12px 0; }
  .today-strip li::before { margin-left: 0; }
  .module-meta { margin-top: 18px; min-width: 0; }
  .card-fields { grid-template-columns: 1fr; }
  .field-label { padding-bottom: 3px; border-bottom: 0; }
  .field-content { padding-top: 4px; }
  .diagnostic-chain { grid-template-columns: repeat(2, 1fr); }
  .diagnostic-chain span::after { display: none; }
  .search-result { grid-template-columns: 1fr auto; }
  .search-result .result-module { grid-column: 1 / -1; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; font-size: 10pt; }
  .topbar, .sidebar, .back-top, .entry-grid, .today-strip, .quick-grid, .template-grid { display: none !important; }
  main { margin: 0; padding: 0; }
  .home-heading { margin: 0 0 10mm; }
  .home-heading h1 { font-size: 24pt; }
  .module-page, .home, .search-page { max-width: none; }
  .module-header { page-break-after: avoid; }
  .section-block, .sop-card, .data-table-wrap { break-inside: avoid; }
  .card-grid { grid-template-columns: 1fr; }
  .sop-card { border-color: #999; }
  .field-label, .field-content { padding: 6px 8px; }
  .data-table th { color: #000; background: #e3e8eb; }
}
