/* ============== 基础变量 ============== */
:root {
    --c-primary: #1e3a8a;
    --c-primary-light: #3b5fc4;
    --c-primary-bg: #eff4ff;
    --c-accent: #f59e0b;
    --c-accent-light: #fef3c7;
    --c-success: #16a34a;
    --c-success-bg: #dcfce7;
    --c-warn: #d97706;
    --c-warn-bg: #fef3c7;
    --c-danger: #dc2626;
    --c-danger-bg: #fee2e2;
    --c-text: #1f2937;
    --c-text-soft: #4b5563;
    --c-text-muted: #6b7280;
    --c-border: #e5e7eb;
    --c-border-strong: #d1d5db;
    --c-bg: #f9fafb;
    --c-card: #ffffff;
    --c-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --c-shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 5px 10px rgba(0,0,0,0.04);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 12px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
            "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --font-mono: "SF Mono", Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--c-text);
    background: var(--c-bg);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============== 顶部合规声明条 ============== */
.compliance-banner {
    background: linear-gradient(90deg, #fef3c7 0%, #fef9e7 100%);
    color: #92400e;
    text-align: center;
    padding: 6px 16px;
    font-size: 12px;
    border-bottom: 1px solid #fde68a;
    font-weight: 500;
}

/* ============== 顶栏 ============== */
.app-header {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.18);
    flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
    background: #ffffff20;
    border-radius: 8px;
    padding: 4px;
}
.brand-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.brand-sub {
    font-size: 12px;
    color: #dbeafe;
    margin-top: 2px;
}
.header-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #ffffff40;
    background: #ffffff15;
    color: #fff;
}
.badge-green { background: #16a34a30; border-color: #16a34a60; }
.badge-blue { background: #3b82f630; border-color: #3b82f660; }
.badge-gray { background: #6b728030; border-color: #6b728060; }
.badge-ai { background: #7c3aed33; border-color: #7c3aed88; color: #d8b4fe; font-weight: 600; }
.badge-tpl { background: #64748b33; border-color: #64748b88; color: #cbd5e1; }
.badge-grounded { background: #0ea5e933; border-color: #0ea5e988; color: #7dd3fc; font-weight: 600; }

/* ============== 布局 ============== */
.layout {
    display: flex;
    flex: 1;
    min-height: 0;
}
.sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid var(--c-border);
    padding: 16px 10px;
    flex-shrink: 0;
    overflow-y: auto;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--c-text-soft);
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    margin-bottom: 2px;
    transition: all 0.15s;
}
.nav-item:hover {
    background: var(--c-primary-bg);
    color: var(--c-primary);
}
.nav-item.active {
    background: var(--c-primary);
    color: #fff;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(30, 58, 138, 0.25);
}
.nav-icon {
    display: inline-block;
    width: 18px;
    text-align: center;
    font-size: 14px;
}
.nav-divider {
    height: 1px;
    background: var(--c-border);
    margin: 10px 8px;
}

.content {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    max-width: 100%;
}

/* ============== 页脚 ============== */
.app-footer {
    background: #1f2937;
    color: #d1d5db;
    padding: 14px 28px;
    font-size: 12px;
    flex-shrink: 0;
}
.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}
.footer-links { color: #9ca3af; }
.footer-links span { margin: 0 4px; }

/* ============== 卡片 ============== */
.card {
    background: var(--c-card);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--c-shadow);
    border: 1px solid var(--c-border);
    margin-bottom: 16px;
}
.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-desc {
    color: var(--c-text-muted);
    font-size: 13px;
    margin: 0 0 16px 0;
}

/* ============== 表单 ============== */
.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    align-items: flex-end;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-group label {
    font-size: 12px;
    color: var(--c-text-muted);
    font-weight: 500;
}
input[type="text"],
input[type="date"],
select,
textarea {
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 14px;
    font-family: var(--font);
    background: #fff;
    color: var(--c-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}
textarea {
    resize: vertical;
    min-height: 120px;
    width: 100%;
    font-family: var(--font);
    line-height: 1.6;
}

/* ============== 按钮 ============== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--c-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
}
.btn:hover { background: #1e40af; box-shadow: 0 2px 6px rgba(30, 58, 138, 0.3); }
.btn:active { transform: translateY(1px); }
.btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}
.btn-secondary {
    background: #fff;
    color: var(--c-text-soft);
    border: 1px solid var(--c-border-strong);
}
.btn-secondary:hover {
    background: var(--c-primary-bg);
    color: var(--c-primary);
    border-color: var(--c-primary);
    box-shadow: none;
}
.btn-accent {
    background: var(--c-accent);
    color: #fff;
}
.btn-accent:hover { background: #d97706; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* 应标材料辅助：上传/粘贴 切换 + 文件选择 */
.bid-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.btn-ghost {
    background: var(--c-primary-bg);
    color: var(--c-text-soft);
    border: 1px solid var(--c-border-strong);
    padding: 6px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--c-primary); }
.btn-ghost.active {
    background: #fff;
    color: var(--c-primary);
    border-color: var(--c-primary);
    font-weight: 500;
}
input[type="file"] {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--c-text-soft);
}

/* ============== 通知条 ============== */
.notice {
    background: var(--c-primary-bg);
    border-left: 3px solid var(--c-primary);
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--c-text-soft);
    font-size: 13px;
    margin: 12px 0;
}
.notice.warn {
    background: var(--c-warn-bg);
    border-left-color: var(--c-warn);
    color: #92400e;
}
.notice.danger {
    background: var(--c-danger-bg);
    border-left-color: var(--c-danger);
    color: #991b1b;
}
.notice.success {
    background: var(--c-success-bg);
    border-left-color: var(--c-success);
    color: #166534;
}

/* ============== 政策列表 ============== */
.policy-list { display: flex; flex-direction: column; gap: 10px; }
.policy-item {
    background: #fff;
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: var(--radius);
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.15s;
}
.policy-item:hover {
    border-color: var(--c-primary);
    box-shadow: var(--c-shadow);
    transform: translateX(2px);
}
.policy-item-title {
    font-weight: 600;
    color: var(--c-text);
    font-size: 15px;
    margin-bottom: 6px;
}
.policy-item-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--c-text-muted);
    margin-bottom: 6px;
}
.policy-item-meta span { display: inline-flex; align-items: center; gap: 4px; }
.policy-item-summary {
    color: var(--c-text-soft);
    font-size: 13px;
    line-height: 1.5;
}
.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--c-primary-bg);
    color: var(--c-primary);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 4px;
}
.tag-region { background: #ecfdf5; color: #065f46; }
.tag-topic { background: var(--c-primary-bg); color: var(--c-primary); }

/* ============== 详情面板 ============== */
.policy-detail {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 16px;
}
.policy-detail h2 {
    margin: 0 0 16px 0;
    color: var(--c-text);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
}
.policy-detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 8px 24px;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: var(--c-bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.policy-detail-meta .label {
    color: var(--c-text-muted);
    display: inline-block;
    width: 80px;
}
.policy-detail-meta .value {
    color: var(--c-text);
    font-weight: 500;
}
.policy-detail-section h3 {
    font-size: 15px;
    color: var(--c-primary);
    margin: 18px 0 8px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--c-border);
}
.policy-detail-section p {
    color: var(--c-text-soft);
    white-space: pre-wrap;
    line-height: 1.7;
    margin: 0 0 12px 0;
}
.policy-detail-section ul {
    color: var(--c-text-soft);
    padding-left: 20px;
    margin: 0;
}
.policy-detail-section li { margin-bottom: 4px; }

/* ============== Tabs（多版本切换） ============== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 16px;
}
.tab {
    padding: 8px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--c-text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}
.tab:hover { color: var(--c-primary); }
.tab.active {
    color: var(--c-primary);
    border-bottom-color: var(--c-primary);
}

/* ============== 生成内容展示 ============== */
.gen-output {
    background: #fafbfc;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 18px 22px;
    font-family: var(--font);
    font-size: 13px;
    line-height: 1.8;
    color: var(--c-text);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 600px;
    overflow-y: auto;
}
.gen-output-empty {
    color: var(--c-text-muted);
    text-align: center;
    padding: 40px;
    font-size: 13px;
    background: var(--c-bg);
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius);
}

