/* ============================================================
   HeaRoot AI Lab 静态原型样式
   目的：按产品原型统一成生命科技主题工作台界面
   ============================================================ */

:root {
    /* 页面最小宽度：窗口变窄时保持固定布局，通过外层滚动条查看被遮住的内容。 */
    --app-min-width: 1360px;
    --color-primary: #0f7f72;
    --color-primary-dark: #073a32;
    --color-primary-soft: #dff4ef;
    --color-blue: #3164f4;
    --color-green: #159447;
    --color-bg: #eef8f6;
    --color-surface: #ffffff;
    --color-text: #102f2b;
    --color-muted: #5d7772;
    --color-border: #c9dfda;
    --color-border-soft: #e0ece9;
    --color-danger: #d94b3d;
    --color-warning: #d98519;
    --shadow-sm: 0 1px 2px rgba(5, 48, 42, 0.05);
    --shadow-md: 0 16px 40px rgba(5, 48, 42, 0.12);
}

body.dark {
    --color-bg: #12211f;
    --color-surface: #1b2d2a;
    --color-text: #edf8f5;
    --color-muted: #a4bbb5;
    --color-border: #31534d;
    --color-border-soft: #29443f;
    --color-primary-soft: #203d38;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    min-width: var(--app-min-width);
    overflow-x: auto;
    overflow-y: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.55;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.lab-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    width: 100%;
    min-width: var(--app-min-width);
    height: 100vh;
    background: var(--color-bg);
    transition: grid-template-columns 0.2s ease;
}

.lab-shell.sidebar-collapsed {
    grid-template-columns: 0 minmax(0, 1fr);
}

.lab-shell.app-locked {
    filter: blur(1px);
    pointer-events: none;
    user-select: none;
}

.lab-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 24px 16px;
    background: var(--color-primary-dark);
    color: #ffffff;
    transition: opacity 0.16s ease, padding 0.2s ease, visibility 0.2s ease;
}

.lab-shell.sidebar-collapsed .lab-sidebar {
    visibility: hidden;
    padding-right: 0;
    padding-left: 0;
    opacity: 0;
    pointer-events: none;
}

.lab-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 44px;
    color: inherit;
    text-decoration: none;
}

/* Logo 区域作为首页链接，键盘访问时清楚显示当前焦点。 */
a.lab-brand:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 6px;
    border-radius: 4px;
}

a.lab-brand:hover {
    opacity: 0.9;
}

.lab-brand-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    background: #ffffff;
}

.lab-brand-name {
    font-size: 26px;
    line-height: 1;
    font-weight: 800;
}

.lab-brand-subtitle {
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.78);
}

.lab-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lab-nav-item {
    width: 100%;
    min-height: 40px;
    padding: 0 22px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.78);
    text-align: left;
    font-size: 14px;
}

.lab-nav-item:hover,
.lab-nav-item.active {
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 700;
}

.lab-sidebar-footer {
    margin-top: auto;
    padding: 12px 8px;
}

/* 反馈固定在侧栏底部；短窗口只滚动主菜单，避免入口被挤出可见区域。 */
.lab-sidebar.has-feedback-entry {
    overflow-y: hidden;
}

.has-feedback-entry .lab-brand {
    flex-shrink: 0;
}

.has-feedback-entry .lab-nav {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

.has-feedback-entry .lab-nav-item {
    flex-shrink: 0;
}

.sidebar-feedback-footer {
    flex-shrink: 0;
    padding: 16px 0 0;
}

.sidebar-feedback-footer .lab-nav-item:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -3px;
}

/* 处理意见列表在窄区域内滚动，空状态文案可换行，避免撑开页面。 */
.feedback-review-table-container {
    overflow-x: auto;
}

.feedback-review-table-container .data-table {
    min-width: 680px;
}

.data-table .feedback-review-empty {
    padding: 56px 16px;
    color: var(--color-muted);
    text-align: center;
    white-space: normal;
}

.offline-status {
    margin-top: 8px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 12px;
}

.model-status {
    display: inline-flex;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 12px;
}

