/* ============================================================
   LIVECHAT ADMIN PANEL — Pro Redesign (Hybrid: dark sidebar + light content)
   v13 — 2026-04-25
   ============================================================ */

/* ---- Design tokens ---- */
:root {
  /* Brand / accents */
  --brand-50:  #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;   /* primary */
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --sky-500:   #0ea5e9;
  --sky-600:   #0284c7;
  --violet-500:#8b5cf6;

  /* Semantic */
  --success-50:  #ecfdf5;
  --success-100: #d1fae5;
  --success-300: #6ee7b7;
  --success-500: #10b981;
  --success-600: #059669;
  --success-700: #047857;

  --warn-50:   #fffbeb;
  --warn-100:  #fef3c7;
  --warn-300:  #fcd34d;
  --warn-500:  #f59e0b;
  --warn-600:  #d97706;
  --warn-700:  #b45309;

  --danger-50:  #fef2f2;
  --danger-100: #fee2e2;
  --danger-300: #fca5a5;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;

  /* Neutrals */
  --bg:         #f7f8fb;
  --surface:    #ffffff;
  --surface-2:  #f1f5f9;
  --surface-3:  #f8fafc;
  --border:     #e5e7eb;
  --border-2:   #eef2f7;
  --text:       #0f172a;
  --text-2:     #334155;
  --text-3:     #64748b;
  --text-muted: #94a3b8;

  /* Sidebar (dark) */
  --sb-bg:      #0b1220;
  --sb-bg-2:    #111a2e;
  --sb-text:    #cbd5e1;
  --sb-text-2:  #94a3b8;
  --sb-active-bg: linear-gradient(180deg, rgba(99,102,241,.18), rgba(79,70,229,.10));
  --sb-active-stripe: var(--brand-500);
  --sb-border:  #1e2742;

  /* Geometry */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-2xl: 22px;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Shadows */
  --sh-xs: 0 1px 2px rgba(15,23,42,.05);
  --sh-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --sh-md: 0 4px 12px rgba(15,23,42,.08), 0 2px 4px rgba(15,23,42,.04);
  --sh-lg: 0 12px 28px rgba(15,23,42,.12), 0 4px 10px rgba(15,23,42,.06);
  --sh-xl: 0 24px 60px rgba(15,23,42,.22);

  /* Transitions */
  --tx: 160ms cubic-bezier(.4,0,.2,1);

  /* Layout */
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15,23,42,.18); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(15,23,42,.32); border: 2px solid transparent; background-clip: padding-box; }

a { color: var(--brand-600); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text-3); font-size: 13px; }
.muted.small { font-size: 12px; }

.error { color: var(--danger-700); background: var(--danger-50); border: 1px solid var(--danger-100); padding: 10px 12px; border-radius: var(--r-sm); font-size: 13px; }

/* ---- SVG icons ---- */
.ico { width: 18px; height: 18px; flex: none; stroke-width: 1.75; }
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 22px; height: 22px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-weight: 500; cursor: pointer;
  transition: background var(--tx), color var(--tx), border-color var(--tx), transform var(--tx), box-shadow var(--tx);
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: #d1d5db; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(79,70,229,.28); border-color: var(--brand-500); }

.btn.primary {
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  border-color: var(--brand-600); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.16) inset, 0 1px 2px rgba(79,70,229,.32);
}
.btn.primary:hover { background: linear-gradient(180deg, var(--brand-600), var(--brand-700)); border-color: var(--brand-700); }
.btn.primary:focus-visible { box-shadow: 0 0 0 3px rgba(79,70,229,.32); }

.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border); color: var(--text); }

.btn.subtle { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.btn.subtle:hover { background: var(--brand-100); }

.btn.danger { background: var(--danger-600); border-color: var(--danger-600); color: #fff; }
.btn.danger:hover { background: var(--danger-700); border-color: var(--danger-700); }
.btn.warn { background: var(--warn-500); border-color: var(--warn-500); color: #fff; }
.btn.warn:hover { background: var(--warn-600); border-color: var(--warn-600); }

.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---- LOGIN ---- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(99,102,241,.30), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(14,165,233,.22), transparent 60%),
    linear-gradient(135deg, #0b1220 0%, #0f172a 100%);
  padding: 20px;
}
.login-card {
  width: 380px; max-width: 96vw;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 28px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--sh-xl);
  border: 1px solid rgba(255,255,255,.06);
}
.login-card h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.login-card input {
  padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; outline: none; transition: border-color var(--tx), box-shadow var(--tx);
  background: var(--surface);
}
.login-card input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.16); }
.login-card .btn.primary { padding: 11px 14px; font-size: 14px; margin-top: 4px; }

/* ============================================================
   APP SHELL — sidebar + slim topbar + main
   ============================================================ */
#app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
}
body.sidebar-collapsed #app { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

.shell { display: grid; grid-template-rows: var(--topbar-h) 1fr; min-width: 0; min-height: 100vh; }
.shell-main { min-width: 0; min-height: 0; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar {
  background: var(--sb-bg);
  color: var(--sb-text);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--sb-border);
  position: relative;
  z-index: 30;
  min-height: 100vh;
}
.sidebar .sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; height: var(--topbar-h);
  border-bottom: 1px solid var(--sb-border);
  color: #fff; font-weight: 700; letter-spacing: -.01em;
}
.sidebar .sb-brand .sb-logo {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.35);
  flex: none;
}
.sidebar .sb-brand .sb-name { font-size: 15px; line-height: 1.1; }
.sidebar .sb-brand .sb-name small { display: block; font-weight: 500; font-size: 11px; color: var(--sb-text-2); margin-top: 2px; }

