/* ================================================================
   DataLab 数据工坊 — Modern Design System
   ================================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
    display: flex; flex-direction: column;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(99,102,241,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(124,58,237,0.04) 0%, transparent 50%);
}

/* ---------- Header — Glassmorphism ---------- */
.app-header {
    background: linear-gradient(135deg, #312e81 0%, #4c1d95 50%, #5b21b6 100%);
    color: #fff;
    padding: 16px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}
.app-header::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}
.app-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex; align-items: center; gap: 6px;
}
.app-header h1 span { font-weight: 400; opacity: 0.85; font-size: 1rem; }
.header-actions { display: flex; gap: 8px; z-index: 1; }

/* ---------- Tab Bar ---------- */
.tab-bar {
    display: flex;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 0 20px; gap: 0;
    position: sticky; top: 0; z-index: 50;
}
.tab-btn {
    padding: 14px 22px; border: none; background: none;
    font-size: 0.9rem; cursor: pointer;
    color: #64748b; font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    position: relative;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tab-btn:hover { color: #4f46e5; background: rgba(99,102,241,0.04); }
.tab-btn.active {
    color: #4f46e5; font-weight: 600;
    border-bottom-color: #4f46e5;
}
.tab-btn-chat {
    margin-left: auto;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff !important;
    border-radius: 8px 8px 0 0;
    padding: 10px 20px; margin-top: 4px;
    border-bottom: none !important;
}

/* ---------- Main Content ---------- */
.app-main {
    flex: 1; padding: 24px; max-width: 1280px; margin: 0 auto; width: 100%;
}
.tab-content { display: none; animation: fadeSlideIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Upload Zone ---------- */
.upload-zone {
    border: 2px dashed #c7d2fe;
    border-radius: 20px;
    padding: 64px 24px; text-align: center; cursor: pointer;
    transition: all 0.35s cubic-bezier(0.4,0,0.2,1);
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(4px);
    margin-bottom: 24px;
    position: relative; overflow: hidden;
}
.upload-zone::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at center, rgba(99,102,241,0.03) 0%, transparent 70%);
    transition: opacity 0.3s;
    opacity: 0;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: #6366f1;
    background: rgba(238,242,255,0.9);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(99,102,241,0.12);
}
.upload-zone:hover::before { opacity: 1; }
.upload-icon { font-size: 3.5rem; margin-bottom: 12px; position: relative; z-index: 1; }
.upload-zone p { color: #94a3b8; margin-bottom: 18px; font-size: 0.95rem; position: relative; z-index: 1; }

.upload-info {
    background: #fff; border-radius: 16px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
}
.upload-info.hidden { display: none; }

.file-card {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; background: linear-gradient(135deg, #eef2ff, #faf5ff);
    border-radius: 12px; margin-bottom: 16px;
    border: 1px solid rgba(99,102,241,0.12);
}
.file-icon { font-size: 1.5rem; }
.badge { padding: 5px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; }
.badge-info { background: #dbeafe; color: #1e40af; }

.parse-summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.parse-summary .stat-item {
    padding: 10px 16px; background: #f8fafc; border-radius: 10px;
    font-size: 0.85rem; border: 1px solid #f1f5f9;
}
.parse-summary .stat-item strong { color: #4f46e5; }

.generate-controls {
    display: flex; align-items: center; gap: 16px; margin-bottom: 12px;
}
.input-number {
    width: 84px; padding: 8px 12px; border: 1.5px solid #e2e8f0;
    border-radius: 8px; font-size: 0.95rem; transition: border-color 0.2s;
}
.input-number:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }

/* ---------- Buttons ---------- */
.btn {
    padding: 10px 22px; border: none; border-radius: 10px; font-size: 0.9rem;
    cursor: pointer; transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    font-weight: 600; letter-spacing: 0.01em;
    position: relative; overflow: hidden;
}
.btn::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
    opacity: 0; transition: opacity 0.25s;
}
.btn:hover::after { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,0.25);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(79,70,229,0.35); transform: translateY(-1px); }

.btn-success {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff; box-shadow: 0 2px 8px rgba(5,150,105,0.25);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(5,150,105,0.35); transform: translateY(-1px); }

.btn-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    color: #fff; padding: 10px 24px; border: none;
    border-radius: 10px; font-size: 0.9rem; cursor: pointer;
    transition: all 0.25s; font-weight: 600;
    box-shadow: 0 2px 8px rgba(217,119,6,0.2);
}
.btn-warning:hover { box-shadow: 0 6px 16px rgba(217,119,6,0.3); transform: translateY(-1px); }

