/* === Arc Platform — Admin Panel, Template Editor, Process Packs === */
/* ─── ADMIN ──────────────────────────────────────────────── */
.admin-container { max-width: 900px; }
.admin-header { margin-bottom: 24px; }
.admin-header h2 { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.admin-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }
/* ─── Dashboard-style Grouped Navigation ───────────── */
.admin-nav {
    margin-bottom: 28px;
}
/* Top row: KPI-strip style card with group buttons + dividers */
.admin-nav-groups {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 6px 8px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    margin-bottom: 10px;
}
.admin-nav-group-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    white-space: nowrap;
    text-align: center;
    letter-spacing: 0.01em;
}
.admin-nav-group-btn:hover {
    color: var(--text-primary);
    background: var(--gray-6);
}
.admin-nav-group-btn.active {
    color: var(--text-primary);
    background: var(--gray-6);
    font-weight: 700;
}
/* Vertical divider between groups (matches .pkpi-divider) */
.admin-nav-divider {
    width: 1px;
    height: 28px;
    background: var(--border);
    flex-shrink: 0;
}
/* Bottom row: verdict-filter style tab bar */
.admin-nav-tabs {
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--gray-6);
    border-radius: 10px;
    width: fit-content;
}
.admin-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}
.admin-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.5);
}
.admin-tab.active {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
/* Legacy .admin-tabs support (unused but safe) */
.admin-tabs { display: none; }
.admin-content { }
/* ─── Section Cards ──────────────────────────────────── */
.admin-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    margin-bottom: 16px;
    overflow: hidden;
}
.admin-card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--gray-6);
}
.admin-card-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px;
}
.admin-card-header .admin-desc {
    font-size: 13px;
    line-height: 1.4;
}
.admin-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    color: var(--primary);
}
.admin-card-body {
    padding: 20px 24px;
}
.admin-section { margin-bottom: 28px; }
.admin-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.admin-section-header h3 { font-size: 17px; font-weight: 700; }
.admin-list {
    border: 1px solid var(--border-light); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow-sm);
}
.admin-list-item {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px;
    border-bottom: 1px solid var(--border-light); transition: all 0.15s;
}
.admin-list-item:last-child { border-bottom: none; }
.admin-list-item:hover { background: var(--bg-secondary); }
.admin-item-handle { font-size: 14px; color: var(--text-muted); cursor: grab; flex-shrink: 0; }
.admin-item-icon { font-size: 20px; flex-shrink: 0; }
.admin-item-info { flex: 1; min-width: 0; }
.admin-item-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.admin-item-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.admin-item-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.admin-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.admin-tag {
    font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 6px;
    background: var(--border-light); color: var(--text-secondary);
}
.avatar-sm {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.admin-edit-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.admin-edit-card {
    background: var(--surface); border-radius: 24px; padding: 28px;
    width: 100%; max-width: 520px; box-shadow: var(--shadow-lg);
}
.admin-edit-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-md);
    font-size: 14px; font-family: inherit; outline: none; transition: all 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,114,22,0.1);
}
.form-textarea { resize: vertical; min-height: 70px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.admin-template-list { display: grid; gap: 8px; }
.admin-template-item {
    border: 1px solid var(--border-light); border-radius: var(--radius-lg);
    overflow: hidden; box-shadow: var(--shadow-sm);
}
.admin-template-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; cursor: pointer; }
.admin-template-header:hover { background: var(--bg-secondary); }
.admin-template-detail { padding: 0 18px 18px; }
.admin-template-section { padding: 12px; background: var(--bg-secondary); border-radius: var(--radius-md); margin-bottom: 8px; }
.admin-template-prompt { font-size: 13px; color: var(--text-secondary); margin-top: 6px; }
.admin-template-deliverable { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.admin-expand { font-size: 12px; color: var(--text-muted); }
.admin-export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.admin-export-card {
    background: var(--surface); border-radius: var(--radius-xl); padding: 24px;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-md);
}
.admin-export-card h4 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.admin-export-card.danger { border-color: var(--gray-3); }
.admin-threshold { margin: 14px 0; }
.admin-note { font-size: 13px; color: var(--text-muted); }

