/* ============================================================
   06.09 — SESSİZ EDİTORYAL (tasarım tuvali "Öneri 1/2 + 2/2")
   Sohbet sayfası: yazma kartı, karşılama, hairline rapor arşivi,
   "Bu sohbet" sağ paneli. tokens/chat.css'ten SONRA yüklenir.
   ============================================================ */

/* ---- Sayfa akışı: sohbet sütunu + sağ panel ---- */
.chat-area { overflow: hidden; }
.chat-shell { display: flex; height: 100%; min-height: 0; }
.chat-column { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; position: relative; }
.chat-column > .chat-messages { flex: 0 0 auto; overflow: visible; min-height: calc(100vh - 300px); }

/* ---- Süren sohbet başlığı ---- */
.chat-header { position: sticky; top: 0; z-index: 5; height: 52px; flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 0 28px; border-bottom: 1px solid var(--border); background: var(--bg-primary); }
.chat-header[hidden] { display: none; }
/* Ö5: başka sohbetteki cevap için engellemeyen şerit (otomatik geçiş yok). Dar ekranda sarılır. */
.is-seridi { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 10px 28px 0; padding: 8px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--bg-secondary); font-size: 13px; color: var(--text-primary); }
.is-seridi-metin { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.is-seridi-ac { padding: 4px 12px; border: 1px solid var(--accent); border-radius: 6px; background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.is-seridi-kapat { padding: 2px 8px; border: none; background: none; color: var(--text-secondary); font-size: 16px; line-height: 1; cursor: pointer; }
.chat-header-title { font-family: var(--font-serif); font-size: 16px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48%; }
.chat-header-tags { display: flex; gap: 6px; }
.chat-header-meta { margin-left: auto; font-size: 12px; color: var(--text-secondary); white-space: nowrap; }

/* ---- Karşılama ---- */
.chat-messages { padding: 32px 28px 16px; }
.welcome-message { max-width: 720px; width: 100%; align-items: flex-start; text-align: left; gap: 10px; margin-top: auto; margin-bottom: auto; }
.welcome-message h1 { font-size: 34px; font-weight: 400; line-height: 1.2; }
.welcome-message > p { font-size: 14px; max-width: 620px; margin: 0; }
.welcome-suggestions { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; }
.welcome-suggestions a { font-size: 13px; color: var(--text-secondary); text-decoration: none; border-bottom: 1px solid var(--border); padding-bottom: 1px; }
.welcome-suggestions a:hover { color: var(--text-primary); border-bottom-color: var(--text-secondary); }
.example-questions { display: none; }

/* ---- Mesajlar: balon yok, avatar yok ---- */
.message { max-width: 720px; width: 100%; margin: 0 auto; gap: 0; }
.message-avatar { display: none; }
.message.user { justify-content: flex-end; }
.message.user .message-content { max-width: 560px; background: var(--user-bubble); border: none; border-radius: 10px; padding: 10px 14px; }
.message.assistant .message-content { background: transparent; border: none; padding: 4px 0; font-size: 14.5px; line-height: 1.65; max-width: 680px; }
.message-content h3 { font-family: var(--font-serif); font-size: 20px; font-weight: 500; border-bottom: none; margin: 14px 0 6px; padding: 0; }
.message-content .cite-link { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-primary); font-size: 12px; font-weight: 500; line-height: 1.6; text-decoration: none; }
.message-timestamp { font-size: 11px; }
.msg-tool-tag { color: var(--gold-text); }
.system-message { max-width: 720px; margin: 0 auto; }
.thinking-state { max-width: 720px; margin: 0 auto; width: 100%; background: transparent; border: none; padding: 4px 0; }

/* ---- Yazma kartı ---- */
.input-area { padding: 12px 28px 8px; border-top: none; border-bottom: 1px solid var(--border); }
.doc-chips { max-width: 720px; }
#chatForm .input-wrapper {
    max-width: 720px; display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 0;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 1px 2px rgba(28,26,23,.04), 0 8px 24px rgba(28,26,23,.05);
}
#chatForm .input-wrapper:focus-within { border-color: var(--text-secondary); box-shadow: 0 1px 2px rgba(28,26,23,.04), 0 8px 24px rgba(28,26,23,.07); }
#userInput { padding: 16px 18px 8px; font-size: 15px; min-height: 44px; }
.input-tools { display: flex; align-items: center; gap: 8px; padding: 8px 10px 10px; border-top: 1px solid var(--bg-tertiary); }
.input-tools-spacer { flex: 1; }
.tool-pill {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px;
    border: 1px solid var(--border); background: transparent; color: var(--text-primary);
    font-family: var(--font-sans); font-size: 12.5px; cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: border-color .15s, background .15s, color .15s;
}
.tool-pill:hover { background: var(--bg-tertiary); }
.tool-pill.active { border-color: var(--gold); background: var(--gold-soft); color: var(--gold-text); }
.input-tools .length-selector { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 6px; color: var(--text-secondary); font-size: 12.5px; }
.input-tools .length-selector span { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.input-tools .length-selector select { border: none; background: transparent; padding: 0; font-size: 12.5px; color: var(--text-secondary); cursor: pointer; }
.input-tools .voice-btn { width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--border); }
#sendBtn, #stopBtn { width: 36px; height: 36px; border-radius: 8px; }
.tool-chip[hidden], .plus-wrap[hidden] { display: none !important; }
.disclaimer { max-width: 720px; margin: 8px auto 0; }