.model-status.loaded {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.lab-main {
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.module-header {
    flex: 0 0 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.module-header-start {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
}

.module-header-start > :not(.sidebar-toggle-btn) {
    min-width: 0;
}

.sidebar-toggle-btn {
    display: inline-flex;
    width: 34px;
    min-width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.sidebar-toggle-btn::before,
.ncbi-history-toggle-btn::before {
    content: "";
    width: 8px;
    height: 8px;
    border: solid currentColor;
    border-width: 0 2px 2px 0;
    transform: rotate(135deg);
}

.lab-shell.sidebar-collapsed .sidebar-toggle-btn::before {
    transform: rotate(-45deg);
}

.ncbi-history-panel.collapsed .ncbi-history-toggle-btn::before {
    transform: rotate(-45deg);
}

.sidebar-toggle-btn:hover,
.sidebar-toggle-btn:focus-visible {
    border-color: var(--color-primary);
    outline: none;
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

@media (prefers-reduced-motion: reduce) {
    .lab-shell,
    .lab-sidebar,
    .sidebar-toggle-btn {
        transition: none;
    }
}

.module-header h1 {
    font-size: 26px;
    line-height: 1.15;
    font-weight: 800;
}

.module-header p {
    margin-top: 2px;
    color: var(--color-muted);
}

.module-title-with-tabs {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.module-title-with-tabs p {
    display: none;
}

.module-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 语言控件在登录页和登录后共用，选项长度变化时宽度自然调整。 */
.language-control {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 6px;
    color: var(--color-muted);
    font-size: 12px;
    white-space: nowrap;
}

.language-select {
    width: auto;
    max-width: 150px;
    min-height: 34px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
    cursor: pointer;
}

.language-select:hover,
.language-select:focus-visible {
    border-color: var(--color-primary);
    outline: 2px solid var(--color-primary-soft);
    outline-offset: 1px;
}

.ghost-btn,
.soft-btn,
.small-primary-btn,
.primary-action,
.btn-send,
.login-btn,
.btn-confirm,
.btn-cancel {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    transition: background 0.16s, border-color 0.16s, color 0.16s;
}

.ghost-btn {
    min-height: 34px;
    padding: 0 12px;
}

.ghost-btn:hover,
.soft-btn:hover,
.btn-cancel:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 4px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}

.user-chip:hover {
    border-color: var(--color-border);
    background: var(--color-primary-soft);
}

.user-chip:focus-visible {
    border-color: var(--color-primary);
    outline: 2px solid var(--color-primary-soft);
    outline-offset: 2px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 800;
}

.user-name {
    font-weight: 800;
}

.user-role {
    color: var(--color-muted);
    font-size: 12px;
}

.module-view {
    display: none;
    flex: 1;
    min-height: 0;
    padding: 20px 32px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.module-view.active {
    display: block;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    margin-bottom: 36px;
}

.feature-card,
.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.feature-card {
    min-height: 174px;
    padding: 24px;
    border-left-width: 5px;
}

.dashboard-entry-card {
    cursor: pointer;
    transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}

.dashboard-entry-card:hover,
.dashboard-entry-card:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
    outline: none;
    transform: translateY(-2px);
}

.feature-card h2,
.panel h2 {
    font-size: 20px;
    margin-bottom: 10px;
}

.feature-card p,
.panel p,
.muted {
    color: var(--color-muted);
}

.card-accent-green {
    border-left-color: var(--color-primary);
}

.card-accent-primary {
    border-left-color: var(--color-primary);
}

.card-accent-blue {
    border-left-color: var(--color-primary);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.tag-row span,
.pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 16px;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 700;
    font-size: 12px;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
}

.dashboard-side {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.panel {
    padding: 24px;
}

.wide-panel {
    min-height: 190px;
}

.data-table,
.compact-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
}

.data-table th,
.data-table td,
.compact-table th,
.compact-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--color-border-soft);
    text-align: left;
}

.data-table th,
.compact-table th {
    color: var(--color-muted);
    font-weight: 800;
}

.status {
    font-weight: 800;
}

.status.running,
.warn {
    color: var(--color-warning);
}

.status.pending {
    color: #d47b17;
}

.status.done {
    color: #0da04b;
}

.status.disabled {
    color: var(--color-danger);
}

.experiment-report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.experiment-report-toolbar h2 {
    margin-bottom: 4px;
    font-size: 20px;
}

.experiment-report-panel-header {
    display: flex;
    justify-content: flex-end;
    min-height: 36px;
}

.experiment-report-table th:last-child,
.experiment-report-table td:last-child {
    width: 160px;
    white-space: nowrap;
}

.experiment-report-table .soft-btn {
    min-height: 32px;
    margin-right: 6px;
    padding: 0 12px;
}

.experiment-report-title-link {
    border: 0;
    background: transparent;
    color: var(--color-primary);
    font-weight: 800;
    text-align: left;
}

.experiment-report-title-link:hover {
    text-decoration: underline;
}

.material-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.material-toolbar h2 {
    margin-bottom: 4px;
    font-size: 20px;
}

.material-toolbar-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* 库存总数放在库存列表标题旁边，用小字展示，避免占用单独的大卡片空间。 */
.material-title-group {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.material-title-count {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.material-title-count strong {
    color: var(--color-text);
    font-size: 14px;
}

.material-summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.material-summary-card {
    display: flex;
    min-height: 96px;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
}

.material-summary-card span {
    color: var(--color-muted);
    font-size: 13px;
    font-weight: 700;
}

.material-summary-card strong {
    color: var(--color-text);
    font-size: 28px;
}

.material-table-panel {
    margin-bottom: 18px;
    overflow-x: auto;
}

.material-search-input {
    width: 100%;
    margin: 14px 0 18px;
}

.material-table th:last-child,
.material-table td:last-child {
    width: 140px;
    white-space: nowrap;
}

.material-table .soft-btn {
    min-height: 32px;
    margin-right: 6px;
    padding: 0 10px;
}

.material-stock-normal {
    color: var(--color-text);
    font-weight: 800;
}

.material-stock-low {
    color: var(--color-danger);
    font-weight: 900;
}

.material-transaction-table td:last-child {
    max-width: 280px;
    white-space: normal;
}

.modal-material,
.modal-material-transaction {
    width: 760px;
}

.material-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.material-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--color-muted);
    font-weight: 700;
}

.material-form label:nth-last-of-type(1),
.material-form .form-error {
    grid-column: 1 / -1;
}

.assistant-layout {
    display: grid;
    grid-template-columns: 252px minmax(640px, 1fr);
    gap: 24px;
    height: calc(100vh - 136px);
    max-height: calc(100vh - 136px);
    min-height: 520px;
}

.context-panel,
.chat-panel {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.small-primary-btn,
.primary-action,
.btn-send,
.login-btn,
.btn-confirm {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #ffffff;
    font-weight: 800;
}

.small-primary-btn {
    min-height: 30px;
    padding: 0 14px;
}

.primary-action {
    width: 100%;
    min-height: 40px;
    margin-top: auto;
}

.inline-action {
    width: auto;
    min-height: 38px;
    margin-top: 0;
    padding: 0 22px;
}

.conversation-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 18px 0;
}

.conv-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--color-text);
    cursor: pointer;
    user-select: none;
}

/* 会话标题行：标题占左侧剩余空间，操作图标靠右显示。 */
.conv-main-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.conv-item:hover,
.conv-item.active {
    background: var(--color-primary-soft);
}

.conv-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
}

.conv-time {
    /* 时间独占下一行，避免和右侧操作图标抢宽度。 */
    display: block;
    color: var(--color-muted);
    font-size: 11px;
    line-height: 1.2;
}

.conv-actions {
    display: none;
    flex: 0 0 auto;
    gap: 8px;
    margin-left: auto;
}

.conv-item:hover .conv-actions {
    display: flex;
}

.conv-actions button {
    border: 0;
    background: transparent;
    color: var(--color-muted);
}

.context-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.soft-btn {
    min-height: 30px;
    padding: 0 14px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    border-color: transparent;
    font-weight: 800;
}

.chat-area {
    position: relative;
    flex: 1;
    min-height: 0;
    margin-top: 16px;
    overflow: hidden;
}

.welcome-page {
    display: flex;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    text-align: center;
    color: var(--color-muted);
}

.welcome-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

.message-list {
    height: 100%;
    overflow-y: auto;
    padding: 10px 4px 20px;
}

.message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
}

.message.user {
    justify-content: flex-end;
}

.bubble {
    position: relative;
    max-width: 68%;
    padding: 16px 18px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-copy-btn {
    position: absolute;
    top: 6px;
    right: 8px;
    border: 1px solid rgba(12, 88, 75, 0.18);
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-primary);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.bubble:hover .message-copy-btn,
.bubble:focus-within .message-copy-btn {
    opacity: 1;
    pointer-events: auto;
}

.message-copy-btn:hover,
.message-copy-btn:focus {
    background: #ffffff;
    border-color: rgba(12, 88, 75, 0.36);
    outline: none;
}

.message.assistant .bubble {
    background: #edf7f4;
}

.message.user .bubble {
    background: #d6f4ef;
}

.avatar,
.avatar-img {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: #ffffff;
    font-weight: 800;
}

.chat-input-area {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 66px;
    gap: 14px;
    align-items: end;
    margin-top: 12px;
}

.user-input {
    width: 100%;
    min-height: 46px;
    max-height: 110px;
    padding: 12px 16px;
    resize: none;
    outline: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text);
    background: var(--color-surface);
}

.user-input:focus {
    border-color: var(--color-primary);
}

.btn-send {
    min-height: 46px;
}

.btn-send.btn-send-stop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    justify-self: center;
    align-self: center;
    padding: 0;
    border-color: var(--color-primary);
    border-radius: 999px;
    background: var(--color-primary);
    box-shadow: 0 8px 18px rgba(12, 88, 75, 0.22);
}

.btn-send.btn-send-stop::before {
    content: "";
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: #ffffff;
}

.btn-send.btn-send-stop:hover,
.btn-send.btn-send-stop:focus {
    border-color: var(--color-primary);
    background: var(--color-primary);
}

.input-hint {
    min-height: 20px;
    margin-top: 6px;
    color: var(--color-muted);
    font-size: 12px;
}

.output-placeholder,
.blank-workspace {
    flex: 1;
    min-height: 260px;
    margin: 18px 0;
    border-radius: 8px;
    background: linear-gradient(180deg, rgba(223, 244, 239, 0.6), rgba(255, 255, 255, 0));
    border: 1px dashed var(--color-border);
}

.output-plan-list {
    display: flex;
    flex: 1;
    min-height: 260px;
    margin: 18px 0;
    padding-right: 2px;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.output-plan-card {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    cursor: pointer;
}

.output-plan-card.active {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.output-plan-card input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--color-primary);
}

.output-plan-body {
    min-width: 0;
}

.output-plan-title {
    color: var(--color-text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.45;
}

.output-plan-text {
    margin-top: 6px;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.55;
}

.output-plan-meta {
    margin-top: 8px;
    color: var(--color-muted);
    font-size: 11px;
}

.output-actions {
    justify-content: flex-start;
}

.danger-btn {
    background: rgba(217, 75, 61, 0.12);
    color: var(--color-danger);
}

.three-column {
    display: grid;
    grid-template-columns: 280px minmax(320px, 1fr) minmax(320px, 1fr);
    gap: 24px;
    min-height: 0;
}

.three-column .panel {
    display: flex;
    flex-direction: column;
}

.ncbi-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    height: calc(100vh - 136px);
    min-height: 540px;
}

