/* Agent seçici (üst çubuk) */
.agent-pick { position: relative; min-width: 0; }
.agent-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(320px, 60vw);
  min-height: 44px;
  padding: 0 10px 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  transition: background-color 0.18s;
}
.agent-btn:hover, .agent-btn[aria-expanded='true'] { background: var(--hover); }
.agent-btn svg { flex: none; color: var(--ink-2); transition: transform 0.2s var(--ease); }
.agent-btn[aria-expanded='true'] svg { transform: rotate(180deg); }
.agent-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.agent-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: var(--z-menu);
  width: min(340px, calc(100vw - 24px));
  max-height: min(70vh, 520px);
  padding: 6px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  animation: pop-in 0.2s var(--ease);
}
.agent-option, .agent-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  text-align: left;
}
.agent-option:hover, .agent-action:hover, .agent-option:focus-visible, .agent-action:focus-visible { background: var(--hover); }
.agent-option-text { display: grid; flex: 1; min-width: 0; line-height: 1.35; }
.agent-option-name { font-weight: 600; }
.agent-option-detail { overflow: hidden; color: var(--ink-2); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.agent-check { display: inline-grid; flex: none; color: var(--accent); visibility: hidden; }
.agent-option[aria-checked='true'] .agent-check { visibility: visible; }
.agent-action { min-height: 44px; color: var(--ink-2); font-size: 15px; }
.agent-action svg { color: var(--accent); }
.menu-sep { margin: 6px 4px; border: 0; border-top: 1px solid var(--line); }
.agent-group + .agent-group { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.agent-group-head { padding: 8px 12px 4px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.agent-option:disabled { cursor: not-allowed; }
.agent-option:disabled .agent-option-name { color: var(--ink-2); }
.agent-option:disabled:hover { background: none; }
a.agent-action { color: var(--ink); text-decoration: none; }
.agent-admin { margin: 14px 0 0; }
.agent-admin-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--accent-ink); font-weight: 600; }
.agent-admin-link svg { color: var(--accent); }

/* Takım işinin adım listesi (cevap balonunun üstünde) */
.team-steps { margin: 0 0 12px; }
.team-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.team-step { padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.team-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 28px; font-size: 14px; }
.team-step-name { font-weight: 600; overflow-wrap: anywhere; }
.team-role { padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12.5px; font-weight: 550; }
.team-step-status { color: var(--ink-2); }
.team-step.is-live .team-step-status { color: var(--accent-ink); font-weight: 550; }
.team-step.is-failed .team-step-status { color: var(--danger); font-weight: 550; }
.team-step-time { margin-left: auto; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.team-answer { margin-top: 6px; }
.team-answer summary { display: flex; align-items: center; min-height: 44px; color: var(--accent-ink); font-size: 14px; font-weight: 600; cursor: pointer; }
.team-answer .body { padding: 4px 0 2px; font-size: 15px; }

/* Cevapta kullanılan araçlar */
.tools-used { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 550;
}

.tool-chip.is-source { background: var(--hover); color: var(--ink); }
.tool-chip.is-source svg { color: var(--accent); }

/* Betik çıktıları: indirme çipleri (dokunma hedefi 44 px) */
.out-files { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.out-files[hidden] { display: none; }
.out-file { min-height: 44px; max-width: 100%; border: 0; cursor: pointer; transition: background-color 0.18s, color 0.18s; }
.out-file:hover { background: var(--accent); color: var(--on-accent); }
.out-file.is-busy { opacity: 0.6; cursor: progress; }
.out-file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out-file-size { font-weight: 400; }

/* Atıflar: cevaptaki [n] üst simge düğmesi, cevabın altındaki numaralı kaynak listesi ve kaynak kartı.
   Görünen düğme küçük; ::after dokunma alanını 44 px'e büyütür. */
.cite {
  position: relative;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin: 0 2px;
  padding: 0 5px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  vertical-align: super;
  cursor: pointer;
}
.cite::after { content: ''; position: absolute; top: 50%; left: 50%; width: max(100%, 32px); height: 44px; transform: translate(-50%, -50%); }
.cite:hover, .cite[aria-expanded='true'] { background: var(--accent); color: var(--on-accent); }

.cite-list { display: grid; gap: 2px; margin: 10px 0 0; padding: 0; list-style: none; }
.cite-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.cite-row:hover, .cite-row[aria-expanded='true'] { background: var(--hover); }
.cite-row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cite-n {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 650;
}

.cite-card {
  display: grid;
  gap: 8px;
  max-width: 640px;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  animation: pop-in 0.2s var(--ease);
}
.cite-card[hidden] { display: none; }
.cite-card:focus { outline: none; }
.cite-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cite-card-head { display: flex; align-items: center; gap: 10px; }
.cite-card-title { flex: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
.cite-close { flex: none; min-width: 44px; height: 44px; margin: -8px -8px -8px 0; }
.cite-excerpt { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.cite-link { display: inline-flex; align-items: center; justify-self: start; min-height: 44px; color: var(--accent-ink); font-size: 14px; font-weight: 600; text-underline-offset: 3px; }

/* Cevap altı beğen / beğenme ve düzeltme formu */
.ghost[aria-pressed='true'] { background: var(--accent-soft); color: var(--accent-ink); }
.ghost:disabled { cursor: default; }
.ghost:disabled:not([aria-pressed='true']) { opacity: 0.45; }
.feedback-form { display: grid; gap: 8px; max-width: 560px; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); animation: pop-in 0.2s var(--ease); }
.feedback-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.feedback-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-weight: 400; resize: vertical; }
.feedback-form textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.feedback-row { display: flex; justify-content: flex-end; gap: 8px; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; }

/* Bilgi bankası penceresi */
.kb-form { display: grid; gap: 12px; margin-bottom: 8px; }
.kb-row { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.kb-row small { color: var(--ink-2); font-size: 12.5px; font-weight: 400; }
.kb-row input[type='file'] { padding: 9px; font-size: 14px; }
.kb-form .seg button { min-height: 38px; }
.kb-head { margin: 18px 0 10px; font-size: 16px; }
.kb-head span { color: var(--ink-2); font-weight: 500; }
.kb-item { align-items: center; }
.kb-ico { display: inline-grid; flex: none; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }

/* Pencereler: ortak hafıza, agent'lar */
.sheet {
  width: min(560px, calc(100vw - 24px));
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}
.sheet[open] { display: flex; animation: pop-in 0.22s var(--ease); }
.sheet::backdrop { background: rgba(10, 8, 24, 0.55); backdrop-filter: blur(4px); }
.sheet-body { flex: 1; min-height: 0; padding: 22px 24px 24px; overflow: auto; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { margin: 0 0 4px; font-size: 21px; letter-spacing: -0.02em; }
.sheet-head p { margin: 0; color: var(--ink-2); font-size: 15px; }
.sheet-head .icon-btn { flex: none; margin: -8px -10px 0 0; }
.sheet-msg { min-height: 22px; margin: 0 0 8px; color: var(--ink-2); font-size: 14px; }
.sheet-msg:empty { min-height: 0; margin: 0; }

.sheet-add { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; margin-bottom: 10px; }
.sheet textarea, .sheet input:not([type='checkbox']) {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
  resize: vertical;
}
.sheet textarea:focus, .sheet input:not([type='checkbox']):focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: background-color 0.18s, border-color 0.18s, opacity 0.18s;
}
.btn-primary { border: 0; background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-ink); }
.btn-secondary { border: 1px solid var(--line); background: none; color: var(--ink); }
.btn-secondary:hover { border-color: var(--accent); }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.55; cursor: progress; }

.note-list, .agent-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.note, .agent-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px 8px 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.note-text, .agent-row-text { display: grid; flex: 1; gap: 2px; min-width: 0; }
.note-text p { margin: 0; overflow-wrap: anywhere; }
.note-meta, .agent-row-text span { color: var(--ink-2); font-size: 13px; }
.note .icon-btn, .agent-row .icon-btn { flex: none; width: 40px; height: 40px; margin-top: -6px; }
.note-del:hover, .agent-del:hover, .agent-del[data-armed] { color: var(--danger); }
.agent-del[data-armed] { background: var(--hover); }
.note-empty { padding: 18px; border: 1px dashed var(--line); border-radius: var(--r-md); color: var(--ink-2); font-size: 14.5px; text-align: center; }
.agent-list { margin-bottom: 14px; }

.agent-form { display: grid; gap: 6px; }
.agent-form label, .agent-form legend { font-size: 14px; font-weight: 600; }
.agent-form input + label, .agent-form textarea + label { margin-top: 8px; }
.agent-form fieldset { margin: 10px 0 0; padding: 0; border: 0; }
.agent-form legend { margin-bottom: 8px; }
.tool-checks { display: grid; gap: 6px; }
.tool-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-weight: 500 !important;
  cursor: pointer;
}
.tool-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.tool-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 720px) {
  .agent-btn { font-size: 16px; }
  .sheet-body { padding: 18px 16px 20px; }
  .sheet-add { grid-template-columns: 1fr; }
}

/* Derin araştırma: plan, adım ayrıntısı, netleştirme formu ve rapor düğmeleri */
.research-plan { margin: 0 0 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.research-plan-title, .research-clarify-title { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.research-plan ol, .research-questions { margin: 0; padding-left: 22px; font-size: 14.5px; line-height: 1.5; }
.team-step-detail { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.research-clarify { display: grid; gap: 8px; max-width: 620px; margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: var(--r-md); background: var(--surface); }
.research-answer-label { font-size: 14px; font-weight: 600; }
.research-clarify textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); color: var(--ink); resize: vertical; }
.research-clarify textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.research-clarify-row, .research-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.research-buttons { justify-content: flex-start; }
.research-clarify .btn-sm, .research-actions .btn-sm { min-height: 44px; }
.research-actions { display: grid; gap: 8px; margin: 12px 0 4px; }
.research-stats { margin: 0; color: var(--ink-2); font-size: 14px; }
.research-note { margin: 0; color: var(--ink-2); font-size: 14px; }
.research-note:empty { display: none; }
.research-note.is-error { color: var(--danger); }