.sidebar .sb-section-label {
  padding: 16px 18px 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--sb-text-2);
  font-weight: 600;
}
.sidebar .nav-list {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 10px;
  flex: 1; overflow-y: auto;
}
/* nav-item — also kept .tab class on element so existing JS works */
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: transparent; border: 0; border-radius: var(--r-sm);
  color: var(--sb-text); font-size: 14px; font-weight: 500;
  text-align: left; cursor: pointer;
  position: relative;
  transition: background var(--tx), color var(--tx);
  width: 100%;
}
.sidebar .nav-item .ico { color: var(--sb-text-2); transition: color var(--tx); }
.sidebar .nav-item:hover { background: rgba(255,255,255,.04); color: #fff; }
.sidebar .nav-item:hover .ico { color: var(--brand-400); }
.sidebar .nav-item.active {
  background: var(--sb-active-bg);
  color: #fff;
}
.sidebar .nav-item.active .ico { color: var(--brand-400); }
.sidebar .nav-item.active::before {
  content: ""; position: absolute; left: -10px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--sb-active-stripe);
}
.sidebar .nav-item .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .nav-item .pill {
  background: rgba(255,255,255,.10); color: #fff; border-radius: 999px;
  padding: 1px 8px; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center;
}
.sidebar .nav-item.active .pill { background: var(--brand-600); color: #fff; }
.sidebar .nav-item .pill[hidden] { display: none !important; }
/* unread/pool — kırmızı vurgu */
.sidebar .nav-item .pill.danger { background: var(--danger-500); color: #fff; }

.sidebar .sb-foot {
  border-top: 1px solid var(--sb-border);
  padding: 10px;
}
.sidebar .user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  background: rgba(255,255,255,.03);
  color: #fff;
}
.sidebar .user-card .uc-av {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; overflow: hidden; flex: none;
}
.sidebar .user-card .uc-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sidebar .user-card .uc-info { min-width: 0; flex: 1; line-height: 1.2; }
.sidebar .user-card .uc-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user-card .uc-role { font-size: 11px; color: var(--sb-text-2); }
.sidebar .user-card .uc-role.admin { color: var(--warn-300); }
.sidebar .user-card .uc-actions { display: flex; gap: 4px; }
.sidebar .user-card .icbtn {
  width: 30px; height: 30px; border-radius: var(--r-xs);
  background: transparent; border: 0; color: var(--sb-text-2);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--tx), color var(--tx);
}
.sidebar .user-card .icbtn:hover { background: rgba(255,255,255,.06); color: #fff; }

/* Sidebar collapsed state (desktop) */
body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .sidebar .sb-brand .sb-name,
body.sidebar-collapsed .sidebar .nav-label,
body.sidebar-collapsed .sidebar .nav-item .pill,
body.sidebar-collapsed .sidebar .sb-section-label,
body.sidebar-collapsed .sidebar .uc-info,
body.sidebar-collapsed .sidebar .uc-actions { display: none !important; }
body.sidebar-collapsed .sidebar .nav-item { justify-content: center; padding: 9px 8px; }
body.sidebar-collapsed .sidebar .user-card { justify-content: center; padding: 6px 4px; }
body.sidebar-collapsed .sidebar .sb-brand { justify-content: center; padding: 16px 8px; }

/* ---- TOPBAR (slim) ---- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.topbar .page-title small { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; margin-top: 1px; }

/* legacy .brand inside topbar (hidden when sidebar exists) */
.topbar .brand { display: none; }
.topbar .tabs { display: none; }

.topbar .me {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
  font-size: 13px; flex-wrap: nowrap; justify-content: flex-end;
}
.topbar .me .role { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-weight: 600; }
.topbar #me-name { color: var(--text-2); font-weight: 600; }

.me-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; overflow: hidden;
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.me-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ws-status { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); transition: background .2s, box-shadow .3s; }
.ws-status.on { background: var(--success-500); box-shadow: 0 0 0 4px rgba(16,185,129,.16); }
.ws-status.off { background: var(--danger-500); box-shadow: 0 0 0 4px rgba(239,68,68,.16); }

#btn-notify, #btn-sound, #btn-logout { padding: 6px 10px; font-size: 12px; font-weight: 500; }
#btn-notify.on, #btn-sound.on { color: var(--success-700); border-color: var(--success-300); background: var(--success-50); }
#btn-notify.off, #btn-sound.off { color: var(--text-3); }
#btn-notify.warn { color: var(--danger-700); border-color: var(--danger-300); background: var(--danger-50); animation: lc-warn-pulse 2s ease-in-out infinite; }
@keyframes lc-warn-pulse { 0%,100%{ box-shadow:0 0 0 0 rgba(185,28,28,.45);} 70%{ box-shadow:0 0 0 6px rgba(185,28,28,0);} }

/* Hamburger (mobile) */
.mobile-menu-btn {
  display: none; background: transparent; border: 0; padding: 6px 10px;
  cursor: pointer; color: var(--text-2);
  border-radius: var(--r-sm);
}
.mobile-menu-btn:hover { background: var(--surface-2); }

/* Scrim for mobile drawer */
.scrim {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  opacity: 0; pointer-events: none;
  transition: opacity var(--tx);
  z-index: 25;
}
body.mobile-menu-open .scrim { opacity: 1; pointer-events: auto; }

/* ---- Live stat (sitede / sohbette) ---- */
.live-stat {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 12px;
  background: linear-gradient(180deg, var(--success-50), #f7fffa);
  color: var(--success-700);
  border: 1px solid var(--success-100);
  border-radius: 999px; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.live-stat .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success-500); animation: lc-pulse 1.6s ease-in-out infinite; flex: none; }
.live-stat-pair { display: inline-flex; align-items: center; gap: 8px; }
.live-stat-pair .lsv { display: inline-flex; align-items: baseline; gap: 4px; }
.live-stat-pair .lsv > span:first-child { font-size: 13px; font-weight: 700; }
.live-stat-pair .lsv small { font-weight: 500; opacity: .8; font-size: 10px; }
.live-stat-pair .lsv-chat { color: var(--warn-700); }
.live-stat-pair .lsep { opacity: .4; }
@keyframes lc-pulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(16,185,129,.6);} 70%{ box-shadow: 0 0 0 6px rgba(16,185,129,0);} }

.site-online-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; background: var(--success-50); color: var(--success-700);
  border: 1px solid var(--success-100); border-radius: 999px;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.site-online-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success-500); }
.site-online-pill .sub { font-weight: 700; color: var(--warn-700); }
.site-online-pill.zero { background: var(--surface-2); color: var(--text-3); border-color: var(--border); }
.site-online-pill.zero .dot { background: var(--text-muted); }
.site-online-pill.zero .sub { color: var(--text-3); }

/* ============================================================
   PAGES
   ============================================================ */
.page { display: none; height: calc(100vh - var(--topbar-h)); overflow: hidden; }
.page[data-page="chats"] { display: grid; grid-template-columns: 320px 1fr 300px; }
.page:not([data-page="chats"]) { display: block; padding: 22px 26px; overflow: auto; background: var(--bg); }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 0 0 18px;
}
.page-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; color: var(--text); }
.page-head h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }
.page-head .head-actions { display: flex; gap: 8px; }

/* Sayfa basinda kucuk bilgilendirme metni */
.page-hint {
  margin: -8px 0 16px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent, #6366f1) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent, #6366f1) 22%, var(--border-2));
  border-left: 3px solid var(--accent, #6366f1);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .page-hint { background: #eef2ff; border-color: #c7d2fe; border-left-color: #6366f1; }
}
.page-hint b { color: var(--text); font-weight: 700; }

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xs);
  padding: 18px 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: 16px; }
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-header h3 { margin: 0; font-size: 15px; font-weight: 600; }

