/* File: /public/css/app.css */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --appbar-bg: #0f172a;
    --appbar-text: #f8fafc;
    --text-color: #333;
    --border-color: #e5e7eb;
    --bg-light: #f4f7f9;
    --bg-white: #fff;
    --appbar-height: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { background: var(--bg-light); color: var(--text-color); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary-color); text-decoration: none; }
a:hover { text-decoration: underline; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.mb-0 { margin-bottom: 0; }
.p-0 { padding: 0; }
.p-4 { padding: 1.5rem; }
.text-center { text-align: center; }
.text-muted { color: #6c757d; }
.btn { display: inline-block; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; border: 1px solid transparent; padding: .375rem .75rem; font-size: 1rem; border-radius: .25rem; transition: all .15s ease-in-out; }
.btn-sm { padding: .25rem .5rem; font-size: .875rem; border-radius: .2rem; }
.btn-primary { color: #fff; background-color: var(--primary-color); border-color: var(--primary-color); }
.btn-primary:hover { background-color: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { color: #374151; background-color: #f3f4f6; border-color: #d1d5db; }
.btn-secondary:hover { color: #111827; background-color: #e5e7eb; border-color: #cbd5e1; }
.btn-outline-primary { color: var(--primary-color); background-color: transparent; border-color: var(--primary-color); }
.btn-outline-primary:hover { color: #fff; background-color: var(--primary-color); border-color: var(--primary-color); }
.btn-danger { color: #fff; background-color: #dc3545; border-color: #dc3545; }

/* Appbar */
.appbar { position: sticky; top: 0; z-index: 1030; height: var(--appbar-height); display: flex; align-items: center; justify-content: space-between; padding: 8px 24px; background: var(--appbar-bg); color: var(--appbar-text); box-shadow: 0 2px 4px rgba(0,0,0,0.08); }
.appbar a.brand { color: var(--appbar-text); font-weight: 700; font-size: 1.2rem; text-decoration: none; }
.appbar-right { display: flex; align-items: center; gap: 15px; }
.user-pill { opacity: .9; }
.logout-button { color: #f8fafc; font-size: 0.9rem; text-decoration: none; opacity: 0.8; }
.logout-button:hover { opacity: 1; }

/* Main Content */
.content-area { padding: 24px; }
.patient-header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.patient-header h1 { font-size: 28px; font-weight: 600; color: #111827; }

/* Modules Grid Layout */
.modules-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 24px; }
.patient-details { grid-column: span 7; }
.survival-details { grid-column: span 5; }
.full-width { grid-column: span 12; }

/* Card Style */
.card.module-card { border: none; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02); }
.card-header { display: flex; justify-content: space-between; align-items: center; background-color: #f9fafb; padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.card-header h5 { margin: 0; font-size: 1rem; font-weight: 600; color: #111827; }
.card-header h5 .fa-solid, .card-header h5 .fa-regular { color: var(--primary-color); opacity: 0.75; }
.surgery-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.surgery-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  margin-left: auto;
}
.surgery-card-actions > * {
  flex: 0 0 auto;
}
.postop-reminder-action,
#patientPostopReminderBtn {
  white-space: nowrap;
}
#patientPostopReminderPanel.d-none {
  display: none !important;
}
@media (max-width: 768px) {
  .surgery-card-header {
    flex-wrap: wrap;
  }
  .surgery-card-actions {
    width: 100%;
  }
}
.card-body { padding: 16px; }

.follow-up-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.follow-up-badge--ok { background: #16a34a; color: #fff; }
.follow-up-badge--warning { background: #f59e0b; color: #111827; }
.follow-up-badge--danger { background: #dc3545; color: #fff; }
.follow-up-badge--muted { background: #9ca3af; color: #fff; }

/* Patient Details Info Grid */
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.info-item .info-label { font-weight: 500; color: #6b7280; margin-right: 8px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table-responsive { overflow-x: auto; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e5e7eb; vertical-align: top; font-size: 0.9rem; }
.table th { background-color: #f9fafb; font-weight: 500; }
.table-striped tbody tr:nth-of-type(odd) { background-color: rgba(0,0,0,0.02); }
.table-hover tbody tr:hover { background-color: rgba(0,0,0,0.04); }
.metrics-summary-table {
    max-height: 520px;
    overflow: auto;
}
.metrics-summary-table thead th {
    position: sticky;
    top: 0;
    background-color: #f9fafb;
    z-index: 3;
}
.metrics-summary-table th:first-child,
.metrics-summary-table td:first-child {
    position: sticky;
    left: 0;
    background-color: #fff;
    z-index: 2;
}
.metrics-summary-table thead th:first-child {
    z-index: 4;
}
.metrics-summary-table tbody tr:hover td:first-child {
    background-color: rgba(0,0,0,0.04);
}
.metrics-summary-table .btn-remove-participant {
    display: none;
}
.metric-definitions-table {
    max-height: 520px;
    overflow-y: auto;
}
.metric-definitions-table thead th {
    position: sticky;
    top: 0;
    background-color: #f9fafb;
    z-index: 1;
}
/* =================================== */
/* ========= 搜索弹窗样式 ========= */
/* =================================== */

/* 半透明背景遮罩 */
.modal-overlay {
    position: fixed;
    inset: 0; /* 等同于 top:0; right:0; bottom:0; left:0; */
    background: rgba(0, 0, 0, 0.6);
    z-index: 1040; /* z-index需要比appbar高 */
}

/* 弹窗主体 */
.search-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 20px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.25);
    z-index: 1050;
    width: 700px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* 弹窗头部 */
.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.search-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.search-modal-header .close-btn {
    font-size: 2rem;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    line-height: 1;
}
.search-modal-header .close-btn:hover {
    color: #333;
}

/* 表单与结果区 */
.search-modal-content .form-group {
    margin-bottom: 15px;
}
.search-modal-content .form-group label {
    font-weight: 500;
    margin-right: 10px;
}
.search-modal-content .form-group input[type="text"],
.search-modal-content .form-group input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.form-actions {
    text-align: right;
    margin-top: 20px;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.search-results-container h4 {
    margin-bottom: 15px;
}

/* 搜索结果表格 */
.results-table {
    width: 100%;
    border-collapse: collapse;
}
.results-table th, .results-table td {
    border: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
}
.results-table th {
    background: #f8fafc;
    font-weight: 600;
}

/* =================================== */
/* ======= 新建病例弹窗样式 ======= */
/* =================================== */

.create-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 20px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.25);
    z-index: 1050;
    width: 800px; /* 可以根据需要调整宽度 */
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.create-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.create-modal .modal-header h3 { margin: 0; font-size: 1.25rem; }
.create-modal .modal-header .close-btn { font-size: 2rem; font-weight: bold; color: #888; cursor: pointer; line-height: 1; }
.create-modal .modal-header .close-btn:hover { color: #333; }

.create-modal .form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px 20px;
    margin-bottom: 15px;
}
.create-modal .form-group {
    display: flex;
    flex-direction: column;
}
.create-modal .form-group label {
    font-weight: 500;
    margin-bottom: 5px;
}
.create-modal .form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}
.create-modal .form-actions {
    text-align: right;
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}
.create-modal .duplicate-list {
    list-style: none;
    padding: 0;
}
.create-modal .duplicate-list li {
    padding: 8px;
    border-bottom: 1px solid #eee;
}
.create-modal .duplicate-list .view-link {
    margin-left: 15px;
    font-weight: bold;
}

/* =================================== */
/* ======== 通用弹窗核心样式 ======== */
/* =================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    z-index: 1040;
}

/* 弹窗容器的基类 */
.modal-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.2);
    z-index: 1050;
    width: 700px; /* 默认宽度 */
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(226, 232, 240, 0.95);
}

.app-modal {
    width: min(700px, 90vw);
}
.app-modal--sm {
    width: min(520px, 90vw);
}
.app-modal--md {
    width: min(700px, 90vw);
}
.app-modal--lg {
    width: min(860px, 94vw);
}
.app-modal--xl {
    width: min(980px, 96vw);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    padding: 18px 24px;
    flex-shrink: 0;
    background: #f8fafc;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 650;
    line-height: 1.35;
    color: #111827;
    letter-spacing: 0;
}

.modal-header .close-btn,
.modal-close,
.btn-ghost.modal-close {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    font-weight: 400;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: none;
    border-radius: 8px;
}
.modal-header .close-btn:hover,
.modal-close:hover,
.btn-ghost.modal-close:hover {
    color: #111827;
    background: #e5e7eb;
}

.modal-body {
    padding: 22px 24px;
    overflow-y: auto;
    max-height: calc(90vh - 132px);
    background: #fff;
}

.modal-footer {
    padding: 14px 24px 18px;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f9fafb;
    flex-shrink: 0;
}

/* 表单通用样式 */
.modal-body .form-section {
    margin-bottom: 1.5rem;
    padding: 16px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}
.modal-body .form-section h4 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #1f2937;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    font-weight: 650;
}
.modal-body .form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem 1.5rem;
    margin-bottom: 1rem;
}
.modal-body .form-group {
    display: flex;
    flex-direction: column;
}
.modal-body .form-group label {
    font-weight: 600;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    color: #374151;
}
.modal-body .form-group input,
.modal-body .form-group select,
.modal-body .form-group textarea,
.modal-container .form-control,
.modal-container .form-select {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #111827;
    background-color: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.modal-body .form-group input:focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus,
.modal-container .form-control:focus,
.modal-container .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.modal-body .form-actions,
.modal-body .surgery-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    text-align: initial;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}
.modal-body .form-actions.metrics-results-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: initial;
}
.modal-body .form-actions.metrics-results-actions .metrics-results-actions__right {
    display: flex;
    gap: 8px;
}
.research-modal .modal-header {
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    padding: 18px 24px;
    background: #f8fafc;
}
.research-modal .modal-header h3 {
    margin: 0;
    font-size: 1.15rem;
    color: #111827;
}
.research-modal .modal-body {
    background-color: #fff;
    padding: 22px 24px;
}
.research-modal-panel {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 16px 18px;
    border: 1px solid #e5e7eb;
    box-shadow: none;
}
.research-modal-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 0;
    box-shadow: none;
}
.research-modal .form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.research-modal .form-row .form-group {
    flex: 1;
    min-width: 200px;
}
.research-modal .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.research-modal .form-group label,
.research-modal .form-label {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.92rem;
}
.research-modal input.form-control,
.research-modal textarea.form-control,
.research-modal select.form-select {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #fff;
}
.research-modal input.form-control:focus,
.research-modal textarea.form-control:focus,
.research-modal select.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background-color: #fff;
}
.research-modal textarea.form-control {
    min-height: 80px;
}
.research-modal .form-actions {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e5e7eb;
}
.research-modal .form-actions.research-modal-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.research-modal .form-actions.research-modal-actions .research-modal-actions__right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Special case modal (align with research modal) */
.special-case-modal {
    width: 640px;
    max-width: calc(100vw - 40px);
}
.special-case-modal .special-case-header {
    padding: 18px 24px;
}
.special-case-modal .special-case-eyebrow {
    font-size: 0.8rem;
    letter-spacing: 0;
    color: var(--primary-color);
    margin: 0;
}
.special-case-modal .special-case-header h3 {
    margin: 4px 0 0;
    font-size: 1.2rem;
    color: #0f172a;
}
.special-case-modal .special-case-body {
    padding: 22px 24px;
}
.special-case-modal .special-case-intro {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    background: #eff6ff;
    margin-bottom: 16px;
}
.special-case-modal .special-case-intro-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    font-size: 1.1rem;
    border: 1px solid #dbeafe;
    box-shadow: none;
}
.special-case-modal .modal-footer {
    padding: 14px 24px 18px;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    background: #f9fafb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.special-case-modal .modal-footer .btn {
    min-width: 110px;
}
@media (max-width: 640px) {
    .special-case-modal {
        width: calc(100vw - 24px);
    }
}

/* --- 弹窗交互增强 (修正版) --- */

/* --- 新的水平表单布局样式 --- */
.modal-body .form-group-horizontal {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-body .form-group-horizontal label {
    flex-basis: 120px; /* 设置一个固定的标签宽度 */
    flex-shrink: 0;
    margin-bottom: 0;
    padding-right: 15px;
    font-weight: 500;
    text-align: right;
}

.modal-body .form-group-horizontal > .diagnosis-choice-container,
.modal-body .form-group-horizontal > input,
.modal-body .form-group-horizontal > select,
.modal-body .form-group-horizontal > textarea {
    flex-grow: 1;
}

/* 移除旧的 form-group 内的 flex-direction */
.modal-body .form-group {
    flex-direction: unset;
}

/* ===== 左侧侧边栏 + 主区域布局 ===== */
:root{
    /* --- [ 修改：设置默认（宽）宽度，用于科研 ] --- */
    --sidebar-width: 520px;
    /* --- [ 结束修改 ] --- */
    --appbar-height: 56px;
}

/* --- [ 修改：实现固定侧边栏和内容滚动 ] --- */
.app-layout{
    display: flex;
    width: 100%;
    height: calc(100vh - var(--appbar-height, 56px));
    overflow: hidden;
}

/* 侧边栏基础样式 */
.sidebar{
    width: 0;
    border-right: 1px solid #e5e7eb;
    background: #fff;
    transition: width 220ms ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    flex-shrink: 0; /* 防止侧边栏被压缩 */
}

.sidebar-handle{
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 28px;
    height: 64px;
    border: none;
    border-radius: 0 12px 12px 0;
    background: #2563eb;
    color: #fff;
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left 220ms ease, background-color 160ms ease;
    z-index: 1020;
}
.sidebar-handle:hover{
    background-color: #1d4ed8;
}
.sidebar-handle:focus-visible{
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}
body.sidebar-open .sidebar-handle{
    left: calc(var(--sidebar-width) - 14px);
}

/* 展开时：通过 body.sidebar-open 控制 */
body.sidebar-open .sidebar{
    width: var(--sidebar-width);
}

/* 侧边栏内部 */
.sidebar-header{
    display: flex; align-items: center; justify-content: flex-start;
    gap: 8px;
    padding: 10px 12px; border-bottom: 1px solid #e5e7eb; background:#f8fafc;
    position: sticky;
    top: 0;
    z-index: 1;
}
.sidebar-body{
    padding: 10px 12px; 
    flex: 1;
}
.muted{ color:#6b7280; }

/* 主内容区 */
.content-area{
    flex: 1 1 auto;
    background: #f6f7fb;
    transition: width 220ms ease; /* 跟随侧栏动画 */
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

/* --- [ 结束修改 ] --- */


/* 主内容内层，始终居中显示 */
.content-inner{
    max-width: 1200px;   /* 你想要的居中宽度上限 */
    margin: 0 auto;      /* 居中 */
}
body.page-statistics .content-inner{
    max-width: 1440px;
}

/* 顶栏里按钮的轻量样式（可选） */
.btn-ghost{
    background: transparent; border: none; color:#374151; cursor:pointer; padding:6px 8px;
}
.btn-ghost:hover{ background:#f3f4f6; border-radius:8px; }


/* --- [ 修改：条件化宽度 ] --- */

/* 响应式：窄屏时侧栏用较小宽度 (科研) */
@media (max-width: 992px){
    :root { 
        --sidebar-width: 380px;
    }
}
@media (max-width: 600px){
    :root { 
        --sidebar-width: 300px;
    }
}

/* 响应式：患者详情页 (窄侧边栏 40%) */
body.page-patient-details {
    --sidebar-width: 208px; /* 520px * 0.4 */
}
@media (max-width: 992px) {
    body.page-patient-details {
        --sidebar-width: 152px; /* 380px * 0.4 */
    }
}
@media (max-width: 600px) {
    body.page-patient-details {
        --sidebar-width: 120px; /* 300px * 0.4 */
    }
}
/* 病例中心列表页：侧栏收窄，给主区域更多空间 */
body.page-patient-center {
    --sidebar-width: 220px;
}
@media (max-width: 992px) {
    body.page-patient-center {
        --sidebar-width: 190px;
    }
}
@media (max-width: 600px) {
    body.page-patient-center {
        --sidebar-width: 160px;
    }
}
/* 统计页面：侧栏再收窄一些 */
body.page-statistics {
    --sidebar-width: 200px;
}
@media (max-width: 992px) {
    body.page-statistics {
        --sidebar-width: 180px;
    }
}
@media (max-width: 600px) {
    body.page-statistics {
        --sidebar-width: 150px;
    }
}
body.page-followup-review-tasks {
    --sidebar-width: 240px;
}
@media (max-width: 992px) {
    body.page-followup-review-tasks {
        --sidebar-width: 200px;
    }
}
@media (max-width: 600px) {
    body.page-followup-review-tasks {
        --sidebar-width: 160px;
    }
}
body.page-form-submissions {
    --sidebar-width: 240px;
}
@media (max-width: 992px) {
    body.page-form-submissions {
        --sidebar-width: 200px;
    }
}
@media (max-width: 600px) {
    body.page-form-submissions {
        --sidebar-width: 160px;
    }
}
/* 统计页面：侧栏再收窄一些 */
body.page-research {
    --sidebar-width: 240px;
}
@media (max-width: 992px) {
    body.page-research {
        --sidebar-width: 216px;
    }
}
@media (max-width: 600px) {
    body.page-research {
        --sidebar-width: 180px;
    }
}
/* --- [ 结束修改 ] --- */
/* 系统设置（管理页）侧边栏缩窄 */
body.page-admin {
    --sidebar-width: 240px;
}
@media (max-width: 992px) {
    body.page-admin {
        --sidebar-width: 200px;
    }
}
@media (max-width: 600px) {
    body.page-admin {
        --sidebar-width: 160px;
    }
}


/* == 侧栏搜索结果表格 == */
#resultsSidebar .sidebar-hint { color:#6b7280; margin:8px 0; }
#resultsSidebar .sidebar-error { color:#b91c1c; margin:8px 0; }
#resultsSidebar .sidebar-empty { color:#6b7280; margin:8px 0; }

#resultsSidebar .sidebar-results-table{
    width:100%;
    border-collapse:separate;
    border-spacing:0;
    font-size:13px;
    table-layout:auto;
}
#resultsSidebar .sidebar-results-table thead th{
    position: sticky; top: 0;
    background:#fff;
    z-index:1;
    border-bottom:1px solid #e5e7eb;
    padding:10px 16px;
    text-align:left;
    font-weight:600;
    white-space:nowrap;
}
#resultsSidebar .sidebar-results-table tbody td{
    border-bottom:1px solid #f1f5f9;
    padding:10px 16px;
    white-space:nowrap;
}
#resultsSidebar .sidebar-results-table tbody tr:nth-child(odd){
    background:#fcfcfd;
}
#resultsSidebar .sidebar-results-table tbody tr:hover{
    background:#f9fafb;
}
#resultsSidebar .btn.btn-sm{
    padding:4px 8px;
    border-radius:6px;
    border:1px solid #2563eb;
    background:#2563eb;
    color:#fff;
    text-decoration:none;
}
#resultsSidebar .btn.btn-sm:hover{
    filter:brightness(.95);
}
.pathology-two-col{ display:flex; gap:12px; align-items:stretch; }
.patho-left{ width:38%; min-width:320px; display:flex; flex-direction:column; }
.patho-left textarea{ flex:1; min-height:260px; resize:vertical; }
.patho-left .btn-row{ display:flex; gap:8px; margin-top:8px; justify-content:flex-end; }
.patho-right{ flex:1; min-width:420px; }