.ncbi-layout.history-collapsed {
    grid-template-columns: 82px minmax(0, 1fr);
}

.ncbi-layout.gene-mode {
    grid-template-columns: minmax(0, 1fr);
}

.ncbi-gene-result-item {
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.ncbi-gene-result-item.exact {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.ncbi-gene-id-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.ncbi-gene-symbol {
    font-weight: 800;
}

.ncbi-gene-desc,
.ncbi-gene-aliases {
    margin-top: 6px;
    color: var(--color-muted);
    word-break: break-word;
}

.ncbi-gene-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.ncbi-gene-meta span {
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-bg);
    color: var(--color-muted);
    font-size: 12px;
}

.ncbi-history-panel,
.ncbi-search-panel {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.ncbi-history-panel {
    transition: padding 0.16s ease;
}

.ncbi-history-panel.collapsed {
    align-items: center;
    padding: 16px 10px;
}

.ncbi-history-panel.collapsed h2,
.ncbi-history-panel.collapsed p,
.ncbi-history-panel.collapsed .ncbi-history-list,
.ncbi-history-panel.collapsed .ncbi-history-pager {
    display: none;
}

.ncbi-history-panel.collapsed .panel-title-row {
    width: 100%;
    justify-content: center;
}

.ncbi-history-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ncbi-history-toggle-btn {
    display: inline-flex;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ncbi-history-panel.collapsed .ncbi-history-actions {
    justify-content: center;
}

.ncbi-history-list,
.ncbi-result-list {
    min-height: 0;
    overflow-y: auto;
}

.ncbi-history-list {
    flex: 1;
    margin-top: 18px;
}

.ncbi-history-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border-soft);
}

.ncbi-history-pager .soft-btn {
    min-width: 64px;
    padding: 0 10px;
}

.ncbi-history-pager .muted {
    flex: 1;
    text-align: center;
    font-size: 12px;
}

.ncbi-history-item {
    position: relative;
    width: 100%;
    padding: 13px 42px 13px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    text-align: left;
}

.ncbi-history-item.active,
.ncbi-history-item:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}

.ncbi-history-item span,
.ncbi-history-item small {
    display: block;
}

.ncbi-history-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.ncbi-history-item small {
    margin-top: 5px;
    color: var(--color-muted);
}

.ncbi-history-delete {
    position: absolute;
    top: 50%;
    right: 12px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-muted);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.ncbi-history-delete:hover {
    color: var(--color-danger);
}

.ncbi-search-form {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr) auto auto;
    gap: 12px;
    align-items: end;
    margin-top: 18px;
}

.ncbi-search-form.gene-mode {
    grid-template-columns: 150px minmax(0, 1fr) minmax(160px, 220px) auto auto;
}

.ncbi-search-form label {
    color: var(--color-muted);
    font-weight: 800;
}

.ncbi-search-form input,
.ncbi-search-form select {
    margin-top: 8px;
}

.ncbi-update-btn {
    min-height: 38px;
}

.ncbi-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 18px 0 12px;
}

.ncbi-page-actions {
    display: flex;
    gap: 8px;
    flex: 0 0 auto;
}

.ncbi-result-list {
    flex: 1;
    padding-right: 4px;
}

.ncbi-result-item {
    display: block;
    width: 100%;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    text-align: left;
}

.ncbi-result-item:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.ncbi-result-title,
.ncbi-result-meta,
.ncbi-result-id {
    display: block;
}

.ncbi-result-title {
    font-weight: 400;
    line-height: 1.45;
}

.ncbi-match-highlight {
    font-weight: 800;
}

.ncbi-result-meta,
.ncbi-result-id {
    margin-top: 6px;
    color: var(--color-muted);
    font-size: 12px;
}

.modal-ncbi-detail {
    width: 900px;
}

.ncbi-detail-body {
    max-height: 68vh;
    overflow-y: auto;
}

.ncbi-detail-body h4 {
    margin-bottom: 12px;
    font-size: 18px;
    line-height: 1.45;
}

.ncbi-detail-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-soft);
}

.ncbi-detail-section h5 {
    margin-bottom: 10px;
    color: var(--color-text);
    font-size: 14px;
}

.ncbi-detail-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border-soft);
}

.ncbi-detail-row span {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 800;
}

.ncbi-detail-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
}

.ncbi-detail-tags,
.ncbi-mesh-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ncbi-detail-tags span,
.ncbi-mesh-list span {
    min-height: 26px;
    padding: 4px 10px;
    border-radius: 8px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 800;
}

