﻿/* ============================================================
   住院患者管理系统 — Design System v5.0
   移植火山方舟风格 · 保留医疗蓝主色 · 冷灰中性阶
   ============================================================ */

:root {
    /* === 医疗蓝主色（7 档） === */
    --blue-50:  #eef3fa;
    --blue-100: #dbe7f1;
    --blue-200: #b8cfe3;
    --blue-300: #8eb2d0;
    --blue-400: #6592bb;
    --blue-500: #3d73a8;   /* 主按钮、链接、激活态 */
    --blue-600: #2d5a87;   /* 悬停 */
    --blue-700: #1e3f63;   /* 侧栏 */
    --blue-800: #132a44;
    --blue-900: #0d1c2f;

    /* === 中性色（冷灰 · 火山方舟） === */
    --ink-900: #0b0b0f;   /* 主标题 */
    --ink-700: #3f3f51;   /* 正文 */
    --ink-500: #737a87;   /* 副文 */
    --ink-400: #afb0c0;   /* 占位/弱化 */
    --ink-300: #c9cbd4;   /* 浅分割 */
    --line:    #e1e3ea;   /* 卡 border */
    --line-2:  #edeef4;   /* 浅分割 */

    /* === 系统色 === */
    --success:  #078686;    --success-bg:  #e8f7f4;
    --warning:  #a6661f;    --warning-bg:  #fef3e2;
    --danger:   #f53f3f;    --danger-bg:   #fff5f6;

    /* === 表面 === */
    --bg:        #f6f8fa;  /* 页面底 */
    --surface:   #ffffff;  /* 卡片 */
    --surface-2: #fbfbfc;  /* 表头 */
    --surface-3: #f1f2f9;  /* 选中 tab */

    /* === 阴影（火山方舟柔和风格） === */
    --shadow-xs: 0 1px 1px rgba(11,11,15,0.04);
    --shadow-sm: 0 2px 6px rgba(11,11,15,0.04);
    --shadow-md: 0 4px 14px rgba(11,11,15,0.06);
    --shadow-lg: 0 8px 24px rgba(11,11,15,0.08);

    /* === 圆角（4 档 + 大卡） === */
    --r-4: 4px;
    --r-6: 6px;
    --r-8: 8px;
    --r-12: 12px;
    --r-16: 16px;

    /* === 侧栏宽度 === */
    --sidebar-w: 220px;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-fast: cubic-bezier(0.16, 1, 0.3, 1);

    /* === 字体（全局标题统一为衬线 Noto Serif SC） === */
    --title-font: 'Noto Serif SC', Georgia, 'Times New Roman', serif;
    --body-font:  -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
                  "Segoe UI", "Inter", "Noto Sans SC", sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
    margin: 0;
    display: flex;
    min-height: 100vh;
    font-family: var(--body-font);
    font-size: 14px;
    line-height: 1.57;
    color: var(--ink-700);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "tnum" 1;
}
*:focus-visible {
    outline: 2px solid var(--blue-500);
    outline-offset: 1px;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d8dbe0; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #b8bcc4; }
a { color: var(--blue-500); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--blue-600); }

.skip-link {
    position: absolute; top: -40px; left: 8px;
    background: var(--blue-700); color: #fff;
    padding: 8px 16px; border-radius: var(--r-4);
    z-index: 1000; font-size: 14px;
}
.skip-link:focus { top: 8px; }

/* ============================================================
   桌面端：侧栏 (≥769px)
   ============================================================ */
@media (min-width: 769px) {
    body { height: 100vh; overflow: hidden; }
}

/* 侧栏 */
.navbar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--blue-700);
    border-right: 1px solid rgba(255,255,255,0.04);
    box-shadow: var(--shadow-xs);
    z-index: 50;
    transition: transform 0.25s var(--ease);
}
.navbar > .bar-inner {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
}
.navbar .brand {
    font-size: 0.92rem; font-weight: 600;
    color: #ffffff;
    padding: 20px 20px 14px;
    letter-spacing: 0.02em;
    display: block;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin: 0;
}
.navbar .brand::after {
    content: "PMS";
    display: block;
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    color: rgba(255,255,255,0.35);
    margin-top: 3px;
}
.navbar nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 10px;
    flex: 1;
}
.navbar nav a {
    color: rgba(255,255,255,0.72);
    padding: 9px 12px;
    border-radius: var(--r-6);
    font-size: 0.84rem; font-weight: 500;
    transition: all .15s var(--ease);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}