/* ============================================================
   CONV LIST (sohbet listesi)
   ============================================================ */
.conv-list { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.queue-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--surface-3);
  padding: 6px;
  gap: 4px;
}
.qtab {
  padding: 8px 6px; border: 0; background: transparent; cursor: pointer;
  font-size: 12px; color: var(--text-3); font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border-radius: var(--r-xs);
  transition: background var(--tx), color var(--tx);
}
.qtab:hover { background: rgba(99,102,241,.06); color: var(--text); }
.qtab.active {
  color: #fff;
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  box-shadow: 0 1px 2px rgba(79,70,229,.32);
}
.qtab .pill { background: rgba(255,255,255,.18); color: #fff; }
.qtab:not(.active) .pill { background: var(--surface-2); color: var(--text-3); }

.conv-filter {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  padding: 10px; border-bottom: 1px solid var(--border-2);
}
.conv-filter input, .conv-filter select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 13px; outline: none; background: var(--surface); color: var(--text);
  transition: border-color var(--tx), box-shadow var(--tx);
}
.conv-filter input:focus, .conv-filter select:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }
.conv-filter input { grid-column: 1 / -1; }

.conv-items { flex: 1; overflow-y: auto; padding: 6px 0; }
.conv-item {
  padding: 12px 14px; border-bottom: 1px solid var(--border-2);
  cursor: pointer;
  display: grid; grid-template-columns: 1fr auto; gap: 4px;
  position: relative;
  transition: background var(--tx);
}
.conv-item:hover { background: var(--surface-3); }
.conv-item.active { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand-600); }
.conv-item .name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; color: var(--text); }
.conv-item .name .online { width: 8px; height: 8px; border-radius: 50%; background: var(--success-500); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.conv-item .name .offline { width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.conv-item .site { font-size: 12px; color: var(--text-3); }
.conv-item .preview {
  grid-column: 1 / -1; font-size: 12.5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.conv-item .time { font-size: 11px; color: var(--text-muted); align-self: start; font-variant-numeric: tabular-nums; }
.conv-item .badge { background: var(--danger-500); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 999px; align-self: end; font-weight: 700; }
.conv-item .assignment { grid-column: 1 / -1; font-size: 11px; display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; }
.conv-item .assignment.pool { color: var(--warn-700); }
.conv-item .assignment.mine { color: var(--success-700); font-weight: 600; }
.conv-item .assignment.other { color: var(--text-2); }
.conv-item .assignment .av {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2);
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
}
.conv-item .assignment .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.conv-item .assignment .pool-tag { background: var(--warn-100); color: var(--warn-700); padding: 1px 7px; border-radius: 4px; font-weight: 600; }

/* ============================================================
   CHAT PANE
   ============================================================ */
.chat-pane { background: linear-gradient(180deg, var(--surface-3), var(--bg)); display: flex; flex-direction: column; min-width: 0; }
.empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
  color: var(--text-3); font-size: 14px; padding: 40px;
  text-align: center;
}
.empty .empty-ico { width: 48px; height: 48px; color: var(--text-muted); opacity: .55; }
.empty h4 { margin: 4px 0 0; font-size: 15px; font-weight: 600; color: var(--text-2); }
.empty p { margin: 0; max-width: 320px; line-height: 1.5; }

.chat-window { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--surface);
  border-bottom: 1px solid var(--border); gap: 12px;
  position: sticky; top: 0; z-index: 10;
}
.ch-info { min-width: 0; flex: 1; }
.ch-title { font-weight: 600; font-size: 15px; color: var(--text); }
.ch-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.ch-assign { font-size: 12px; margin-top: 5px; display: inline-flex; align-items: center; gap: 6px; }
.ch-assign.pool { color: var(--warn-700); }
.ch-assign.mine { color: var(--success-700); font-weight: 600; }
.ch-assign.other { color: var(--text-2); }
.ch-assign .av {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2);
  font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; overflow: hidden;
}
.ch-assign .av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ch-actions .btn.small { padding: 6px 11px; }
.ch-readonly {
  background: var(--warn-50); color: var(--warn-700);
  padding: 9px 16px; font-size: 13px; text-align: center;
  border-bottom: 1px solid var(--warn-100); font-weight: 500;
}