.ncbi-external-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ncbi-external-links a {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 4px 12px;
    border: 1px solid var(--color-primary);
    border-radius: 8px;
    color: var(--color-primary);
    background: var(--color-primary-soft);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.ncbi-external-links a:hover {
    background: var(--color-primary);
    color: #ffffff;
}

.ncbi-detail-authors {
    margin-bottom: 14px;
}

.ncbi-author-card {
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid var(--color-border-soft);
    border-radius: 8px;
    background: var(--color-bg);
}

.ncbi-author-card strong {
    display: block;
    margin-bottom: 4px;
}

.ncbi-author-card p {
    color: var(--color-muted);
    font-size: 12px;
    word-break: break-word;
}

.ncbi-detail-abstract {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 14px;
    border: 1px solid var(--color-border-soft);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: inherit;
    line-height: 1.65;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.metric-grid,
.analysis-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.metric-grid div {
    padding: 12px;
    border: 1px solid var(--color-border-soft);
    border-radius: 8px;
}

.metric-grid span {
    display: block;
    color: var(--color-muted);
    font-size: 12px;
}

.metric-grid strong {
    display: block;
    margin-top: 4px;
    color: var(--color-primary);
    font-size: 18px;
}

.danger-text {
    color: var(--color-danger);
}

.formula-summary-grid {
    display: block;
    margin-bottom: 36px;
}

.formula-stat-card {
    min-height: 112px;
    padding: 24px;
    border: 1px solid var(--color-border);
    border-left-width: 5px;
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.formula-stat-card h2 {
    font-size: 20px;
    margin-bottom: 10px;
}

/* 配方统计融合卡片：一张卡片展示总量、待复核、通过和失败，减少顶部空间占用。 */
.formula-summary-card {
    border-left-color: var(--color-primary);
}

/* 统计项使用自适应网格，空间足够时横向排布，空间变窄时自动换行。 */
.formula-stat-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

/* 单个统计项只展示名称和数量，避免说明文字占用页面高度。 */
.formula-stat-item {
    min-height: 64px;
    padding: 14px 16px;
    border-radius: 8px;
    background: var(--color-primary-soft);
}

.formula-stat-item span,
.formula-stat-item strong {
    display: block;
}

.formula-stat-item span {
    color: var(--color-muted);
    font-size: 13px;
}

.formula-stat-item strong {
    margin-top: 8px;
    color: var(--color-text);
    font-size: 26px;
    line-height: 1;
}

.formula-workspace {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
    min-height: 0;
}

.formula-record-panel,
.formula-detail-panel {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.formula-record-panel {
    min-height: 0;
}

.formula-record-list {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
    overflow-y: auto;
}

.formula-empty-text {
    padding: 14px;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    color: var(--color-muted);
    font-size: 14px;
}

.formula-record-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    width: 100%;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    text-align: left;
}

.formula-record-row {
    width: 100%;
}

.formula-record-row.active .formula-record-item,
.formula-record-item:hover {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}

.formula-record-delete {
    display: inline-flex;
    align-items: center;
    min-width: 58px;
    min-height: 42px;
    align-self: center;
    padding: 0 12px;
    justify-content: center;
}

.formula-record-main,
.formula-record-main span,
.formula-record-item small {
    display: block;
}

.formula-record-main {
    min-width: 0;
}

.formula-record-main span {
    font-weight: 800;
}

.formula-record-item small {
    margin-top: 6px;
    color: var(--color-muted);
}

.formula-detail-actions {
    margin-top: 0;
}

.formula-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.formula-edit-grid label,
.formula-textarea-label {
    display: block;
    color: var(--color-muted);
    font-weight: 800;
}

.formula-edit-grid input,
.formula-edit-grid select {
    margin-top: 8px;
}

.formula-textarea-label {
    margin-top: 18px;
}

.formula-editor {
    width: 100%;
    margin-top: 8px;
    padding: 14px;
    resize: vertical;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    outline: none;
    background: var(--color-surface);
    color: var(--color-text);
}

.formula-editor:focus {
    border-color: var(--color-primary);
}

.modal.modal-formula-detail {
    width: 50vw;
    height: 700px;
    max-width: calc(100vw - 96px);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.modal.modal-formula-detail .formula-detail-form {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    max-height: none;
    overflow-y: auto;
    margin-bottom: 16px;
}

.modal.modal-formula-detail .formula-detail-form .form-error {
    margin-top: 10px;
}

.modal.modal-formula-detail .formula-textarea-label {
    display: flex;
    min-height: 0;
    flex-direction: column;
}

.modal.modal-formula-detail .formula-textarea-label:nth-of-type(1) {
    flex: 2;
}

.modal.modal-formula-detail .formula-textarea-label:nth-of-type(2) {
    flex: 1;
}

.modal.modal-formula-detail #formula-content {
    min-height: 0;
    flex: 2;
}

.modal.modal-formula-detail #formula-review-notes {
    min-height: 0;
    flex: 1;
}

.modal.modal-formula-detail .modal-footer {
    flex: 0 0 auto;
}

.static-card-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(6, 26, 22, 0.48);
    z-index: 100;
}

.modal {
    width: 420px;
    max-width: 92vw;
    padding: 22px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.modal.modal-ncbi-detail {
    width: 850px;
    max-width: calc(100vw - 520px);
    max-height: calc(100vh - 140px);
    display: flex;
    flex-direction: column;
}

.modal.modal-ncbi-detail .ncbi-detail-body {
    min-height: 0;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
}

.modal-small {
    width: 340px;
}

.modal-model {
    width: 460px;
}

.modal-experiment-report {
    width: 720px;
}

.modal-experiment-report-detail {
    width: 840px;
}

.modal-body.experiment-report-form {
    max-height: calc(100vh - 180px);
}

/* 新建和修改共用 AI 报告卡片边界，字段变化时仍保持同一视觉结构。 */
.experiment-report-form .experiment-report-editor-card {
    min-width: 0;
    margin: 0;
    padding: 16px 18px;
}

/* 首个分区直接承接弹窗标题，避免顶部重复出现分隔线和空白。 */
.experiment-report-form .experiment-report-editor-card > .workflow-report-section:first-child {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}

/* 后续表单分区与 AI 报告卡片使用相同的间距和分隔方式。 */
.experiment-report-form .experiment-report-editor-card > .workflow-report-section {
    min-width: 0;
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--color-border-soft);
}

.experiment-report-form .workflow-report-section-title {
    margin: 0 0 10px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.4;
}

/* 短字段使用双列排布，标题占满整行以容纳较长的报告名称。 */
.experiment-report-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.experiment-report-field-wide {
    grid-column: 1 / -1;
}

/* 物种名称与完整序列成组排列，避免新建和修改时对应错位。 */
.experiment-report-gene-input-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.experiment-report-species-input-group {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 10px;
}

.experiment-report-primer-sequence-field {
    margin-top: 14px;
}

.experiment-report-form .experiment-report-field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
    color: var(--color-muted);
    font-weight: 700;
}

.experiment-report-form .rename-input {
    width: 100%;
}

.experiment-report-form .form-error {
    margin-top: 14px;
}

.experiment-report-textarea {
    width: 100%;
    min-height: 118px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    outline: none;
    resize: vertical;
    background: var(--color-surface);
    color: var(--color-text);
}

.experiment-report-textarea:focus {
    border-color: var(--color-primary);
}

/* FASTA 使用等宽字体保留换行，方便核对标题行和碱基序列。 */
.experiment-report-sequence-textarea {
    min-height: 132px;
    overflow: auto;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;
    white-space: pre;
}

/* 窄屏改为单列，避免日期、客户和物种输入框互相挤压。 */
@media (max-width: 640px) {
    .experiment-report-field-grid,
    .experiment-report-gene-input-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .experiment-report-field-wide {
        grid-column: auto;
    }
}

.form-error {
    min-height: 20px;
    color: var(--color-danger);
    font-size: 13px;
}

.experiment-report-detail {
    max-height: calc(100vh - 180px);
}

.experiment-report-detail-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.experiment-report-detail-meta div {
    padding: 12px;
    border: 1px solid var(--color-border-soft);
    border-radius: 6px;
    background: var(--color-primary-soft);
}

.experiment-report-detail-meta span {
    display: block;
    margin-bottom: 4px;
    color: var(--color-muted);
    font-size: 12px;
}

.experiment-report-detail section {
    padding: 16px 0;
    border-top: 1px solid var(--color-border-soft);
}

.experiment-report-detail h4 {
    margin-bottom: 8px;
    font-size: 15px;
}

.experiment-report-detail p {
    white-space: pre-wrap;
    color: var(--color-text);
}

.experiment-report-gene-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.experiment-report-gene-grid div {
    padding: 12px;
    border: 1px solid var(--color-border-soft);
    border-radius: 6px;
    background: var(--color-surface);
}

.experiment-report-gene-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--color-muted);
    font-size: 12px;
}

.experiment-report-gene-grid strong {
    white-space: pre-wrap;
}

/* 详情正文复用 AI 报告卡片边界，避免旧详情分区样式覆盖卡片内边距。 */
.experiment-report-detail .experiment-report-detail-card {
    margin: 0;
    padding: 16px 18px;
}

/* 卡片首个分区不显示顶部间隔和分隔线，保持与 AI 报告卡片开头一致。 */
.experiment-report-detail .experiment-report-detail-card > .workflow-report-section:first-child {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}

/* 后续分区沿用 AI 报告卡片的连续分隔方式，不使用独立内容块。 */
.experiment-report-detail .experiment-report-detail-card > .workflow-report-section {
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--color-border-soft);
}

.experiment-report-detail .workflow-report-section-title {
    margin: 0 0 10px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.4;
}

