/* MindForge's dashboard: /mindforge (groups), /mindforge/{group} (its AI), /mindforge/{group}/{key} (one AI's
   instructions, model and versions). Classes start with mf-. */

.mf-parents {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.mf-parent-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
}

.mf-parent-head { display: flex; align-items: center; gap: 10px; }
.mf-parent-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: none;
    border-radius: 10px; background: #f1effd; color: #6b5fe6; font-size: 17px;
}
.mf-parent-name { margin: 0; font-size: 18px; font-weight: 700; }
.mf-parent-name a { color: #1f2330; text-decoration: none; }
.mf-parent-name a:hover { color: #6b5fe6; }
.mf-parent-desc { margin: 0; color: #4b5563; font-size: 14px; line-height: 1.5; flex: 1; }
.mf-parent-facts, .mf-item-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.mf-open { align-self: flex-start; font-size: 14px; font-weight: 600; color: #6b5fe6; text-decoration: none; }
.mf-open:hover { text-decoration: underline; }

.mf-fact {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 9px; border-radius: 999px;
    background: #f3f4f6; color: #374151; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.mf-fact.mf-on { background: #dcfce7; color: #166534; }
.mf-fact.mf-off { background: #fee2e2; color: #991b1b; }
.mf-fact.mf-model { background: #ede9fe; color: #5b21b6; }
.mf-fact.mf-lock { background: #fffbeb; color: #92400e; }

.mf-error, .mf-saved {
    display: flex; gap: 8px; align-items: flex-start;
    margin: 10px 0 14px; padding: 10px 14px; border-radius: 10px; font-size: 14px;
}
.mf-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.mf-saved { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.mf-loading { display: flex; gap: 8px; align-items: center; color: #6b7280; padding: 16px 0; }

/* A group's page and one AI's page */
.mf-page { padding: 24px 32px; width: 100%; box-sizing: border-box; }
.mf-back { display: inline-flex; gap: 6px; align-items: center; color: #6b5fe6; font-size: 14px; text-decoration: none; margin-bottom: 14px; }
.mf-title-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.mf-title { margin: 0; font-size: 24px; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mf-subtitle { margin: 4px 0 0; color: #4b5563; font-size: 14px; line-height: 1.5; }
.mf-kind { display: inline-block; padding: 2px 8px; border-radius: 6px; background: #eef2ff; color: #4338ca; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.mf-item-where { color: #6b7280; font-size: 13px; margin: 6px 0 0; }
.mf-item-where a { color: #6b5fe6; }
.mf-empty { padding: 30px 0; }

.mf-items { display: flex; flex-direction: column; gap: 10px; }
.mf-item-row {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 16px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px;
    color: inherit; text-decoration: none;
}
.mf-item-row:hover { border-color: #c4b5fd; box-shadow: 0 2px 8px rgba(107, 95, 230, .08); }
.mf-item-main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.mf-item-name { font-weight: 700; font-size: 16px; color: #1f2330; }
.mf-item-main .mf-kind { align-self: flex-start; }
.mf-item-desc { color: #4b5563; font-size: 13px; line-height: 1.45; }
.mf-item-facts { justify-content: flex-end; max-width: 46%; }
.mf-chevron { color: #9ca3af; }

.mf-two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.mf-column { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.mf-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; }
.mf-card-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: #eef0f3; font-weight: 700; font-size: 14px; flex-wrap: wrap; }
.mf-card-header .mf-version { margin-left: auto; font-weight: 500; color: #6b7280; font-size: 12px; }
.mf-card-body { padding: 14px 16px; font-size: 14px; line-height: 1.5; }
.mf-card-body p { margin: 0 0 8px; }

.mf-instructions, .mf-version-text pre {
    margin: 0; white-space: pre-wrap; word-break: break-word;
    font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
    background: #f9fafb; border: 1px solid #eef0f3; border-radius: 8px; padding: 12px;
    max-height: 560px; overflow: auto;
}
.mf-editor {
    width: 100%; box-sizing: border-box; resize: vertical;
    font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
    border: 1px solid #d1d5db; border-radius: 8px; padding: 10px;
}
.mf-editor:focus, .mf-note:focus, .mf-field select:focus { outline: 2px solid #c4b5fd; border-color: #6b5fe6; }
.mf-editor-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.mf-note { flex: 1; min-width: 180px; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.mf-editor-hints { justify-content: space-between; }
.mf-hint { color: #6b7280; font-size: 12.5px; }
.mf-label { display: inline-block; min-width: 150px; color: #6b7280; font-size: 13px; }

.mf-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px; border: 1px solid #6b5fe6;
    background: #fff; color: #6b5fe6; font-weight: 600; font-size: 14px; cursor: pointer;
}
.mf-btn:hover:not(:disabled) { background: #f5f3ff; }
.mf-btn-primary { background: #6b5fe6; color: #fff; }
.mf-btn-primary:hover:not(:disabled) { background: #5a4fd4; }
.mf-btn:disabled { opacity: .5; cursor: default; }
.mf-link { background: none; border: none; padding: 0; color: #6b5fe6; font-size: 13px; font-weight: 600; cursor: pointer; }
.mf-link:hover:not(:disabled) { text-decoration: underline; }
.mf-link:disabled { opacity: .5; cursor: default; }

.mf-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.mf-field label { font-size: 13px; font-weight: 600; color: #374151; }
.mf-field select { border: 1px solid #d1d5db; border-radius: 8px; padding: 7px 10px; font-size: 14px; }
.mf-check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; font-size: 14px; }

.mf-versions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.mf-version-row { padding: 10px 12px; border: 1px solid #eef0f3; border-radius: 10px; }
.mf-version-row.in-use { border-color: #bbf7d0; background: #f0fdf4; }
.mf-version-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mf-version-text summary { cursor: pointer; color: #6b5fe6; font-size: 13px; margin: 6px 0; }
.mf-version-text pre { max-height: 300px; }

/* Phase 2: a newer shipped default, testing on samples, comparing versions, use and cost */
.mf-fact.mf-newer { background: #fef3c7; color: #92400e; }
.mf-fact.mf-use-all { background: #e0f2fe; color: #075985; }

.mf-newer-default {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin: 0 0 16px; padding: 10px 14px; border-radius: 10px;
    background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 14px;
}
.mf-newer-default > span:first-of-type { flex: 1; min-width: 200px; }
.mf-newer-actions, .mf-hint-actions, .mf-version-actions { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.mf-version-actions { margin-top: 2px; }

.mf-sample-desc { margin: -4px 0 8px; }
.mf-sample-input summary { cursor: pointer; color: #6b5fe6; font-size: 13px; margin: 2px 0 6px; }
.mf-sample-input pre, .mf-test-answer {
    margin: 0; white-space: pre-wrap; word-break: break-word;
    font: 12.5px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
    background: #f9fafb; border: 1px solid #eef0f3; border-radius: 8px; padding: 10px;
    max-height: 360px; overflow: auto;
}
.mf-sample-image { display: block; max-width: 100%; height: auto; margin-bottom: 8px; border: 1px solid #eef0f3; border-radius: 8px; }
.mf-test-results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; }
.mf-test-results.mf-test-two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mf-test-result { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mf-test-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mf-test-meta { line-height: 1.4; }
.mf-test-result .mf-error { margin: 0; }

.mf-usage { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mf-usage th, .mf-usage td { padding: 6px 8px; text-align: left; border-bottom: 1px solid #f1f2f4; }
.mf-usage thead th { color: #6b7280; font-weight: 600; font-size: 12.5px; }
.mf-usage tbody th { color: #374151; font-weight: 600; white-space: nowrap; }
.mf-usage tr:last-child th, .mf-usage tr:last-child td { border-bottom: none; }

.mf-compare-box { max-width: 900px; }
.mf-compare-title { margin: 0 32px 10px 0; font-size: 20px; display: flex; gap: 10px; align-items: center; }
.mf-compare-legend { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.mf-compare-summary { margin-left: auto; }
.mf-diff-key { padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.mf-diff {
    border: 1px solid #eef0f3; border-radius: 8px; max-height: 60vh; overflow: auto;
    font: 12.5px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}
.mf-diff > .mf-hint { padding: 10px; margin: 0; }
.mf-diff-line { padding: 1px 10px 1px 28px; white-space: pre-wrap; word-break: break-word; position: relative; min-height: 1.55em; }
.mf-diff-sign { position: absolute; left: 10px; color: #9ca3af; }
.mf-diff-removed { background: #fef2f2; color: #991b1b; }
.mf-diff-removed .mf-diff-sign { color: #dc2626; }
.mf-diff-added { background: #f0fdf4; color: #166534; }
.mf-diff-added .mf-diff-sign { color: #16a34a; }
.mf-diff-skipped { background: #f9fafb; color: #6b7280; font-style: italic; padding-left: 10px; }

@media (max-width: 900px) {
    .mf-page { padding: 20px 16px; }
    .mf-two { grid-template-columns: minmax(0, 1fr); }
    .mf-item-row { flex-wrap: wrap; }
    .mf-item-facts { max-width: none; justify-content: flex-start; }
    .mf-chevron { display: none; }
    .mf-test-results.mf-test-two { grid-template-columns: minmax(0, 1fr); }
    .mf-compare-box { padding: 24px 16px; }
    .mf-label { min-width: 0; }
}
.mf-compare-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.mf-compare-overlay:focus { outline: none; }