.btn-icon {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff; padding: 7px 14px; border-radius: 8px;
    cursor: pointer; font-size: 0.85rem; font-weight: 500;
    backdrop-filter: blur(8px);
    transition: all 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.2); }

.btn-xs {
    padding: 5px 12px; border: none; border-radius: 6px; font-size: 0.78rem;
    cursor: pointer; font-weight: 600; transition: all 0.2s;
}
.btn-add { background: #6366f1; color: #fff; }
.btn-add:hover { background: #4f46e5; }
.btn-remove { background: #fee2e2; color: #ef4444; }
.btn-remove:hover { background: #fecaca; }

/* ---------- Table ---------- */
.table-wrapper {
    background: #fff; border-radius: 16px; overflow: auto; max-height: 65vh;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.03);
}
.table-empty, .stats-empty, .export-empty {
    text-align: center; padding: 80px 24px; color: #94a3b8; font-size: 1rem;
}
.data-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; padding: 0 4px;
}
.data-info { font-size: 0.85rem; color: #64748b; }
.data-search .input-text {
    width: 200px; padding: 8px 14px; border: 1.5px solid #e2e8f0;
    border-radius: 8px; font-size: 0.9rem; transition: border-color 0.2s;
}
.data-search .input-text:focus { outline: none; border-color: #6366f1; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
thead { position: sticky; top: 0; z-index: 2; }
th {
    background: #f8fafc; color: #475569; padding: 12px 14px;
    text-align: left; white-space: nowrap; font-weight: 600;
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em;
    border-bottom: 2px solid #e2e8f0;
}
td { padding: 10px 14px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
tr:hover td { background: #f8fafc; }

.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 16px; }
.pagination.hidden { display: none; }
.pagination button {
    padding: 8px 16px; border: 1.5px solid #e2e8f0; border-radius: 8px;
    background: #fff; cursor: pointer; font-size: 0.85rem; font-weight: 500;
    transition: all 0.2s;
}
.pagination button:hover { background: #f1f5f9; border-color: #cbd5e1; }
.pagination button:disabled { opacity: 0.35; cursor: not-allowed; }
.pagination .page-info { font-size: 0.85rem; color: #64748b; }

/* ---------- Stats ---------- */
.stats-content.hidden, .export-content.hidden { display: none; }

.quality-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-radius: 14px; margin-bottom: 24px;
    font-size: 0.9rem; font-weight: 600;
}
.quality-bar.passed { background: #ecfdf5; border: 1.5px solid #6ee7b7; color: #065f46; }
.quality-bar.failed { background: #fffbeb; border: 1.5px solid #fcd34d; color: #92400e; }
.quality-bar.hidden { display: none; }

.dimension-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.dim-card {
    background: #fff; border-radius: 14px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border-left: 4px solid #6366f1;
    transition: all 0.25s;
}
.dim-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.dim-card h4 { margin-bottom: 8px; color: #334155; font-size: 0.95rem; }
.dim-card .alpha-value { font-size: 1.6rem; font-weight: 700; }
.alpha-good { color: #10b981; }
.alpha-ok { color: #f59e0b; }
.alpha-bad { color: #ef4444; }
.dim-card .dim-detail { font-size: 0.82rem; color: #94a3b8; margin-top: 6px; }

.kmo-card {
    background: #fff; border-radius: 14px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 24px;
}
.kmo-card p { margin: 6px 0; font-size: 0.9rem; }

.correlation-matrix {
    background: #fff; border-radius: 14px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); overflow-x: auto;
}
.correlation-matrix table { margin-top: 10px; }
.correlation-matrix th { background: #f1f5f9; color: #475569; text-align: center; }
.correlation-matrix td { text-align: center; }

.overall-alpha { margin-bottom: 24px; }
.overall-alpha .dim-card { border-left-color: #f59e0b; }

/* ---------- Regression ---------- */
.regression-section {
    background: #fff; border-radius: 14px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-top: 20px;
}
.regression-hint { color: #94a3b8; font-size: 0.88rem; margin-bottom: 16px; }
.regression-controls { display: flex; flex-direction: column; gap: 14px; }
.regression-controls label { font-weight: 600; display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.regression-ivs { border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 14px; }
.regression-ivs legend { font-weight: 600; padding: 0 8px; color: #475569; }
.checkbox-group {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px; max-height: 200px; overflow-y: auto;
}
.checkbox-label {
    display: flex; align-items: center; gap: 8px; font-size: 0.85rem;
    cursor: pointer; padding: 5px 8px; border-radius: 6px; transition: background 0.15s;
}
.checkbox-label:hover { background: #f1f5f9; }
.checkbox-label input[type="checkbox"] { margin: 0; cursor: pointer; accent-color: #6366f1; }

.regression-results { margin-top: 20px; }
.regression-summary {
    background: #f8fafc; border-radius: 10px; padding: 14px 18px;
    margin-bottom: 16px; font-size: 0.9rem; line-height: 1.7;
}
.regression-error {
    margin-top: 16px; padding: 14px; background: #fef2f2;
    border-radius: 10px; color: #ef4444; font-size: 0.88rem;
}
.regression-table { width: 100%; font-size: 0.88rem; }
.regression-table th { background: #f1f5f9; padding: 8px 12px; text-align: left; }
.regression-table td { padding: 7px 12px; border-bottom: 1px solid #f1f5f9; }

/* ---------- Export ---------- */
.export-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-top: 16px; }
.export-card {
    background: #fff; border-radius: 16px; padding: 28px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    text-align: center; transition: all 0.25s;
}
.export-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.export-card h4 { margin-bottom: 8px; font-size: 1.05rem; }
.export-card p { color: #94a3b8; margin-bottom: 18px; font-size: 0.85rem; }

/* ---------- Chat Panel ---------- */
.chat-panel {
    position: fixed; right: 0; top: 0; bottom: 0; width: 420px;
    background: #fff; box-shadow: -8px 0 40px rgba(0,0,0,0.08);
    z-index: 100; display: flex; flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
}
.chat-panel.hidden { transform: translateX(100%); }
.chat-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #312e81, #4c1d95);
    color: #fff;
}
.chat-header .btn-icon { color: #fff; border-color: rgba(255,255,255,0.3); }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-welcome { color: #94a3b8; font-size: 0.9rem; line-height: 1.7; }
.chat-welcome ul { margin: 8px 0 0 18px; }
.chat-welcome li { margin: 4px 0; color: #6366f1; cursor: pointer; }
.chat-welcome li:hover { text-decoration: underline; }

.chat-message { max-width: 85%; padding: 12px 16px; border-radius: 16px; font-size: 0.88rem; line-height: 1.6; word-break: break-word; }
.chat-message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff; border-bottom-right-radius: 6px;
}
.chat-message.assistant {
    align-self: flex-start; background: #f1f5f9; color: #334155;
    border-bottom-left-radius: 6px;
}
.chat-message.system {
    align-self: stretch; background: #fffbeb; border: 1px solid #fcd34d;
    border-radius: 10px; font-size: 0.84rem; color: #92400e;
}
.chat-message.system summary { cursor: pointer; font-weight: 600; }

.chat-input-area { display: flex; gap: 8px; padding: 14px; border-top: 1px solid #f1f5f9; }
.chat-input-area textarea {
    flex: 1; padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px;
    resize: none; font-family: inherit; font-size: 0.9rem; transition: border-color 0.2s;
}
.chat-input-area textarea:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.08); }

.typing-indicator { display: flex; gap: 5px; padding: 12px 16px; }
.typing-indicator span {
    width: 8px; height: 8px; border-radius: 50%; background: #94a3b8;
    animation: typing 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ---------- Modal ---------- */
.modal {
    position: fixed; inset: 0; background: rgba(15,23,42,0.5);
    backdrop-filter: blur(6px);
    display: flex; justify-content: center; align-items: center; z-index: 200;
    animation: modalFadeIn 0.2s ease;
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal.hidden { display: none; }
.modal-content {
    background: #fff; border-radius: 18px; width: 92%; max-width: 500px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.15);
    animation: modalSlideIn 0.3s cubic-bezier(0.4,0,0.2,1);
}
@keyframes modalSlideIn {
    from { transform: translateY(20px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 22px; border-bottom: 1px solid #f1f5f9;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.modal-body label { display: flex; flex-direction: column; gap: 5px; font-size: 0.88rem; font-weight: 600; color: #475569; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: #94a3b8; transition: color 0.2s; }
.modal-close:hover { color: #ef4444; }

.input-text, .input-select {
    padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px;
    font-size: 0.9rem; width: 100%; transition: border-color 0.2s;
}
.input-text:focus, .input-select:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.08); }

/* ---------- Status Bar ---------- */
.status-bar {
    background: #fff; border-top: 1px solid #f1f5f9;
    padding: 10px 22px; font-size: 0.82rem; color: #94a3b8;
}

/* ---------- Requirements Panel ---------- */
.requirements-panel {
    background: #fff; border-radius: 16px; padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 24px;
}
.requirements-panel.hidden { display: none; }
.requirements-panel h3 { margin-bottom: 6px; font-size: 1.1rem; }
.requirements-hint { color: #94a3b8; font-size: 0.88rem; margin-bottom: 18px; }

.req-group {
    border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 16px 18px; margin-bottom: 14px;
}
.req-group legend {
    font-weight: 700; font-size: 0.92rem; color: #334155; padding: 0 8px;
    display: flex; align-items: center; gap: 12px;
}
.req-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.req-row-3col label { flex: 1; min-width: 180px; }
.req-dynamic-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.req-item {
    background: #f8fafc; border-radius: 10px; padding: 14px 16px; border: 1px solid #e2e8f0;
}
.req-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.req-item-title { font-weight: 700; font-size: 0.9rem; color: #4f46e5; }
.req-hint-text { color: #94a3b8; font-size: 0.82rem; margin-top: 8px; }
.regression-ivs-mini { border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.regression-ivs-mini legend { font-size: 0.82rem; color: #64748b; }
.input-number-sm {
    width: 80px; padding: 7px 10px; border: 1.5px solid #e2e8f0; border-radius: 6px; font-size: 0.9rem;
}
.input-number-sm:focus { outline: none; border-color: #6366f1; }
.iv-item-row { display: flex; align-items: center; gap: 12px; padding: 3px 0; }
.iv-item-row .checkbox-label { flex: 1; }
.iv-sig-label { font-size: 0.8rem; color: #64748b; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.iv-sign-select { font-size: 0.75rem; padding: 2px 6px; margin: 0 6px; width: auto; border: 1px solid #e2e8f0; border-radius: 4px; }
.input-select-xs { font-size: 0.75rem; padding: 3px 6px; border: 1px solid #e2e8f0; border-radius: 4px; }
.iv-list { max-height: 220px; overflow-y: auto; }

/* ---------- Requirements Status ---------- */
.requirements-status {
    background: #fff; border-radius: 16px; padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 20px;
}
.requirements-status.hidden { display: none; }
.requirements-status h3 { margin-bottom: 14px; font-size: 1.05rem; }
.requirements-status h4 { font-size: 0.88rem; color: #6366f1; margin: 12px 0 6px; }
.req-status-list { list-style: none; padding: 0; margin: 4px 0; }
.req-status-item { padding: 7px 12px; border-radius: 8px; font-size: 0.88rem; margin: 4px 0; }
.req-status-item.met { background: #ecfdf5; border-left: 3px solid #10b981; }
.req-status-item.unmet { background: #fffbeb; border-left: 3px solid #f59e0b; }
.req-status-group { margin-bottom: 10px; }
.req-status-group ul { list-style: none; padding: 0; margin: 4px 0; }

/* ---------- Gen Progress Modal ---------- */
.gen-progress-content { max-width: 540px; }
.gen-progress-content .modal-header {
    background: linear-gradient(135deg, #312e81, #4c1d95);
    color: #fff; border-radius: 18px 18px 0 0;
}
.gen-progress-content .modal-header h3 { color: #fff; }
.gen-spinner {
    width: 52px; height: 52px; margin: 0 auto 18px;
    border: 4px solid #e2e8f0; border-top: 4px solid #6366f1;
    border-radius: 50%; animation: gen-spin 0.8s linear infinite;
}
@keyframes gen-spin { to { transform: rotate(360deg); } }
.gen-status-text { text-align: center; font-size: 1rem; color: #475569; margin-bottom: 18px; font-weight: 500; }
.gen-stats { background: #f8fafc; border-radius: 10px; padding: 14px 18px; margin-bottom: 16px; font-size: 0.88rem; }
.gen-stat-row { display: flex; justify-content: space-between; padding: 4px 0; }
.gen-stat-row span { color: #94a3b8; }
.gen-stat-row strong { color: #1e293b; }
.gen-requirements { margin-bottom: 16px; }
.gen-req-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 12px;
    border-radius: 8px; font-size: 0.84rem; margin: 4px 0;
}
.gen-req-item.met { background: #ecfdf5; color: #065f46; }
.gen-req-item.unmet { background: #fffbeb; color: #92400e; }
.gen-req-item .req-icon { font-size: 0.95rem; }
.gen-progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.gen-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed, #a78bfa);
    background-size: 200% 100%;
    animation: gen-progress-shimmer 2s linear infinite;
    border-radius: 4px; transition: width 0.5s;
}
@keyframes gen-progress-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.gen-timeout-actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }

/* ---------- Baby Panel ---------- */
.baby-panel {
    margin-top: 24px; padding: 22px;
    background: linear-gradient(135deg, #fefce8 0%, #fef3c7 100%);
    border: 1px solid #fde68a; border-radius: 16px;
}
.baby-panel-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.baby-panel-header h3 { font-size: 1.05rem; color: #92400e; }
.baby-panel-badge {
    font-size: 0.75rem; background: #f59e0b; color: #fff;
    padding: 3px 12px; border-radius: 20px; font-weight: 700;
}
.baby-panel-desc { font-size: 0.85rem; color: #78716c; margin-bottom: 18px; }
.baby-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.baby-actions .btn-sm { font-size: 0.8rem; padding: 7px 14px; font-weight: 600; }
.baby-stats { margin-bottom: 14px; }
.baby-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.baby-stat-card { background: #fff; border-radius: 10px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.baby-stat-label { font-size: 0.78rem; color: #94a3b8; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.baby-stat-value { font-size: 1.05rem; font-weight: 700; color: #1e293b; }
.baby-stat-detail { font-size: 0.76rem; color: #94a3b8; margin-top: 4px; }
.baby-rules-details { background: #fff; border-radius: 10px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.baby-rules-details summary { cursor: pointer; font-weight: 700; color: #92400e; font-size: 0.92rem; user-select: none; }
.baby-rules-content { margin-top: 14px; }
.baby-rule-count { margin-bottom: 10px; font-size: 0.88rem; }
.baby-rules-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; }
.baby-rule-card { background: #fefefe; border: 1px solid #f1f5f9; border-radius: 10px; padding: 12px 14px; }
.baby-rule-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.baby-rule-num { font-size: 0.73rem; color: #94a3b8; background: #f1f5f9; padding: 2px 8px; border-radius: 4px; }
.baby-rule-action { font-weight: 700; font-size: 0.88rem; color: #1e293b; }
.baby-rule-confidence { font-size: 0.73rem; padding: 2px 10px; border-radius: 12px; font-weight: 700; }
.baby-rule-support { font-size: 0.73rem; color: #94a3b8; }
.confidence-high { background: #d1fae5; color: #065f46; }
.confidence-medium { background: #fef3c7; color: #92400e; }
.confidence-low { background: #fee2e2; color: #991b1b; }
.baby-rule-condition { font-size: 0.84rem; color: #475569; line-height: 1.6; }
.baby-rule-method { font-size: 0.78rem; color: #94a3b8; margin-top: 4px; }
.baby-empty-state { text-align: center; padding: 24px; color: #94a3b8; }
.baby-empty-state p { margin-bottom: 6px; }
.baby-recent-logs { background: #fff; border-radius: 10px; padding: 14px; margin-top: 10px; }
.baby-log-entry { font-size: 0.8rem; padding: 5px 0; border-bottom: 1px solid #f1f5f9; }

/* ---------- Dim Tags ---------- */
.dim-tag {
    display: inline-flex; align-items: center; gap: 2px;
    background: #eef2ff; padding: 2px 4px 2px 10px; border-radius: 6px;
    margin: 3px; font-size: 0.8rem;
}
.dim-delete-btn {
    background: none; border: none; color: #94a3b8; cursor: pointer;
    font-size: 1rem; line-height: 1; padding: 0 5px; border-radius: 3px;
    transition: all 0.15s;
}
.dim-delete-btn:hover { color: #fff; background: #ef4444; }
.dim-block .dim-delete-btn {
    font-size: 0.73rem; color: #ef4444; margin-left: 8px;
    background: #fef2f2; border: 1px solid #fecaca; padding: 2px 10px;
    border-radius: 5px; vertical-align: middle;
}
.dim-block .dim-delete-btn:hover { background: #ef4444; color: #fff; }

/* ---------- Questionnaire Preview ---------- */
.questionnaire-preview { margin-top: 20px; }
.questionnaire-preview .dim-block {
    background: #fff; border-radius: 14px; padding: 18px; margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border-left: 4px solid #6366f1;
}
.questionnaire-preview .dim-block h4 { color: #4f46e5; margin-bottom: 10px; font-size: 0.95rem; }
.questionnaire-preview .dim-block ol { padding-left: 22px; }
.questionnaire-preview .dim-block li { padding: 4px 0; font-size: 0.88rem; color: #475569; }
.questionnaire-preview .demo-block {
    background: #fffbeb; border-radius: 14px; padding: 18px; margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    border-left: 4px solid #f59e0b;
}

/* ---------- Utility ---------- */
.hidden { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .app-header { padding: 12px 16px; }
    .app-header h1 { font-size: 1.1rem; }
    .tab-btn { padding: 10px 14px; font-size: 0.8rem; }
    .tab-btn-chat { padding: 8px 14px; }
    .app-main { padding: 16px; }
    .chat-panel { width: 100%; }
    .upload-zone { padding: 40px 16px; }
}