/* 长段实验内容保留用户换行，并允许长字符串自然换行。 */
.experiment-report-detail .experiment-report-detail-text {
    min-width: 0;
    margin: 0;
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.modal h3 {
    margin-bottom: 16px;
}

.profile-modal {
    width: 480px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.profile-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.profile-modal-header h3 {
    margin: 0;
}

.profile-close-btn {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: transparent;
    color: var(--color-muted);
    font-size: 22px;
    line-height: 1;
}

.profile-close-btn:hover,
.profile-close-btn:focus-visible {
    border-color: var(--color-primary);
    color: var(--color-primary);
    outline: none;
}

.profile-section {
    display: grid;
    gap: 12px;
    padding-top: 20px;
}

.profile-section + .profile-section {
    margin-top: 20px;
    border-top: 1px solid var(--color-border);
}

.profile-section h4 {
    margin: 0;
    font-size: 16px;
}

.profile-field {
    display: grid;
    gap: 6px;
    color: var(--color-muted);
    font-size: 13px;
}

.profile-field input[readonly] {
    background: var(--color-bg);
    color: var(--color-muted);
}

/* 资料输入框占用剩余空间，操作按钮按文字宽度固定在右侧。 */
.profile-input-action-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 10px;
}

.profile-inline-actions {
    display: flex;
}

/* 用户名修改机会用完后，隐藏同行按钮并释放其占用的空间。 */
.profile-inline-actions[hidden] {
    display: none;
}

.profile-input-action-row .btn-confirm {
    white-space: nowrap;
}

.profile-form-status {
    min-height: 20px;
    color: var(--color-danger);
    font-size: 13px;
}

.profile-form-status.success {
    color: var(--color-primary);
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
}

.modal-body {
    max-height: 360px;
    overflow-y: auto;
    margin-bottom: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-confirm,
.btn-cancel {
    min-height: 34px;
    padding: 0 16px;
}

.rename-input,
.role-select,
.login-input {
    width: 100%;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    outline: none;
    background: var(--color-surface);
    color: var(--color-text);
}

.rename-input:focus,
.role-select:focus,
.login-input:focus {
    border-color: var(--color-primary);
}

/* 登录遮罩显示时不继承业务工作区的最小宽度，避免底部出现无意义的横向滚动条。 */
body:has(.lab-shell.app-locked) {
    min-width: 0;
    overflow: hidden;
}

.login-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    z-index: 9999;
    background: var(--color-bg);
}

.login-stage {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center;
    width: 100%;
    min-height: 100%;
    padding: 80px 32px;
}

/* 品牌固定在整页内容的左上角，不再占用登录表单旁边的一整列。 */
.login-hero {
    position: absolute;
    top: 40px;
    left: 48px;
    display: flex;
    min-width: 0;
    align-items: center;
    color: var(--color-text);
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.login-hero-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    object-fit: contain;
    background: #ffffff;
}

.login-brand h1 {
    font-size: 26px;
    line-height: 1;
    font-weight: 800;
    white-space: nowrap;
}

.login-card {
    align-self: center;
    justify-self: center;
    width: min(440px, calc(100% - 64px));
    margin: 40px 32px;
    padding: 40px 48px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

/* 只调整登录遮罩内的卡片，独立的微信邮箱验证页保持原有布局。 */
.login-overlay .login-card {
    align-self: center;
    width: min(440px, 100%);
    min-height: 560px;
    margin: 0;
    padding: 40px;
}

.login-overlay .login-card h2,
.login-overlay .login-card-subtitle {
    text-align: center;
}

/* 语言控件仍使用原来的交互；跟随整页内容滚动，避免遮住矮窗口中的输入框。 */
.login-overlay .login-language-control {
    position: absolute;
    left: 48px;
    bottom: 32px;
    width: auto;
    max-width: calc(100% - 96px);
    margin: 0;
    justify-content: flex-start;
}

.login-card h2 {
    font-size: 22px;
    line-height: 1.35;
    margin-bottom: 8px;
}

.login-card-subtitle,
.login-switch {
    color: var(--color-muted);
}

.login-label {
    display: block;
    margin: 28px 0 8px;
    font-weight: 800;
}

.login-error {
    min-height: 22px;
    margin-top: 10px;
    color: var(--color-danger);
}

.login-btn {
    width: 100%;
    min-height: 50px;
    margin-top: 12px;
}

.login-switch {
    margin-top: 24px;
    font-size: 12px;
}

/* 注册入口只使用文字按钮，沿用登录卡片和浅绿色背景，不改变业务页布局。 */
.login-switch-button { padding: 0; border: 0; background: transparent; color: var(--color-primary); font: inherit; text-decoration: underline; cursor: pointer; }
.login-switch-button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 4px; }
.login-overlay [hidden] { display: none; }
.login-overlay .login-btn:disabled { cursor: not-allowed; opacity: 0.55; }

.model-item,
.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.model-item.active {
    background: var(--color-primary-soft);
    border-color: var(--color-primary);
}

.model-size,
.modal-empty-text,
.user-role-text {
    color: var(--color-muted);
    font-size: 12px;
}

.user-modal {
    width: 720px;
}

.user-create-row {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(180px, 0.8fr) auto;
    gap: 10px;
    margin-bottom: 12px;
}

.user-group-create-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

/* 邮箱域名管理独立成卡片，沿用现有绿色按钮和边框，不调整其它业务模块。 */
.institution-email-domain-panel[hidden], .institution-email-domain-panel [hidden] { display: none; }
.institution-email-domain-note { color: var(--color-muted); margin: 0 0 12px; font-size: 13px; line-height: 1.65; }
.institution-email-domain-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto auto; gap: 12px; align-items: end; margin-bottom: 12px; }
.institution-email-domain-form > label { display: flex; flex-direction: column; gap: 8px; min-width: 0; font-weight: 700; }
.institution-email-domain-form .rename-input { width: 100%; min-width: 0; }
.institution-email-domain-form > .institution-email-domain-state { flex-direction: row; align-items: center; min-height: 40px; white-space: nowrap; }
.institution-email-domain-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.institution-email-domain-feedback { min-height: 22px; margin-bottom: 12px; color: var(--color-danger); }
.institution-email-domain-feedback.success { color: var(--color-green); }
.institution-email-domain-list { display: grid; gap: 10px; }
.institution-email-domain-row { display: grid; grid-template-columns: minmax(180px, 1.3fr) minmax(160px, 1fr) minmax(70px, 0.4fr) auto; gap: 16px; padding: 14px 16px; align-items: center; border: 1px solid var(--color-border); border-radius: 8px; background: var(--color-bg); }
.institution-email-domain-row > div { min-width: 0; }
.institution-email-domain-caption { display: block; margin-bottom: 4px; color: var(--color-muted); font-size: 12px; }
.institution-email-domain-value, .institution-email-name-value { display: block; overflow-wrap: anywhere; }
.institution-email-domain-status { color: var(--color-muted); font-weight: 700; }
.institution-email-domain-status.is-active { color: var(--color-green); }
.institution-email-domain-panel button:disabled { cursor: not-allowed; opacity: 0.55; }
@media (max-width: 900px) {
    .institution-email-domain-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .institution-email-domain-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .institution-email-domain-form, .institution-email-domain-row { grid-template-columns: minmax(0, 1fr); }
}

.user-group-create-row .rename-input {
    width: min(360px, 100%);
}

.user-group-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 10px;
}

.user-group-row {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
}

.user-group-row > .user-group-summary {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.user-group-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
}

.user-group-actions .role-select {
    width: min(180px, 100%);
}

.user-group-delete-btn {
    display: inline-flex;
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
}

.user-group-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-group-row span {
    color: var(--color-muted);
    font-size: 12px;
}

