* { box-sizing: border-box; }
body {
  font-family: Segoe UI, system-ui, sans-serif;
  margin: 0;
  background: #f4f6f9;
  color: #1f2937;
}

/* --- Platform basligi --- */
.platform-header {
  background: linear-gradient(180deg, #ffffff, #f0f3f8);
  border-bottom: 1px solid #e5e7eb;
  padding: 22px 32px;
  margin: 16px;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.brand { display: flex; align-items: center; gap: 18px; justify-content: center; }
.logo {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
  padding: 8px 14px; display: flex; align-items: center;
}
.logo img { height: 50px; width: auto; display: block; }
.brand-text h1 { margin: 0; font-size: 30px; color: #4f5fc7; font-weight: 800; }
.brand-text p { margin: 4px 0 0; color: #8a93a6; font-size: 14px; }

/* --- Ust arac cubugu --- */
.topbar { display: flex; gap: 14px; justify-content: flex-end; padding: 0 32px 8px; }
button {
  background: #c0453d; color: #fff; border: 0; padding: 9px 16px;
  border-radius: 8px; cursor: pointer; font-size: 14px;
}
button:hover { filter: brightness(.94); }
button.ghost { background: #fff; color: #374151; border: 1px solid #d1d5db; }
button.ghost:hover { background: #f3f4f6; }

/* --- Giris ekrani --- */
.login-prompt { text-align: center; margin-top: 90px; color: #6b7280; }
.login-prompt button { background: #2563eb; margin-top: 12px; padding: 11px 22px; }

/* --- Hos geldin banner --- */
.welcome {
  margin: 4px 16px 0; padding: 12px 18px; border-radius: 10px;
  background: #eef2ff; border: 1px solid #e0e7ff; color: #3730a3; font-size: 14px;
}
.welcome a { color: #4f46e5; }

/* --- Genel container --- */
.container { max-width: 1180px; margin: 18px auto; padding: 0 20px; }
.section-title { font-size: 22px; color: #1f2937; margin: 16px 0 18px; }

/* --- Ajan kartlari --- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.card {
  background: linear-gradient(180deg, #fbfcfe, #eef1f7);
  border: 1px solid #e3e7ef; border-radius: 14px; padding: 26px 22px;
  text-align: center; display: flex; flex-direction: column; align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.05); transition: transform .12s, box-shadow .12s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.08); }
.card-active { border-color: #c9b6f5; }
.card-icon { font-size: 40px; margin-bottom: 8px; }
.card h3 { margin: 6px 0 10px; font-size: 19px; color: #1f2937; }
.card p { color: #6b7280; font-size: 14px; line-height: 1.5; min-height: 60px; margin: 0 0 14px; }
.card-meta {
  width: 100%; background: #fff; border: 1px solid #eef0f4; border-radius: 8px;
  padding: 8px 10px; font-size: 12px; color: #9ca3af; text-align: left; margin-bottom: 16px;
}
.card-btn { width: 100%; padding: 11px; font-size: 14px; }

/* --- Araç çubuğu / Geri butonu --- */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.back-btn { background: #fff; color: #374151; border: 1px solid #d1d5db; margin-bottom: 14px; }
.back-btn:hover { background: #f3f4f6; }
.toolbar .back-btn { margin-bottom: 0; }

/* --- Markdown cevap içeriği --- */
.answer-md { line-height: 1.55; }
.answer-md p { margin: 0 0 8px; }
.answer-md p:last-child { margin-bottom: 0; }
.answer-md ul, .answer-md ol { margin: 6px 0 8px; padding-left: 22px; }
.answer-md li { margin: 2px 0; }
.answer-md h1, .answer-md h2, .answer-md h3 { margin: 10px 0 6px; font-size: 16px; }
.answer-md code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.answer-md pre { background: #f3f4f6; padding: 10px; border-radius: 6px; overflow-x: auto; }
.answer-md pre code { background: none; padding: 0; }
.answer-md table { border-collapse: collapse; margin: 8px 0; font-size: 13px; }
.answer-md th, .answer-md td { border: 1px solid #e5e7eb; padding: 5px 9px; }
.answer-md strong { font-weight: 600; }
.answer-md a { color: #2563eb; }

/* --- RAG kaynak etiketi --- */
.sources { margin-top: 10px; font-size: 12px; color: #6b7280; font-style: italic; }

/* --- Excel indir butonu --- */
.dl-btn { background: #16a34a; color: #fff; margin-top: 12px; padding: 8px 14px; font-size: 13px; display: block; }
.dl-btn:hover { background: #15803d; }

/* --- Placeholder (yakinda) --- */
.soon { text-align: center; padding: 70px 20px; color: #6b7280; }
.soon-icon { font-size: 54px; }
.soon h2 { color: #374151; margin: 14px 0 6px; }

/* --- Kullanım panosu --- */
.usage-total { font-size: 16px; margin: 4px 0 16px; }
.usage-total b { color: #0f4c81; }
#tab-usage h3 { font-size: 15px; margin: 0 0 8px; }
.ubar { display: flex; align-items: center; gap: 10px; margin: 5px 0; font-size: 13px; }
.ubar-l { flex: 0 0 200px; text-align: right; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ubar-track { flex: 1; background: #eef1f6; border-radius: 6px; height: 16px; overflow: hidden; }
.ubar-fill { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #4f5fc7); }
.ubar-v { flex: 0 0 44px; color: #6b7280; }
.acf-lbl { display: block; font-size: 12px; color: #9ca3af; margin: 10px 0 4px; }

/* --- Settings sekmeleri --- */
.tabbar { display: flex; gap: 6px; border-bottom: 2px solid #e5e7eb; margin: 6px 0 20px; }
.tab {
  background: transparent; color: #6b7280; border: 0; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 10px 16px; font-size: 15px; margin-bottom: -2px;
}
.tab:hover { color: #374151; }
.tab.tab-active { color: #c0453d; border-bottom-color: #c0453d; font-weight: 600; }

/* --- Agent Configuration --- */
.agent-cfg {
  display: grid; grid-template-columns: 300px 1fr; gap: 12px 16px; align-items: start;
  padding: 16px 0; border-bottom: 1px solid #eef0f4;
}
.agent-cfg label { display: block; font-size: 12px; color: #9ca3af; margin-bottom: 4px; }
.agent-cfg input, .agent-cfg select, .agent-cfg textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.agent-cfg select { font-size: 15px; cursor: pointer; }
.acf-name { grid-column: 2; }
.acf-desc { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .agent-cfg { grid-template-columns: 1fr; }
  .acf-name { grid-column: 1; }
}

/* --- Settings / yetki tablosu --- */
.perm-editor { background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; padding: 20px; }
.perm-editor h3 { margin: 0 0 14px; }
.perm-row { display: flex; gap: 10px; align-items: center; }
.perm-row input[type=email], #permEmail {
  flex: 0 0 320px; max-width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px;
}
.perm-msg { font-size: 13px; color: #6b7280; }
.perm-table { border-collapse: collapse; width: 100%; font-size: 14px; background: #fff; }
.perm-table th, .perm-table td { border: 1px solid #eceef2; padding: 9px 12px; text-align: center; }
.perm-table th { background: #f8fafc; color: #6b7280; font-weight: 600; }
.perm-table input[type=checkbox] { width: 17px; height: 17px; cursor: pointer; }
button.mini { padding: 5px 10px; font-size: 12px; }
button.mini.danger { background: #ef4444; }
button:disabled { opacity: .5; cursor: not-allowed; filter: none; }

/* --- Çoklu kişi seçimi (mail "Kime" alanı gibi) --- */
.chip-box { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 8px; min-height: 42px;
  border: 1px solid #d1d5db; border-radius: 8px; background: #fff; cursor: text; }
.chip-box:focus-within { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.chip-box input { flex: 1 1 220px; min-width: 160px; border: none; outline: none; padding: 6px 4px; font-size: 14px; background: transparent; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #e0e7ff; color: #1e3a8a; border-radius: 999px;
  padding: 4px 6px 4px 10px; font-size: 13px; max-width: 100%; }
.chip.existing { background: #fef3c7; color: #92400e; }
.chip small { color: inherit; opacity: .7; }
.chip button { background: transparent; color: inherit; padding: 0 4px; font-size: 15px; line-height: 1; border: none; }
.chip button:hover { background: rgba(0,0,0,.08); filter: none; border-radius: 50%; }

/* --- Doküman toplu seçim --- */
.doc-bulk { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.perm-table td.sel, .perm-table th.sel { width: 36px; }

/* --- Sohbet --- */
#messages { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.msg { padding: 12px 16px; border-radius: 10px; max-width: 90%; white-space: pre-wrap; line-height: 1.5; }
.msg.user { background: #dbeafe; align-self: flex-end; }
.msg.bot { background: #fff; align-self: flex-start; border: 1px solid #e5e7eb; width: 100%; }
.msg canvas { margin-top: 12px; max-height: 360px; }
#chatForm { display: flex; gap: 8px; }
#questionInput { flex: 1; padding: 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 15px; }
#chatForm button { background: #2563eb; }
.tablewrap { overflow-x: auto; margin-top: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border: 1px solid #e5e7eb; padding: 6px 10px; text-align: left; }
th { background: #f9fafb; }
details { margin-top: 10px; font-size: 13px; color: #6b7280; }
pre { background: #f3f4f6; padding: 10px; border-radius: 6px; overflow-x: auto; }