.ch-msgs {
  flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px;
}
.ch-msg {
  max-width: 70%; padding: 9px 13px; border-radius: 14px;
  font-size: 14px; line-height: 1.45; word-break: break-word; white-space: pre-wrap;
  box-shadow: var(--sh-xs);
}
.ch-msg.visitor {
  align-self: flex-start; background: var(--surface);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.ch-msg.operator {
  align-self: flex-end;
  background: linear-gradient(180deg, var(--brand-500), var(--brand-600));
  color: #fff; border-bottom-right-radius: 4px;
  box-shadow: 0 1px 2px rgba(79,70,229,.24);
}
.ch-msg.system {
  align-self: center; background: var(--warn-50); color: var(--warn-700);
  border: 1px solid var(--warn-100);
  font-style: italic; font-size: 12px; padding: 6px 12px;
}
.ch-msg .meta { display: block; font-size: 11px; opacity: .7; margin-top: 4px; }
.ch-msg img { max-width: 280px; border-radius: 10px; display: block; margin-top: 4px; }
.ch-msg a { color: inherit; text-decoration: underline; word-break: break-all; }

/* Ziyaretci canli yazma onizlemesi — operator hemen fark etsin diye renkli */
.ch-typing {
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent, #6366f1) 12%, transparent) 0%, transparent 100%);
  border-top: 1px solid color-mix(in srgb, var(--accent, #6366f1) 35%, var(--border-2));
  border-bottom: 1px solid color-mix(in srgb, var(--accent, #6366f1) 25%, var(--border-2));
  display: flex; align-items: center; gap: 8px;
  position: relative;
}
@supports not (background: color-mix(in srgb, red, blue)) {
  .ch-typing { background: #eef2ff; border-top-color: #c7d2fe; border-bottom-color: #c7d2fe; }
}
.ch-typing::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  flex: 0 0 8px;
  animation: chTypingPulse 1.1s ease-in-out infinite;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #6366f1) 60%, transparent);
}
@keyframes chTypingPulse {
  0%   { transform: scale(0.85); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #6366f1) 50%, transparent); }
  60%  { transform: scale(1.15); box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent, #6366f1) 0%, transparent); }
  100% { transform: scale(0.85); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #6366f1) 0%, transparent); }
}
.ch-typing .typing-label { font-weight: 700; color: var(--accent, #6366f1); margin-right: 2px; flex: 0 0 auto; }
.ch-typing .typing-preview { color: var(--text); font-style: italic; word-break: break-word; flex: 1 1 auto; min-width: 0; }
.ch-typing .typing-preview .dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.ch-typing .typing-preview .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--accent, #6366f1); display: inline-block; animation: chTypingDot 1.4s infinite; }
.ch-typing .typing-preview .dots i:nth-child(2) { animation-delay: .2s; }
.ch-typing .typing-preview .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes chTypingDot { 0%,80%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.ch-composer {
  padding: 12px 14px; background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end;
}
.ch-composer textarea {
  flex: 1; resize: none; max-height: 140px;
  padding: 10px 13px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; outline: none; line-height: 1.45; font-family: inherit;
  transition: border-color var(--tx), box-shadow var(--tx);
}
.ch-composer textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }

/* ============================================================
   INFO PANE
   ============================================================ */
.info-pane { background: var(--surface); border-left: 1px solid var(--border); padding: 18px; overflow-y: auto; }
.info-pane h3 { margin: 0 0 14px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; }
.info-pane dl { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0; }
.info-pane dt { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.info-pane dd { margin: 3px 0 0; font-size: 13.5px; color: var(--text); word-break: break-all; padding-bottom: 10px; border-bottom: 1px dashed var(--border-2); }
.info-pane dd:last-child { border-bottom: 0; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--sh-xs);
}
.table {
  width: 100%; border-collapse: collapse; background: var(--surface);
}
.table th, .table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-2);
  font-size: 14px; text-align: left; vertical-align: middle;
}
.table thead th {
  background: var(--surface-3);
  font-weight: 600; color: var(--text-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em;
  position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--border);
}
.table tbody tr { transition: background var(--tx); }
.table tbody tr:hover { background: var(--surface-3); }
.table tbody tr:nth-child(even) { background: rgba(248,250,252,.5); }
.table tbody tr:nth-child(even):hover { background: var(--surface-3); }
.table tr:last-child td { border-bottom: 0; }
.table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table .actions .btn { padding: 5px 9px; }

.swatch { width: 18px; height: 18px; border-radius: 5px; display: inline-block; vertical-align: middle; border: 1px solid var(--border); box-shadow: var(--sh-xs); }

.code {
  background: #0b1220; color: #e2e8f0; padding: 14px; border-radius: var(--r-sm);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; word-break: break-all; white-space: pre-wrap;
  border: 1px solid #1e2742;
}

/* Status pills (re-usable) */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent;
}
.status-pill.success { background: var(--success-50); color: var(--success-700); border-color: var(--success-100); }
.status-pill.warn { background: var(--warn-50); color: var(--warn-700); border-color: var(--warn-100); }
.status-pill.danger { background: var(--danger-50); color: var(--danger-700); border-color: var(--danger-100); }
.status-pill.muted { background: var(--surface-2); color: var(--text-3); border-color: var(--border); }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  width: 480px; max-width: 100%;
  display: flex; flex-direction: column;
  gap: 14px;
  max-height: 90vh; overflow: auto;
  box-shadow: var(--sh-xl);
  border: 1px solid var(--border);
  padding: 22px;
}
.modal-card h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.modal-card h4 { margin: 0; font-size: 14px; font-weight: 600; }
.modal-card label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.modal-card label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.modal-card input, .modal-card textarea, .modal-card select {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; outline: none; font-family: inherit; background: var(--surface);
  color: var(--text);
  transition: border-color var(--tx), box-shadow var(--tx);
}
.modal-card input:focus, .modal-card textarea:focus, .modal-card select:focus {
  border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.14);
}
.modal-card-wide { width: 640px; }
.modal-card-tabs { width: 760px; max-width: 95vw; padding-top: 18px; }

.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-2);
}

/* Site modal tabs */
.tabs-strip {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: 8px -4px 0; padding: 0 4px;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.tabs-strip .tab-btn {
  background: transparent; border: 0; padding: 9px 14px; cursor: pointer; color: var(--text-3);
  font-weight: 600; font-size: 13px; border-radius: 8px 8px 0 0;
  border-bottom: 3px solid transparent;
  transition: color var(--tx), border-color var(--tx), background var(--tx); white-space: nowrap;
}
.tabs-strip .tab-btn:hover { color: var(--brand-600); background: var(--brand-50); }
.tabs-strip .tab-btn.active { color: var(--brand-700); border-bottom-color: var(--brand-600); background: var(--surface); }
.tabs-body { display: block; }
.tab-pane { display: none; flex-direction: column; gap: 12px; padding-top: 14px; }
.tab-pane.active { display: flex; }
.tab-pane label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.tab-pane label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.tab-pane input[type="text"], .tab-pane input[type="url"], .tab-pane input[type="number"], .tab-pane input[type="password"],
.tab-pane select, .tab-pane textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; outline: none; transition: border-color var(--tx), box-shadow var(--tx);
  background: var(--surface); color: var(--text);
}
.tab-pane input:focus, .tab-pane select:focus, .tab-pane textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }

.upload-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 4px 0; }
.upload-row .btn { display: inline-flex; align-items: center; }
.img-preview { max-height: 56px; max-width: 140px; border-radius: var(--r-xs); border: 1px solid var(--border); object-fit: cover; }

/* Visual sekmesindeki bolum basligi */
.visual-section-title {
  margin: 14px 0 4px;
  font-size: 13px; font-weight: 700; color: var(--text);
  letter-spacing: .01em;
}
.visual-section-title:first-of-type { margin-top: 6px; }
.sep { border: 0; border-top: 1px dashed var(--border); margin: 6px 0; }

/* Quick links list (admin) */
.ql-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px; display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; align-items: center;
}
.ql-row select, .ql-row input { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.ql-row .ql-actions { display: flex; gap: 4px; }
.ql-row .ql-handle { color: var(--text-muted); font-size: 18px; cursor: grab; user-select: none; }

/* Field options (radio/select) */
.fr-options { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; padding: 6px 4px 0; border-top: 1px dashed var(--border); }
.fr-options-list { display: flex; flex-direction: column; gap: 4px; }
.fr-opt-row { display: flex; gap: 6px; align-items: center; }
.fr-opt-row input { flex: 1; padding: 6px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.fr-opt-row .btn { padding: 4px 9px; font-size: 12px; }
.fr-content-block { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; padding: 6px 4px 0; border-top: 1px dashed var(--border); }
.fr-content-block label { font-size: 12px; }
.fr-content-block textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, monospace; resize: vertical; min-height: 70px; }
.fr-content-block code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 11px; }