/* 侧边栏 icon */
.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.navbar nav a.active .nav-icon { stroke: #ffffff; }
.navbar nav a::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    height: 16px; width: 3px;
    transform: translateY(-50%) scaleY(0);
    border-radius: 0 2px 2px 0;
    background: var(--blue-300);
    transition: transform .15s var(--ease);
}
.navbar nav a:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}
.navbar nav a.active {
    color: #ffffff;
    background: rgba(255,255,255,0.14);
    font-weight: 600;
}
.navbar nav a.active::before {
    transform: translateY(-50%) scaleY(1);
}
.navbar .spacer { flex: 1; }

/* === 侧边栏底部用户卡片（admin 风格） === */
.navbar .navbar-bottom {
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.navbar .user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 9px 10px;
    box-shadow: 0 1px 3px rgba(11,11,15,0.04);
    transition: box-shadow .15s var(--ease);
}
.navbar .user-card:hover {
    box-shadow: 0 2px 8px rgba(11,11,15,0.08);
}
.navbar .user-avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue-400), var(--blue-700));
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(61,115,168,0.25);
    text-transform: uppercase;
}
.navbar .user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.navbar .user-name {
    color: var(--ink-900);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.navbar .user-status {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--success);
    font-size: 10px;
    line-height: 1;
}
.navbar .status-dot {
    position: relative;
    width: 6px;
    height: 6px;
    flex-shrink: 0;
}
.navbar .status-dot::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--success);
    animation: ping-dot 2s cubic-bezier(0,0,0.2,1) infinite;
    opacity: 0.5;
}
.navbar .status-dot::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 50%;
    background: var(--success);
}
@keyframes ping-dot {
    0% { transform: scale(1); opacity: 0.6; }
    75%, 100% { transform: scale(2); opacity: 0; }
}
.navbar .user-logout {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a3a8b8;
    transition: all .15s var(--ease);
    text-decoration: none;
}
.navbar .user-logout:hover {
    background: #fff5f6;
    color: #f53f3f;
}
.navbar .user-logout svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 内容区包裹 */
.content-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
@media (min-width: 769px) {
    .content-wrap { height: 100vh; overflow: hidden; }
}
.content-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================================
   容器 + 卡片
   ============================================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 48px;
}
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-12);
    box-shadow: var(--shadow-sm);
    padding: 24px 28px;
    margin-bottom: 20px;
    transition: all 150ms var(--ease-fast);
}
/* ---- 全局标题统一（衬线 Noto Serif SC） ---- */
h1, h2, h3, h4, h5, h6 { font-family: var(--title-font); }

.card h2 {
    font-size: 1rem; font-weight: 600;
    color: var(--ink-900);
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-2);
    font-family: var(--title-font);
}
.section-label {
    font-size: 0.76rem; font-weight: 600;
    color: var(--ink-500);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 20px 0 12px;
}

/* ============================================================
   表格（火山方舟紧凑风格）
   ============================================================ */
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.78rem; font-weight: 600;
    color: var(--ink-500);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line-2);
    letter-spacing: 0.04em;
}
tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line-2);
    font-size: 0.86rem;
    color: var(--ink-900);
}
tbody tr { transition: background 150ms var(--ease-fast); }
tbody tr:hover td { background: var(--surface-3); }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   按钮（4 档：主渐变 / 次白底 / 文本 / 危险）
   ============================================================ */
.btn {
    height: 36px;
    padding: 0 16px;
    border-radius: var(--r-8);
    border: none;
    font-size: 0.84rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 150ms var(--ease-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--blue-500);
    color: #ffffff;
    text-decoration: none;
    line-height: 1;
}
.btn:hover { background: var(--blue-600); color: #ffffff; }
.btn:active { transform: scale(0.98); }
.btn:disabled {
    background: #a3a8b8;
    cursor: not-allowed;
    opacity: 0.6;
}
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: var(--ink-700);
    border: 1px solid var(--line);
    border-radius: var(--r-8);
    padding: 6px 14px;
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 150ms var(--ease-fast);
    height: 32px;
    line-height: 1;
    box-sizing: border-box;
}
.btn-export:hover {
    color: var(--blue-500);
    border-color: var(--blue-500);
    background: #ffffff;
    text-decoration: none;
}
.btn-secondary {
    background: #ffffff;
    color: var(--ink-700);
    border: 1px solid var(--ink-300);
}
.btn-secondary:hover {
    color: var(--blue-500);
    border-color: var(--blue-500);
    background: #ffffff;
}
.btn-sm {
    height: 30px;
    padding: 0 12px;
    font-size: 0.78rem;
}
.btn-danger {
    background: #ffffff;
    color: var(--danger);
    border: 1px solid #ffd6d6;
}
.btn-danger:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
}

