* { margin: 0; padding: 0; box-sizing: border-box; }

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--c-text);
    background: #f9f9f9;
    word-break: break-word;
    padding-bottom: 120px;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* 测试设计这类宽表格/脑图页面：放开宽度，别把空间浪费在两侧 */
.container.container-wide {
    max-width: 1760px;
    padding: 0 28px;
}

.site-header { background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: 16px 0; }
.site-header .container { display: flex; justify-content: space-between; align-items: center; }
.site-title { font-size: 1.375rem; font-weight: 700; color: var(--c-heading); }
.site-nav a { margin-left: 20px; color: var(--c-text-2); font-size: 0.9375rem; }
/* 「测试中心」入口：黑色加粗，和其它导航项区分开 */
.site-nav a.nav-strong { color: #000; font-weight: 700; }
.post-list { padding: 32px 0; }
.tag-heading { margin-bottom: 20px; color: #666; font-weight: 400; font-size: 1.125rem; }
.post-item { background: var(--c-surface); padding: 20px 24px; margin-bottom: 16px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.post-item h2 { font-size: 1.125rem; margin-bottom: 8px; }
.post-item h2 a { color: var(--c-heading); }
.post-item h2 a:hover { color: #2563eb; }
.post-meta { font-size: 0.8125rem; color: #888; margin-bottom: 10px; }
.post-meta .post-date { margin-right: 12px; }
.tag { display: inline-block; background: #eef2ff; color: #4f46e5; padding: 2px 8px; border-radius: 4px; font-size: 0.8125rem; margin-right: 6px; }
.tag:hover { background: #4f46e5; color: #fff; text-decoration: none; }
.post-excerpt { color: var(--c-text-2); margin-bottom: 10px; font-size: 0.9375rem; line-height: 1.7; }
.read-more { font-size: 0.875rem; color: #2563eb; }
.empty-tip { color: #999; text-align: center; padding: 48px 0; font-size: 0.9375rem; }

.blog-layout { display: flex; gap: 24px; padding: 32px 0; }
.post-detail { flex: 1; min-width: 0; }
/*.sidebar { width: 260px; flex-shrink: 0; }*/

/*.widget { background: var(--c-surface); padding: 16px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 16px; position: sticky; top: 20px; }*/

.blog-layout {
    display: flex;
    gap: 24px;
    padding: 32px 0;
    align-items: flex-start;      /* 关键：别让侧边栏被拉伸 */
}

.post-detail { flex: 1; min-width: 0; }

.sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;             /* sticky 挪到这里 */
    top: 20px;
    align-self: flex-start;       /* 关键：按内容定高，防止塌陷 */
}

.widget {
    background: var(--c-surface);
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    margin-bottom: 16px;
    /* position: sticky 去掉，恢复默认 static */
}

.widget h3 { font-size: 0.9375rem; margin-bottom: 12px; color: var(--c-text); border-bottom: 2px solid #2563eb; padding-bottom: 8px; }
#article-toc ul { list-style: none; }
#article-toc li { margin-bottom: 6px; }
#article-toc a { color: var(--c-text-2); font-size: 0.875rem; }
#article-toc a:hover { color: #2563eb; }

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud-item {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8125rem;
    line-height: 1;
    background: var(--c-bg-soft);
    color: #374151;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tag-cloud-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    text-decoration: none;
}

.tag-cloud-item:nth-child(6n+1) { background: #eef2ff; color: #4338ca; }
.tag-cloud-item:nth-child(6n+2) { background: #ecfdf5; color: #047857; }
.tag-cloud-item:nth-child(6n+3) { background: #fef3c7; color: #b45309; }
.tag-cloud-item:nth-child(6n+4) { background: #ffe4e6; color: #be123c; }
.tag-cloud-item:nth-child(6n+5) { background: #e0f2fe; color: #0369a1; }
.tag-cloud-item:nth-child(6n+6) { background: #f3e8ff; color: #7e22ce; }

/* 侧栏标签云（关于页、归档页用的是 .tag）：同一套色板，逐个不同色。
   这里的 nth-child 规则选择器权重高于 .tag:hover，悬停时不会被打回统一的靛蓝。 */
.tag-cloud .tag {
    margin-right: 0;
}

.tag-cloud .tag:nth-child(6n+1) { background: #eef2ff; color: #4338ca; }
.tag-cloud .tag:nth-child(6n+2) { background: #ecfdf5; color: #047857; }
.tag-cloud .tag:nth-child(6n+3) { background: #fef3c7; color: #b45309; }
.tag-cloud .tag:nth-child(6n+4) { background: #ffe4e6; color: #be123c; }
.tag-cloud .tag:nth-child(6n+5) { background: #e0f2fe; color: #0369a1; }
.tag-cloud .tag:nth-child(6n+6) { background: #f3e8ff; color: #7e22ce; }

.tag-cloud .tag:hover {
    text-decoration: none;
    filter: brightness(0.94);
}

.latest-posts-list {
    list-style: none;
}

.latest-posts-list li {
    margin-bottom: 10px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.latest-posts-list a {
    color: var(--c-text);
    display: block;
    margin-bottom: 2px;
}

.latest-posts-list a:hover {
    color: #2563eb;
}

.latest-posts-list .post-date {
    font-size: 0.75rem;
    color: #999;
}

.archives-list {
    list-style: none;
}

.archives-list li {
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.archives-list a {
    color: var(--c-text-2);
}

.archives-list a:hover {
    color: #2563eb;
}

/* 全局音乐播放器 */
.global-music-player {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1000;
    width: 280px;
    background: var(--c-surface);
    border-radius: 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.music-player-inner {
    padding: 12px 14px;
}

.music-info {
    margin-bottom: 10px;
    padding: 0 18px;      /* 避开右上角的收起/关闭按钮 */
    text-align: center;
    font-size: 0.875rem;
    color: var(--c-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.music-btn {
    background: var(--c-bg-soft);
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.music-btn:hover {
    background: #e5e7eb;
}

.music-playlist {
    display: none;
    margin-top: 12px;
    border-top: 1px solid var(--c-border);
    padding-top: 10px;
}

.music-playlist.show {
    display: block;
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--c-text-2);
}

.music-list {
    list-style: none;
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.8125rem;
}

.music-list li {
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #444;
}

.music-list li:hover {
    background: var(--c-bg-soft);
}

.music-list li.active {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 500;
}

/* 文章详情页样式 */
.post-content {
    background: var(--c-surface);
    padding: 32px 40px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.post-content h1 {
    font-size: 1.75rem;
    margin-bottom: 12px;
    color: var(--c-heading);
    line-height: 1.4;
}

.post-body {
    margin-top: 24px;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--c-text);
}

.post-body p {
    margin-bottom: 16px;
}

.post-body h2 {
    font-size: 1.375rem;
    margin: 28px 0 12px;
    color: var(--c-heading);
}

.post-body h3 {
    font-size: 1.125rem;
    margin: 24px 0 10px;
    color: var(--c-heading);
}

.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 16px 0;
}

.post-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.post-body code {
    background: var(--c-bg-soft);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.875rem;
}

.post-body pre code {
    background: none;
    padding: 0;
}

.post-body blockquote {
    border-left: 4px solid #2563eb;
    padding-left: 16px;
    margin: 16px 0;
    color: var(--c-text-2);
}

.post-body ul,
.post-body ol {
    margin: 16px 0;
    padding-left: 24px;
}

.post-body li {
    margin-bottom: 6px;
}

.post-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.post-body th,
.post-body td {
    border: 1px solid var(--c-border);
    padding: 8px 12px;
    text-align: left;
    font-size: 0.9375rem;
}

.post-body th {
    background: #f9fafb;
    font-weight: 600;
}

/* 响应式 */
@media (max-width: 768px) {
    .blog-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }

    .global-music-player {
        width: calc(100% - 40px);
        right: 20px;
        bottom: 10px;
    }

    .post-content {
        padding: 20px;
    }
}

/* ---------- 测试中心 ---------- */
.lab-page {
    padding: 40px 0 64px;
}

.lab-title {
    font-size: 1.5rem;
    color: var(--c-heading);
    margin-bottom: 8px;
}

.lab-subtitle {
    color: #666;
    font-size: 0.9375rem;
    margin-bottom: 28px;
}

.lab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.lab-card {
    display: block;
    background: var(--c-surface);
    padding: 20px 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    color: var(--c-text);
    transition: box-shadow 0.15s, transform 0.15s;
}

.lab-card:hover {
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.lab-card h2 {
    font-size: 1.0625rem;
    color: var(--c-heading);
    margin-bottom: 8px;
}

.lab-card p {
    font-size: 0.875rem;
    color: #666;
    margin-bottom: 14px;
    line-height: 1.6;
}

.lab-card-link {
    font-size: 0.875rem;
    color: #2563eb;
}

/* ---------- 测试中心：登录页 ---------- */
.auth-wrap {
    display: flex;
    justify-content: center;
    padding: 56px 0 80px;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background: var(--c-surface);
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}

.auth-card h1 {
    font-size: 1.25rem;
    color: var(--c-heading);
    margin-bottom: 6px;
}

.auth-tip {
    font-size: 0.8125rem;
    color: #999;
    margin-bottom: 18px;
}

.auth-notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.8125rem;
    line-height: 1.6;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.auth-form .field {
    display: block;
    margin-bottom: 16px;
}

.auth-form .field span {
    display: block;
    font-size: 0.875rem;
    color: #444;
    margin-bottom: 6px;
}

.auth-form input[type="text"],
.auth-form input[type="password"],
.auth-form input[type="email"],
.auth-form input[type="tel"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.9375rem;
    color: var(--c-text);
    background: var(--c-surface);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="password"]:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="tel"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8125rem;
    margin-bottom: 20px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--c-text-2);
    cursor: pointer;
}

.btn-primary {
    width: 100%;
    padding: 11px;
    background: #2563eb;
    color: #fff;
    border: 0;
    border-radius: 6px;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.auth-back {
    margin-top: 18px;
    font-size: 0.8125rem;
    text-align: center;
}

/* ---------- 测试中心：注册 / 找回密码 ---------- */
.auth-card-wide {
    max-width: 460px;
}

.auth-card .field-error {
    display: block;
    color: #dc2626;
    font-size: 0.75rem;
    font-style: normal;
    margin-top: 4px;
}

.auth-card .field-hint {
    display: block;
    color: #999;
    font-size: 0.75rem;
    font-style: normal;
    margin-top: 4px;
}

.form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    font-size: 0.8125rem;
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 14px;
}

.code-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.code-row input {
    flex: 1;
}

.code-badge {
    flex-shrink: 0;
    background: #eff6ff;
    border: 1px dashed #93c5fd;
    color: #1d4ed8;
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 0.9375rem;
    letter-spacing: 3px;
    user-select: all;
}

.agree-row {
    margin: 4px 0 18px;
    font-size: 0.8125rem;
}

/* ---------- 测试中心：订单管理 ---------- */
.admin-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.admin-head-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user {
    font-size: 0.875rem;
    color: #666;
}

.btn-ghost {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    background: var(--c-surface);
    color: #444;
    font-size: 0.875rem;
    cursor: pointer;
}

.btn-ghost:hover {
    border-color: #2563eb;
    color: #2563eb;
    text-decoration: none;
}

.btn-ghost[disabled] {
    color: #aaa;
    border-color: var(--c-border);
    background: #fafafa;
    cursor: not-allowed;
}

.status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.status-tabs a {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.8125rem;
    color: var(--c-text-2);
    background: var(--c-surface);
    border: 1px solid var(--c-border);
}

.status-tabs a:hover {
    text-decoration: none;
    border-color: #2563eb;
    color: #2563eb;
}

.status-tabs a.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.data-card {
    background: var(--c-surface);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--c-text);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 11px 18px;
    text-align: left;
    font-size: 0.875rem;
    border-bottom: 1px solid #f5f5f5;
}

.data-table th {
    background: #fafafa;
    color: #666;
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.data-table tbody tr:hover {
    background: #fafcff;
}

.data-table .num {
    text-align: right;
    white-space: nowrap;
}

.data-table .muted {
    color: #888;
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.badge-pending_payment { background: #fff7e6; color: #b45309; }
.badge-pending_review  { background: #eef2ff; color: #4338ca; }
.badge-pending_ship    { background: #eff6ff; color: #1d4ed8; }
.badge-shipped         { background: #ecfeff; color: #0e7490; }
.badge-completed       { background: #ecfdf5; color: #047857; }
.badge-refunding       { background: #fef2f2; color: #b91c1c; }
.badge-refunded        { background: #f5f3ff; color: #6d28d9; }
.badge-cancelled       { background: var(--c-bg-soft); color: #6b7280; }

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 16px;
}

.detail-side {
    display: flex;
    flex-direction: column;
}

.kv {
    padding: 6px 18px 14px;
}

.kv dt {
    font-size: 0.8125rem;
    color: #999;
    margin-top: 12px;
}

.kv dd {
    font-size: 0.875rem;
    color: var(--c-text);
    margin-top: 2px;
    line-height: 1.6;
}

.amounts {
    padding: 12px 18px 18px;
    border-top: 1px solid #f5f5f5;
}

.amounts > div {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #666;
    padding: 4px 0;
}

.amounts b {
    color: var(--c-text);
}

.amount-final {
    border-top: 1px dashed #eee;
    margin-top: 6px;
    padding-top: 8px !important;
}

.amount-final b {
    color: #e11d48;
    font-size: 1.0625rem;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 18px;
}

.log-list {
    list-style: none;
    padding: 6px 18px 16px;
}

.log-list li {
    display: flex;
    gap: 12px;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: 1px dashed #f2f2f2;
    font-size: 0.875rem;
}

.log-list li:last-child {
    border-bottom: 0;
}

.log-time {
    color: #999;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.log-list b {
    color: var(--c-text);
    font-weight: 600;
}

.log-list .muted {
    color: #666;
}

.lab-note {
    font-size: 0.8125rem;
    color: #999;
    text-align: center;
    margin-top: 8px;
}

.lab-breadcrumb {
    font-size: 0.875rem;
    margin-bottom: 14px;
}

@media (max-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }
}

/* ---------- 测试中心：电商演示系统 ---------- */
.demo-shell {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding: 32px 0 64px;
}

.demo-menu {
    width: 216px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    background: var(--c-surface);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 12px 0;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.demo-menu-home {
    display: block;
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--c-text);
}

.demo-menu-home.active {
    color: #2563eb;
}

.demo-menu-group {
    margin-top: 10px;
}

.demo-menu-title {
    display: block;
    padding: 6px 18px;
    font-size: 0.8125rem;
    color: #999;
}

.demo-menu-title.active {
    color: #2563eb;
}

.demo-menu ul {
    list-style: none;
}

.demo-menu li a {
    display: block;
    padding: 6px 18px 6px 30px;
    font-size: 0.8125rem;
    color: var(--c-text-2);
    border-left: 2px solid transparent;
}

.demo-menu li a:hover {
    background: #f5f8ff;
    color: #2563eb;
    text-decoration: none;
}

.demo-menu li a.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
    border-left-color: #2563eb;
    padding-left: 28px;
}

.demo-content {
    flex: 1;
    min-width: 0;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 18px;
}

.chip {
    padding: 4px 12px;
    border-radius: 999px;
    background: #f3f6ff;
    color: #3157b8;
    font-size: 0.8125rem;
}

.chip:hover {
    background: #2563eb;
    color: #fff;
    text-decoration: none;
}

.feature-list {
    padding: 12px 18px 18px 34px;
}

.feature-list li {
    font-size: 0.875rem;
    color: var(--c-text-2);
    padding: 4px 0;
}

.demo-link-btn {
    display: inline-block;
    width: auto;
    padding: 9px 22px;
}

@media (max-width: 768px) {
    .demo-shell {
        flex-direction: column;
    }

    .demo-menu {
        width: 100%;
        position: static;
        max-height: none;
    }
}

/* ---------- 测试中心：筛选栏 / 分页 / 提示 ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: var(--c-surface);
    padding: 14px 18px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    margin-bottom: 16px;
}

.filter-bar input,
.filter-bar select,
.inline-form input,
.inline-form select {
    padding: 7px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.8125rem;
    color: var(--c-text);
    background: var(--c-surface);
    outline: none;
}

.filter-bar input:focus,
.filter-bar select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-bar input[type="text"] {
    width: 180px;
}

.filter-bar input[type="number"] {
    width: 96px;
}

.btn-inline {
    width: auto;
    padding: 7px 16px;
    font-size: 0.8125rem;
}

.pager {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding: 6px 0 4px;
    font-size: 0.8125rem;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.flash-area {
    padding-top: 16px;
}

.flash {
    padding: 9px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.flash-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
}

.flash-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

/* ---------- 测试设计 ---------- */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--c-surface);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-num {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--c-heading);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8125rem;
    color: #888;
}

.tree-wrap {
    overflow-x: auto;
}

.tree,
.tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 竖向树：逐层缩进 */
.tree ul {
    display: block;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px dashed #dbe2ef;
}

.tree li {
    position: relative;
    padding: 4px 0;
}

.tree ul > li::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 22px;
    width: 18px;
    border-top: 1px dashed #dbe2ef;
}

/* 折叠：收起子节点 */
.tree li.collapsed > ul {
    display: none;
}

.fold {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--c-faint);
    font-size: 0.625rem;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
}

.fold:hover {
    color: #2563eb;
}

.tree {
    display: flex;
    align-items: center;
}

/* 每一层都是一列，向右展开 */
.tree ul {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 2px;
    margin-left: 24px;
    padding-left: 24px;
    border-left: 1px dashed #dbe2ef;
}

.tree li {
    position: relative;
    display: flex;
    align-items: flex-start;
    padding: 2px 0;
}

/* 从竖线到节点的横向连接线 */
.tree ul > li::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 19px;
    width: 20px;
    border-top: 1px dashed #dbe2ef;
}

.tree-label {
    display: inline-block;
    min-width: 150px;
    max-width: 260px;
    background: #f5f8ff;
    border: 1px solid #e3e9f7;
    color: #334155;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 0.9375rem;
    line-height: 1.4;
    white-space: normal;
    word-break: break-word;
}

/* (模块)/(场景)/(用例) 标识：比标题小一号，和标题留一点间距 */
.tree-label .mark {
    font-size: 0.8125rem;
    font-weight: 600;
    opacity: 0.85;
    margin-right: 5px;
}

.tree > li > .tree-label {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
    font-weight: 600;
}

li[data-kind="module"] > .tree-label {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #312e81;
    font-weight: 600;
}

li[data-kind="scenario"] > .tree-label {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

li[data-kind="case"] > .tree-label {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

/* 图例里的小标识沿用对应层级的文字色 */
.tree-legend {
    float: right;
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
}

.tree-legend .mark {
    margin-left: 10px;
    margin-right: 3px;
}

.tree-legend .mark-module {
    color: #312e81;
}

.tree-legend .mark-scenario {
    color: #92400e;
}

.tree-legend .mark-case {
    color: #065f46;
}

.cov {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.cov-has {
    background: #ecfdf5;
    color: #047857;
}

.cov-none {
    background: var(--c-bg-soft);
    color: #9ca3af;
}

.matrix-table .center {
    text-align: center;
}

.matrix-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 18px 16px;
    font-size: 0.8125rem;
    color: #666;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
    padding: 18px;
}

.form-grid .field {
    display: block;
}

.form-grid .field > span {
    display: block;
    font-size: 0.8125rem;
    color: var(--c-text-2);
    margin-bottom: 5px;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-surface);
    outline: none;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-grid .field-error {
    display: block;
    color: #dc2626;
    font-size: 0.75rem;
    font-style: normal;
    margin-top: 4px;
}

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

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.link-danger {
    background: none;
    border: 0;
    color: #dc2626;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0;
}

.link-danger:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- 测试设计：脑图就地编辑 ---------- */
.node-tools {
    display: inline-flex;
    gap: 4px;
    margin-left: 6px;
    vertical-align: middle;
    opacity: 0;
    transition: opacity 0.12s;
}

/* 只有鼠标停在节点自己身上（标签或按钮）才出现，
   悬停在子节点上不会带出父级的按钮 */
.tree li > .tree-label:hover ~ .node-tools,
.tree li > .node-tools:hover {
    opacity: 1;
}

/* 用例节点的按钮常驻，模块/场景仍然悬停才出现 */
li[data-kind="case"] > .node-tools {
    opacity: 1;
}

.node-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    background: var(--c-surface);
    border: 1px solid var(--c-border-strong);
    border-radius: 4px;
    color: var(--c-text-2);
    cursor: pointer;
    line-height: 1;
}

.node-btn:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.node-btn-danger:hover {
    border-color: #dc2626;
    color: #dc2626;
}

.nt {
    font-size: 0.75rem;
}

li[data-kind="case"] {
    cursor: grab;
}

li[data-kind="case"]:active {
    cursor: grabbing;
}

li.drop-hover > .tree-label {
    outline: 2px dashed #2563eb;
    outline-offset: 2px;
    background: #eff6ff;
}

.drawer-mask {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 60;
}

.drawer-mask[hidden] {
    display: none;
}

/* 居中弹窗（原先是右侧抽屉） */
.drawer {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 560px;
    max-width: 92vw;
    max-height: 82vh;
    background: var(--c-surface);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    z-index: 61;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.drawer[hidden] {
    display: none;
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eeeeee;
    font-size: 0.9375rem;
}

.drawer-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px 18px;
}

.drawer-body .field {
    display: block;
    margin-bottom: 14px;
}

.drawer-body .field > span {
    display: block;
    font-size: 0.8125rem;
    color: var(--c-text-2);
    margin-bottom: 5px;
}

.drawer-body input,
.drawer-body select,
.drawer-body textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--c-text);
    outline: none;
}

.drawer-body input:focus,
.drawer-body select:focus,
.drawer-body textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.drawer-foot {
    display: flex;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid #eeeeee;
}

.field-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* 用例节点可点击看详情 */
.case-link {
    cursor: pointer;
}

.case-link:hover {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.22);
}

/* 脑图卡片内的两栏：左树 + 右详情 */
.map-detail {
    padding: 10px 14px 12px;
}

.map-detail[hidden] {
    display: none;
}

.btn-mini {
    padding: 4px 12px;
    font-size: 0.75rem;
}

/* ---------- 用例详情（右栏常驻表单） ---------- */
.case-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.case-form-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* 详情头部的小按钮：点位更好按，和正文 16px 比例协调 */
.case-form-head .btn-mini {
    min-width: 64px;
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.case-form-head .btn-primary.btn-mini {
    font-weight: 500;
}

/* 这两个按钮按内容宽度，不要撑满整行 */
.case-form-btns .btn-primary,
.case-form-btns .btn-ghost {
    width: auto;
}

.case-mode {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--c-text-2);
}

/* 标题顶在最上面，字号最大 */
.case-title-field {
    display: block;
    margin-bottom: 8px;
}

.case-title-field > span {
    display: block;
    margin-bottom: 2px;
    font-size: 0.6875rem;
    color: var(--c-faint);
}

.case-title-field textarea {
    width: 100%;
    padding: 6px 9px;
    border: 1px solid var(--c-border-strong);
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--c-heading);
    font-family: inherit;
    background: var(--c-surface);
    outline: none;
    resize: vertical;
}

.case-title-field textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 属性两列排布 */
.case-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    margin-bottom: 4px;
}

.case-grid .field {
    margin: 0;
}

.field-full {
    grid-column: 1 / -1;
}

.case-form .field {
    display: block;
    margin-bottom: 6px;
}

.case-form .field > span {
    display: block;
    margin-bottom: 2px;
    font-size: 0.6875rem;
    color: var(--c-faint);
}

.case-form .field-hint {
    display: block;
    margin: 0 0 2px;
    font-size: 0.6875rem;
    font-style: normal;
    color: #9ca3af;
}

.case-form input,
.case-form select,
.case-form textarea {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid var(--c-border-strong);
    border-radius: 5px;
    font-size: 0.8125rem;
    font-family: inherit;
    line-height: 1.45;
    color: var(--c-text);
    background: var(--c-surface);
    outline: none;
}

.case-form input:focus,
.case-form select:focus,
.case-form textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}


/* ---------- 测试设计：两栏布局 ---------- */
/* 左列：脑图 → 覆盖矩阵 → 状态迁移；右列：用例详情 */
#design-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(380px, 32%, 520px);
    grid-template-areas:
        "stats  stats"
        "map    detail"
        "right  detail";
    gap: 16px;
    align-items: start;
}

#design-body > .stat-row {
    grid-area: stats;
    margin-bottom: 0;
}

#design-body > .map-card {
    grid-area: map;
    min-width: 0;
}

.design-col-right {
    grid-area: right;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.design-col-detail {
    grid-area: detail;
    position: sticky;
    top: 16px;
    min-width: 0;
}

#design-body .data-card {
    margin-bottom: 0;
}

.detail-empty {
    padding: 32px 18px;
    text-align: center;
    color: var(--c-faint);
    font-size: 0.8125rem;
}