/* info-field opsiyonel gorsel/GIF blogu */
.fr-image-block {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px; border: 1px dashed var(--border); border-radius: 8px;
  background: var(--surface-2);
}
.fr-image-row { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; align-items: end; }
.fr-image-row label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.fr-image-row input, .fr-image-row select { padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; background: var(--surface); }
.fr-image-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fr-image-actions .btn { padding: 6px 10px; font-size: 12px; }
.fr-image-preview { max-height: 80px; max-width: 200px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover; }
@media (max-width: 700px) {
  .fr-image-row { grid-template-columns: 1fr; }
}

.form-grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }

/* Fields builder */
.fields-builder {
  border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px;
  background: var(--surface-3); display: flex; flex-direction: column; gap: 10px;
}
.fields-builder-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fields-list { display: flex; flex-direction: column; gap: 8px; }
.field-row {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; position: relative;
}
.field-row .fr-row { display: contents; }
.field-row label { font-size: 12px; gap: 3px; }
.field-row label.check { grid-column: span 1; flex-direction: row; align-items: center; padding-top: 14px; }
.field-row .fr-actions { grid-column: 1 / -1; display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding-top: 4px; border-top: 1px dashed var(--border); }
.field-row .fr-actions .key-info { margin-right: auto; font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace; }
.field-row .fr-icon-btn {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: background var(--tx), color var(--tx);
}
.field-row .fr-icon-btn:hover { background: var(--surface-2); }
.field-row .fr-icon-btn.danger { color: var(--danger-700); border-color: var(--danger-100); }
.field-row .fr-icon-btn.danger:hover { background: var(--danger-50); }
.field-row input[type=text], .field-row select { padding: 7px 9px; font-size: 13px; }

/* Inline forms */
.form-inline {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--surface); padding: 16px; border-radius: var(--r-lg);
  box-shadow: var(--sh-xs); border: 1px solid var(--border);
  margin-top: 12px;
}
.form-inline input {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; flex: 1; min-width: 180px;
  outline: none; transition: border-color var(--tx), box-shadow var(--tx);
}
.form-inline input:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }

/* ============================================================
   PROFILIM
   ============================================================ */
.profile-card {
  background: var(--surface); padding: 24px; border-radius: var(--r-lg);
  box-shadow: var(--sh-xs); border: 1px solid var(--border);
  display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: flex-start;
}
.profile-avatar { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.profile-avatar-wrap {
  width: 128px; height: 128px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--violet-500));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 46px; font-weight: 700; overflow: hidden;
  box-shadow: 0 8px 24px rgba(79,70,229,.32);
}
.profile-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-avatar-actions { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 220px; text-align: center; }
.profile-avatar-actions .btn { width: 150px; }
.profile-info { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.profile-info > div { padding: 8px 0; border-bottom: 1px dashed var(--border-2); }
.profile-info b { color: var(--text-3); font-weight: 600; min-width: 180px; display: inline-block; }

/* ============================================================
   EKIP SOHBET
   ============================================================ */
.team-chat {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-xs); border: 1px solid var(--border);
  display: flex; flex-direction: column;
  height: calc(100vh - 180px); min-height: 400px;
  max-width: 920px; margin: 0 auto; width: 100%;
}
.team-msgs { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.team-msgs .empty { color: var(--text-3); text-align: center; padding: 40px 0; font-size: 14px; }
.team-msg { display: flex; gap: 10px; align-items: flex-start; max-width: 85%; }
.team-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.team-msg-av {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--text-2), var(--text));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; overflow: hidden;
}
.team-msg-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.team-msg-body { background: var(--surface-2); padding: 9px 13px; border-radius: var(--r-md); }
.team-msg.mine .team-msg-body { background: var(--brand-50); border: 1px solid var(--brand-100); }
.team-msg-meta { font-size: 11px; color: var(--text-3); margin-bottom: 2px; }
.team-msg-meta .role { display: inline-block; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); font-size: 10px; margin-left: 5px; }
.team-msg-meta .role.admin { background: var(--warn-100); color: var(--warn-700); }
.team-msg-content { white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.45; }
.team-msg-content a { color: var(--brand-600); }
.team-composer { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.team-composer textarea {
  flex: 1; padding: 10px 13px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; resize: none; font-family: inherit;
  outline: none; transition: border-color var(--tx), box-shadow var(--tx);
}
.team-composer textarea:focus { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(79,70,229,.14); }
.team-composer .btn { align-self: stretch; }

/* ---- Quick replies popup + buton + tablo ---- */
.ch-input-wrap { position: relative; flex: 1; display: flex; flex-direction: column; }
.qr-popup {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  max-height: 240px; overflow-y: auto; z-index: 50;
}
.qr-item { padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--border-2); transition: background var(--tx); }
.qr-item:last-child { border-bottom: 0; }
.qr-item:hover, .qr-item.active { background: var(--brand-50); }
.qr-row1 { display: flex; align-items: center; gap: 8px; }
.qr-shortcut { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; font-weight: 600; color: var(--text); }
.qr-preview { font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr-pill { font-size: 10px; padding: 2px 7px; border-radius: 999px; font-weight: 600; }
.qr-pill.global { background: var(--warn-100); color: var(--warn-700); }
.qr-pill.mine { background: var(--success-100); color: var(--success-700); }
.qr-cell-content { white-space: pre-wrap; word-break: break-word; max-width: 480px; font-size: 13px; line-height: 1.45; }

.qr-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border: 1px solid var(--border);
  background: var(--surface-3); color: var(--text-2);
  border-radius: var(--r-sm); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background var(--tx), border-color var(--tx), color var(--tx);
  align-self: stretch;
}
.qr-btn:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
.qr-btn:active { background: var(--brand-100); }
.qr-btn-ico { font-size: 14px; line-height: 1; }
.qr-btn-lbl { font-weight: 600; }
.qr-empty { padding: 16px; font-size: 13px; color: var(--text-3); text-align: center; }
.qr-empty a { color: var(--brand-600); cursor: pointer; }