/* 两种登录方式沿用现有品牌色，选中页签以文字和下划线同时提示。 */
.login-method-tabs { display: flex; margin-top: 24px; border-bottom: 1px solid var(--color-border); }
.login-method-tabs [role="tab"] { flex: 1; min-width: 0; min-height: 46px; padding: 10px 4px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; color: var(--color-muted); font-size: 14px; line-height: 1.5; cursor: pointer; }
.login-method-tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--color-primary); color: var(--color-primary); font-weight: 700; }
.login-method-tabs [role="tab"]:hover { color: var(--color-primary); }
.login-method-tabs [role="tab"]:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -4px; }
.wechat-login-entry { margin-top: 24px; }
.wechat-entry-note { color: var(--color-muted); font-size: 13px; line-height: 1.65; margin: 12px 0; }
.wechat-registration-body { min-width: 0; min-height: 100dvh; height: auto; overflow-x: hidden; overflow-y: auto; display: grid; place-items: center; padding: 24px; }
.wechat-registration-card { padding: 32px; }
/* 独立注册页的宽度不继承后面业务登录卡片的手机规则，左右留白始终一致。 */
.wechat-registration-body .wechat-registration-card { width: min(100%, 460px); margin: 0; }
.wechat-registration-card h1 { font-size: 24px; margin-top: 24px; }
.wechat-code-row { display: flex; gap: 12px; align-items: stretch; }
.wechat-code-row input { flex: 1; min-width: 0; }
.wechat-code-row button { flex: 0 0 auto; min-width: 112px; padding: 0 12px; }
.wechat-home-link { color: var(--color-primary); font-size: 14px; }
.wechat-registration-card [hidden], .profile-section[hidden], #btn-bind-wechat[hidden] { display: none; }
.wechat-login-entry button:disabled { cursor: not-allowed; opacity: 0.55; }
.wechat-home-link:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 4px; }
@media (max-width: 520px) {
    .wechat-registration-body { padding: 16px; }
    .wechat-registration-card { padding: 24px 20px; }
}

.user-admin-create-row {
    margin: 12px 0 0;
}

.user-search-row {
    margin-bottom: 12px;
}

.user-list-panel {
    margin-top: 24px;
}

.user-info {
    min-width: 0;
}

.user-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
}

.user-actions .btn-cancel,
.user-actions .role-select {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
}

.user-actions .btn-cancel {
    min-width: auto;
    padding: 0 14px;
}

.user-admin-group-control {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.user-admin-group-control > span {
    white-space: nowrap;
}

.user-admin-group-control .role-select {
    width: min(210px, 100%);
}

.user-admin-title-row {
    margin-bottom: 12px;
}

.user-admin-manage-btn {
    width: auto;
    min-width: 72px;
    padding: 0 16px;
    white-space: nowrap;
}

.user-admin-manage-btn.active {
    color: #fff;
    border-color: var(--color-primary);
    background: var(--color-primary);
}

.user-admin-table .user-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.1fr) minmax(150px, 1fr) minmax(90px, 0.7fr) minmax(80px, 0.6fr) minmax(260px, auto);
    align-items: center;
}

.user-admin-table .user-group-select {
    width: fit-content;
    min-width: 112px;
    max-width: 100%;
    justify-self: start;
    field-sizing: content;
}

.user-admin-table .user-status-select {
    width: fit-content;
    min-width: 88px;
    max-width: 100%;
    justify-self: start;
    field-sizing: content;
}

.operation-log-panel {
    margin-top: 24px;
    margin-bottom: 32px;
}

.primer-single-main {
    display: grid;
    /* 单列必须允许收缩，否则长序列会按内容宽度撑开结果面板，内部滚动条无法生效。 */
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
    gap: 24px;
}

.primer-mode-tabs {
    display: inline-flex;
    gap: 8px;
    padding: 4px;
    margin-bottom: 0;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

/* 登录前即可选择语言，右对齐避免挤压登录标题。 */
.login-language-control {
    width: 100%;
    justify-content: flex-end;
    margin-bottom: 18px;
}

.primer-mode-tab {
    min-height: 34px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--color-muted);
    font-weight: 700;
}

.primer-mode-tab.active {
    background: var(--color-primary);
    color: #ffffff;
}

.primer-genbank-btn {
    /* 顶部 GenBank 查询入口和模式切换按钮同高，避免标题栏上下跳动。 */
    min-height: 36px;
    padding: 0 16px;
    font-weight: 800;
}