/* ========================================================= */
/* ================ Statistics Page Styling ================ */
/* ========================================================= */
.hidden { display: none !important; }

.btn-light {
    color: #1f2937;
    background-color: #f8fafc;
    border-color: #e2e8f0;
}
.btn-light:hover {
    background-color: #e2e8f0;
    border-color: #d1d5db;
}
.btn-outline-secondary {
    color: #334155;
    background-color: #fff;
    border-color: #cbd5f5;
}
.btn-outline-secondary:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: rgba(37,99,235,0.08);
}

.form-control,
.form-select,
textarea.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #fff;
    font-size: 0.95rem;
    color: #1f2937;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.18);
}

.statistics-page {
    max-width: 1380px;
    margin: 0 auto;
    padding: 24px 24px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: calc(100vh - var(--appbar-height));
}

.stats-section {
    background: var(--bg-white);
    border-radius: 18px;
    padding: 26px 28px;
    box-shadow: 0 22px 45px rgba(15,23,42,0.05);
    border: 1px solid rgba(148, 163, 184, 0.18);
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.stats-section__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}
.stats-section__header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}
.stats-section__header h2 i {
    color: var(--primary-color);
}
.stats-section__header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.95rem;
    max-width: 720px;
}
.stats-section__body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
    min-height: 0;
}
.stats-section__body .stats-card-body {
    flex: 1;
    min-height: 0;
}
.stats-section--scroll {
    overflow: hidden;
}
.stats-section--scroll .stats-section__body {
    overflow-y: auto;
    padding-right: 6px;
}
.stats-section--toolbar {
    padding: 16px 20px;
}
.stats-section__body--toolbar {
    flex: 0 0 auto;
    overflow: visible;
}
.stats-toolbar-placeholder {
    min-height: 54px;
    display: flex;
    align-items: center;
}