/* ============================================================
   标签（火山方舟胶囊风格）
   ============================================================ */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--r-4);
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}
/* 在院 —— 蓝 */
.tag.status { background: #eef3fa; color: #2b6cb0; border: 1px solid #d4e2f2; }
/* 已出院 —— 灰蓝（避开 hover 色 #f1f2f9，用更深的 #e2e5ed） */
.tag.status.discharged { background: #e2e5ed; color: #6b6f7f; border: 1px solid #d0d4de; }
/* 转归 —— 绿/黄/红，都加细边 */
.tag.outcome-success { background: #e3f4f0; color: #078686; border: 1px solid #b8e3d9; }
.tag.outcome-warn { background: #fef0d4; color: #a6661f; border: 1px solid #f4d7a0; }
.tag.outcome-danger { background: #ffe1e2; color: #d93025; border: 1px solid #f2b5b7; }

/* ============================================================
   表单
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 20px;
}
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--ink-700);
    letter-spacing: 0.02em;
}
.form-row .req-mark { color: var(--ink-400); font-weight: 400; }
.form-row input,
.form-row select,
.form-row textarea {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--ink-300);
    border-radius: var(--r-6);
    font-size: 0.84rem;
    font-family: inherit;
    background: #ffffff;
    color: var(--ink-900);
    transition: border-color 150ms var(--ease-fast);
    width: 100%;
}
.form-row input:hover,
.form-row select:hover { border-color: var(--ink-500); }
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    border-color: var(--blue-500);
    outline: none;
}
.form-row textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; }
.form-grid + .form-row { margin-top: 16px; }

/* 登录卡 */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background: #f6f8fa;
    position: relative;
    overflow: hidden;
}
/* 背景装饰圆（admin 风格） */
.login-wrap::before {
    content: "";
    position: absolute;
    top: -120px;
    left: -80px;
    width: 360px; height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(61,115,168,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.login-wrap::after {
    content: "";
    position: absolute;
    bottom: -160px;
    right: -100px;
    width: 420px; height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(61,115,168,0.06) 0%, transparent 70%);
    pointer-events: none;
}
.login-card {
    background: #ffffff;
    border: 1px solid #edeef4;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(11,11,15,0.06);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}
.login-card .login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 4px;
}
.login-card .login-brand-logo {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue-400), var(--blue-700));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(61,115,168,0.25);
}
.login-card .login-brand-logo svg {
    width: 18px; height: 18px;
    stroke: #ffffff; fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.login-card h1 {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink-900);
    margin: 0 0 2px;
    letter-spacing: 0.02em;
    font-family: var(--title-font);
}
.login-card .login-sub {
    text-align: center;
    font-size: 0.78rem;
    color: var(--ink-400);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 22px;
}

/* ============================================================
   登录提示条（临床行政系统风格：左侧色条 + 图标 + 双行文案）
   ============================================================ */
.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    margin: 0 0 18px;
    border-radius: var(--r-6);
    background: var(--surface-2);
    border: 1px solid var(--line-2);
    border-left: 3px solid var(--blue-500);
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--ink-700);
}
.login-alert .alert-icon {
    flex-shrink: 0;
    width: 16px; height: 16px;
    margin-top: 2px;
    color: var(--blue-500);
}
.login-alert .alert-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-900);
    margin-bottom: 2px;
    letter-spacing: 0.01em;
}
.login-alert .alert-text {
    font-size: 0.8rem;
    color: var(--ink-600);
}
/* 账号锁定：用警示黄棕色条，比纯红更克制（符合临床系统不要大红色块的偏好） */
.login-alert.is-locked {
    border-left-color: #c78a2a;
    background: #fbf6ec;
}
.login-alert.is-locked .alert-icon { color: #c78a2a; }
/* 普通错误（密码错）：默认蓝色边；如需更明显可改成淡紫 */
.login-alert.is-error {
    /* 保持克制的蓝色系，避免大红色 AI 味 */
}
.login-card .form-row + .form-row { margin-top: 14px; }

/* 密码输入 + 眼睛切换 */
.login-card .pwd-wrap {
    position: relative;
}
.login-card .pwd-wrap input {
    padding-right: 44px;
}
.login-card .pwd-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--ink-400);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card .pwd-toggle:hover {
    color: var(--ink-600);
    background: var(--ink-50);
}
.login-card .pwd-toggle svg {
    width: 18px;
    height: 18px;
    position: absolute;
    transition: opacity .15s;
}
.login-card .pwd-toggle .eye-off {
    opacity: 0;
}
.login-card .pwd-toggle.showing svg:first-child {
    opacity: 0;
}
.login-card .pwd-toggle.showing .eye-off {
    opacity: 1;
}