/* ---- Rapor arşivi: hairline liste ---- */
.research-archive { padding: 24px 28px 48px; }
.ra-inner { max-width: 720px; }
.ra-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.ra-title { font-size: 20px; font-weight: 500; }
.ra-sub { display: none; }
.ra-search-wrap { display: inline-flex; align-items: center; gap: 8px; width: 240px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-secondary); }
.ra-search { flex: 1; border: none; background: transparent; padding: 0; font-size: 13px; color: var(--text-primary); outline: none; }
.ra-list { gap: 0; }
.ra-card { background: transparent; border: none; border-bottom: 1px solid var(--border); border-radius: 0; }
.ra-card:hover, .ra-card.open { border-color: var(--border); }
.ra-card-head { padding: 14px 4px; }
.ra-card-ico { display: none; }
.ra-card-title { font-size: 14.5px; font-weight: 500; }
.ra-card-meta { font-size: 12px; }
.ra-card-chevron { color: var(--text-secondary); }
.ra-card.open { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 12px; margin: 6px 0; }
.ra-card.open .ra-card-head { padding: 14px 18px; }
.ra-detail { padding: 6px 18px 16px; }

/* ---- Bu sohbet — sağ panel ---- */
.context-panel { flex-shrink: 0; display: flex; border-left: 1px solid var(--border); background: var(--bg-primary); height: 100%; }
.cp-rail { width: 44px; display: flex; flex-direction: column; align-items: center; padding-top: 12px; gap: 6px; }
.cp-rail-btn { width: 32px; height: 32px; border-radius: 8px; border: none; background: transparent; color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cp-rail-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.cp-body { display: none; width: 320px; flex-direction: column; min-height: 0; }
.context-panel[data-open="1"] .cp-rail { display: none; }
.context-panel[data-open="1"] .cp-body { display: flex; }
.cp-tabs { height: 52px; flex-shrink: 0; display: flex; align-items: stretch; gap: 16px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.cp-kicker { align-self: center; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); }
.cp-tab { background: none; border: none; padding: 0; margin-bottom: -1px; border-bottom: 2px solid transparent; font-family: var(--font-sans); font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.cp-tab.active { color: var(--text-primary); border-bottom-color: var(--gold); font-weight: 600; }
.cp-tab-n { font-weight: 400; color: var(--text-secondary); margin-left: 3px; }
.cp-close { margin-left: auto; background: none; border: none; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; }
.cp-content { flex: 1; overflow-y: auto; padding: 6px 18px 12px; }
.cp-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 2px; border-bottom: 1px solid var(--border); }
.cp-item:last-child { border-bottom: none; }
.cp-item-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cp-item-text { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.cp-item-badge { align-self: flex-start; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-secondary); }
.cp-empty { font-size: 13px; color: var(--text-secondary); padding: 14px 2px; }
.cp-report { flex-shrink: 0; padding: 12px 18px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.cp-report[hidden] { display: none; }
.cp-report-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Başlık etiketleri ---- */
.hdr-pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: var(--text-secondary); }
.hdr-pill.research { color: var(--gold-text); border-color: rgba(200,169,106,.5); background: var(--gold-soft); }

/* ---- Dar ekranlar ---- */
@media (max-width: 1280px) { .context-panel[data-open="1"] .cp-body { width: 280px; } }
@media (max-width: 1100px) { .context-panel { display: none; } }
@media (max-width: 768px) {
    .is-seridi { margin: 8px 16px 0; }
    .chat-column > .chat-messages { min-height: calc(100dvh - 320px); }
    .chat-messages, .input-area, .research-archive { padding-left: 14px; padding-right: 14px; }
    .research-archive { padding-bottom: 90px; }
    .ra-search-wrap { width: 100%; }
    .welcome-message h1 { font-size: 26px; }
    /* Dar kutu: uzunluk seçici gizli (varsayılan Orta), pill'ler sıkı; gönder sağda kalır */
    .input-tools { gap: 6px; padding: 8px 8px 8px; }
    .input-tools .length-selector { display: none; }
    .tool-pill { height: 30px; padding: 0 9px; font-size: 12px; }
    .input-tools .voice-btn { width: 30px; height: 30px; }
    #sendBtn, #stopBtn { width: 34px; height: 34px; }
}