.stats-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}
.stats-panel--fixed {
    flex: 0 0 calc(33.333% - 8px);
    min-height: 0;
}
.stats-panel--grow {
    flex: 1;
    min-height: 0;
}

.stats-filters {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.filter-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.filter-group-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid rgba(203, 213, 225, 0.85);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f8fbff);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.filter-group-card__connector {
    align-self: flex-start;
    margin-top: -2px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(37,99,235,0.08);
    color: #1d4ed8;
    font-size: 0.8rem;
    font-weight: 600;
}
.filter-group-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-group-card__title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
}
.filter-group-card__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.filter-group-card__join-mode {
    min-width: 156px;
}
.filter-group-card__body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.filter-conditions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.condition-row {
    display: grid;
    grid-template-columns: 470px 122px minmax(560px, 1fr) 42px;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    background: #f9fafc;
    border-radius: 12px;
    border: 1px solid rgba(203, 213, 225, 0.7);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.condition-row .condition-cell select,
.condition-row .condition-cell input,
.condition-row .condition-cell textarea {
    width: 100%;
}
.condition-cell.condition-operator {
    display: flex;
    align-items: center;
}
.condition-cell.condition-operator .form-select {
    width: 100%;
    font-size: 0.85rem;
}
.condition-field-stack {
    display: grid;
    grid-template-columns: 190px 220px;
    gap: 8px;
}
.condition-cell.condition-value .value-input-wrapper input.form-control[type="text"] {
    width: 100%;
    max-width: 180px;
    font-size: 0.85rem;
}
.value-input-wrapper--stack {
    display: grid;
    grid-template-columns: 180px minmax(300px, 1fr);
    align-items: center;
    gap: 8px;
}
.value-input-wrapper--stack > * {
    min-width: 0;
}
.value-input-wrapper--keyword {
    display: grid;
    grid-template-columns: minmax(140px, 0.9fr) minmax(160px, 1.1fr);
    gap: 8px;
    align-items: center;
}
.condition-date-range {
    display: grid;
    grid-template-columns: 126px 126px;
    gap: 8px;
    justify-items: start;
}
.condition-date-range .form-control {
    width: 90%;
    font-size: 0.8rem;
}
.condition-row .condition-remove .btn {
    color: #dc2626;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .2s;
}
.condition-cell.condition-remove {
    justify-self: start;
    padding-left: 4px;
}
.condition-row .condition-remove .btn:hover {
    background-color: rgba(220, 38, 38, 0.08);
}

.filter-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-actions .actions-left,
.filter-actions .actions-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filters-status {
    font-size: 0.9rem;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #f8fafc;
}
.filters-status.info {
    color: var(--primary-color);
    background: rgba(37,99,235,0.08);
    border-color: rgba(37,99,235,0.22);
}
.filters-status.warn {
    color: #b45309;
    background: rgba(251, 191, 36, 0.14);
    border-color: rgba(217, 119, 6, 0.35);
}
.filters-status.success {
    color: #15803d;
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(22, 163, 74, 0.28);
}
.filters-status.error {
    color: #b91c1c;
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
}
.filters-status.muted {
    color: #64748b;
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.22);
}