/* 登录选项（双 checkbox 行） */
.login-card .login-options {
    margin-top: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
.login-card .login-options .chk {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--ink-500);
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}
.login-card .login-options .chk input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--blue-500);
    cursor: pointer;
}

.login-card .btn {
    width: 100%;
    margin-top: 24px;
    height: 40px;
    font-size: 0.88rem;
}
.login-card input {
    height: 40px;
    padding: 0 14px;
    border-radius: 8px;
}
.login-card .form-row label {
    font-size: 0.78rem;
    margin-bottom: 6px;
}
.login-card .login-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.72rem;
    color: var(--ink-400);
}

/* ============================================================
   统计卡
   ============================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 16px;
}
@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-12);
    padding: 20px 22px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.stat-card .stat-num,
.stat-card .num {
    font-size: 1.5rem; font-weight: 600;
    color: var(--ink-900);
    font-feature-settings: "tnum";
    line-height: 1.3;
}
.stat-card .stat-label,
.stat-card .label {
    font-size: 0.76rem;
    color: var(--ink-500);
    margin-top: 2px;
}

/* ============================================================
   Flash / 错误提示
   ============================================================ */
.flash-msg {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: var(--r-8);
    font-size: 0.84rem;
    font-weight: 500;
    z-index: 2000;
    box-shadow: var(--shadow-md);
    opacity: 1;
    transition: opacity .25s;
}
.flash-msg.success { background: var(--success-bg); color: var(--success); }
.flash-msg.error { background: var(--danger-bg); color: var(--danger); }

.error-bar {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--r-8);
    font-size: 0.82rem;
    margin-bottom: 16px;
    border-left: 3px solid var(--danger);
}

/* ============================================================
   行操作（编辑主按钮 / 删除文本链接）
   ============================================================ */