/* ============================================================
   TOUCH / IOS
   ============================================================ */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 38px; }
  .btn.small { min-height: 32px; }
  input, textarea, select { font-size: 16px; }
}
.ch-msgs, .conv-items, .team-msgs, .modal-card { -webkit-overflow-scrolling: touch; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Hide info pane on mid-narrow desktops */
@media (max-width: 1180px) {
  .page[data-page="chats"] { grid-template-columns: 300px 1fr; }
  .info-pane { display: none; }
}

/* Tablet & mobile: sidebar becomes a drawer */
@media (max-width: 960px) {
  #app { grid-template-columns: 1fr; }
  body.sidebar-collapsed #app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w); max-width: 86vw;
    transform: translateX(-100%);
    transition: transform var(--tx);
    z-index: 40;
    box-shadow: var(--sh-lg);
  }
  body.mobile-menu-open .sidebar { transform: translateX(0); }
  .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .page-title { font-size: 15px; }
  .live-stat { font-size: 11px; padding: 3px 9px; gap: 6px; }
  .live-stat-pair .lsv > span:first-child { font-size: 12px; }
  .live-stat-pair .lsv small { font-size: 9px; }
  .topbar #me-name { display: none; }
  .topbar .me .role { display: none; }
  .topbar #btn-sound, .topbar #btn-notify, .topbar #btn-logout { padding: 5px 9px; font-size: 11.5px; }
  .modal-card-wide { width: 90%; }
}

/* <720: collapse topbar buttons to icons */
@media (max-width: 720px) {
  .topbar { padding: 0 10px; padding-top: max(0px, env(safe-area-inset-top)); height: var(--topbar-h); }
  .topbar .page-title small { display: none; }
  .topbar #btn-logout { display: inline-flex; }

  /* Sohbetler: tek sutun, conv ile chat-pane arasinda gecis */
  .page { height: calc(100dvh - var(--topbar-h)); }
  .page[data-page="chats"] { grid-template-columns: 1fr; }
  .info-pane { display: none !important; }

  .conv-list { display: flex; }
  .chat-pane { display: none; }
  body.conv-open .conv-list { display: none; }
  body.conv-open .chat-pane { display: flex; }
  .ch-back-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; font-size: 18px; }

  .chat-head { flex-wrap: wrap; padding: 8px 10px; gap: 8px; position: sticky; top: 0; z-index: 10; }
  .ch-info { flex: 1 1 60%; min-width: 0; }
  .ch-title { font-size: 14px; }
  .ch-sub { font-size: 11px; }
  .ch-actions { width: 100%; justify-content: flex-end; gap: 4px; }
  .ch-actions .btn { font-size: 12px; padding: 6px 10px; min-height: 32px; }
  .ch-msgs { padding: 10px; padding-bottom: 14px; }
  .ch-msg { max-width: 88%; font-size: 14px; }
  .ch-msg img { max-width: 240px; }

  .ch-composer { padding: 8px; padding-bottom: max(8px, env(safe-area-inset-bottom)); gap: 6px; align-items: stretch; flex-wrap: wrap; position: sticky; bottom: 0; }
  .ch-input-wrap { flex: 1 1 100%; }
  .ch-composer textarea { width: 100%; min-height: 38px; }
  .ch-composer #ch-send { flex: 0 0 auto; min-height: 38px; }
  .qr-btn { min-height: 38px; padding: 6px 10px; }
  .qr-btn-lbl { display: none; }

  .table { display: block; overflow-x: auto; white-space: nowrap; font-size: 13px; -webkit-overflow-scrolling: touch; }
  .page:not([data-page="chats"]) { padding: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .page-head { flex-wrap: wrap; gap: 8px; }

  .modal { padding: 0; align-items: stretch; }
  .modal-card, .modal-card-wide {
    width: 100%; max-width: 100%;
    min-height: 100dvh; max-height: 100dvh;
    border-radius: 0; padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-top: max(16px, env(safe-area-inset-top));
    overflow-y: auto;
  }
  .modal-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 0; margin: 0; border-top: 1px solid var(--border); }
  .form-grid-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }

  .profile-card { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
  .profile-info b { min-width: 0; display: block; }

  .team-chat { height: calc(100dvh - 160px); border-radius: 0; box-shadow: none; max-width: 100%; border-left: 0; border-right: 0; }

  .qr-popup { max-height: 50vh; }
  .qr-cell-content { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  .conv-item { padding: 12px 14px; }
  .conv-item .name { font-size: 15px; }
}

@media (max-width: 600px) {
  .modal-card-tabs { width: 100%; }
  .tabs-strip .tab-btn { padding: 8px 10px; font-size: 13px; }
  .ql-row { grid-template-columns: 1fr; }
  .ql-row .ql-actions { justify-content: flex-end; }
}

@media (max-width: 480px) {
  .topbar { padding: 0 8px; }
  .topbar .page-title { font-size: 14px; }
  .live-stat { font-size: 10px; padding: 2px 7px; gap: 4px; }
  .live-stat-pair { gap: 4px; }
  .live-stat-pair .lsv > span:first-child { font-size: 11px; }
  .live-stat-pair .lsv small { display: none; }
  .me-avatar { width: 28px; height: 28px; font-size: 11px; }
  .ch-actions .btn { font-size: 11px; padding: 5px 8px; }
  .ch-msg { max-width: 92%; font-size: 14px; padding: 7px 10px; }
  .ch-msg img { max-width: 100%; }
  .conv-filter { grid-template-columns: 1fr; }
  .conv-filter input, .conv-filter select { padding: 9px 11px; min-height: 38px; }
  .chat-head { padding: 6px 8px; }
  .ch-title { font-size: 13px; }
  .login-card { padding: 20px; }
}

@media (max-width: 380px) {
  .topbar .me { gap: 4px; }
  .topbar #btn-sound, .topbar #btn-notify { padding: 4px 7px; font-size: 10px; }
  .live-stat-pair .lsep { display: none; }
  .live-stat { padding: 2px 6px; }
  .qtab { font-size: 11px; padding: 8px 4px; }
  .ch-msg { font-size: 13px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  .topbar { height: 48px; }
  :root { --topbar-h: 48px; }
  .chat-head { padding: 4px 10px; }
  .ch-title { font-size: 13px; }
  .ch-msgs { padding: 6px 10px; }
  .ch-msg { padding: 6px 10px; font-size: 13px; }
  .ch-composer { padding: 6px; }
  .ch-composer textarea { max-height: 80px; }
}

/* =====================================================================
   SITE STUDIO — split-pane modal (modal-site)
   Sol: form sekmeleri  /  Sag: canli widget onizleme iframe'i
   ===================================================================== */

.modal-card.modal-split {
  width: min(1200px, 96vw);
  max-width: 96vw;
  max-height: 92vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ms-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 14px 22px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.ms-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.ms-title-wrap h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ms-version-badge {
  font-size: 11px; font-weight: 600; color: var(--brand-700);
  background: var(--brand-50); padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--brand-200, #c7d2fe);
}
.ms-dirty-badge {
  font-size: 11px; font-weight: 600; color: #b45309;
  background: #fef3c7; padding: 2px 8px; border-radius: 999px;
  border: 1px solid #fde68a;
  animation: ms-dirty-pulse 1.4s ease-in-out infinite;
}
@keyframes ms-dirty-pulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }

.ms-header-actions { display: flex; gap: 6px; }

.ms-split {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.ms-form-pane {
  padding: 8px 22px 18px;
  overflow-y: auto;
  min-width: 0;
  display: flex; flex-direction: column;
}
.ms-form-pane .tabs-strip {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  margin: 0 -22px;
  padding: 0 22px;
}
.ms-form-pane .tabs-body { flex: 1; min-height: 0; }

.ms-preview-pane {
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  border-left: 1px solid var(--border);
  min-width: 0;
  position: relative;
}
.ms-preview-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.65);
  backdrop-filter: blur(6px);
}
.ms-preview-label { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.ms-preview-state {
  margin-left: auto;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 999px;
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
}
.ms-preview-state.is-live { background: #dcfce7; color: #166534; border-color: #86efac; }
.ms-preview-pane .icbtn {
  width: 28px; height: 28px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.ms-preview-pane .icbtn:hover { background: rgba(99,102,241,.1); color: var(--brand-700); border-color: var(--border); }
.ms-preview-pane .ico { width: 14px; height: 14px; }

.ms-preview-frame-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 12px;
}
#ms-preview-iframe {
  flex: 1;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15,23,42,.12);
  min-height: 480px;
  display: block;
}
.ms-preview-empty {
  position: absolute; inset: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.92);
  border-radius: 12px;
  border: 1px dashed var(--border);
  z-index: 2;
  padding: 16px;
  text-align: center;
}
.ms-preview-empty[hidden] { display: none !important; }

