:root {
    --primary: #1f7aec;
    --primary-dark: #135fbd;
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --border: #e5e7eb;
    --ok: #16a34a;
    --warn: #f59e0b;
    --danger: #dc2626;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
.page { min-height: 100vh; padding: 18px; }
.mobile-container { max-width: 820px; margin: 0 auto; }
.hero { background: linear-gradient(135deg, #1f7aec, #49a2ff); color: #fff; border-radius: 24px; padding: 28px 22px; box-shadow: 0 18px 45px rgba(31,122,236,.22); }
.hero h1 { margin: 0 0 10px; font-size: 28px; letter-spacing: .5px; }
.hero p { margin: 0; opacity: .92; line-height: 1.7; }
.search-card { margin-top: -22px; background: var(--card); border-radius: 22px; padding: 18px; box-shadow: 0 14px 40px rgba(15,23,42,.08); }
.form-row { display: flex; gap: 10px; }
.input { width: 100%; border: 1px solid var(--border); border-radius: 14px; padding: 14px 14px; font-size: 16px; outline: none; background: #fff; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(31,122,236,.12); }
.btn { border: 0; border-radius: 14px; padding: 14px 18px; font-size: 16px; font-weight: 700; background: var(--primary); color: #fff; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--primary-dark); }
.tips { margin-top: 14px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.card { background: var(--card); border-radius: 18px; padding: 18px; box-shadow: 0 10px 30px rgba(15,23,42,.06); margin-top: 14px; border: 1px solid rgba(229,231,235,.75); }
.report-head { display: flex; align-items: center; gap: 14px; }
.logo { width: 58px; height: 58px; border-radius: 14px; object-fit: cover; border: 1px solid var(--border); background: #fff; }
.logo-fallback { width:58px;height:58px;border-radius:14px;background:#e8f1ff;display:grid;place-items:center;color:var(--primary);font-weight:800; }
.hospital h1 { margin: 0; font-size: 21px; }
.hospital p { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.badge { display: inline-flex; align-items: center; border-radius: 99px; padding: 5px 10px; background: #e8f1ff; color: var(--primary); font-size: 12px; font-weight: 700; }
.watermark { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: #fff7ed; color: #9a3412; font-size: 13px; line-height: 1.6; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.info-item { background: #f8fafc; border-radius: 14px; padding: 12px; }
.info-item span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.info-item strong { font-size: 15px; word-break: break-all; }
.section-title { margin: 0 0 12px; font-size: 17px; display: flex; align-items: center; justify-content: space-between; }
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; min-width: 650px; background: #fff; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
th { background: #f8fafc; color: #475569; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.result-ok { color: var(--ok); font-weight: 700; }
.result-warn { color: var(--danger); font-weight: 700; }
.group-row td { background: #eef6ff; color: #1d4ed8; font-weight: 800; }
.conclusion { line-height: 1.8; white-space: pre-wrap; }
.footer-note { text-align: center; color: var(--muted); padding: 18px 0 6px; font-size: 12px; }
.empty { text-align: center; padding: 38px 18px; color: var(--muted); }
.error-text { color: var(--danger); margin-top: 12px; font-weight: 700; }
.actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.secondary { background: #edf2f7; color: #1f2937; }
.secondary:hover { background: #e5e7eb; }
@media (max-width: 640px) {
    .page { padding: 12px; }
    .hero { border-radius: 20px; padding: 24px 18px 42px; }
    .hero h1 { font-size: 24px; }
    .search-card { margin-top: -26px; }
    .form-row { flex-direction: column; }
    .btn { width: 100%; }
    .info-grid { grid-template-columns: 1fr; gap: 10px; }
    .report-head { align-items: flex-start; }
    .hospital h1 { font-size: 18px; }
    table { min-width: 560px; }
    th, td { font-size: 13px; padding: 10px 8px; }
}
@media print {
    body { background: #fff; }
    .page { padding: 0; }
    .actions, .footer-note { display: none; }
    .card, .hero, .search-card { box-shadow: none; }
}

/* 查看报告页：按用户截图风格重做 */
.report-body {
    background: #ececec;
    color: #252b33;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
.lab-report-shell {
    width: 100%;
    max-width: 576px;
    min-height: 100vh;
    margin: 0 auto;
    background: #ececec;
    overflow-x: hidden;
}
.lab-hero {
    position: relative;
    height: 166px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #20c56a 0%, #31ca78 100%);
    color: #fff;
}
.lab-hero-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 14% 48%, rgba(13,134,76,.12) 0 86px, transparent 87px),
        linear-gradient(0deg, rgba(255,255,255,.02), rgba(255,255,255,.02)),
        radial-gradient(circle at 78% 22%, rgba(255,255,255,.05) 0 2px, transparent 3px),
        radial-gradient(circle at 84% 58%, rgba(255,255,255,.04) 0 2px, transparent 3px),
        linear-gradient(155deg, rgba(255,255,255,.03), rgba(5,98,55,.08));
}
.lab-hero::before,
.lab-hero::after {
    content: "";
    position: absolute;
    border: 2px solid rgba(19,137,77,.18);
    border-radius: 999px;
    transform: rotate(-18deg);
}
.lab-hero::before {
    width: 240px;
    height: 118px;
    left: -96px;
    top: 22px;
}
.lab-hero::after {
    width: 260px;
    height: 120px;
    right: -114px;
    bottom: 8px;
}
.lab-person-name {
    position: relative;
    z-index: 1;
    font-size: 31px;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: .5px;
}
.lab-report-type {
    position: relative;
    z-index: 1;
    min-width: 118px;
    max-width: 240px;
    margin-top: 17px;
    padding: 10px 18px;
    border-radius: 999px;
    color: rgba(255,255,255,.96);
    background: rgba(12,160,76,.42);
    box-shadow: inset 0 -1px 0 rgba(0,0,0,.02), inset 0 0 15px rgba(0,0,0,.04);
    font-size: 16px;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lab-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
    align-items: center;
    min-height: 58px;
    padding: 0 14px;
    background: #fff;
    border-bottom: 1px solid #f1f1f1;
}
.lab-meta-top {
    border-bottom: 10px solid #ececec;
}
.lab-meta-bottom {
    margin-top: 10px;
    border-bottom: 1px solid #f1f1f1;
}
.lab-meta-item {
    min-width: 0;
    color: #a0a4aa;
    font-size: 15px;
    line-height: 1;
    white-space: nowrap;
}
.lab-meta-item span {
    display: inline-block;
    margin-right: 6px;
    color: #a0a4aa;
    font-size: 15px;
    vertical-align: middle;
}
.lab-meta-item strong {
    color: #43ae76;
    font-size: 15px;
    font-weight: 500;
    vertical-align: middle;
}
.lab-meta-item.align-right { text-align: right; }
.lab-table-card {
    background: #fff;
}
.lab-table-head {
    display: grid;
    grid-template-columns: 43% 24% 33%;
    min-height: 62px;
    align-items: center;
    padding: 0 14px;
    border-bottom: 1px solid #f3f3f3;
    color: #2d3138;
    font-size: 18px;
    font-weight: 500;
    background: #fff;
}
.lab-table-head div:nth-child(2) { padding-left: 8px; }
.lab-table-head div:nth-child(3) { text-align: right; }
.lab-table-row {
    display: grid;
    grid-template-columns: 43% 24% 33%;
    align-items: center;
    min-height: 92px;
    padding: 14px 14px;
    border-bottom: 1px solid #f3f3f3;
    background: #fff;
}
.lab-name {
    color: #2d3138;
    font-size: 15px;
    line-height: 1.65;
    word-break: break-word;
    padding-right: 10px;
}
.lab-result {
    color: #20242a;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 500;
    word-break: break-all;
    padding-left: 8px;
}
.lab-range {
    color: #b1b5bb;
    font-size: 15px;
    line-height: 1.5;
    text-align: right;
    word-break: break-word;
}
.lab-empty {
    padding: 48px 18px;
    color: #9da2a9;
    text-align: center;
    background: #fff;
}
.lab-actions {
    margin-top: 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,.02);
}
.lab-actions-inner {
    background: #fff;
}
.lab-download {
    display: block;
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 0;
    background: #22c766;
    color: #fff;
    font-size: 19px;
    font-weight: 500;
    letter-spacing: 1px;
    cursor: pointer;
}
.lab-download:active {
    background: #1fb35c;
}
.lab-bottom-spacer {
    height: 300px;
    background: #ececec;
}
@media (max-width: 390px) {
    .lab-hero { height: 154px; }
    .lab-person-name { font-size: 28px; }
    .lab-table-head { font-size: 16px; }
    .lab-table-head,
    .lab-table-row { grid-template-columns: 43% 24% 33%; padding-left: 12px; padding-right: 12px; }
    .lab-name,
    .lab-result,
    .lab-range,
    .lab-meta-item span,
    .lab-meta-item strong { font-size: 14px; }
}
@media print {
    .report-body { background: #fff; }
    .lab-report-shell { max-width: none; background: #fff; }
    .lab-bottom-spacer { display: none; }
}