/* ─── ADMIN REORDER & SECTION EDITOR ──────────────────── */
.admin-item-actions button:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}
.admin-edit-card-wide {
    max-width: 640px;
}
.admin-edit-card-wide .form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    line-height: 1.5;
}
.btn-ai-prompt-gen {
    background: linear-gradient(135deg, var(--primary), #e8650d);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.btn-ai-prompt-gen:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249,114,22,0.3);
}
.btn-ai-prompt-gen:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.ai-prompt-status {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    line-height: 1.4;
}
.ai-prompt-status.loading { background: rgba(249,114,22,0.08); color: #b45309; }
.ai-prompt-status.error   { background: rgba(239,68,68,0.08);  color: #ef4444; }
.ai-prompt-status.success  { background: rgba(249,114,22,0.08); color: #EA580C; }

/* ─── PROCESS PACK SELECTOR ──────────────────────────────── */
.process-pack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}
.process-pack-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s ease;
}
.process-pack-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(249,114,22,0.12);
    transform: translateY(-1px);
}
.process-pack-card.active {
    border-color: var(--primary);
    background: rgba(249,114,22,0.04);
}
.process-pack-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 2px;
}
.process-pack-info { flex: 1; min-width: 0; }
.process-pack-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
}
.process-pack-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 50px;
    vertical-align: middle;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.process-pack-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 4px;
}
.process-pack-meta {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* ─── CRITERIA CATEGORIES ──────────────────────────────── */
.admin-categories-list { display: grid; gap: 12px; }
.admin-category-card {
    border: 1px solid var(--border-light); border-radius: var(--radius-lg);
    padding: 16px 18px; background: var(--surface); box-shadow: var(--shadow-sm);
    transition: all 0.15s;
}
.admin-category-card:hover { box-shadow: var(--shadow-md); }
.admin-category-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.admin-category-chips {
    display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; align-items: center;
}
.criteria-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 500; color: var(--text-primary);
    background: var(--bg-secondary); border: 1px solid var(--border-light);
    transition: all 0.15s;
}
.criteria-chip:hover { background: var(--border-light); }
.criteria-chip.uncategorized {
    border-style: dashed; background: rgba(142,142,147,0.06);
    color: var(--text-secondary);
}
.chip-remove {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 50%;
    transition: all 0.15s;
}
.chip-remove:hover { color: var(--red, #ef4444); background: rgba(239,68,68,0.1); }
.chip-assign {
    font-size: 11px; padding: 2px 6px; border: 1px solid var(--border);
    border-radius: 6px; background: var(--surface); color: var(--text-secondary);
    cursor: pointer; outline: none; font-family: inherit;
}
.chip-assign:focus { border-color: var(--primary); }

/* ─── EDITABLE STAGE FORMS ──────────────────────────────── */
.editable-guide-card {
    display: flex; align-items: flex-start; gap: 16px;
    background: var(--primary-light);
    border: 1px solid rgba(249,114,22,0.10); border-radius: var(--radius-xl);
    padding: 20px 24px; margin-bottom: 24px;
}
.editable-guide-icon { font-size: 28px; flex-shrink: 0; margin-top: 2px; }
.editable-guide-text strong { font-size: 15px; color: var(--text-primary); display: block; margin-bottom: 4px; }
.editable-guide-text p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }
.editable-sections { display: grid; gap: 16px; margin-bottom: 24px; }
.editable-section {
    background: var(--surface); border-radius: var(--radius-xl); padding: 24px;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}
.editable-section:focus-within {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,114,22,0.08), var(--shadow-md);
}
.editable-section-header { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.editable-section-num {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    background: var(--primary); color: #fff;
    font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.editable-section-info { flex: 1; }
.editable-section-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.editable-section-prompt { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.editable-section-deliverable {
    font-size: 12px; color: var(--text-muted); margin-top: 6px;
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--bg-secondary); padding: 3px 10px; border-radius: 6px;
}
.editable-textarea {
    width: 100%; padding: 14px 16px; border: 1.5px solid var(--border);
    border-radius: var(--radius-lg); font-size: 14px; font-family: inherit;
    line-height: 1.7; color: var(--text-primary); resize: vertical;
    min-height: 100px; background: var(--bg-secondary);
    transition: all 0.2s; outline: none;
}
.editable-textarea:focus {
    border-color: var(--primary); background: var(--surface);
    box-shadow: 0 0 0 3px rgba(249,114,22,0.08);
}
.editable-textarea::placeholder { color: var(--text-muted); }
.editable-actions {
    display: flex; gap: 12px; justify-content: flex-end;
    padding: 20px 0; border-top: 1px solid var(--border-light); margin-top: 8px;
}

/* Saved content display */
.saved-content-card {
    background: var(--bg-secondary); border-radius: var(--radius-lg);
    padding: 18px 22px; border: 1px solid var(--border-light);
}
.saved-content-text { font-size: 14px; color: var(--text-secondary); line-height: 1.8; }

/* Toast notification */
.save-notification {
    position: fixed; bottom: 24px; right: 90px;
    background: var(--text-primary); color: #fff;
    padding: 14px 24px; border-radius: var(--radius-lg);
    font-size: 14px; font-weight: 600; z-index: 10000;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    transform: translateY(20px); opacity: 0;
    transition: all 0.3s ease;
    display: flex; align-items: center; gap: 8px;
    max-width: 420px;
}
.save-notification.show { transform: translateY(0); opacity: 1; }
.save-notification.toast-success { background: var(--green-dark); }
.save-notification.toast-error { background: var(--red-dark); }
.save-notification.toast-warning { background: var(--amber-dark); }
.save-notification.toast-info { background: var(--primary-dark); }

/* Form validation */
.form-group input.field-error,
.form-group textarea.field-error,
.form-group select.field-error {
    border-color: var(--red) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}
.form-error-msg {
    color: var(--red);
    font-size: 12px;
    margin-top: 4px;
    display: none;
}
.form-error-msg.visible { display: block; }

/* localStorage storage meter */
.storage-meter { margin-top: 12px; }
.storage-meter-bar {
    width: 100%; height: 8px; background: var(--border-light);
    border-radius: 4px; overflow: hidden; margin-bottom: 6px;
}
.storage-meter-fill {
    height: 100%; border-radius: 4px;
    transition: width 0.4s ease;
    background: var(--primary);
}
.storage-meter-fill.warn { background: var(--amber); }
.storage-meter-fill.critical { background: var(--red); }
.storage-meter-label {
    font-size: 12px; color: var(--text-muted); display: flex;
    justify-content: space-between;
}

/* ─── INTERACTIVE SCORING ────────────────────────────────── */
.scoring-summary-card {
    background: var(--surface); border-radius: var(--radius-xl); padding: 24px 28px;
    border: 1px solid var(--border-light); box-shadow: var(--shadow-md);
    margin-bottom: 24px; display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.scoring-summary-score { display: flex; align-items: baseline; gap: 4px; }
.scoring-summary-number { font-size: 40px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.scoring-summary-max { font-size: 16px; color: var(--text-muted); font-weight: 500; }
.scoring-summary-verdict { flex: 1; min-width: 200px; }
.scoring-summary-verdict-badge {
    display: inline-flex; padding: 8px 18px; border-radius: 10px;
    font-size: 13px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.3px; margin-bottom: 6px;
}
.scoring-summary-threshold { font-size: 13px; color: var(--text-secondary); }
.scoring-summary-bar { flex: 0 0 200px; }
.scoring-summary-bar-track {
    height: 8px; background: var(--border-light); border-radius: 4px;
    overflow: visible; position: relative;
}
.scoring-summary-bar-fill { height: 100%; border-radius: 4px; transition: all 0.4s ease; }
.scoring-summary-bar-threshold {
    position: absolute; top: -4px; width: 2px; height: 16px;
    background: var(--text-primary); border-radius: 1px;
}
.scoring-instruction-card {
    display: flex; align-items: flex-start; gap: 16px;
    background: var(--primary-light);
    border: 1px solid rgba(249,114,22,0.10); border-radius: var(--radius-xl);
    padding: 18px 22px; margin-bottom: 24px;
}
.scoring-category-interactive {
    background: var(--surface); border-radius: var(--radius-xl); padding: 24px;
    margin-bottom: 20px; border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
}
.scoring-category-header-interactive {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 16px; margin-bottom: 16px; border-bottom: 2px solid var(--border-light);
}
.scoring-category-subtotal {
    font-size: 15px; font-weight: 700; color: var(--primary);
    background: var(--primary-light); padding: 6px 14px; border-radius: var(--radius-md);
}
.scoring-criteria-row-interactive {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 16px; background: #f8fafc; border-radius: var(--radius-lg);
    margin-bottom: 8px; border: 1px solid transparent; transition: all 0.2s;
}
.scoring-criteria-row-interactive:hover {
    background: var(--surface); border-color: var(--border);
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.scoring-criteria-left { flex: 1; min-width: 0; }
.scoring-criteria-right { flex-shrink: 0; }
.scoring-note-input {
    width: 100%; padding: 6px 10px; border: 1px solid var(--border-light);
    border-radius: 6px; font-size: 12px; font-family: inherit;
    color: var(--text-secondary); margin-top: 6px; outline: none;
    background: transparent; transition: all 0.15s;
}
.scoring-note-input:focus {
    border-color: var(--primary); background: var(--surface);
    box-shadow: 0 0 0 2px rgba(249,114,22,0.08);
}
.scoring-note-input::placeholder { color: var(--text-muted); }
.score-selector { display: flex; gap: 6px; }
.score-btn {
    width: 36px; height: 36px; border-radius: 8px; border: 2px solid var(--border);
    background: var(--surface); color: var(--text-secondary);
    font-size: 14px; font-weight: 700; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.score-btn:hover { border-color: var(--primary); color: var(--primary); transform: scale(1.08); }
.score-btn.active.high { background: var(--primary); border-color: var(--primary); color: #fff; }
.score-btn.active.mid { background: var(--primary); border-color: var(--primary); color: #fff; opacity: 0.75; }
.score-btn.active.low { background: var(--primary); border-color: var(--primary); color: #fff; opacity: 0.5; }

/* ─── AI GENERATION UI ───────────────────────────────────── */
.generate-ai-card {
    display: flex; flex-direction: column; gap: 16px; padding: 28px 32px; margin-bottom: 24px;
    background: #ffffff;
    border: 1px solid var(--border-light); border-radius: 16px;
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
}
.generate-ai-icon { display: none; }
.generate-ai-header { display: flex; gap: 16px; align-items: flex-start; }
.generate-ai-header h3 { margin: 0 0 4px; color: var(--text-primary); font-size: 16px; }
.generate-ai-header p { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.generate-ai-body h3 { margin: 0 0 4px; color: var(--text-primary); font-size: 16px; }
.generate-ai-body p { margin: 0 0 16px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.generate-ai-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.generate-hint { margin: 6px 0 0; font-size: 12px; color: var(--text-secondary); width: 100%; }
.generate-hint a { color: var(--accent, #E8833A); text-decoration: underline; font-weight: 600; }

.btn-ai-generate {
    padding: 12px 28px; font-size: 14px; font-weight: 600; cursor: pointer;
    background: var(--primary); color: #fff;
    border: none; border-radius: 50px; transition: all 0.25s ease;
    font-family: inherit; display: inline-flex; align-items: center; gap: 8px;
}
.btn-ai-generate:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(249,114,22,0.3); background: var(--primary-dark); }
.btn-ai-generate:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.generation-progress {
    display: flex; align-items: center; gap: 12px; margin-top: 16px;
    padding: 12px 16px; background: var(--surface); border-radius: 8px;
}
.generation-spinner {
    width: 20px; height: 20px; border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.generation-status { color: var(--text-secondary); font-size: 14px; }

/* ─── CONTEXT BRIEF CARD ────────────────────────────────── */
.context-brief-card {
    border-left: 4px solid var(--primary);
    background: var(--surface);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
}
.context-brief-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.context-brief-header h4 {
    font-size: 15px; font-weight: 700; color: var(--text-primary); margin: 0;
}
.context-brief-score {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    background: var(--gray-6); padding: 4px 12px; border-radius: 50px;
}
.context-brief-progress {
    height: 6px; background: var(--gray-6); border-radius: 3px;
    margin-bottom: 20px; overflow: hidden;
}
.context-brief-bar {
    height: 100%; border-radius: 3px;
    background: var(--primary);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.context-brief-fields {
    display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px;
}
.context-field {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 13px; line-height: 1.5; padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
}
.context-field:last-child { border-bottom: none; }
.context-field-icon {
    flex-shrink: 0; width: 20px; text-align: center; font-size: 14px; margin-top: 1px;
}
.context-field.filled .context-field-icon { color: #F97216; }
.context-field.missing .context-field-icon { color: var(--text-muted); opacity: 0.4; }
.context-field-label {
    width: 140px; flex-shrink: 0; font-weight: 600; color: var(--text-secondary);
}
.context-field-value {
    flex: 1; color: var(--text-primary);
}
.context-field.missing .context-field-value {
    color: var(--text-muted); font-style: italic;
}
.context-brief-actions {
    display: flex; gap: 10px; margin-top: 4px;
}
.btn-enrich {
    padding: 9px 20px; font-size: 13px; font-weight: 600;
    background: var(--primary); color: #fff; border: none;
    border-radius: 8px; cursor: pointer; transition: all 0.2s ease;
    font-family: inherit;
}
.btn-enrich:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-enrich:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-enrich.secondary {
    background: transparent; color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-enrich.secondary:hover {
    border-color: var(--primary); color: var(--primary); background: var(--gray-6);
}
.context-brief-hint {
    font-size: 12px; color: var(--text-muted); margin-top: 12px; line-height: 1.5;
}

/* ─── ENRICHMENT REVIEW ─────────────────────────────────── */
.enrichment-review-card {
    border-left: 4px solid var(--primary);
    background: var(--surface);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 20px;
    border: 1px solid var(--border-light);
    border-left: 4px solid var(--primary);
}
.enrichment-review-card h4 {
    font-size: 15px; font-weight: 700; color: var(--text-primary); margin: 0 0 20px 0;
}
.enrichment-suggestions {
    display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px;
}
.enrichment-suggestion {
    background: var(--card-bg); border: 1px solid var(--border-light);
    border-radius: 10px; padding: 16px; transition: border-color 0.2s ease;
}
.enrichment-suggestion.accepted { border-color: #F97216; background: rgba(249,114,22,0.04); }
.enrichment-suggestion.rejected { border-color: var(--border-light); opacity: 0.5; }
.enrichment-suggestion-header {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.enrichment-suggestion-label {
    font-size: 13px; font-weight: 600; color: var(--text-secondary);
}
.enrichment-suggestion-actions { display: flex; gap: 6px; }
.enrich-accept, .enrich-reject {
    padding: 4px 12px; font-size: 11px; font-weight: 600;
    border-radius: 6px; cursor: pointer; transition: all 0.2s ease;
    border: 1px solid var(--border); background: transparent;
    color: var(--text-muted); font-family: inherit;
}
.enrich-accept:hover { border-color: #F97216; color: #F97216; }
.enrich-reject:hover { border-color: #ef4444; color: #ef4444; }
.enrich-accept.active {
    background: #F97216; color: #fff; border-color: #F97216;
}
.enrich-reject.active {
    background: #ef4444; color: #fff; border-color: #ef4444;
}
.enrichment-suggestion textarea {
    width: 100%; min-height: 60px; padding: 10px 12px; font-size: 13px;
    font-family: inherit; line-height: 1.5; color: var(--text-primary);
    background: var(--surface); border: 1px solid var(--border-light);
    border-radius: 8px; resize: vertical; box-sizing: border-box;
}
.enrichment-suggestion textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249,114,22,0.1);
}
.enrichment-review-actions {
    display: flex; gap: 10px;
}

.template-section-num {
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    background: var(--primary); color: #fff; display: flex; align-items: center;
    justify-content: center; font-size: 12px; font-weight: 700;
}
.template-section-card {
    display: flex; gap: 12px; padding: 16px; margin-bottom: 8px;
    background: var(--surface); border-radius: 10px; border: 1px solid var(--border-light);
}
.template-section-info { flex: 1; }
.template-section-title { font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.template-section-prompt { color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; }
.template-section-deliverable { color: var(--text-muted); font-size: 12px; }
.template-section-type { margin-top: 4px; font-size: 11px; color: var(--primary); }
.template-section-type code { background: rgba(249,114,22,0.1); padding: 2px 6px; border-radius: 4px; }

/* ─── CLIPBOARD MODAL ────────────────────────────────────── */
.modal-lg { max-width: 800px; width: 95%; max-height: 85vh; overflow-y: auto; }
.clipboard-tabs { display: flex; gap: 0; margin-bottom: 16px; }
.clipboard-tab {
    padding: 10px 20px; border: none; background: var(--surface); cursor: pointer;
    font-size: 14px; font-weight: 500; color: var(--text-secondary); transition: all 0.2s;
    border-bottom: 2px solid transparent;
}
.clipboard-tab:first-child { border-radius: 8px 0 0 0; }
.clipboard-tab:last-child { border-radius: 0 8px 0 0; }
.clipboard-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: rgba(249,114,22,0.05); }
.clipboard-panel { display: none; }
.clipboard-panel.active { display: block; }
.clipboard-instruction { margin: 0 0 12px; color: var(--text-secondary); font-size: 14px; }
.clipboard-prompt-area {
    max-height: 300px; overflow-y: auto; padding: 16px; background: #1e1e2e; color: #cdd6f4;
    border-radius: 8px; margin-bottom: 12px; font-family: monospace; font-size: 12px;
    white-space: pre-wrap; word-break: break-word;
}
.clipboard-response-area {
    width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: 8px;
    font-family: monospace; font-size: 12px; resize: vertical;
    background: var(--surface); color: var(--text-primary);
}
.clipboard-tip { margin-top: 8px; font-size: 13px; color: var(--primary); }

/* ─── EXPORT PDF DROPDOWN + DELETE BUTTONS ───────────────── */
.pdf-dropdown {
    position: relative;
    display: inline-block;
}
.btn-export-pdf {
    padding: 7px 18px; font-size: 12px; font-weight: 500;
    border: 1px solid var(--border); color: var(--text-muted);
    background: transparent; border-radius: 50px; cursor: pointer; transition: all 0.25s ease;
    font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn-export-pdf:hover { border-color: var(--primary); color: var(--primary); background: var(--gray-6); }
.pdf-dropdown-arrow { font-size: 9px; margin-left: 2px; opacity: 0.6; }
.pdf-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 9999;
    min-width: 180px;
    padding: 4px;
    animation: fadeSlideDown 0.12s ease;
    -webkit-overflow-scrolling: touch;
}
.pdf-dropdown-menu.open { display: block; }
.pdf-dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pdf-dropdown-menu button:hover,
.pdf-dropdown-menu button:active {
    background: var(--gray-6);
    color: var(--primary);
}
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.btn-delete-solution {
    padding: 7px 18px; font-size: 12px; font-weight: 500;
    border: 1px solid var(--border); color: var(--text-muted);
    background: transparent; border-radius: 50px; cursor: pointer; transition: all 0.25s ease;
    font-family: inherit; display: inline-flex; align-items: center; gap: 6px;
}
.btn-delete-solution:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }
.detail-hero-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.detail-hero-top-actions { display: flex; gap: 8px; align-items: center; }

/* ─── STAGE HEADER ACTIONS ───────────────────────────────── */
.stage-header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.stage-header-bar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; gap: 16px; }

/* ─── ADMIN TEMPLATE EDITING ─────────────────────────────── */
.admin-template-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.admin-template-section-actions { display: flex; gap: 6px; }

/* ─── ADMIN AI SETTINGS ──────────────────────────────────── */
.admin-ai-card { padding: 20px; background: var(--surface); border-radius: 12px; border: 1px solid var(--border-light); }
.admin-ai-card h4 { margin: 0 0 8px; color: var(--text-primary); }
.admin-ai-key-status { display: flex; align-items: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.admin-ai-key-label { font-weight: 500; color: var(--text-secondary); font-size: 13px; }
.admin-ai-key-value { padding: 4px 10px; background: var(--bg-secondary); border-radius: 6px; font-size: 13px; }
.admin-ai-key-badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.admin-ai-key-badge.active { background: rgba(249, 114, 22, 0.1); color: var(--primary); }
.admin-ai-key-badge.inactive { background: rgba(239, 68, 68, 0.1); color: var(--red); }
.admin-ai-input-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.admin-ai-key-input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--surface); color: var(--text-primary); }
.admin-ai-model-select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--surface); color: var(--text-primary); min-width: 250px; }
.admin-ai-flow { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.admin-ai-flow-step { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--bg-secondary); border-radius: 8px; font-size: 13px; }
.admin-ai-flow-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }

/* Usage dashboard */
.usage-stat-card { padding: 14px; background: var(--bg-secondary); border-radius: 10px; text-align: center; }
.usage-stat-value { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.usage-stat-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.usage-table th { padding: 8px 12px; font-weight: 600; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--border-light); }
.usage-table th:first-child { text-align: left; width: 40%; }
.usage-table th:not(:first-child) { text-align: right; }
.usage-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.usage-table td:first-child { text-align: left; }
.usage-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.usage-table tr:last-child td { border-bottom: none; }
.usage-table tbody tr:hover { background: var(--bg-secondary); }

/* ─── EVALUATE OVERVIEW ──────────────────────────────────────── */
/* Remove extra bottom margin on last card-grid inside evaluate blocks */
.eval-overview-block .card-grid:last-child,
.eval-competitive-block .card-grid:last-child { margin-bottom: 0; }
.eval-overview-block .card-grid:last-child .sleek-card,
.eval-competitive-block > .sleek-card:last-child { margin-bottom: 0; }
/* Competitive block: standalone sleek-cards with margin-top inline need no extra bottom */
.eval-competitive-block > .sleek-card { margin-bottom: 0; }

.eval-identity-strip {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 0;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
    padding-bottom: 16px;
}
.eval-identity-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.eval-identity-codename {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-secondary, #f5f5f7);
    padding: 2px 10px;
    border-radius: 6px;
}
.eval-identity-meta {
    display: flex;
    gap: 8px;
    margin-left: auto;
}
.eval-pill {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary, #f1f5f9);
    padding: 3px 12px;
    border-radius: 20px;
}
.eval-field-row {
    display: flex;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}
.eval-field-row:last-child { border-bottom: none; }
.eval-field-label {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 100px;
    flex-shrink: 0;
    padding-top: 3px;
}

/* Admin: per-solution table */
.admin-table {
    border-collapse: collapse;
}
.admin-table th {
    text-align: left;
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.admin-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}
.admin-table tr:last-child td {
    border-bottom: none;
}

/* ─── AI Engine Tab ─────────────────────────────────────────── */

.aiengine-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    min-height: 400px;
}

.aiengine-stage-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 12px;
    padding: 8px;
    background: var(--bg-secondary, #F5F5F7);
    max-height: 600px;
    overflow-y: auto;
}

.aiengine-stage-card {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
}
.aiengine-stage-card:hover { background: #fff; }
.aiengine-stage-card.active {
    background: #fff;
    border-color: #F97216;
    box-shadow: 0 2px 8px rgba(249,114,22,0.1);
}

.aiengine-stage-icon { font-size: 18px; flex-shrink: 0; }
.aiengine-stage-info { flex: 1; min-width: 0; }
.aiengine-stage-name { font-size: 13px; font-weight: 600; color: #1D1D1F; }
.aiengine-stage-meta {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: #8E8E93; margin-top: 2px;
    flex-wrap: wrap;
}

.aiengine-stage-config {
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 12px;
    padding: 20px;
    background: #fff;
}

.aiengine-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.aiengine-task-list { display: flex; flex-direction: column; gap: 6px; }

.aiengine-task-row {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: var(--bg-secondary, #F5F5F7);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.aiengine-task-row:hover { border-color: var(--border, #d1d5db); background: #fff; }
.aiengine-task-row[draggable="true"] { cursor: grab; }

.aiengine-task-info { flex: 1; min-width: 0; }

.admin-item-handle {
    color: #C7C7CC;
    font-size: 14px;
    letter-spacing: -3px;
    cursor: grab;
    flex-shrink: 0;
    user-select: none;
}

.aiengine-empty {
    padding: 32px; text-align: center; color: #8E8E93;
    border: 2px dashed var(--border-light, #e5e7eb); border-radius: 12px;
}

.aiengine-var-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.aiengine-var-chip {
    font-size: 11px; font-weight: 500;
    padding: 3px 10px; border-radius: 4px;
    background: #FFF7ED; color: #F97216;
    border: 1px solid rgba(249,114,22,0.15);
    cursor: pointer; transition: all 0.15s;
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
}
.aiengine-var-chip:hover {
    background: #F97216; color: #fff;
    transform: translateY(-1px);
}

.aiengine-stage-summary {
    padding: 12px 16px;
    background: var(--bg-secondary, #F5F5F7);
    border-radius: 8px;
    font-size: 13px;
}
.aiengine-sync-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    margin-bottom: 16px;
    background: #FFF7ED;
    border: 1px solid #FDBA74;
    border-radius: 10px;
    font-size: 13px;
    color: #9A3412;
}

/* ─── Generate AI Tasks button ──────────────────────────── */
.btn-accent {
    border: none;
    background: var(--primary, #F97216);
    color: #fff;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.btn-accent:hover { background: var(--primary-dark, #EA580C); }
.btn-accent:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Spinner for generate button */
.spinner-sm {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin-sm 0.6s linear infinite;
}
@keyframes spin-sm {
    to { transform: rotate(360deg); }
}

/* ─── Generate Review Modal ────────────────────────────── */
.gen-task-card:hover {
    border-color: var(--primary, #F97216) !important;
}

/* Hide sync indicator in print */
@media print {
    .sync-status-indicator { display: none !important; }
}