/* ============== Markdown 渲染 ============== */
.gen-output.markdown-body {
    white-space: normal;
    word-break: break-word;
}
.markdown-body > :first-child { margin-top: 0; }
.markdown-body > :last-child { margin-bottom: 0; }
.markdown-body h1 {
    font-size: 20px; line-height: 1.4; margin: 18px 0 10px;
    padding-bottom: 8px; border-bottom: 1px solid var(--c-border); color: var(--c-text);
}
.markdown-body h2 { font-size: 17px; margin: 16px 0 8px; color: var(--c-text); }
.markdown-body h3 { font-size: 15px; margin: 14px 0 6px; color: #1e3a8a; }
.markdown-body h4 { font-size: 13.5px; margin: 12px 0 6px; color: var(--c-text); }
.markdown-body p { margin: 8px 0; }
.markdown-body ul, .markdown-body ol { margin: 8px 0; padding-left: 22px; }
.markdown-body li { margin: 4px 0; }
.markdown-body a { color: #1e3a8a; text-decoration: underline; }
.markdown-body blockquote {
    margin: 10px 0; padding: 8px 14px;
    border-left: 3px solid #1e3a8a; background: #f1f5f9;
    color: var(--c-text-soft); border-radius: 0 6px 6px 0;
}
.markdown-body code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    background: #eef2f7; padding: 1px 5px; border-radius: 4px;
    font-size: 12.5px; color: #be123c;
}
.markdown-body pre.md-code {
    background: #0f172a; color: #e2e8f0; padding: 12px 14px;
    border-radius: 8px; overflow-x: auto; margin: 10px 0;
}
.markdown-body pre.md-code code { background: transparent; color: inherit; padding: 0; }
.markdown-body hr { border: none; border-top: 1px solid var(--c-border); margin: 14px 0; }

/* ============== 流式逐字生成 ============== */
.stream-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 4px 2px;
}
.stream-section {
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.stream-section-head {
    background: var(--c-primary-bg);
    color: var(--c-primary);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--c-border);
}
.stream-section .gen-output {
    border: none;
    border-radius: 0;
    max-height: none;
    background: #fff;
}
.gen-dots {
    font-size: 13px;
    color: var(--c-text-muted);
    font-weight: 500;
}
.gen-dots::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 5px;
    border-radius: 50%;
    background: var(--c-primary);
    animation: pulse-dot 1s ease-in-out infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.25); }
}
.caret {
    display: inline-block;
    color: var(--c-primary);
    font-weight: 700;
    animation: blink 1s step-end infinite;
    margin-left: 1px;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ============== 采集任务日志 ============== */
.ingest-log {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 14px 18px;
    margin: 12px 0;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.7;
    max-height: 360px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.log-line { padding: 1px 0; }
.log-line.src { color: #7dd3fc; font-weight: 600; }
.log-line.ok { color: #86efac; }
.log-line.skip { color: #94a3b8; }
.log-line.warn { color: #fbbf24; }
.log-line.err { color: #fca5a5; font-weight: 600; }

/* ============== 来源标注 ============== */
.sources {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 12px;
}
.sources-title {
    color: #0369a1;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.source-item {
    color: var(--c-text-soft);
    padding: 3px 0;
    border-top: 1px dashed #bae6fd;
}
.source-item:first-of-type { border-top: none; }
.source-item a {
    color: #0369a1;
    text-decoration: none;
    word-break: break-all;
}
.source-item a:hover { text-decoration: underline; }

/* ============== 加载 ============== */
.loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ffffff60;
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.loading-dark {
    border-color: var(--c-border-strong);
    border-top-color: var(--c-primary);
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============== 合规校验结果 ============== */
.compliance-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    text-align: center;
}
.stat-num {
    font-size: 24px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}
.stat-num.high { color: var(--c-danger); }
.stat-num.medium { color: var(--c-warn); }
.stat-num.low { color: var(--c-primary); }
.stat-num.total { color: var(--c-text); }
.stat-label {
    font-size: 12px;
    color: var(--c-text-muted);
}
.issue-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 8px;
    border-left: 3px solid var(--c-border-strong);
}
.issue-card.high { border-left-color: var(--c-danger); background: #fef9f9; }
.issue-card.medium { border-left-color: var(--c-warn); background: #fffbeb; }
.issue-card.low { border-left-color: var(--c-primary); }
.issue-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 6px;
}
.issue-card-cat { font-weight: 600; color: var(--c-text); }
.issue-card-severity {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.issue-card-severity.high { background: var(--c-danger-bg); color: #991b1b; }
.issue-card-severity.medium { background: var(--c-warn-bg); color: #92400e; }
.issue-card-severity.low { background: var(--c-primary-bg); color: var(--c-primary); }
.issue-card-snippet {
    background: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--c-text-soft);
    margin: 6px 0;
    border: 1px solid var(--c-border);
}
.issue-card-suggestion {
    color: var(--c-text-soft);
    font-size: 13px;
    margin: 4px 0;
}
.issue-card-ref {
    font-size: 11px;
    color: var(--c-text-muted);
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed var(--c-border);
}

/* ============== Dashboard ============== */
.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    right: -40px;
    top: -40px;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #ffffff20 0%, transparent 70%);
    pointer-events: none;
}
.hero h1 {
    font-size: 26px;
    margin: 0 0 8px 0;
    font-weight: 700;
}
.hero p {
    font-size: 14px;
    color: #dbeafe;
    margin: 0 0 16px 0;
    max-width: 600px;
}
.hero-actions { display: flex; gap: 10px; }
.hero-actions .btn { background: #fff; color: var(--c-primary); }
.hero-actions .btn:hover { background: #f3f4f6; }
.hero-actions .btn-accent { background: var(--c-accent); color: #fff; }
.hero-actions .btn-accent:hover { background: #d97706; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.feature-card {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.15s;
    border-top: 3px solid var(--c-primary);
}
.feature-card:hover {
    box-shadow: var(--c-shadow-lg);
    transform: translateY(-2px);
    border-top-color: var(--c-accent);
}
.feature-card-icon {
    width: 36px;
    height: 36px;
    background: var(--c-primary-bg);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--c-primary);
    font-size: 18px;
    margin-bottom: 10px;
}
.feature-card-title {
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 4px;
}
.feature-card-desc {
    font-size: 12px;
    color: var(--c-text-muted);
    line-height: 1.5;
}

/* ============== Toast ============== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    background: #1f2937;
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    transition: transform 0.3s;
    z-index: 1000;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============== 工具类 ============== */
.row { display: flex; gap: 12px; }
.row.align-center { align-items: center; }
.row.justify-between { justify-content: space-between; }
.col { flex: 1; min-width: 0; }
.muted { color: var(--c-text-muted); }
.small { font-size: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-mono { font-family: var(--font-mono); }
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--c-text-muted);
}

/* ============== 响应式 ============== */
@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--c-border);
        padding: 8px;
        display: flex;
        flex-wrap: wrap;
        overflow-x: auto;
    }
    .nav-item {
        padding: 6px 12px;
        font-size: 13px;
    }
    .nav-divider { display: none; }
    .content { padding: 16px; }
    .app-header { padding: 10px 16px; flex-direction: column; gap: 8px; align-items: flex-start; }
    .compliance-summary { grid-template-columns: repeat(2, 1fr); }
}

/* ============== v3b 配图与预览工作室 ============== */
.studio-cta { margin-top: 16px; }
.studio-grid { display: grid; grid-template-columns: 280px 1fr; gap: 20px; margin-top: 14px; align-items: start; }
.studio-left { border: 1px solid var(--c-border, #e2e8f0); border-radius: 10px; padding: 14px; background: #f8fafc; }
.studio-lib { margin-top: 12px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.lib-item { border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; background: #fff; }
.lib-item img { width: 100%; height: 84px; object-fit: cover; display: block; }
.lib-name { font-size: 11px; color: #475569; padding: 4px 6px; line-height: 1.3; word-break: break-all; }
.studio-right { min-width: 0; }
.a4-page { background: #fff; border: 1px solid #cbd5e1; border-radius: 4px; box-shadow: 0 4px 18px rgba(15,23,42,.12); padding: 36px 40px; max-height: 720px; overflow: auto; font-size: 13px; color: #1e293b; line-height: 1.7; }
.a4-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 2px solid #1e293b; }
.a4-h { font-size: 15px; font-weight: 700; margin: 14px 0 6px; color: #0f172a; }
.a4-p { white-space: pre-wrap; margin: 0 0 6px; color: #334155; }
.a4-slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 8px; }
.a4-slot { border: 1px dashed #cbd5e1; border-radius: 8px; padding: 8px; background: #f8fafc; }
.a4-slot-label { font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.a4-slot-img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; display: block; background: #e2e8f0; }
.a4-slot-empty { width: 100%; height: 110px; border-radius: 6px; background: repeating-linear-gradient(45deg,#f1f5f9,#f1f5f9 8px,#e2e8f0 8px,#e2e8f0 16px); display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 12px; }
.a4-slot-select { width: 100%; margin-top: 6px; padding: 5px 6px; font-size: 12px; border: 1px solid #cbd5e1; border-radius: 6px; background: #fff; color: #1e293b; }
.studio-actions { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
@media (max-width: 900px) { .studio-grid { grid-template-columns: 1fr; } .a4-slots { grid-template-columns: 1fr; } }


/* ============== v4a 模板装配工作台 ============== */
.v4-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 4px; }
.v4-steps { color: #64748b; margin: 4px 0 12px; }
.v4-blocks { display: flex; flex-direction: column; gap: 10px; max-height: 62vh; overflow: auto; padding-right: 6px; }
.v4-block { border: 1px solid var(--c-border, #e2e8f0); border-radius: 10px; padding: 10px 12px; background: #fff; }
.v4-block.req { border-left: 3px solid #e24b4a; }
.v4-bhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.v4-btitle { font-weight: 500; font-size: 13px; color: #1e293b; flex: 1; min-width: 140px; }
.v4-req { font-size: 11px; color: #a32d2d; border: 1px solid #f09595; border-radius: 4px; padding: 0 4px; }
.v4-field { display: grid; grid-template-columns: 130px 1fr 80px; gap: 8px; align-items: center; margin: 3px 0; }
.v4-fkey { font-size: 12px; color: #475569; }
.v4-fval { font-size: 12px; padding: 3px 6px; border: 1px solid #cbd5e1; border-radius: 6px; width: 100%; }
.v4-fval:disabled { background: #f8fafc; color: #475569; }
.v4-fsrc { font-size: 11px; text-align: right; }
.v4-imgs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.v4-img { font-size: 11px; background: #e1f5ee; color: #085041; border-radius: 6px; padding: 2px 6px; }
.v4-gap { font-size: 11px; color: #a32d2d; margin-top: 4px; }
.v4-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.badge.v4-a1 { background: #e1f5ee; color: #085041; }
.badge.v4-a2 { background: #e6f1fb; color: #0c447c; }
.badge.v4-a3 { background: #eef2ff; color: #3730a3; }
.badge.v4-b  { background: #faeeda; color: #633806; }
.badge.v4-c  { background: #fbeaf0; color: #72243e; }

/* v4 上传入口卡片 + 解析摘要 */
.v4-entry-card { border-left: 4px solid #534ab7; }
.v4-upload { margin-top: 10px; }
.v4-parse-summary { margin: 8px 0; padding: 8px 10px; background: #f8fafc; border-radius: 8px; }
