/* ========== 全站基础 ========== */
* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif;
    background: #F7FBFD;
    color: #333;
    font-size: 14px;
}
a { color:#2D5B99; text-decoration:none; }
a:hover { color:#204372; }

/* ========== 顶部栏 ========== */
.topbar {
    height: 50px;
    background: linear-gradient(135deg, #2D5B99 0%, #204372 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    position: fixed; top:0; left:0; right:0; z-index:100;
}
.topbar-logo { font-size:22px; margin-right:8px; }
.topbar-title { font-size:16px; font-weight:bold; letter-spacing:1px; }
.topbar-right { display:flex; align-items:center; gap:15px; font-size:13px; }
.topbar-user { color:#F2CA70; font-weight:bold; }
.topbar-link { color:#fff; opacity:.9; }
.topbar-link:hover { color:#F2CA70; opacity:1; }

/* ========== 布局 ========== */
.layout { display:flex; margin-top:50px; min-height: calc(100vh - 90px); }
.sidebar {
    width: 180px;
    background: #fff;
    border-right: 1px solid #D6E8F7;
    padding: 15px 0;
    flex-shrink: 0;
}
.content { flex:1; padding:20px; background:#F7FBFD; }
.footer {
    text-align:center; padding:15px; color:#888; font-size:12px;
    background:#fff; border-top:1px solid #D6E8F7;
}

/* ========== 菜单 ========== */
.menu { list-style:none; }
.menu li a {
    display:block; padding:10px 20px; color:#444; font-size:13.5px;
    border-left:3px solid transparent;
}
.menu li a:hover { background:#E3ECF8; color:#2D5B99; }
.menu li a.active {
    background:#E3ECF8; color:#2D5B99; font-weight:bold;
    border-left-color:#2D5B99;
}
.menu-group {
    padding:12px 20px 6px; font-size:11px; color:#999;
    text-transform:uppercase; letter-spacing:1px;
}

/* ========== 卡片 ========== */
.card {
    background:#fff; border-radius:10px; padding:20px;
    box-shadow: 0 2px 8px rgba(45,91,153,.08);
    border:1px solid #D6E8F7; margin-bottom:20px;
}
.card h2 {
    font-size:18px; color:#2D5B99; margin-bottom:15px;
    padding-bottom:10px; border-bottom:2px solid #E3ECF8;
}
.page-title {
    font-size:22px; color:#204372; margin-bottom:20px; font-weight:bold;
}

/* ========== 表格 ========== */
table.data-table {
    width:100%; border-collapse:collapse; font-size:13.5px;
}
table.data-table th {
    background: linear-gradient(180deg, #3A6BB5, #2D5B99);
    color:#fff; padding:10px 12px; text-align:left; font-weight:bold;
    border:1px solid #204372;
}
table.data-table td {
    padding:9px 12px; border:1px solid #D6E8F7;
}
table.data-table tr:nth-child(even) td { background:#F7FBFD; }
table.data-table tr:hover td { background:#E3ECF8; }

/* ========== 按钮 ========== */
.btn {
    display:inline-block; padding:7px 16px; border-radius:5px;
    font-size:13px; cursor:pointer; border:none; text-decoration:none;
    transition:all .2s;
}
.btn-primary { background:#2D5B99; color:#fff; }
.btn-primary:hover { background:#204372; color:#fff; }
.btn-success { background:#5BA88A; color:#fff; }
.btn-success:hover { background:#3F8A6E; color:#fff; }
.btn-warning { background:#E8A87C; color:#fff; }
.btn-danger { background:#D9534F; color:#fff; }
.btn-default { background:#E3ECF8; color:#2D5B99; border:1px solid #D6E8F7; }
.btn-sm { padding:4px 10px; font-size:12px; }

/* ========== 表单 ========== */
.form-group { margin-bottom:15px; }
.form-group label {
    display:block; margin-bottom:5px; font-weight:bold; color:#204372;
    font-size:13px;
}
.form-control {
    width:100%; padding:8px 12px; border:1px solid #D6E8F7;
    border-radius:5px; font-size:14px; background:#fff;
}
.form-control:focus { outline:none; border-color:#2D5B99; box-shadow:0 0 0 3px rgba(45,91,153,.1); }
textarea.form-control { min-height:100px; resize:vertical; font-family:inherit; }

/* ========== 徽章 ========== */
.badge {
    display:inline-block; padding:3px 10px; border-radius:10px;
    font-size:12px; color:#fff;
}
.badge-secondary { background:#999; }
.badge-warning { background:#E8A87C; }
.badge-info { background:#5BC0DE; }
.badge-success { background:#5BA88A; }
.badge-danger { background:#D9534F; }

/* ========== 待办卡片 ========== */
.stat-row { display:flex; gap:15px; flex-wrap:wrap; margin-bottom:20px; }
.stat-card {
    flex:1; min-width:150px; background:#fff; border-radius:10px;
    padding:18px; text-align:center; border:1px solid #D6E8F7;
    box-shadow:0 2px 6px rgba(45,91,153,.06);
}
.stat-card .num { font-size:30px; font-weight:bold; color:#2D5B99; }
.stat-card .label { font-size:13px; color:#666; margin-top:5px; }
.stat-card.warn .num { color:#E8A87C; }
.stat-card.danger .num { color:#D9534F; }
.stat-card.ok .num { color:#5BA88A; }

/* ========== 登录页 ========== */
.login-body {
    background: linear-gradient(135deg, #2D5B99 0%, #204372 100%);
    min-height:100vh; display:flex; align-items:center; justify-content:center;
}
.login-box {
    background:#fff; border-radius:12px; padding:40px;
    width:380px; box-shadow:0 10px 40px rgba(0,0,0,.2);
}
.login-box h1 {
    text-align:center; color:#2D5B99; font-size:20px; margin-bottom:5px;
}
.login-box .sub {
    text-align:center; color:#888; font-size:13px; margin-bottom:25px;
}
.login-box .btn { width:100%; padding:10px; font-size:15px; }
.login-error {
    background:#FDECEA; color:#D9534F; padding:10px; border-radius:5px;
    margin-bottom:15px; font-size:13px; text-align:center;
}

/* ============================================================
   SOP 打印排版样式（严格按贵院5.3节规范）
   A4 / 上3.7 下2.54 左右2.54 / 页眉1.7cm
   ============================================================ */
.sop-page {
    width: 210mm;
    min-height: 297mm;
    margin: 10mm auto;
    background: #fff;
    padding: 37mm 25.4mm 25.4mm 25.4mm;  /* 上3.7 下2.54 左2.54 右2.54 */
    position: relative;
    box-shadow: 0 0 10px rgba(0,0,0,.15);
    font-family: "SimSun", "宋体", serif;
    font-size: 12pt;  /* 小四 */
    line-height: 20pt;  /* 固定值20磅 */
    text-align: justify;
}

/* 页眉（在padding-top区域内绝对定位） */
.sop-header {
    position: absolute;
    top: 17mm;  /* 页眉顶端1.7cm */
    left: 25.4mm;
    right: 25.4mm;
    font-family: "FangSong", "仿宋", serif;
    font-size: 10.5pt;  /* 五号 */
    display: table;
    width: calc(210mm - 50.8mm);
    border: 1px solid #000;
    line-height: 1.5;
}
.sop-header > div {
    display: table-cell;
    vertical-align: middle;
    padding: 4px 8px;
}
.sop-header .h-left { text-align:center; width:33.33%; border-right:1px solid #000; }
.sop-header .h-center { text-align:center; width:33.33%; border-right:1px solid #000; }
.sop-header .h-right { text-align:left; width:33.34%; }
.sop-header .h-center .bold { font-weight:bold; }

/* 页脚 */
.sop-footer {
    position: absolute;
    bottom: 10mm;
    left: 25.4mm;
    right: 25.4mm;
    font-family: "FangSong", "仿宋", serif;
    font-size: 9pt;  /* 小五 */
    display: table;
    width: calc(210mm - 50.8mm);
    border-top: 1px solid #000;
    padding-top: 3mm;
}
.sop-footer > div { display: table-cell; text-align:center; }

/* 封面 */
.sop-cover {
    text-align:center;
    padding-top: 30mm;
    font-family: "FangSong", "仿宋", serif;
}
.sop-cover .cover-dept { font-size: 22pt; margin-bottom: 20mm; }
.sop-cover .cover-title { font-size: 26pt; font-weight:bold; margin-bottom: 40mm; line-height:1.5; }
.sop-cover .cover-version { font-size: 14pt; margin-bottom: 25mm; }
.sop-cover .cover-desc { font-size: 14pt; margin-bottom: 20mm; }
.sop-cover .cover-sign { font-size: 14pt; margin: 8mm 0; }
.sop-cover .cover-effective { font-size: 14pt; margin-top: 20mm; }
.sop-cover .cover-hospital {
    position: absolute; bottom: 20mm; left:0; right:0;
    font-size: 16pt; border-top: 1px solid #000; padding-top: 5mm;
}

/* 目录页 */
.sop-toc-title {
    text-align:center; font-size:18pt; font-weight:bold;
    font-family:"SimSun","宋体",serif; margin-bottom:10mm; letter-spacing:8mm;
}
.sop-toc table { width:100%; border-collapse:collapse; font-size:12pt; }
.sop-toc th, .sop-toc td { border:1px solid #000; padding:5px 8px; }
.sop-toc th { background:#f0f0f0; text-align:center; font-weight:bold; }

/* 修订页/阅读页表格 */
.sop-form-title {
    text-align:center; font-size:18pt; font-weight:bold;
    font-family:"SimSun","宋体",serif; margin-bottom:8mm; letter-spacing:5mm;
}
.sop-form-table { width:100%; border-collapse:collapse; font-size:11pt; }
.sop-form-table th, .sop-form-table td {
    border:1px solid #000; padding:6px 8px; height:10mm;
}
.sop-form-table th { background:#f0f0f0; text-align:center; font-weight:bold; }

/* SOP正文标题（首页大标题） */
.sop-doc-title {
    font-family:"SimSun","宋体",serif;
    font-size:18pt;  /* 小二 */
    font-weight:bold;
    text-align:center;
    margin: 10mm 0;  /* 与页眉和下一行各空一行 */
}

/* 正文段落 */
.sop-body {
    font-family:"SimSun","宋体",serif;
    font-size:12pt;  /* 小四 */
    line-height:20pt;
    text-indent: 2em;  /* 首行缩进2字符 */
    margin: 0;
}
.sop-lvl0 {  /* 第1层 1. 加粗黑色，与上一段空一行 */
    font-weight:bold;
    color:#000;
    margin-top: 20pt;
    text-indent:0;
}
.sop-lvl1, .sop-lvl2, .sop-lvl3 {  /* 2层及以下 与sop-body完全一致，顶格不加粗 */
    font-family:"SimSun","宋体",serif;
    font-size:12pt;
    line-height:20pt;
    font-weight:normal;
    color:#000;
    text-indent:0;
    margin: 0;
}
.sop-lvl4 {  /* a) 层 左空2字符 */
    text-indent: 2em;
    color:#000;
}
.sop-num { font-weight:bold; margin-right: 0; }

/* 打印时隐藏后台元素 */
@media print {
    .topbar, .sidebar, .footer, .no-print { display:none !important; }
    .content { padding:0; }
    .sop-page {
        margin:0; box-shadow:none; page-break-after:always;
    }
    body { background:#fff; }
}