.ms-footer {
  border-top: 1px solid var(--border);
  padding: 12px 22px;
  background: var(--surface);
  margin-top: 0;
}
.ms-shortcut-hint { margin-right: auto; }
.ms-shortcut-hint kbd {
  display: inline-block; padding: 1px 6px; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface-2); font-size: 11px; font-family: ui-monospace, monospace;
  color: var(--text-2);
}

/* Test cikti kutusu (origins / recaptcha) */
.test-out {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.test-out .row { display: flex; gap: 8px; align-items: center; }
.test-out .ok  { color: #166534; }
.test-out .err { color: #b91c1c; }

/* History list */
.history-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 360px; overflow-y: auto;
  padding-right: 4px;
}
.history-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 10px; align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}
.history-row .h-ver { font-weight: 700; color: var(--brand-700); font-size: 12px; }
.history-row .h-meta { font-size: 12px; color: var(--text-2); min-width: 0; }
.history-row .h-meta b { color: var(--text); }
.history-row .h-meta .h-date { display: block; font-size: 11px; color: var(--text-3); }
.history-row .h-meta .h-summary { display: block; font-size: 11px; color: var(--text-3); }
.history-row .h-actions { display: flex; gap: 4px; }

/* Embed kod & key display */
.code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
  max-height: 140px; overflow: auto;
}
.key-display {
  font-family: ui-monospace, monospace; font-size: 12px;
  background: var(--surface-2); padding: 4px 8px; border-radius: 6px;
  border: 1px solid var(--border); color: var(--text-2);
}

.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 0; }

/* Field row + sortable: drag/drop gorsel ipuclari */
.fields-list[data-sortable] .field-row,
.fields-list[data-sortable] .ql-row,
.fields-list .field-row,
.fields-list .ql-row {
  position: relative;
}
.field-row[draggable="true"],
.ql-row[draggable="true"] { cursor: default; }
.field-row.is-dragging,
.ql-row.is-dragging { opacity: .45; cursor: grabbing; }
.field-row.is-drop-target,
.ql-row.is-drop-target {
  border-color: var(--brand-500);
  box-shadow: 0 -3px 0 0 var(--brand-500);
}
.fr-grip, .ql-grip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; min-height: 28px;
  letter-spacing: -3px; color: var(--text-3);
  cursor: grab;
  user-select: none;
  font-size: 14px; line-height: 1;
}
.fr-grip:active, .ql-grip:active { cursor: grabbing; }
.ql-icon-prev {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px; padding: 0 6px;
  background: var(--brand-50); color: var(--brand-700);
  border-radius: 6px;
  font-size: 14px; font-weight: 700;
}

/* Inline form-error highlight */
.cfg-input-error,
[data-cfg].cfg-input-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,.18) !important;
}
.cfg-error-msg {
  color: #b91c1c; font-size: 11px; margin-top: 2px;
}

/* Toast bilesseni (success/info/error) */
#toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
  max-width: 360px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-500);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 12px 32px rgba(15,23,42,.18);
  font-size: 13px; color: var(--text);
  pointer-events: auto;
  transform: translateY(8px); opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
  display: flex; gap: 8px; align-items: flex-start;
}
.toast.is-shown { transform: translateY(0); opacity: 1; }
.toast.toast-success { border-left-color: #16a34a; }
.toast.toast-error   { border-left-color: #dc2626; }
.toast.toast-info    { border-left-color: var(--brand-500); }
.toast .toast-x {
  margin-left: auto; cursor: pointer; color: var(--text-3);
  background: transparent; border: 0; font-size: 16px; line-height: 1;
}

/* Icon picker (quick links) */
.icon-picker-wrap { position: relative; }
.icon-picker-grid {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15,23,42,.16);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(6, 28px);
  gap: 4px;
}
.icon-picker-grid button {
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-2); cursor: pointer;
}
.icon-picker-grid button:hover,
.icon-picker-grid button.is-active {
  background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200, #c7d2fe);
}

/* Daha kucuk panel: preview daralir ama yine gorunur */
@media (max-width: 1100px) {
  .modal-card.modal-split { width: 96vw; }
  .ms-split { grid-template-columns: 1fr 320px; }
}
/* Mobil/dar: preview default kapali, toggle ile fullscreen acilir */
@media (max-width: 900px) {
  .modal-card.modal-split { width: 100vw; max-width: 100vw; max-height: 100vh; }
  .ms-split { grid-template-columns: 1fr; }
  .ms-preview-pane { display: none; }
  body.ms-show-preview .ms-preview-pane {
    display: flex;
    position: fixed; inset: 0; z-index: 60;
    border-left: 0;
  }
  body.ms-show-preview .ms-preview-head {
    padding: 12px 14px; background: var(--surface);
  }
  body.ms-show-preview .ms-preview-pane::after {
    content: "";
    position: fixed; inset: 0; z-index: -1;
    background: rgba(0,0,0,.4);
  }
}

