/* AI Chatbot admin */
:root {
  --a-bg: #f4f7fb;
  --a-side: #0f172a;
  --a-accent: #0284c7;
  --a-card: #fff;
  --a-border: #e2e8f0;
  --a-text: #0f172a;
  --a-muted: #64748b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--a-bg);
  color: var(--a-text);
}
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 5; }
}
.side {
  background: var(--a-side);
  color: #e2e8f0;
  padding: 1.25rem 1rem;
}
.side .brand { font-weight: 800; font-size: 1.05rem; margin-bottom: 1.25rem; letter-spacing: -.02em; }
.side a {
  display: block;
  color: #cbd5e1;
  text-decoration: none;
  padding: .55rem .75rem;
  border-radius: 8px;
  margin-bottom: .25rem;
  font-size: .92rem;
}
.side a:hover, .side a.active { background: #1e293b; color: #fff; }
.main { padding: 1.5rem 1.5rem 3rem; }
.card {
  background: var(--a-card);
  border: 1px solid var(--a-border);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 2px #0f172a08;
}
.card h1 { margin: 0 0 .35rem; font-size: 1.35rem; }
.card h2 { margin: 0 0 1rem; font-size: 1.05rem; }
.muted { color: var(--a-muted); font-size: .9rem; }
label { display: block; font-size: .82rem; font-weight: 600; margin: .75rem 0 .35rem; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%;
  border: 1px solid var(--a-border);
  border-radius: 10px;
  padding: .6rem .75rem;
  font: inherit;
  background: #fff;
}
textarea { min-height: 140px; resize: vertical; }
.btn {
  display: inline-block;
  background: var(--a-accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: .55rem 1rem;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  font-size: .92rem;
}
.btn-secondary { background: #334155; }
.btn-outline { background: #fff; color: var(--a-text); border: 1px solid var(--a-border); }
.alert {
  padding: .75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: .92rem;
}
.alert-ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(160deg, #0f172a, #0c4a6e);
}
.login-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
}
.embed-box {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: 10px;
  font-size: .8rem;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.chat-box {
  height: 360px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--a-border);
  border-radius: 12px;
  overflow: hidden;
}
.chat-log { flex: 1; overflow: auto; padding: 1rem; background: #f8fafc; }
.bubble {
  max-width: 90%;
  margin-bottom: .6rem;
  padding: .55rem .75rem;
  border-radius: 10px;
  font-size: .92rem;
  white-space: pre-wrap;
}
.bubble.user { margin-left: auto; background: #e0f2fe; }
.bubble.bot { background: #fff; border: 1px solid var(--a-border); }
.chat-form { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--a-border); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--a-border); }

.api-key-wrap {
  display: flex;
  align-items: stretch;
  gap: 0;
  max-width: 36rem;
}
.api-key-wrap input {
  flex: 1;
  border-radius: 8px 0 0 8px;
  margin: 0;
}
.api-eye {
  border: 1px solid var(--a-border);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #f1f5f9;
  color: #334155;
  padding: 0 .85rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.api-eye:hover { background: #e2e8f0; }

.bot-tabs-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.bot-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--a-border);
  background: #f8fafc;
  color: var(--a-text);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 650;
}
.bot-tab:hover { border-color: #94a3b8; background: #fff; }
.bot-tab.active {
  background: #0c4a6e;
  border-color: #0c4a6e;
  color: #fff;
}
.bot-tab-sub {
  font-weight: 500;
  font-size: .78rem;
  opacity: .85;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bot-tab.active .bot-tab-sub { opacity: .9; }
.bot-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}
.bot-tab-dot.on { background: #22c55e; }
.bot-tab.active .bot-tab-dot { background: #94a3b8; }
.bot-tab.active .bot-tab-dot.on { background: #86efac; }
.embed-box-sm { font-size: .75rem; padding: .75rem; }
.bot-train-banner {
  border-left: 4px solid var(--a-accent);
  background: linear-gradient(90deg, #f0f9ff, #fff);
}

/* Chatbot görüşme listesi (CRM stili) */
.crm-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
}
.crm-count {
  font-size: .85rem;
  font-weight: 700;
  color: var(--a-muted);
  background: #f1f5f9;
  padding: .35rem .7rem;
  border-radius: 999px;
}
.crm-table-wrap { overflow: auto; margin: 0 -.35rem; }
.crm-table { min-width: 720px; border-collapse: separate; border-spacing: 0 .45rem; }
.crm-table thead th {
  border: 0;
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--a-muted);
  padding: .25rem .65rem;
  font-weight: 700;
}
.crm-table tbody tr.crm-row {
  cursor: pointer;
  background: #fafbfc;
  box-shadow: 0 0 0 1px var(--a-border);
  border-radius: 12px;
}
.crm-table tbody tr.crm-row td {
  border: 0;
  padding: .85rem .65rem;
  vertical-align: middle;
  background: #f8fafc;
}
.crm-table tbody tr.crm-row td:first-child { border-radius: 12px 0 0 12px; }
.crm-table tbody tr.crm-row td:last-child { border-radius: 0 12px 12px 0; }
.crm-table tbody tr.crm-row:hover td { background: #f0f9ff; }
.crm-title { font-weight: 600; max-width: 16rem; }
.crm-table .mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; font-weight: 700; color: #0c4a6e; }
.crm-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  border: 1px solid var(--a-border);
  background: #fff;
  color: var(--a-text);
  font-size: .72rem;
  font-weight: 700;
  text-decoration: none;
}
.crm-open:hover { border-color: var(--a-accent); color: var(--a-accent); }
.st-pill {
  display: inline-block;
  padding: .28rem .55rem;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .03em;
  white-space: nowrap;
}
.st-wait { background: #ffedd5; color: #c2410c; }
.st-lead { background: #dbeafe; color: #1d4ed8; }
.st-ok { background: #dcfce7; color: #15803d; }
.lead-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .85rem;
  margin-top: .25rem;
}
@media (max-width: 800px) {
  .lead-grid { grid-template-columns: 1fr 1fr; }
}
.lead-grid .lg-k {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--a-muted);
  margin-bottom: .2rem;
}
.admin-chat-log {
  max-height: 520px;
  border: 1px solid var(--a-border);
  border-radius: 12px;
  background: #f8fafc;
}
.admin-chat-log .bubble-meta {
  font-size: .72rem;
  font-weight: 700;
  color: var(--a-muted);
  margin-bottom: .25rem;
}
