/* AI Product Ops Console - P0 Styles */

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

.demo-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
}
.demo-banner code { background: rgba(255,255,255,0.2); padding: 2px 6px; border-radius: 4px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

/* Navbar */
.navbar {
    background: #1a1a2e;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand {
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}
.nav-links a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    margin-left: 20px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-links a.active { color: #fff; background: rgba(255,255,255,0.15); }

/* Container */
.container { max-width: 1400px; margin: 24px auto; padding: 0 24px; }

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.page-header h1 { font-size: 24px; color: #1a1a2e; }
.back-link { color: #667eea; text-decoration: none; font-size: 14px; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid #ccc;
}
.stat-card.blue { border-left-color: #3b82f6; }
.stat-card.orange { border-left-color: #f59e0b; }
.stat-card.green { border-left-color: #10b981; }
.stat-card.gray { border-left-color: #9ca3af; }
.stat-title { font-size: 13px; color: #888; margin-bottom: 8px; }
.stat-number { font-size: 32px; font-weight: 700; color: #1a1a2e; }
.stat-detail { font-size: 12px; color: #999; margin-top: 6px; }

/* Section */
.section { margin-bottom: 32px; }
.section h2 { font-size: 18px; margin-bottom: 12px; color: #1a1a2e; }

/* Two Column */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* Table */
.table-wrapper { overflow-x: auto; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
    background: #f8f9fb;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid #f0f0f0; vertical-align: top; }
.data-table tr:hover { background: #f9fafb; }
.data-table.compact td, .data-table.compact th { padding: 8px 10px; }
.cell-strong { font-weight: 600; color: #1a1a2e; }
.cell-mono { font-family: "SF Mono", Monaco, monospace; font-size: 12px; color: #666; }
.cell-action { font-size: 12px; color: #666; max-width: 200px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: #e5e7eb;
    color: #666;
    white-space: nowrap;
}
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-orange { background: #fef3c7; color: #d97706; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-blue { background: #dbeafe; color: #2563eb; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-gray { background: #f3f4f6; color: #6b7280; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #374151;
    transition: all 0.2s;
}
.btn:hover { background: #f9fafb; border-color: #9ca3af; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { border: none; color: #3b82f6; text-decoration: none; }

/* Info Box */
.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 14px 16px;
    margin-top: 20px;
    font-size: 13px;
    color: #1e40af;
}

/* Setup Card */
.setup-card {
    background: #fff;
    max-width: 640px;
    margin: 60px auto;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}
.setup-card h2 { margin-bottom: 16px; }
.setup-card ol { margin: 16px 0 16px 20px; }
.setup-card li { margin-bottom: 8px; }
.setup-card pre {
    background: #1a1a2e;
    color: #a5b4fc;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin: 12px 0;
}
.setup-card code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.setup-card a { color: #3b82f6; }

/* Empty */
.empty { color: #999; padding: 24px; text-align: center; }

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: #aaa;
    font-size: 12px;
    margin-top: 40px;
}

/* Timestamp */
.timestamp { font-size: 12px; color: #999; }

/* Funnel Nodes */
.funnel-container { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 8px 0; }
.funnel-node {
    background: #fff; border-radius: 8px; padding: 14px 16px; min-width: 160px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08); border-top: 3px solid #3b82f6; flex-shrink: 0;
}
.funnel-node-last { border-top-color: #10b981; }
.funnel-name { font-size: 16px; font-weight: 700; color: #1a1a2e; margin-bottom: 6px; }
.funnel-meta { font-size: 12px; color: #666; margin-bottom: 4px; }
.funnel-skill { font-size: 11px; color: #2563eb; margin-bottom: 2px; }
.funnel-threshold { font-size: 11px; color: #d97706; }
.funnel-arrow { display: flex; align-items: center; padding: 0 8px; font-size: 20px; color: #ccc; flex-shrink: 0; }

/* Section Header */
.section-header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.section-header h2 { font-size: 18px; color: #1a1a2e; }
.section-desc { font-size: 12px; color: #999; }

/* Stat Pills */
.stat-pills { display: flex; gap: 8px; }
.pill { padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 600; }
.pill-orange { background: #fef3c7; color: #d97706; }
.pill-green { background: #d1fae5; color: #059669; }
.pill-blue { background: #dbeafe; color: #2563eb; }
.pill-purple { background: #ede9fe; color: #7c3aed; }

/* Extract Form */
.extract-form { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); max-width: 600px; }
.form-row { display: flex; align-items: center; margin-bottom: 12px; }
.form-row label { width: 100px; font-size: 13px; color: #666; }
.form-row select, .form-row input { flex: 1; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }

/* Responsive */
@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .nav-links a { margin-left: 8px; font-size: 12px; }
}

/* Form Card */
.form-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); margin-top: 16px; }
.form-card h3 { font-size: 15px; margin-bottom: 14px; color: #1a1a2e; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .form-row { margin-bottom: 0; }
.form-result { margin-top: 12px; font-size: 13px; }
.form-result pre { background: #1a1a2e; color: #a5b4fc; padding: 10px; border-radius: 6px; font-size: 12px; overflow-x: auto; margin-top: 8px; }

/* Primary Button */
.btn-primary { background: #3b82f6; color: #fff; border: none; }
.btn-primary:hover { background: #2563eb; }

/* Text colors */
.text-green { color: #059669; }
.text-red { color: #dc2626; }

/* Sub-section */
.sub-section { margin-bottom: 20px; }
.sub-section h3 { font-size: 14px; color: #666; margin-bottom: 8px; padding-left: 8px; border-left: 3px solid #3b82f6; }

/* Form row full width */
.form-row { display: flex; align-items: center; margin-bottom: 12px; }
.form-row label { width: 100px; font-size: 13px; color: #666; flex-shrink: 0; }
.form-row select, .form-row input { flex: 1; padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 13px; }

/* Danger Button */
.btn-danger { background: #ef4444; color: #fff; border: none; }
.btn-danger:hover { background: #dc2626; }

/* Toast Notification */
.toast {
    position: fixed;
    top: 80px;
    right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    z-index: 9999;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { background: #10b981; }
.toast-error { background: #ef4444; }
.toast-info { background: #3b82f6; }

/* Modal 弹层 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    width: 640px;
    max-width: 92vw;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #f0f0f0;
}
.modal-header h3 { font-size: 16px; color: #1a1a2e; margin: 0; }
.modal-close { cursor: pointer; font-size: 20px; color: #999; line-height: 1; border: none; background: none; }
.modal-close:hover { color: #333; }
.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid #f0f0f0;
}
/* Biz Switcher */
.biz-switcher {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}
.biz-switcher select {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
}
.biz-switcher select option { color: #333; }
.biz-switcher label { color: rgba(255,255,255,0.5); font-size: 12px; }

/* Status Badges - 提取状态机四态 */
.badge-status-running { background: #dbeafe; color: #2563eb; }
.badge-status-pending { background: #fef3c7; color: #d97706; }
.badge-status-done { background: #d1fae5; color: #059669; }
.badge-status-failed { background: #fee2e2; color: #dc2626; }

/* Section Card (配置页板块卡片) */
.section-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
    overflow: hidden;
}
.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #f8f9fb;
    border-bottom: 1px solid #eee;
}
.section-card-header h3 { font-size: 15px; color: #1a1a2e; margin: 0; }
.section-card-body { padding: 16px 20px; }
.section-card-body .form-grid { margin-bottom: 0; }

/* Nested sub-table under section card */
.node-sub-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.node-sub-table th { background: #fafbfc; padding: 8px 10px; text-align: left; font-weight: 600; color: #888; font-size: 12px; }
.node-sub-table td { padding: 8px 10px; border-top: 1px solid #f0f0f0; }
.node-sub-table tr:hover { background: #f9fafb; }

/* Edit inline row highlight */
tr.editing { background: #eff6ff !important; }
tr.editing td input { width: 100%; padding: 4px 6px; border: 1px solid #3b82f6; border-radius: 4px; font-size: 13px; }

/* Retry button */
.btn-retry { background: #fef3c7; color: #d97706; border: 1px solid #fcd34d; }
.btn-retry:hover { background: #fde68a; }

/* Detail expand */
.detail-row { display: none; }
.detail-row.show { display: table-row; background: #fafbfc; }
.detail-row td { padding: 12px 20px; font-size: 13px; color: #555; }

/* Empty state with icon */
.empty-block { text-align: center; padding: 40px 20px; color: #bbb; }
.empty-block .empty-icon { font-size: 32px; margin-bottom: 8px; }
