/* =====================================================================
   社内ナレッジ画面（docs.html、案B Phase 2 / PR12）
   ---------------------------------------------------------------------
   社内マニュアル・規程を登録し、AI の検索対象に載せる画面。

   クラス名前空間は dc- で統一する（検査 [20]。他画面の名前空間
   rq-（requests）/ ag-（agents）/ be-（bulk-extract）/ kn-（settings）/
   conn-（admin）を再定義しないこと）。

   共通側にあるものは再定義しない:
     .panel / .btn-primary / .btn-small / .hidden
     .glass-overlay / .glass-dialog / .glass-dialog-head / -title /
     -close / -body / -foot（モーダルの器はすべて components.css）
   ===================================================================== */

/* 対象組織の選択バー。共通 CSS には無く、agents / dashboard / bulk-extract /
   requests がそれぞれ同じ定義を持っている（既存の慣習に合わせる）。 */
.org-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.org-bar label { margin: 0; font-size: 12.5px; white-space: nowrap; }
.org-bar select { width: auto; min-width: 220px; padding: 8px 12px; }

.dc-main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 24px 48px;
}

/* ── 案内パネル（組織なし・機能無効）── */
.dc-empty-panel {
    text-align: center;
    padding: 48px 24px;
}

.dc-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
}

.dc-empty-text {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ── セクション ── */
.dc-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 10px;
}

.dc-upload,
.dc-trial,
.dc-list-panel {
    padding: 20px 22px;
    margin-bottom: 18px;
}

.dc-upload-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.dc-used {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--text-muted);
}

/* ── フォーム ── */
.dc-upload-grid {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 14px 16px;
    align-items: start;
    margin-top: 12px;
}

.dc-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    padding-top: 8px;
}

.dc-field { min-width: 0; }

.dc-select,
.dc-input,
.dc-file {
    padding: 7px 10px;
    font-size: 13px;
    color: #fff;
    background: var(--bg-light);
    border: 1px solid var(--panel-border-light);
    border-radius: 6px;
    font-family: inherit;
}

.dc-input { display: block; width: 100%; }
.dc-file  { display: block; width: 100%; }
.dc-block { display: block; width: 100%; }
.dc-grow  { flex: 1; min-width: 0; }

.dc-select:focus,
.dc-input:focus,
.dc-file:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.dc-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-top: 6px;
}

/* 受理形式の案内は種別ごとに 1 行ずつ出す。textContent へ \n を入れるので
   （動的な文字列を innerHTML へ渡さないため）改行を活かす指定が要る。 */
.dc-hint-lines { white-space: pre-line; }

.dc-upload-foot {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--panel-border-light);
}

.dc-cost-note {
    flex: 1;
    min-width: 240px;
    font-size: 12px;
    line-height: 1.8;
    color: var(--text-muted);
}

.dc-cost-note strong { color: #fff; font-weight: 600; }

.dc-progress {
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--text-muted);
}

/* ── 検索を試す ── */
.dc-trial-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.dc-results { margin-top: 12px; }

.dc-result {
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--bg-light);
    border: 1px solid var(--panel-border-light);
    border-radius: 8px;
}

.dc-result-cite {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
}

.dc-result-score {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.dc-result-text {
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.dc-no-hit {
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--text-muted);
}

/* ── 一覧 ── */
.dc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dc-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-light);
    border: 1px solid var(--panel-border-light);
    border-radius: 8px;
    flex-wrap: wrap;
}

.dc-card-main { flex: 1; min-width: 200px; }

.dc-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    word-break: break-word;
}

.dc-card-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.7;
}

.dc-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
}

/* 状態の色。記号（JS 側の STATUS_MARKS）と併用し、色だけに頼らない */
.dc-badge-ready   { color: #7ee2b8; background: rgba(126, 226, 184, 0.14); }
.dc-badge-working { color: #ffd479; background: rgba(255, 212, 121, 0.14); }
.dc-badge-wait    { color: #9ec5ff; background: rgba(158, 197, 255, 0.14); }
.dc-badge-error   { color: #ff9f9f; background: rgba(255, 159, 159, 0.14); }

.dc-badge-scope {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.07);
}

.dc-card-error {
    width: 100%;
    font-size: 11.5px;
    line-height: 1.7;
    color: #ff9f9f;
}

/* ── モーダル ── */
.dc-dialog {
    width: min(560px, 92vw);
    max-height: 88vh;
}

.dc-dialog-spacer { flex: 1; }

.dc-est-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    line-height: 1.6;
    word-break: break-word;
}

.dc-est-facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 14px 0;
    font-size: 12.5px;
}

.dc-est-facts dt { color: var(--text-muted); }
.dc-est-facts dd { margin: 0; color: var(--text); }

.dc-est-reason {
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--text-muted);
}

/* 費用は一番目立たせる。ここが承認の判断材料になる */
.dc-est-cost {
    margin-top: 14px;
    padding: 12px 14px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.7;
    color: #fff;
    background: var(--bg-light);
    border: 1px solid var(--panel-border-light);
    border-radius: 8px;
}

.dc-danger {
    background: #b4443f;
    border-color: #b4443f;
}

@media (max-width: 720px) {
    .dc-upload-grid { grid-template-columns: 1fr; gap: 6px; }
    .dc-label { padding-top: 10px; }
}
