:root {
  --bg: #0c0d10;
  --bg-2: #12141a;
  --card: #181a22;
  --card-hover: #1e212b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f8fafc;
  --text-dim: #cbd5e1;
  --muted: #94a3b8;
  --primary: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --green: #4ade80;
  --amber: #fde047;
  --red: #fb7185;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Auth Ekranı */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-box {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
}
.auth-header {
  text-align: center;
  margin-bottom: 24px;
}
.brand-logo {
  font-size: 48px;
  margin-bottom: 8px;
}
.auth-header h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: rgba(18, 20, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-icon { font-size: 26px; }
.brand-text strong { display: block; font-size: 15px; font-weight: 800; line-height: 1.1; }
.brand-sub { font-size: 10.5px; color: var(--primary); font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }

.nav-links {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.nav-tab {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.nav-tab:hover { color: #fff; }
.nav-tab.is-active {
  background: var(--card);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.llm-radar-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.dot-radar {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #eab308;
  box-shadow: 0 0 8px #eab308;
}
.dot-radar.online { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.dot-radar.offline { background: #ef4444; box-shadow: 0 0 8px #ef4444; }

/* Layout */
.main-content {
  padding: 28px;
  max-width: 1440px;
  margin: 0 auto;
}
.tab-pane { display: none; }
.tab-pane.is-active { display: block; }
.pane-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}
.pane-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.muted { color: var(--muted); }
.muted.small { font-size: 12px; }

/* Kartlar */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.grid-2-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) { .grid-2-col { grid-template-columns: 1fr; } }

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.stat-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-lbl {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.stat-num {
  font-size: 32px;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  margin: 4px 0;
  line-height: 1.1;
}
.stat-sub { font-size: 11.5px; color: var(--muted); }

/* Bot Grid */
.bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}
.bot-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.15s, border-color 0.15s;
}
.bot-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}
.bot-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.bot-card-title {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.pill-active { background: rgba(74, 222, 128, 0.15); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.pill-inactive { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Inbox / Live Chat Layout */
.inbox-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: calc(100vh - 200px);
  min-height: 540px;
  overflow: hidden;
}
.inbox-sidebar {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--bg-2);
}
.chat-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
}
.chat-item:hover { background: rgba(255, 255, 255, 0.03); }
.chat-item.is-selected { background: rgba(56, 189, 248, 0.08); border-left: 3px solid var(--primary); }
.chat-item-title { font-weight: 700; font-size: 13.5px; display: flex; justify-content: space-between; }
.chat-item-msg { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.inbox-chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-panel-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.15);
}
.chat-panel-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-panel-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  background: rgba(0, 0, 0, 0.15);
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
}
.chat-bubble.user {
  align-self: flex-start;
  background: #272a36;
  color: #fff;
  border-bottom-left-radius: 2px;
}
.chat-bubble.assistant {
  align-self: flex-end;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.bubble-time { font-size: 10px; opacity: 0.6; margin-top: 4px; text-align: right; }

/* Formlar & Elemanlar */
.form { display: flex; flex-direction: column; gap: 14px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-dim); }
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
textarea { resize: vertical; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

.form-msg { font-size: 13px; font-weight: 600; }
.form-msg.is-ok { color: var(--green); }
.form-msg.is-error { color: var(--red); }

/* Table */
.table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13.5px; }
.table th { padding: 12px 16px; font-size: 11.5px; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line-strong); font-weight: 700; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Modals */
.media-dlg {
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: #fff;
  border-radius: var(--radius);
  max-width: 600px;
  width: 90vw;
  margin: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.media-dlg::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(6px); }
.media-dlg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.icon-btn { background: none; border: none; color: #fff; cursor: pointer; font-size: 16px; padding: 4px; }
