* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans KR", sans-serif;
    background: #f6f7f9;
    color: #1a1a1a;
    line-height: 1.7;
}
.container { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
.back-link { display: inline-block; margin-bottom: 16px; color: #556; text-decoration: none; font-size: 14px; }
.back-link:hover { color: #223; }

.wiki-head { margin-bottom: 20px; }
.wiki-title-row { display: flex; align-items: center; gap: 12px; }
.wiki-title-row h1 { margin: 0; font-size: 26px; }
.wiki-title-row .ticker { font-size: 15px; color: #7a828c; font-weight: 500; }
.wiki-meta { margin-top: 8px; font-size: 13px; color: #8a919b; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.status-badge { font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.status-ready { background: #e7f6ec; color: #1a7f42; }
.status-running, .status-pending { background: #fdf3e2; color: #b5761a; }
.status-failed { background: #fde8e8; color: #c0392b; }
.sector-badge { font-size: 12px; padding: 2px 9px; border-radius: 6px; background: #eef1f5; color: #556; }
.error-note { margin-top: 10px; padding: 10px 12px; background: #fde8e8; color: #a5281b; border-radius: 8px; font-size: 13px; }

.wiki-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 860px) { .wiki-layout { grid-template-columns: 1fr; } }

.wiki-main { min-width: 0; }
.wiki-body {
    background: #fff; border: 1px solid #e6e8eb; border-radius: 12px; padding: 24px 28px;
    overflow-wrap: break-word;
}
.wiki-body h1, .wiki-body h2, .wiki-body h3 { line-height: 1.35; }
.wiki-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 14px; }
.wiki-body th, .wiki-body td { border: 1px solid #e0e3e7; padding: 6px 10px; text-align: left; }
.wiki-body th { background: #f2f4f6; }
.wiki-body code { background: #f0f2f4; padding: 1px 5px; border-radius: 4px; font-size: 90%; }
.wiki-body pre { background: #f0f2f4; padding: 12px; border-radius: 8px; overflow-x: auto; }
.muted { color: #99a; }

.revisions { margin-top: 28px; }
.revisions h2 { font-size: 18px; }
.revision-timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid #e2e5e9; }
.revision-item { position: relative; padding: 0 0 18px 18px; }
.revision-item::before { content: ""; position: absolute; left: -7px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #b6bdc6; }
.revision-when { font-size: 13px; color: #667; font-weight: 600; }
.changelog { margin: 6px 0 0; padding-left: 4px; list-style: none; font-size: 13px; }
.changelog li { margin: 3px 0; color: #445; }
.cl-type { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 5px; margin-right: 6px; background: #eef1f5; color: #667; }
.cl-added { background: #e7f6ec; color: #1a7f42; }
.cl-updated { background: #eaf1fb; color: #2b5ea8; }

.wiki-side section { background: #fff; border: 1px solid #e6e8eb; border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.wiki-side h2 { font-size: 15px; margin: 0 0 12px; }
.field-label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; color: #445; }
.upload-form input[type=file], .memo-form textarea {
    width: 100%; font-size: 13px; padding: 8px; border: 1px solid #d7dbe0; border-radius: 8px; font-family: inherit;
}
.memo-form textarea { resize: vertical; }
.btn {
    margin-top: 8px; width: 100%; padding: 8px 12px; border: none; border-radius: 8px;
    background: #1f2937; color: #fff; font-size: 13px; cursor: pointer;
}
.btn:hover { background: #111827; }
.btn:disabled { opacity: .5; cursor: default; }
.field-hint { font-size: 11px; color: #99a; margin: 6px 0 0; }
.add-status { font-size: 12px; margin: 10px 0 0; color: #2a7f42; min-height: 16px; }
.add-status.error { color: #c0392b; }

.source-list { list-style: none; padding: 0; margin: 0; }
.source-item { padding: 8px 0; border-bottom: 1px solid #eef0f2; font-size: 13px; }
.source-item:last-child { border-bottom: none; }
.source-kind { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 5px; background: #eef1f5; color: #667; margin-right: 6px; }
.source-crawled_report .source-kind { background: #eaf1fb; color: #2b5ea8; }
.source-uploaded_file .source-kind { background: #f3eafb; color: #6b3ea8; }
.source-user_memo .source-kind { background: #fdf3e2; color: #b5761a; }
.source-label { color: #223; text-decoration: none; }
a.source-label:hover { text-decoration: underline; }
.src-flag { font-size: 10px; color: #c0392b; margin-left: 6px; }
.src-flag.pending { color: #b5761a; }
.memo-text { margin-top: 6px; padding: 6px 8px; background: #fbfaf6; border-radius: 6px; font-size: 12px; color: #556; white-space: pre-wrap; }
.count { color: #99a; font-weight: 400; }

/* 종목 뉴스 */
.source-news .source-kind { background: #e7f6ee; color: #1f8b52; }
.news-refresh { margin-top: 14px; padding-top: 14px; border-top: 1px solid #eef0f2; }
.excluded-news { margin-top: 20px; }
.excluded-news h2 { color: #99a; }
.excluded-news .source-item.excluded { opacity: .7; }
.excluded-news .source-item.excluded .source-label { color: #667; }