@media (max-width: 720px) {
  .modal-card.modal-split { max-height: 100vh; height: 100vh; border-radius: 0; }
  .ms-form-pane { padding: 8px 14px 14px; }
  .ms-form-pane .tabs-strip { margin: 0 -14px; padding: 0 14px; }
  .ms-footer { padding: 10px 14px; flex-wrap: wrap; }
  .ms-shortcut-hint { display: none; }
}

/* ============================================================
   v2 OVERHAUL — Analitik / KB / Otomasyon / Webhooklar / Toast
   ============================================================ */

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-card .kpi-label {
  font-size: 12px;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 600;
}
.kpi-card .kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text, #111827);
}
.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--muted, #6b7280);
}
.kpi-card.success .kpi-value { color: var(--success-600, #059669); }
.kpi-card.warn .kpi-value { color: var(--warn-600, #d97706); }
.kpi-card.danger .kpi-value { color: var(--danger-600, #dc2626); }

/* Charts grid */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 12px;
}
.chart-card {
  padding: 12px 14px 8px;
}
.chart-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #111827);
}
.chart-card canvas {
  width: 100% !important;
  height: 220px !important;
  max-width: 100%;
  display: block;
}
@media (max-width: 700px) {
  .charts-grid { grid-template-columns: 1fr; }
}

/* Generic small input/select */
.input.small, .select.small {
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 6px;
}

/* Toast notifications */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-stack .toast {
  pointer-events: auto;
  background: var(--surface, #fff);
  color: var(--text, #111827);
  border: 1px solid var(--border, #e5e7eb);
  border-left: 4px solid var(--brand-600, #4f46e5);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 240px;
  max-width: 360px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  animation: toast-in .25s ease;
}
.toast-stack .toast.success { border-left-color: var(--success-500, #10b981); }
.toast-stack .toast.error { border-left-color: var(--danger-500, #ef4444); }
.toast-stack .toast.warn { border-left-color: var(--warn-500, #f59e0b); }
@keyframes toast-in {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Command palette (Ctrl+K) */
.cmd-palette {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  z-index: 9000;
}
.cmd-palette[hidden] { display: none !important; }
.cmd-palette .cmd-box {
  background: var(--surface, #fff);
  width: min(560px, 92vw);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  overflow: hidden;
}
.cmd-palette input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
  font-size: 16px;
  padding: 14px 16px;
  outline: none;
}
.cmd-palette ul {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: 60vh;
  overflow: auto;
}
.cmd-palette li {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}
.cmd-palette li:hover, .cmd-palette li.is-active {
  background: var(--brand-50, #eef2ff);
  color: var(--brand-700, #4338ca);
}
.cmd-palette small { color: var(--muted, #6b7280); }

/* Operator status pill (header) */
.op-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--success-100, #d1fae5);
  color: var(--success-700, #047857);
  border: 1px solid var(--success-300, #6ee7b7);
}
.op-status-pill::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success-500, #10b981);
}
.op-status-pill[data-status="away"] { background: var(--warn-100, #fef3c7); color: var(--warn-700, #b45309); border-color: var(--warn-300, #fcd34d); }
.op-status-pill[data-status="away"]::before { background: var(--warn-500, #f59e0b); }
.op-status-pill[data-status="busy"] { background: var(--danger-100, #fee2e2); color: var(--danger-700, #b91c1c); border-color: var(--danger-300, #fca5a5); }
.op-status-pill[data-status="busy"]::before { background: var(--danger-500, #ef4444); }
.op-status-pill[data-status="offline"] { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.op-status-pill[data-status="offline"]::before { background: #9ca3af; }

/* Read-receipts (tikler) */
.msg-receipts {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  color: var(--muted, #6b7280);
  font-size: 12px;
}
.msg-receipts.read { color: var(--brand-500, #6366f1); }

/* Multi-chat tabs (operator panel) */
.multi-chat-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
}
.multi-chat-strip .mc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px 6px 0 0;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text, #111827);
}
.multi-chat-strip .mc-tab.is-active {
  background: var(--brand-50, #eef2ff);
  border-color: var(--brand-200, #c7d2fe);
  border-bottom-color: transparent;
  color: var(--brand-700, #4338ca);
  font-weight: 600;
}
.multi-chat-strip .mc-tab .unread {
  background: var(--danger-500, #ef4444);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
}
.multi-chat-strip .mc-close {
  background: transparent; border: 0; color: var(--muted, #6b7280);
  cursor: pointer; padding: 0 2px;
}

/* Tags pills */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e5e7eb;
  color: #374151;
  margin-right: 4px;
}

/* Sessions list */
.sessions-list .session-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border, #e5e7eb);
}
.sessions-list .session-row.is-current { background: var(--brand-50, #eef2ff); padding: 10px 12px; border-radius: 8px; }

/* ============================================================
   ADMIN DARK MODE — tokens.css'in [data-theme="dark"] kismi ile
   ============================================================ */
[data-theme="dark"] body,
[data-theme="dark"] {
  background: var(--bg) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .topbar,
[data-theme="dark"] .card,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .modal-card-tabs,
[data-theme="dark"] .ms-form-pane,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] .chart-card,
[data-theme="dark"] .toast-stack .toast,
[data-theme="dark"] .cmd-palette .cmd-box {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .table th,
[data-theme="dark"] .table td {
  border-color: var(--border) !important;
  color: var(--text) !important;
}
[data-theme="dark"] .table thead {
  background: var(--surface-hover) !important;
}
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--surface-hover) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .btn.ghost {
  color: var(--text-2) !important;
  border-color: var(--border) !important;
}
[data-theme="dark"] .btn.ghost:hover {
  background: var(--surface-hover) !important;
}
[data-theme="dark"] .nav-item {
  color: var(--text-2);
}
[data-theme="dark"] .nav-item.active {
  color: var(--brand-400);
  background: rgba(99, 102, 241, .15);
}

/* Mobile bottom-nav (admin) */
@media (max-width: 768px) {
  .mobile-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 56px;
    background: var(--surface, #fff);
    border-top: 1px solid var(--border, #e5e7eb);
    display: flex;
    z-index: 50;
    box-shadow: 0 -4px 12px rgba(0,0,0,.08);
  }
  .mobile-bottom-nav button {
    flex: 1;
    background: transparent;
    border: 0;
    color: var(--muted, #6b7280);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    cursor: pointer;
  }
  .mobile-bottom-nav button.is-active {
    color: var(--brand-600, #4f46e5);
  }
  .mobile-bottom-nav .ico { width: 20px; height: 20px; }
  body.has-bottom-nav .shell { padding-bottom: 60px; }
}