.primer-genbank-modal {
    width: 900px;
    max-width: calc(100vw - 96px);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.primer-genbank-detail-modal {
    width: 900px;
    max-width: calc(100vw - 96px);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.primer-genbank-detail-body {
    min-height: 0;
    margin-top: 12px;
    overflow-y: auto;
}

.primer-genbank-detail-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.primer-genbank-search {
    /* 查询栏保持一行布局，便于输入关键词后直接提交。 */
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 14px;
}

.primer-genbank-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.primer-genbank-pages {
    display: flex;
    gap: 8px;
}

.primer-genbank-results {
    min-height: 220px;
    max-height: 54vh;
    margin-top: 12px;
    overflow-y: auto;
}

.primer-genbank-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.primer-genbank-item + .primer-genbank-item {
    margin-top: 10px;
}

.primer-genbank-item-body {
    min-width: 0;
    cursor: pointer;
}

.primer-genbank-item-body strong,
.primer-genbank-item-body span,
.primer-genbank-item-body small {
    display: block;
    overflow-wrap: anywhere;
}

.primer-genbank-item-body strong {
    margin-bottom: 6px;
    color: var(--color-text);
}

.primer-genbank-item-body span,
.primer-genbank-item-body small {
    color: var(--color-muted);
    font-size: 12px;
}

.primer-genbank-import {
    white-space: nowrap;
}

.primer-genbank-item-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.primer-genbank-detail-btn {
    white-space: nowrap;
}

.primer-genbank-sequence-block {
    max-height: 320px;
    overflow: auto;
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.55;
}

.primer-mode-panel {
    display: none;
}

.primer-mode-panel.active {
    display: block;
}

.primer-form-panel,
.primer-result-panel {
    /* 面板作为网格子项时允许缩小到当前可用宽度，超长序列交给内部容器滚动。 */
    min-width: 0;
    min-height: 620px;
}

.primer-form-panel {
    align-self: start;
}

.primer-sequence-input {
    font-family: Consolas, "Courier New", monospace;
    line-height: 1.5;
}

.primer-parameter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.primer-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.primer-result-list {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.primer-result-card {
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.primer-result-card h3 {
    font-size: 16px;
}

.primer-pair-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.primer-pair-grid section {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
}

.primer-pair-grid h4 {
    margin-bottom: 8px;
    font-size: 13px;
}

.primer-pair-grid code {
    display: block;
    overflow-wrap: anywhere;
    padding: 8px;
    border-radius: 6px;
    background: var(--color-primary-soft);
    color: var(--color-text);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
}

.primer-metric-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: 12px;
}

.primer-metric-row strong {
    max-width: 70%;
    overflow-wrap: anywhere;
    color: var(--color-text);
    text-align: right;
}

.primer-pair-summary {
    margin-top: 12px;
}

.primer-single-panel,
.primer-multi-panel {
    width: 100%;
    max-width: none;
    min-height: 520px;
}

.primer-single-workspace,
.primer-multi-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.primer-multi-main {
    min-width: 0;
}

.primer-history-panel {
    min-width: 0;
    padding-left: 18px;
    border-left: 1px solid var(--color-border);
}

.primer-history-list {
    display: flex;
    max-height: 640px;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.primer-history-item {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 8px;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    text-align: left;
}

.primer-history-item:hover,
.primer-history-item.active {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.primer-history-title {
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.primer-history-time {
    grid-column: 1 / 2;
    color: var(--color-muted);
    font-size: 12px;
}

.primer-history-delete {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    align-self: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-muted);
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.primer-history-delete:hover {
    color: var(--color-danger);
}

@media (max-width: 1100px) {
    .primer-single-workspace,
    .primer-multi-workspace {
        grid-template-columns: 1fr;
    }

    .primer-history-panel {
        padding-left: 0;
        padding-top: 16px;
        border-top: 1px solid var(--color-border);
        border-left: 0;
    }
}

.primer-multi-placeholder {
    margin-top: 18px;
    padding: 18px;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    background: var(--color-bg);
}

.primer-multi-placeholder h3 {
    margin-bottom: 8px;
    font-size: 16px;
}

.primer-multi-placeholder p {
    max-width: 720px;
    margin-bottom: 16px;
    color: var(--color-muted);
}

.primer-diff-card {
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.primer-alignment-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.primer-multi-design-card {
    padding: 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
}

.msa-scroll {
    width: 100%;
    max-width: 100%;
    margin-top: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #ffffff;
}

.msa-table {
    display: inline-block;
    min-width: 100%;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1;
}

.msa-row {
    display: flex;
    min-width: max-content;
}

.msa-name {
    position: sticky;
    left: 0;
    z-index: 1;
    width: 210px;
    flex: 0 0 210px;
    overflow: hidden;
    padding: 4px 6px;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    background: #f5f7f7;
    color: var(--color-text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msa-sequence {
    display: flex;
    flex: 0 0 auto;
    border-bottom: 1px solid var(--color-border);
}

.msa-base {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 12px;
    height: 20px;
    color: #001414;
    font-weight: 700;
}

.msa-base.base-a {
    background: #66d95f;
}

.msa-base.base-t {
    background: #ff6d6d;
}

.msa-base.base-c {
    background: #55d4f0;
}

.msa-base.base-g {
    background: #c767f2;
}

.msa-base.base-gap {
    background: #ffffff;
    color: #3b4a4a;
}

.msa-base.base-other {
    background: #f3f0a6;
}

.msa-primer-row .msa-name {
    /* 引物探针行使用浅色底，避免和真实序列名称混在一起。 */
    background: #eef8f5;
    color: var(--color-primary);
    font-weight: 800;
}

.msa-primer-base {
    /* 引物探针也沿用固定列宽，保证横向滚动时能和上方序列严格对齐。 */
    color: #ffffff;
    font-weight: 800;
}

.msa-primer-forward {
    background: #0f8f7d;
}

.msa-primer-probe {
    background: #f2c94c;
    color: #173332;
}

.msa-primer-reverse {
    background: #2563eb;
}

.msa-primer-empty {
    background: #ffffff;
    color: transparent;
}

.sequence-alignment-tool-card .tool-card-summary {
    margin-bottom: 0;
}

.message.assistant,
.message.assistant .bubble,
.message.assistant .tool-card-list,
.sequence-alignment-tool-card {
    min-width: 0;
}

.sequence-alignment-tool-card {
    max-width: 100%;
}

.sequence-alignment-content {
    min-width: 0;
}

.sequence-alignment-tool-card .msa-scroll {
    max-height: 360px;
    overflow: auto;
}

.sequence-alignment-message {
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--color-border-soft);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-muted);
    line-height: 1.5;
}

.sequence-alignment-error {
    border-color: rgba(217, 75, 61, 0.32);
    background: rgba(217, 75, 61, 0.06);
    color: var(--color-danger);
}

@media (max-width: 720px) {
    .sequence-alignment-tool-card .msa-name {
        width: 150px;
        flex-basis: 150px;
    }
}

.primer-diff-card + .primer-diff-card {
    margin-top: 14px;
}

.primer-diff-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
}

.primer-diff-tags span {
    padding: 5px 8px;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-text);
    font-size: 12px;
}

.think-section {
    margin-bottom: 10px;
}

.think-header {
    color: var(--color-muted);
    cursor: pointer;
    font-size: 12px;
    margin-bottom: 6px;
}

.think-content {
    padding: 10px;
    border-left: 3px solid var(--color-primary);
    border-radius: 6px;
    background: var(--color-primary-soft);
    color: var(--color-muted);
    font-size: 12px;
}

.tool-card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.tool-card {
    position: relative;
    overflow: hidden;
    padding: 12px 12px 12px 14px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: 8px;
    background: var(--color-surface);
    white-space: normal;
}

.tool-card-success {
    border-left-color: var(--color-primary);
}

.tool-card-pending {
    border-left-color: var(--color-warning);
}

.tool-card-failed {
    border-left-color: var(--color-danger);
}

.tool-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.tool-card-title-wrap {
    min-width: 0;
}

.tool-card-title {
    color: var(--color-text);
    font-weight: 900;
    line-height: 1.35;
}

.tool-card-step {
    margin-top: 3px;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.35;
}

.tool-card-badge {
    flex: 0 0 auto;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.tool-card-pending .tool-card-badge {
    background: rgba(217, 133, 25, 0.12);
    color: var(--color-warning);
}

.tool-card-failed .tool-card-badge {
    background: rgba(217, 75, 61, 0.12);
    color: var(--color-danger);
}

.tool-card-summary {
    margin-top: 10px;
    color: var(--color-text);
    line-height: 1.55;
}

.literature-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.literature-card-item {
    padding: 9px 10px;
    border: 1px solid var(--color-border-soft);
    border-radius: 6px;
    background: var(--color-bg);
}

.literature-card-title {
    color: var(--color-text);
    font-weight: 800;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.literature-card-meta {
    margin-top: 4px;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.literature-card-empty {
    margin-top: 10px;
    padding: 9px 10px;
    border: 1px dashed var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-muted);
    line-height: 1.5;
}

.literature-card-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.literature-card-links a {
    color: var(--color-primary);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.literature-card-links a:hover {
    text-decoration: underline;
}

.literature-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

.gene-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

.literature-card-toggle {
    min-height: 30px;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.gene-card-toggle {
    min-height: 30px;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.literature-card-toggle:hover {
    background: var(--color-primary-soft);
}

.gene-card-toggle:hover {
    background: var(--color-primary-soft);
}

.literature-card-jump {
    min-height: 30px;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.gene-card-jump {
    min-height: 30px;
    padding: 5px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-primary);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.literature-card-jump:hover {
    background: var(--color-primary-dark);
}

.gene-card-jump:hover {
    background: var(--color-primary-dark);
}

.gene-card-query {
    margin-top: 10px;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.gene-card-list,
.gene-sequence-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.gene-card-item,
.gene-sequence-item {
    padding: 9px 10px;
    border: 1px solid var(--color-border-soft);
    border-radius: 6px;
    background: var(--color-bg);
}

.gene-card-title {
    color: var(--color-text);
    font-weight: 800;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.gene-card-meta {
    margin-top: 4px;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.gene-card-description {
    margin-top: 6px;
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.gene-sequence-text {
    margin-top: 7px;
    max-height: 96px;
    overflow: auto;
    padding: 8px;
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 最终报告沿用工具卡片边界，但内部使用连续分区，避免出现卡片嵌套。 */
.workflow-report-card {
    min-width: 0;
    padding: 16px 18px;
}

/* 报告名称不设置固定高度，长物种名会自然换行并撑开标题区域。 */
.workflow-report-name {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.workflow-report-name span {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 700;
}

.workflow-report-name strong {
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.workflow-report-section {
    min-width: 0;
    padding-top: 14px;
    margin-top: 14px;
    border-top: 1px solid var(--color-border-soft);
}

.workflow-report-section-title {
    margin: 0 0 10px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 900;
    line-height: 1.4;
}

/* 标签列保持稳定，内容列根据文本长度占用剩余空间并允许自然换行。 */
.workflow-report-fields {
    display: grid;
    grid-template-columns: minmax(88px, 120px) minmax(0, 1fr);
    gap: 6px 12px;
    margin: 0;
}

.workflow-report-fields dt,
.workflow-report-fields dd {
    min-width: 0;
    margin: 0;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.workflow-report-fields dt {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 800;
}

.workflow-report-fields dd {
    color: var(--color-text);
    font-size: 13px;
}

.workflow-report-sequence-title {
    margin: 12px 0 7px;
    color: var(--color-text);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.45;
}

.workflow-report-sequence-list {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 9px;
}

.workflow-report-sequence-item {
    min-width: 0;
}

.workflow-report-sequence-meta {
    margin-bottom: 5px;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* 序列正文完整保留；可视高度为两行，超过后仅在框内上下滚动。 */
.workflow-report-sequence-text {
    width: 100%;
    max-height: calc(2.9em + 16px);
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-all;
}

/* 详情内每个物种紧跟自己的完整序列，引物探针作为同一基因分区的末尾内容。 */
.experiment-report-species-sequence-group {
    min-width: 0;
}

.experiment-report-species-sequence-group + .experiment-report-species-sequence-group {
    margin-top: 14px;
}

/* 窄屏时只让表格区域横向滚动，不挤压聊天气泡或改变其他分区宽度。 */
.workflow-report-table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 6px;
}

/* auto 布局让表头宽度随实际引物内容变化，原生表格保证上下列严格对齐。 */
.workflow-report-assay-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    color: var(--color-text);
    font-size: 12px;
}

.workflow-report-assay-table th,
.workflow-report-assay-table td {
    padding: 8px 10px;
    border-right: 1px solid var(--color-border-soft);
    border-bottom: 1px solid var(--color-border-soft);
    text-align: left;
    vertical-align: top;
}

.workflow-report-assay-table th:last-child,
.workflow-report-assay-table td:last-child {
    border-right: 0;
}

.workflow-report-assay-table tbody tr:last-child td {
    border-bottom: 0;
}

.workflow-report-assay-table th {
    background: var(--color-primary-soft);
    font-weight: 900;
    white-space: nowrap;
}

.workflow-report-assay-sequence {
    font-family: Consolas, "Courier New", monospace;
    white-space: nowrap;
}

.workflow-report-text-list {
    margin: 0;
    padding-left: 18px;
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.6;
}

.workflow-report-text-list li + li {
    margin-top: 4px;
}

.workflow-report-empty {
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.5;
}

.tool-card-details {
    margin-top: 10px;
    color: var(--color-muted);
    font-size: 12px;
}

.tool-card-details summary {
    width: fit-content;
    color: var(--color-primary);
    cursor: pointer;
    font-weight: 800;
}

.tool-card-details pre {
    max-height: 220px;
    overflow: auto;
    margin-top: 8px;
    padding: 10px;
    border: 1px solid var(--color-border-soft);
    border-radius: 6px;
    background: var(--color-bg);
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.5;
}

.loading-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin: 0 2px;
    border-radius: 50%;
    background: var(--color-muted);
    animation: pulse 1.2s infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--color-border);
}

/* ============================================================
   优先级 UI 优化
   目的：不改变业务功能和主题色，统一控件、滚动与键盘操作体验。
   ============================================================ */

/* 普通文字按钮保持同一高度，图标按钮继续使用原有固定尺寸。 */
.ghost-btn,
.soft-btn,
.small-primary-btn,
.btn-confirm,
.btn-cancel {
    min-height: 36px;
}

.material-table .soft-btn,
.experiment-report-table .soft-btn {
    min-height: 36px;
}

/* 全站交互控件使用统一的主题色焦点框，键盘操作时能确认当前位置。 */
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible,
.user-chip:focus-visible,
.sidebar-toggle-btn:focus-visible,
.profile-close-btn:focus-visible,
.message-copy-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* 表头跟随内容区吸顶，长列表滚动时仍能看清每一列的含义。 */
.data-table thead th,
.compact-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-surface);
    box-shadow: inset 0 -1px 0 var(--color-border);
}

.data-table tbody tr,
.compact-table tbody tr,
.user-admin-table .user-admin-row:not(.table-head) {
    transition: background-color 0.16s ease, border-color 0.16s ease;
}

.data-table tbody tr:hover td,
.compact-table tbody tr:hover td {
    background: var(--color-primary-soft);
}

.user-admin-table .table-head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-surface);
    box-shadow: 0 1px 0 var(--color-border);
}

.user-admin-table .user-admin-row:not(.table-head):hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

/* 表格的横向溢出交给页面内容区，避免阻断表头相对页面的吸顶效果。 */
.material-table-panel {
    overflow-x: visible;
}

/* 数量与库存变化使用右对齐和等宽数字，便于逐行比较。 */
.material-table th:nth-child(4),
.material-table td:nth-child(4),
.material-transaction-table th:nth-child(5),
.material-transaction-table td:nth-child(5),
.material-transaction-table th:nth-child(6),
.material-transaction-table td:nth-child(6),
.material-transaction-table th:nth-child(7),
.material-transaction-table td:nth-child(7) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* 长研发回答利用更多横向空间，序列和工具卡片仍由各自容器处理滚动。 */
.bubble {
    max-width: 80%;
}

/* 会话操作预留固定空间，显示时不会挤动标题。 */
.conv-actions {
    display: flex;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.16s ease;
}

.conv-item:hover .conv-actions,
.conv-item.active .conv-actions,
.conv-item:focus-within .conv-actions {
    visibility: visible;
    opacity: 1;
}

/* 中等宽度取消整页最小宽度，复杂模块改在自己的内容区内横向滚动。 */
@media (max-width: 1160px) {
    html,
    body {
        min-width: 0;
    }

    .lab-shell {
        width: 100vw;
        min-width: 0;
    }

    .module-view {
        overflow-x: auto;
    }

    .assistant-layout {
        min-width: 916px;
    }

    .ncbi-layout {
        min-width: 960px;
    }

    .formula-workspace {
        min-width: 860px;
    }

    .material-table {
        min-width: 900px;
    }

    .material-transaction-table {
        min-width: 1120px;
    }

    .experiment-report-table,
    .user-admin-table,
    .operation-log-panel .data-table {
        min-width: 900px;
    }

}

/* 较窄窗口仍保持单列，缩小四周留白并为品牌和语言入口预留空间。 */
@media (max-width: 900px) {
    .login-stage {
        padding: 100px 24px;
    }

    .login-hero {
        top: 24px;
        left: 24px;
    }

    .login-hero-logo {
        width: 44px;
        height: 44px;
    }

    .login-overlay .login-card {
        padding: 32px;
    }

    .login-overlay .login-language-control {
        left: 24px;
        bottom: 24px;
        max-width: calc(100% - 48px);
    }

    .login-card {
        align-self: start;
        width: min(440px, calc(100vw - 32px));
        margin: 28px auto 36px;
        padding: 32px 30px;
    }

    .module-header {
        height: auto;
        min-height: 72px;
        flex: 0 0 auto;
        flex-wrap: wrap;
        gap: 10px 18px;
        padding: 10px 16px;
    }

    .module-actions {
        min-width: 0;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .module-view {
        padding: 16px;
    }
}

/* 手机宽度进一步压缩品牌与表单留白，避免长语言文本挤压输入区域。 */
@media (max-width: 560px) {
    .login-stage {
        padding: 96px 12px;
    }

    .login-hero {
        left: 20px;
    }

    .login-hero-logo {
        width: 40px;
        height: 40px;
    }

    .login-brand h1 {
        font-size: 24px;
    }

    .login-overlay .login-card {
        min-height: 540px;
        padding: 32px 24px;
    }

    .login-overlay .login-language-control {
        left: 20px;
        max-width: calc(100% - 40px);
    }

    .login-card {
        width: calc(100vw - 24px);
        margin: 20px auto 28px;
        padding: 28px 22px;
    }
}

/* 触屏设备没有稳定悬停状态，因此直接显示已有的会话和复制操作。 */
@media (hover: none) {
    .conv-actions {
        visibility: visible;
        opacity: 1;
    }

    .message-copy-btn {
        opacity: 1;
        pointer-events: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .data-table tbody tr,
    .compact-table tbody tr,
    .user-admin-table .user-admin-row:not(.table-head),
    .conv-actions {
        transition: none;
    }
}