.stats-card-body {
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 14px;
    background-color: #fff;
    overflow-x: auto;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.stats-card-body .placeholder-text {
    padding: 28px;
    text-align: center;
    color: #6b7280;
    font-size: 0.95rem;
}

.stats-case-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}
.stats-case-table thead {
    background: #f9fafc;
}
.stats-case-table th,
.stats-case-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
    font-size: 0.95rem;
    color: #1f2937;
    vertical-align: middle;
}
.stats-case-table th {
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0.01em;
}
.stats-case-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.06);
}
.stats-case-table tbody tr.is-selected {
    background: rgba(37, 99, 235, 0.12);
    box-shadow: inset 2px 0 0 var(--primary-color);
}
.stats-case-table .case-cell.case-select {
    width: 220px;
}
.stats-case-table .case-cell.case-clinical-diagnosis {
    min-width: 220px;
    white-space: normal;
    line-height: 1.5;
}
.stats-case-table .case-cell.case-actions {
    width: 100px;
}
.stats-diagnosis-line + .stats-diagnosis-line {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed rgba(203, 213, 225, 0.8);
}
.stats-case-table .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.92rem;
    color: #334155;
}
.stats-case-table select.stats-case-group {
    margin-top: 4px;
}

.stats-toolbar {
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #f8fafc;
    padding: 18px 20px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
.statistics-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.statistics-toolbar .toolbar-left {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.statistics-toolbar .toolbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.statistics-toolbar .selected-info {
    color: #475569;
    font-size: 0.95rem;
}

.summary-section {
    display: grid;
    gap: 18px;
}
.summary-section.summary-groups {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.summary-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.summary-card {
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid rgba(203, 213, 225, 0.8);
    padding: 20px 22px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.summary-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.summary-card__header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
}
.summary-card__header .badge {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.summary-metric strong {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}
.summary-metric p {
    margin: 0;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
}
.summary-card--compact {
    padding: 18px;
}
.summary-card--compact ul {
    margin: 0;
    padding-left: 18px;
    color: #475569;
    font-size: 0.9rem;
}
.summary-card--compact li {
    margin-bottom: 6px;
}

.modal-container.stats-modal {
    width: min(620px, 92vw);
    border-radius: 10px;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 22px 48px rgba(15,23,42,0.2);
    overflow: hidden;
}
.stats-modal--wide {
    width: min(760px, 94vw);
}
.stats-modal--survival {
    max-height: 90vh;
}
.stats-modal--survival .modal-body {
    max-height: none;
    overflow: visible;
    padding-bottom: 16px;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
    background: #f8fafc;
}
.modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 650;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
}
.modal-body {
    padding: 22px 24px;
    max-height: calc(90vh - 132px);
    overflow-y: auto;
}
.modal-footer {
    padding: 14px 24px 18px;
    border-top: 1px solid rgba(226, 232, 240, 0.95);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f9fafb;
}
.modal-status {
    margin-top: 12px;
    font-size: 0.92rem;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
}
.modal-status.info {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.12);
    border-color: rgba(37, 99, 235, 0.24);
}
.modal-status.warn {
    color: #b45309;
    background: rgba(251, 191, 36, 0.16);
    border-color: rgba(217, 119, 6, 0.32);
}
.modal-status.error {
    color: #b91c1c;
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(239, 68, 68, 0.32);
}
.modal-status.success {
    color: #15803d;
    background: rgba(34, 197, 94, 0.18);
    border-color: rgba(22, 163, 74, 0.32);
}

.app-prompt-modal {
    width: min(420px, calc(100vw - 32px));
}
.app-prompt-modal .modal-body {
    font-size: 0.96rem;
    line-height: 1.65;
    color: #1f2937;
    white-space: pre-wrap;
}
.app-prompt-modal .modal-footer .btn {
    min-width: 86px;
}
.app-toast-region {
    position: fixed;
    right: 20px;
    top: calc(var(--appbar-height) + 16px);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.app-toast {
    min-width: 240px;
    max-width: min(380px, calc(100vw - 40px));
    padding: 11px 14px;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
    color: #1e3a8a;
    background: #eff6ff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.16);
    font-size: 0.92rem;
    line-height: 1.5;
}
.app-toast--success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}
.app-toast--error {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}
.app-toast--warn {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

.stats-save-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.stats-save-form label {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}
.required {
    color: #dc2626;
}

.queue-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.queue-item {
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 12px;
    background: #f8fafc;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.queue-item__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}
.queue-item__header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
}
.queue-item__meta {
    font-size: 0.85rem;
    color: #64748b;
}
.queue-item__remark {
    margin: 0;
    color: #475569;
    font-size: 0.92rem;
    line-height: 1.5;
}
.queue-item__info,
.queue-item__filters {
    margin: 0;
    font-size: 0.9rem;
    color: #475569;
}
.queue-item__actions {
    display: flex;
    justify-content: flex-end;
}

.survival-chart-wrapper {
    width: 100%;
    max-width: 100%;
    margin-top: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    padding: 10px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.survival-chart-wrapper canvas {
    width: 100%;
    height: 100%;
    display: block;
}
.survival-legend {
    margin-top: 12px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.survival-legend__item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #1f2937;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
}
.survival-legend__color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #cbd5f5;
    accent-color: var(--primary-color);
}
.stats-case-group {
    min-width: 140px;
}

@media (max-width: 1024px) {
    .filter-group-card__actions {
        width: 100%;
        justify-content: flex-start;
    }
    .condition-row {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "field operator"
            "value value"
            "remove remove";
    }
    .condition-cell.condition-field { grid-area: field; }
    .condition-cell.condition-operator { grid-area: operator; }
    .condition-cell.condition-value { grid-area: value; }
    .condition-cell.condition-remove { grid-area: remove; justify-self: flex-end; }
    .condition-field-stack {
        grid-template-columns: 1fr;
    }
    .condition-cell.condition-value .value-input-wrapper input.form-control[type="text"] {
        width: 100%;
    }
    .value-input-wrapper--stack {
        grid-template-columns: 1fr;
    }
    .condition-date-range,
    .value-input-wrapper--keyword {
        grid-template-columns: 1fr;
    }
}
@media (max-width: 720px) {
    .statistics-page {
        padding: 24px 16px 40px;
    }
    .stats-section {
        padding: 22px 20px;
    }
    .statistics-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .statistics-toolbar .toolbar-left,
    .statistics-toolbar .toolbar-right {
        justify-content: space-between;
    }
    .stats-case-table {
        min-width: 640px;
    }
    .stats-panel--fixed {
        flex: 0 0 auto;
    }
}

/* --- [ 新增：科室管理 (Admin) 模块样式 ] --- */

/* 1. 页面主布局 (替换旧的 body padding) */
.admin-page-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem; /* 24px 间距 */
}

/* 2. 卡片样式 (替换旧的 .card) */
.admin-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem; /* 24px 内边距 */
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.admin-card h3 {
    font-size: 1.125rem; /* 18px */
    font-weight: 600;
    color: #111827;
    margin: 0 0 1.25rem 0; /* 20px 底部间距 */
    padding-bottom: 1rem; /* 16px */
    border-bottom: 1px solid var(--border-color);
}

/* 3. 表单网格 (替换 .grid-2, .grid-3) */
.form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 默认 3 列 */
    gap: 1rem 1.5rem; /* 16px 24px */
}
/* 搜索栏的特定布局 (替换 .row) */
.form-grid.form-grid-toolbar {
    grid-template-columns: 1fr 1fr auto;
    align-items: flex-end;
}
/* 医疗组表单的特定布局 */
.form-grid.form-grid-team {
    grid-template-columns: 2fr 1fr;
}
.form-grid .grid-span-all {
    grid-column: 1 / -1;
    display: flex;
    gap: 0.5rem; /* 8px */
}

/* 4. 表单组 (用于包裹 Label 和 Input) */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem; /* 6px */
}
.form-group label {
    font-size: 0.875rem; /* 14px */
    font-weight: 500;
    color: #374151;
}
/* 继承自统计模块的 .form-control / .form-select 样式将自动应用 */

