/* ===== WA Kampanya — NAV Business Panel Tarzı ===== */
:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1f2430;
  --muted: #8a92a3;
  --line: #edeef1;
  --teal: #12a594;
  --teal-d: #0e8a7c;
  --purple: #8b7ff5;
  --purple-d: #7c6cf0;
  --grad-header: linear-gradient(90deg, #7c5cf0 0%, #12a594 100%);
  --grad-active: linear-gradient(90deg, #12a594 0%, #16b8a0 100%);
  --shadow: 0 1px 3px rgba(20,25,40,.06), 0 1px 2px rgba(20,25,40,.04);
  --shadow-lg: 0 4px 16px rgba(20,25,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* ===== Layout ===== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; border-bottom: 1px solid var(--line); }
.brand-logo {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #7c5cf0, #12a594); color: #fff;
  font-weight: 800; font-size: 15px; display: grid; place-items: center; letter-spacing: -.5px;
}
.brand-logo.big { width: 64px; height: 64px; font-size: 24px; border-radius: 18px; margin: 0 auto 14px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.2; }
.brand-txt b { font-size: 14px; font-weight: 800; letter-spacing: -.2px; }
.brand-txt span { font-size: 11px; color: var(--muted); }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.nav-section {
  font-size: 11px; font-weight: 700; color: var(--teal); text-transform: uppercase;
  letter-spacing: .6px; padding: 14px 12px 6px;
}
.navitem {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #5b6270; font-weight: 500; font-size: 14px; margin-bottom: 2px; transition: all .15s; position: relative;
}
.navitem .ico { width: 20px; height: 20px; flex-shrink: 0; color: #9aa1b0; }
.navitem .ico svg { width: 100%; height: 100%; }
.navitem:hover { background: #f5f6f8; color: var(--ink); }
.navitem.active {
  background: var(--grad-active); color: #fff; box-shadow: 0 4px 12px rgba(18,165,148,.3);
}
.navitem.active .ico { color: #fff; }
.nav-badge {
  margin-left: auto; background: #ede9fe; color: #7c5cf0; font-size: 11px; font-weight: 700;
  padding: 2px 9px; border-radius: 20px;
}
.navitem.active .nav-badge { background: rgba(255,255,255,.25); color: #fff; }

.side-bottom { border-top: 1px solid var(--line); padding: 12px; }
.conn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: #f5f6f8; margin-bottom: 8px; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.conn.ok .conn-dot { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.conn.off .conn-dot { background: #cbd0d8; }
.conn b { display: block; font-size: 13px; }
.conn span { font-size: 11px; color: var(--muted); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.side-ava { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg,#a78bfa,#f0abfc); color: #fff; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.side-user > span { flex: 1; font-size: 13px; font-weight: 600; }
.side-logout { width: 20px; height: 20px; color: var(--muted); }
.side-logout:hover { color: #e14b4b; }
.side-logout svg { width: 100%; height: 100%; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--grad-header); color: #fff; padding: 18px 28px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10;
}
.page-title { font-size: 20px; font-weight: 700; margin: 0; }
.sync-btn { background: rgba(255,255,255,.18); color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; border: 1px solid rgba(255,255,255,.25); transition: background .15s; }
.sync-btn:hover { background: rgba(255,255,255,.3); }
main { padding: 24px 28px; flex: 1; }

/* ===== İstatistik kartları ===== */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.statcard {
  background: var(--card); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
}
.statcard.teal { border-left-color: #12a594; }
.statcard.green { border-left-color: #22c55e; }
.statcard.orange { border-left-color: #f59e0b; }
.statcard.blue { border-left-color: #3b82f6; }
.statcard-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.statcard-value { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin: 6px 0 2px; }
.statcard-sub { font-size: 12px; color: var(--muted); }

/* ===== Kartlar ===== */
.card { background: var(--card); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head span:first-child { font-size: 16px; font-weight: 700; }
.muted { color: var(--muted); font-size: 13px; }
.view-all { font-size: 13px; font-weight: 600; color: var(--teal); padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; }
.view-all:hover { background: #f5f6f8; }

.dash-2col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; margin-bottom: 22px; }

/* Bar chart */
.chart-scroll { overflow-x: auto; }
.barchart { width: 100%; min-width: 520px; height: 260px; display: block; }
.bar-lbl { fill: var(--muted); font-size: 13px; }
.bar-val { fill: #6b7280; font-size: 12px; font-weight: 700; }

/* Mini tablo (en aktif numaralar) */
.mini-table { width: 100%; border-collapse: collapse; box-shadow: none; }
.mini-table td { padding: 12px 6px; border-bottom: 1px solid var(--line); font-size: 14px; }
.mini-table tr:last-child td { border-bottom: none; }
.mini-table .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.right { text-align: right; }

/* ===== Tablolar ===== */
.table-card { padding: 20px 20px 8px; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; padding: 12px 14px; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

/* ===== Rozetler ===== */
.badge { padding: 4px 12px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; display: inline-block; }
.badge.connected, .badge.completed { background: #dcfce7; color: #16a34a; }
.badge.disconnected { background: #fef3c7; color: #d97706; }
.badge.qr_pending, .badge.sending, .badge.scheduled { background: #dbeafe; color: #2563eb; }
.badge.banned, .badge.cancelled { background: #fee2e2; color: #dc2626; }
.badge.draft, .badge.paused { background: #eef0f3; color: var(--muted); }

/* ===== Formlar / butonlar ===== */
input, textarea, select {
  background: #fff; border: 1px solid #dfe2e8; color: var(--ink);
  border-radius: 8px; padding: 10px 12px; font: inherit; width: 100%; transition: border .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(18,165,148,.12); }
label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: #4b5262; }
label input, label textarea, label select { margin-top: 6px; font-weight: 400; color: var(--ink); }
button, .btn {
  background: var(--teal); color: #fff; border: none; border-radius: 8px; padding: 10px 18px;
  cursor: pointer; font-weight: 600; font-size: 14px; transition: background .15s; display: inline-block;
}
button:hover, .btn:hover { background: var(--teal-d); }
button.ghost { background: #eef0f3; color: var(--ink); }
button.ghost:hover { background: #e2e5ea; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
h1 { font-size: 20px; }
h3 { margin-top: 0; }
.err { background: #fee2e2; color: #dc2626; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
ol { line-height: 2; padding-left: 20px; }

/* ===== Hedef kitle seçimi ===== */
.target-opts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.target-opts .opt { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid #dfe2e8; border-radius: 10px; cursor: pointer; font-weight: 400; }
.target-opts .opt:hover { border-color: var(--teal); }
.target-opts .opt input { width: auto; margin-top: 3px; }
.target-opts .opt span { display: flex; flex-direction: column; }
.target-opts .opt b { font-size: 14px; font-weight: 600; }
.target-opts .opt small { color: var(--muted); font-size: 12px; }

/* ===== Giriş ===== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--grad-header); }
.login-card { background: #fff; border-radius: 18px; padding: 40px 36px; width: 360px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.login-card h1 { font-size: 22px; margin: 0 0 4px; font-weight: 800; letter-spacing: -.3px; }
.login-card .sub { color: var(--muted); margin: 0 0 24px; font-size: 13px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-card button { padding: 12px; font-size: 15px; margin-top: 4px; }

/* ===== QR / sohbet ===== */
#qrbox { text-align: center; }
#qrbox img { border-radius: 12px; border: 6px solid #fff; box-shadow: var(--shadow-lg); }
.chat { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; max-height: 62vh; overflow-y: auto; padding: 14px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); }
.bubble { max-width: 70%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.4; }
.bubble.in { align-self: flex-start; background: #f2f3f5; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 4px; }
.bubble .t { display: block; font-size: 10px; opacity: .6; margin-top: 4px; }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .dash-2col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .sidebar { width: 68px; }
  .brand-txt, .nav-section, .navitem .lbl, .conn div, .side-user > span { display: none; }
  .navitem { justify-content: center; }
  .stat-row { grid-template-columns: 1fr; }
}