/* 操作列的 td —— 不许被挤压 */
td:has(.row-actions),
td.row-actions-cell { min-width: 160px; white-space: nowrap; }
.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
}
.row-actions .act {
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    padding: 4px 8px;
    border-radius: var(--r-4);
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    line-height: 1;
    flex-shrink: 0;
}
.row-actions .act-edit {
    background: var(--blue-500);
    color: #ffffff;
    padding: 6px 14px;
    border-radius: var(--r-8);
    height: 30px;
    flex-shrink: 0;
}
.row-actions .act-edit:hover { background: var(--blue-600); color: #ffffff; }

/* 出院 —— 次白底胶囊 */
.row-actions .act-discharge {
    background: #ffffff;
    color: var(--ink-700);
    border: 1px solid var(--ink-300);
    padding: 6px 14px;
    border-radius: var(--r-8);
    height: 30px;
}
.row-actions .act-discharge:hover {
    color: var(--blue-500);
    border-color: var(--blue-500);
    background: #ffffff;
}

/* 删除 —— 危险胶囊 */
.row-actions .act-delete {
    background: #ffffff;
    color: var(--danger);
    border: 1px solid #ffd6d6;
    padding: 6px 14px;
    border-radius: var(--r-8);
    height: 30px;
}
.row-actions .act-delete:hover {
    background: var(--danger-bg);
    border-color: var(--danger);
}
.inline-form { display: inline; margin: 0; padding: 0; }

/* ============================================================
   个人资料卡（设置页顶部）
   ============================================================ */
.profile-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 20px;
}
.profile-left {
    background: linear-gradient(180deg, var(--blue-50), #ffffff);
    border: 1px solid var(--ink-200);
    border-radius: var(--r-8);
    padding: 28px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.profile-avatar {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 600;
    font-family: var(--title-font);
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(43,108,176,0.18);
}
.profile-name {
    font-size: 1.02rem;
    font-weight: 600;
    color: var(--ink-900);
    font-family: var(--title-font);
    margin-top: 4px;
}
.profile-sub {
    font-size: 0.8rem;
    color: var(--ink-500);
}
.profile-form {
    padding: 4px 4px 4px 8px;
    max-width: 380px;
}

@media (max-width: 720px) {
    .profile-grid { grid-template-columns: 1fr; }
    .profile-form { max-width: 100%; padding: 4px; }
}

/* ============================================================
   搜索条 / 状态 tab / 分页
   ============================================================ */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
    align-items: center;
}
.search-bar input,
.search-bar select {
    height: 36px;
    padding: 0 14px;
    border: 1px solid var(--ink-300);
    border-radius: var(--r-8);
    font-size: 0.84rem;
    width: 260px;
    font-family: inherit;
    background: #ffffff;
    color: var(--ink-900);
}
.search-bar select {
    width: 180px;
    padding-right: 32px;
}
.search-bar input:focus,
.search-bar select:focus { border-color: var(--blue-500); outline: none; }

.status-tabs {
    display: inline-flex;
    background: var(--surface-3);
    border-radius: var(--r-4);
    padding: 3px;
    gap: 2px;
}
.status-tab {
    padding: 4px 16px;
    border-radius: var(--r-4);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink-700);
    cursor: pointer;
    text-decoration: none;
    transition: all 150ms var(--ease-fast);
    line-height: 1.6;
}
.status-tab:hover { color: var(--ink-900); }
.status-tab.active {
    background: var(--blue-500);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--r-4);
    font-size: 0.8rem;
    border: 1px solid var(--line);
    color: var(--ink-700);
    background: #ffffff;
}
.pagination a:hover { border-color: var(--blue-500); color: var(--blue-500); }
.pagination .current {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: #ffffff;
}

/* 详情 grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 24px;
}
.detail-grid .row { display: flex; gap: 8px; }
.detail-grid .item {
    display: flex;
    align-items: baseline;
    gap: 0;
    padding: 4px 0;
}
.detail-grid .label {
    color: var(--ink-500);
    font-size: 0.78rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.detail-grid .label::after {
    content: "：";
    color: var(--ink-500);
    margin: 0 4px 0 2px;
}
.detail-grid .value {
    color: var(--ink-900);
    font-weight: 500;
    font-size: 0.84rem;
    flex: 1;
}
.detail-grid .item.full { grid-column: 1 / -1; }
.detail-grid .item.empty .value,
.detail-grid .value:empty { color: var(--ink-300); }

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.muted { color: var(--ink-500); }

/* ============================================================
   弹窗（火山方舟风格 —— 全新实现）
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11, 11, 15, 0.45);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: modal-fade-in 200ms var(--ease-fast) both;
}
.modal-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-12);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    animation: modal-slide-up 240ms var(--ease-fast) both;
    overflow: hidden;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-2);
}
.modal-head .modal-title {
    padding: 0;
}
.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--ink-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
}
.modal-close:hover {
    background: var(--ink-50);
    color: var(--ink-700);
}
.modal-close svg {
    width: 16px;
    height: 16px;
}
.modal-title {
    padding: 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink-900);
    font-family: var(--title-font);
}
.modal-body {
    padding: 18px 20px;
    font-size: 0.84rem;
    color: var(--ink-700);
    line-height: 1.6;
}
.modal-body .form-row label {
    margin-bottom: 6px;
    display: block;
}
.modal-body .form-row input,
.modal-body .form-row select {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--ink-300);
    border-radius: var(--r-8);
    font-size: 0.84rem;
    font-family: inherit;
    background: #ffffff;
    color: var(--ink-900);
}
.modal-body .form-row input:focus,
.modal-body .form-row select:focus {
    border-color: var(--blue-500);
    outline: none;
}
.discharge-tip {
    margin: 0 0 16px;
    color: var(--ink-700);
    font-size: 0.85rem;
    line-height: 1.6;
    padding: 10px 12px;
    background: var(--blue-50);
    border: 1px solid rgba(43,108,176,0.18);
    border-radius: var(--r-8);
}
.discharge-tip strong {
    color: var(--ink-900);
    font-weight: 600;
}
.modal-actions {
    padding: 14px 20px 18px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--line-2);
    background: var(--surface-2);
}
.modal-actions .btn { height: 34px; padding: 0 14px; font-size: 0.8rem; }

.modal-closing { animation: modal-fade-out 180ms var(--ease-fast) both; }
.modal-closing .modal-card { animation: modal-slide-down 180ms var(--ease-fast) both; }

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes modal-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes modal-slide-up {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modal-slide-down {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

/* ---- 移动端元素默认隐藏（仅 ≤768px 显示） ---- */
.mobile-topbar, .bottom-nav, .drawer, .drawer-overlay { display: none; }