/* 5. 错误消息 */
.form-error {
    color: #b91c1c;
    font-size: 0.875rem; /* 14px */
    margin-top: 0.25rem; /* 4px */
}

/* 6. 表格样式 (使用现有 .table) */
.admin-table-wrapper {
    overflow-x: auto;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th, 
.admin-table td {
    padding: 0.75rem 1rem; /* 12px 16px */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.9rem; /* 14.4px */
    white-space: nowrap;
}
.admin-table th {
    background-color: #f9fafb;
    font-weight: 500;
}
.admin-table tbody tr:hover {
    background-color: rgba(0,0,0,0.02);
}

/* 7. 表格内的元素 */
.admin-table .badge {
    padding: 0.125rem 0.5rem; /* 2px 8px */
    border-radius: 999px;
    font-size: 0.75rem; /* 12px */
    font-weight: 500;
}
.admin-table .badge.on {
    background-color: #ecfdf5;
    color: #065f46;
}
.admin-table .badge.off {
    background-color: #fef2f2;
    color: #991b1b;
}
.admin-table .actions {
    display: flex;
    gap: 0.5rem; /* 8px */
}
form.inline {
    display: inline;
}

/* 8. 分页 (使用现有样式，稍作调整) */
.pagination {
    display: flex;
    gap: 0.5rem; /* 8px */
    margin-top: 1rem; /* 16px */
}
.pagination a, .pagination span {
    display: inline-block;
    padding: 0.375rem 0.75rem; /* 6px 12px */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: #111827;
    font-size: 0.875rem;
}
.pagination a:hover {
    background-color: #f4f4f5;
}
.pagination .current {
    background-color: #1f2937;
    color: #fff;
    border-color: #1f2937;
}

/* 9. 响应式调整 */
@media (max-width: 768px) {
    .form-grid.form-grid-toolbar,
    .form-grid.form-grid-team,
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* --- [ 新增：标签页 (Tab) 导航样式 ] --- */
.tab-nav {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem; /* 24px (与 admin-page-layout 的 gap 一致) */
}
.tab-nav-link {
    display: inline-block;
    padding: 0.75rem 1.25rem; /* 12px 20px */
    margin-bottom: -1px; /* 关键：使其底部边框与父级边框重叠 */
    border: 1px solid transparent;
    border-radius: 6px 6px 0 0; /* 顶部圆角 */
    font-size: 1rem; /* 16px */
    font-weight: 500;
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}
.tab-nav-link:hover {
    background-color: #f9fafb; /* 浅灰色背景 */
    border-color: var(--border-color);
    text-decoration: none;
}
.tab-nav-link.active {
    background-color: var(--bg-white); /* 与卡片背景色一致 */
    border-color: var(--border-color) var(--border-color) var(--bg-white); /* 关键：底部边框设为白色，覆盖父级边框 */
    color: #111827; /* 激活时用深色文字 */
    font-weight: 600;
}

.tab-pane {
    display: none; /* 默认隐藏所有内容 */
}
.tab-pane.active {
    display: flex; /* 只显示激活的 */
    flex-direction: column;
    gap: 1.5rem; /* 重新应用卡片间的 24px 间距 */
}