/* ============================================================
   审计页表格（摘要列溢出 / 差异展开 / hover 截断）
   ============================================================ */
.audit-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
.audit-table thead th,
.audit-table tbody td {
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
}
.audit-table col[data-col="time"]   { width: 180px; }
.audit-table col[data-col="opname"] { width: 88px; }
.audit-table col[data-col="role"]   { width: 68px; text-align: center; }
.audit-table col[data-col="type"]   { width: 72px; }
.audit-table col[data-col="action"] { width: 92px; }
.audit-table col[data-col="target"] { width: 92px; }
.audit-table col[data-col="ip"]     { width: 140px; }
/* 剩余宽度自动给摘要列 */

.audit-summary {
    max-width: 100%;
    line-height: 1.55;
    color: var(--ink-900);
    overflow-wrap: anywhere;
    word-break: break-word;
}
.audit-diff-wrap {
    margin-top: 6px;
}
.btn-link {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.78rem;
    color: var(--blue-600);
    background: transparent;
    border: 1px solid rgba(43,108,176,0.28);
    border-radius: var(--r-6);
    cursor: pointer;
    transition: all .15s;
}
.btn-link:hover {
    background: var(--blue-50);
    border-color: var(--blue-500);
}
.diff-box {
    margin-top: 10px;
    max-height: 0;
    padding: 0 12px;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--r-8);
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: max-height .25s var(--ease), padding .2s var(--ease),
                border-color .2s var(--ease), opacity .2s var(--ease), transform .2s var(--ease);
}
.diff-box.show {
    max-height: 340px;
    padding: 10px 12px;
    border-color: var(--line-2);
    overflow: auto;
    opacity: 1;
    transform: translateY(0);
}
.diff-title {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--r-4);
    display: inline-block;
    margin-bottom: 4px;
}
.diff-title.before { background: #fdeeee; color: #c53030; border: 1px solid #f8cfcf; }
.diff-title.after  { background: #e3f4ea; color: #2f855a; border: 1px solid #b8e3c8; }
.diff-code {
    margin: 0;
    font-family: ui-monospace, Menlo, "SF Mono", Consolas, monospace;
    font-size: 0.72rem;
    line-height: 1.55;
    padding: 8px 10px;
    color: var(--ink-900);
    background: #ffffff;
    border: 1px solid var(--line-2);
    border-radius: var(--r-6);
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* ============================================================
   患者列表：住院号 9 位数字预留 / 在院与已出院分两卡
   ============================================================ */
.patients-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}
.patients-table col[data-col="hospitalNo"] { width: 112px; }
.patients-table col[data-col="name"]       { width: 88px; }
.patients-table col[data-col="status"]     { width: 68px; }
.patients-table col[data-col="gender"]     { width: 52px; text-align: center; }
.patients-table col[data-col="dept"]       { width: 88px; }
.patients-table col[data-col="diag"]       { /* 主诊断：自动剩余自适应 */ }
.patients-table col[data-col="admit"]      { width: 104px; }
.patients-table col[data-col="discharge"]  { width: 104px; }
.patients-table col[data-col="outcome"]    { width: 84px; }
.patients-table col[data-col="followup"]   { width: 104px; }
.patients-table col[data-col="ops"]        { width: 200px; }

.patients-table td.col-hospital,
.patients-table th:first-child,
.patients-table td:first-child {
    font-family: ui-monospace, Menlo, "SF Mono", Consolas, monospace;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-900);
    letter-spacing: 0.02em;
}

/* 姓名列 / 科室列：列宽已紧凑（含 padding 可容纳约 4 个中文字），不再强制截断省略 */
.patients-table td.col-name > a {
    display: inline;
}

.pt-section-h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-2);
}
.pt-section-h3 h3 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--ink-900);
    letter-spacing: 0.02em;
}
.pt-section-h3 .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.pt-section-h3 .dot.in  { background: #2b7bd6; box-shadow: 0 0 0 4px rgba(43,123,214,0.12); }
.pt-section-h3 .dot.out { background: #8092aa; box-shadow: 0 0 0 4px rgba(128,146,170,0.14); }
.pt-section-h3 .muted {
    margin-left: 2px;
    font-size: 0.78rem;
}

.pt-card .card { padding-top: 20px; }
.empty-tip {
    text-align: center;
    padding: 32px 0;
    color: var(--ink-500);
    font-size: 0.86rem;
}
.card.pt-card:last-of-type {
    margin-bottom: 8px;
}

/* ============================================================
   移动端（≤768px）
   ============================================================ */
@media (max-width: 768px) {
    .navbar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        transform: translateX(-100%);
        z-index: 100;
    }
    .navbar.open { transform: translateX(0); }

    /* 移动端顶 bar —— 显示 */
    .mobile-topbar {
        display: flex;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 48px;
        background: var(--surface);
        border-bottom: 1px solid var(--line-2);
        align-items: center;
        padding: 0 16px;
        gap: 12px;
        z-index: 90;
    }
    .mobile-topbar .drawer-btn {
        width: 32px; height: 32px;
        border: none; background: transparent;
        cursor: pointer;
        display: flex; align-items: center; justify-content: center;
        color: var(--ink-900);
        border-radius: var(--r-6);
    }
    .mobile-topbar .drawer-btn:hover { background: var(--surface-3); }
    .mobile-topbar .mobile-title {
        font-size: 0.92rem;
        font-weight: 600;
        color: var(--ink-900);
    }
    body { padding-top: 48px; }
    .content-wrap { height: auto; overflow: visible; }
    .container { padding: 16px 16px 80px; }
    .card { padding: 18px 18px; margin-bottom: 14px; border-radius: var(--r-8); }

    /* 抽屉遮罩 —— 显示（open 时） */
    .drawer-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(11, 11, 15, 0.45);
        z-index: 95;
        opacity: 0;
        pointer-events: none;
        transition: opacity 200ms var(--ease);
    }
    .drawer-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }
    .drawer {
        display: flex;
        position: fixed;
        left: 0; top: 0; bottom: 0;
        width: 260px;
        background: var(--blue-700);
        z-index: 101;
        transform: translateX(-100%);
        transition: transform 250ms var(--ease);
        flex-direction: column;
    }
    .drawer.open { transform: translateX(0); }
    .drawer-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 20px 14px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .drawer-header .brand {
        color: #ffffff;
        font-size: 0.92rem;
        font-weight: 600;
    }
    .drawer-close {
        color: rgba(255,255,255,0.7);
        background: none;
        border: none;
        font-size: 1.5rem;
        cursor: pointer;
        width: 28px; height: 28px;
        line-height: 1;
    }
    .drawer-nav {
        display: flex;
        flex-direction: column;
        gap: 2px;
        padding: 12px 10px;
        flex: 1;
    }
    .drawer-nav a {
        color: rgba(255,255,255,0.72);
        padding: 10px 12px;
        border-radius: var(--r-6);
        font-size: 0.88rem;
        font-weight: 500;
    }
    .drawer-nav a.active {
        color: #ffffff;
        background: rgba(255,255,255,0.14);
        font-weight: 600;
    }
    .drawer-footer {
        padding: 12px 20px;
        border-top: 1px solid rgba(255,255,255,0.08);
    }
    .drawer-footer a {
        color: rgba(255,255,255,0.55);
        font-size: 0.82rem;
    }

    /* 底部胶囊 nav —— 显示 */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        height: 60px;
        background: rgba(255,255,255,0.88);
        backdrop-filter: blur(20px) saturate(180%);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        border-top: 1px solid var(--line-2);
        z-index: 90;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .bottom-nav a {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.72rem;
        font-weight: 500;
        color: var(--ink-500);
        text-decoration: none;
        transition: color 150ms;
    }
    .bottom-nav a.active { color: var(--blue-500); }

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