/* ============================================================
   HS GRUP — WhatsApp Otomasyon Paneli
   Tasarım sistemi: "Mission Control" — Checkly ilhamlı, derin lacivert
   zeminler, tek canlı mavi sinyal rengi, kıl payı (hairline) kenarlıklar,
   Inter + JetBrains Mono tipografi. CSS değişkenleriyle açık/koyu tema,
   kenar çubuklu (sidebar) düzen, taşma-güvenli bileşenler.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ---- Yüzeyler: product-light — parlak, temiz "ürün ekranı" hissi ---- */
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-alt: #f7f9fc;
  --surface-hover: #eef1f7;
  --border: #e5e9f0;
  --ink: #041734;          /* Void Navy — birincil metin, marka rengi */
  --muted: #445458;        /* Console Gray */
  --muted-2: #64748b;      /* Slate Mute */
  --primary: #1fae6e;      /* WhatsApp yeşili — başarı/canlı anlamı korunuyor */
  --primary-strong: #0b6b45;
  --primary-soft: #e6f8f0;
  --on-primary: #ffffff;
  --warn: #f59e0b;
  --warn-soft: #fef3e0;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --info: #0075ff;         /* Signal Blue */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(4, 23, 52, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(4, 23, 52, 0.08), 0 4px 6px -4px rgba(4, 23, 52, 0.06);
  --shadow-lg: 0 25px 50px -12px rgba(4, 23, 52, 0.20);
  --sidebar-w: 240px;
  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* ---- Teknolojik aksan katmanı (Canlı Akış, Bağlı Siteler, giriş ekranı
     gibi "mission control" bileşenlerinde kullanılır. --primary anlamı
     (başarı/yeşil) hiçbir yerde değiştirilmedi.) ---- */
  --tech-1: #0075ff;   /* Signal Blue */
  --tech-2: #008ef0;   /* Probe Cyan */
  --tech-3: #22d3ee;   /* parlak siyan — parıltı/packet rengi */
  --tech-gradient: linear-gradient(135deg, var(--tech-1) 0%, var(--tech-2) 100%);
  --tech-glow: 0 0 0 1px rgba(0, 117, 255, 0.14), 0 8px 28px rgba(0, 117, 255, 0.18);
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-border: rgba(255, 255, 255, 0.5);

  /* ---- Void katmanları — koyu temada ve "canlı" sayfalarda kullanılır ---- */
  --void: #041734;
  --orbit: #0f172a;
  --deck: #1a1f36;
}

[data-theme="dark"] {
  --bg: #041734;           /* Void Navy — sayfa zemini */
  --surface: #0f172a;      /* Orbit Slate — kart yüzeyleri */
  --surface-alt: #131b2e;
  --surface-hover: #1a1f36;/* Deck Charcoal — hover / yükseltilmiş panel */
  --border: #1f2a3d;       /* Deep Hull */
  --ink: #ffffff;          /* Pure White */
  --muted: #a7babe;        /* Mist — ikincil metin, HUD okumaları */
  --muted-2: #64748b;      /* Slate Mute — üçüncül/zaman damgası */
  --primary: #4ade80;      /* Status Green */
  --primary-strong: #86efac;
  --primary-soft: rgba(74, 222, 128, 0.14);
  --on-primary: #052e16;
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --info: #4da8ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.45), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.65);
  --tech-1: #2f8dff;
  --tech-2: #22d3ee;
  --tech-3: #38e0f5;
  --tech-gradient: linear-gradient(135deg, var(--tech-1) 0%, var(--tech-2) 100%);
  --tech-glow: 0 0 0 1px rgba(47, 141, 255, 0.22), 0 8px 32px rgba(47, 141, 255, 0.30);
  --glass-bg: rgba(15, 23, 42, 0.55);
  --glass-border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01" on, "cv11" on;
  transition: background-color .2s ease, color .2s ease;
}

* { min-width: 0; } /* flex/grid çocuklarında metin taşmasını önlemenin anahtarı */

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 600; letter-spacing: -0.015em; }
code, .mono { font-family: var(--font-mono); }
a { color: inherit; }

::selection { background: var(--primary-soft); }

/* Klavye odağı her zaman görünür olsun */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

/* ============================================================
   UYGULAMA İSKELETİ: kenar çubuğu + ana içerik
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Kenar çubuğu JS ile (nav.js) sonradan enjekte ediliyor; bu boşluğu
   baştan ayırmazsak, sayfa ilk yüklenirken içerik bir an tam genişlikte
   render olup JS çalışınca aniden sağa "kayar" (kullanıcıların şikayet
   ettiği ani zıplama/kayma budur). CSS bunu JS beklemeden çözer. */
#sidebarRoot { flex-shrink: 0; }
@media (min-width: 901px) {
  #sidebarRoot { width: var(--sidebar-w); min-height: 100vh; }
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
[data-theme="dark"] .sidebar { background: var(--void); }

.sidebar-brand {
  padding: 18px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .logo-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--tech-gradient);
  box-shadow: var(--tech-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  color: #fff;
}
.sidebar-brand .brand-text { min-width: 0; }
.sidebar-brand .brand-title { font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand .brand-sub {
  font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 1px; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  margin: 0 2px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.nav-link .nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
  color: currentColor; opacity: .85;
}
.nav-link .nav-icon svg { width: 17px; height: 17px; stroke: currentColor; }
.nav-link > span:not(.nav-icon):not(.nav-newtab-hint) { flex: 1; }
.nav-newtab-hint { font-size: 11px; opacity: .45; flex-shrink: 0; }
.nav-link:hover { background: var(--surface-hover); color: var(--ink); }
.nav-link.active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 600; }
.nav-link.active::before {
  content: ''; position: absolute; left: -2px; top: 6px; bottom: 6px; width: 2px;
  border-radius: 2px; background: var(--primary);
}
.nav-section-label {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted-2); padding: 16px 14px 6px;
}
.sidebar-nav > .nav-section-label:first-child { padding-top: 4px; }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.sidebar-user .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user .who { min-width: 0; }
.sidebar-user .who .uname { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who .urole { font-size: 11px; color: var(--muted); }
.sidebar-footer-actions { display: flex; gap: 6px; }
.sidebar-footer-actions .btn { flex: 1; }

.mobile-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 45;
}
.mobile-topbar .brand-title { font-weight: 700; font-size: 14px; }
.hamburger-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  width: 36px; height: 36px; font-size: 16px; cursor: pointer; color: var(--ink);
}

.sidebar-backdrop { display: none; }

.main-content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  max-width: 100%;
}

.page-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px 60px;
}
.page-wrap.wide { max-width: none; }
.page-wrap.no-pad { padding: 0; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 20px; }
.page-head .page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    width: 250px;
    transition: left .18s ease;
    box-shadow: none;
  }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .app-shell { flex-direction: column; }
  .mobile-topbar { display: flex; }
  .sidebar-backdrop.open {
    display: block;
    position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 39;
  }
  .page-wrap { padding: 18px 16px 40px; }
}

/* ============================================================
   BUTONLAR
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s, transform .05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.92); }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #452b00; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; width: 32px; }

/* ============================================================
   KARTLAR / BÖLÜMLER
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.section-title { font-size: 15px; font-weight: 650; margin-bottom: 4px; }
.section-desc { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.stat-card .num { font-size: 24px; font-weight: 700; color: var(--primary-strong); font-variant-numeric: tabular-nums; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Oturum kartları grid'i: taşma güvenli */
.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.session-card h3 {
  font-size: 14.5px;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.session-card .card-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Canlı durum noktası — imza animasyonu */
.status-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--muted-2); flex-shrink: 0; display: inline-block;
}
.status-dot.live { background: var(--primary); box-shadow: 0 0 0 0 rgba(31,174,110,.6); animation: pulse-live 1.8s infinite; }
.status-dot.warn { background: var(--warn); }
.status-dot.error { background: var(--danger); }
@keyframes pulse-live {
  0% { box-shadow: 0 0 0 0 rgba(31,174,110,.55); }
  70% { box-shadow: 0 0 0 7px rgba(31,174,110,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,174,110,0); }
}
[data-theme="dark"] .status-dot.live { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
[data-theme="dark"] .status-dot.live { animation: pulse-live-dark 1.8s infinite; }
@keyframes pulse-live-dark {
  0% { box-shadow: 0 0 0 0 rgba(52,211,153,.55); }
  70% { box-shadow: 0 0 0 7px rgba(52,211,153,0); }
  100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
}

.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted-2); display: inline-block; }
.live-dot.on { background: var(--primary); animation: pulse-live 1.8s infinite; }

/* ============================================================
   SUNUCU DURUMU (SAĞ ÜST, KÜÇÜK YÜZDELİK ROZETLER)
   ------------------------------------------------------------
   Önceki tasarımda tam genişlikte bir "uyarı kutusu" vardı; bu kutu
   uyarı çıkıp çıkmadığına göre görünür/gizli oluyor, bu da altındaki
   tüm sayfanın her saniye yeniden ölçülüp kaymasına (layout shift /
   "kasılma" hissi) sebep oluyordu. Yerine, boyutu hiç değişmeyen,
   sadece rengi ve rakamı güncellenen sabit rozetler kullanıyoruz.
   ============================================================ */

.server-vitals { display: flex; gap: 6px; }
.vital-pill {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-variant-numeric: tabular-nums;
  background: var(--surface-alt); border: 1px solid var(--border);
  min-width: 68px; justify-content: center;
  transition: background-color 0.35s ease, border-color 0.35s ease, color 0.35s ease;
}
.vital-label { color: var(--muted); font-weight: 600; }
.vital-value { font-weight: 700; }
.vital-pill[data-level="warn"] { background: var(--warn-soft); border-color: var(--warn); }
.vital-pill[data-level="warn"] .vital-value { color: var(--warn); }
.vital-pill[data-level="crit"] { background: var(--danger-soft); border-color: var(--danger); }
.vital-pill[data-level="crit"] .vital-value { color: var(--danger); }
@media (max-width: 900px) {
  .server-vitals { order: 3; width: 100%; justify-content: flex-start; }
}

/* ============================================================
   SEKME (TAB) SİSTEMİ
   ============================================================ */

.tab-bar { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 10px 14px; font-size: 13px; font-weight: 550; color: var(--muted);
  cursor: pointer; white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--primary-strong); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   MODAL — içerik kendi içinde kaydırılır, sayfa asla kırpılmaz
   ============================================================ */

.modal {
  position: fixed; inset: 0; background: rgba(16,24,40,0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 200;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-wide { max-width: 720px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; margin: 0; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; min-height: 0; }
.btn-close {
  background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted);
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
}
.btn-close:hover { background: var(--surface-hover); color: var(--ink); }

/* ============================================================
   FORM ELEMANLARI
   ============================================================ */

input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input:not([type]), textarea, select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  margin-bottom: 10px;
}
textarea { resize: vertical; min-height: 60px; }
label { font-size: 13px; }
.switch-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 13.5px; }
.switch-row input { width: 16px; height: 16px; margin: 0; }
.hint { font-size: 12px; color: var(--muted); margin: 4px 0 10px; line-height: 1.5; }

.trigger-form input, .trigger-form textarea, #delayInput { margin-bottom: 8px; }
.step-row select, .step-row input, .step-row textarea { margin-bottom: 6px; }

/* ============================================================
   LİSTE ÖĞELERİ (kısayollar, kurallar, sohbetler...)
   ============================================================ */

.trigger-list { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.trigger-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px;
  min-width: 0;
}
.trigger-item > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trigger-item code { background: var(--surface-hover); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ============================================================
   TABLOLAR — geniş tablolar sayfayı bozmadan yatay kayar
   ============================================================ */

.table-scroll { width: 100%; overflow-x: auto; }
table.report-table, table.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px;
}
table.report-table th, table.report-table td,
table.data-table th, table.data-table td {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.report-table td:nth-child(4), table.data-table td.wrap { white-space: normal; }
table.report-table th, table.data-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; }

/* ============================================================
   ROZETLER / ETİKETLER
   ============================================================ */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--radius-full);
  white-space: nowrap;
}
.badge.green { background: var(--primary-soft); color: var(--primary-strong); }
.badge.amber { background: var(--warn-soft); color: #92620a; }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.gray { background: var(--surface-hover); color: var(--muted); }
[data-theme="dark"] .badge.amber { color: var(--warn); }

.type-chip { background: var(--surface-hover); padding: 3px 9px; border-radius: var(--radius-full); font-size: 11.5px; white-space: nowrap; }

/* ============================================================
   TOAST BİLDİRİMLERİ (alert() yerine)
   ============================================================ */

.toast-stack {
  position: fixed; top: 18px; right: 18px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px; max-width: 340px;
}
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--info);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  padding: 11px 14px; font-size: 13px; animation: toast-in .15s ease-out;
}
.toast.success { border-left-color: var(--primary); }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   ORTAK KÜÇÜK YARDIMCILAR
   ============================================================ */

.brand-accent { color: var(--primary-strong); font-weight: 400; }
.empty-note { color: var(--muted); font-size: 13px; padding: 10px 0; }
.nowrap { white-space: nowrap; }

/* ============================================================
   ANA PANEL: oturum grid'i + canlı akış yan paneli
   (index.html tarafında dinamik olarak app.js üretiyor)
   ============================================================ */

.content-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  align-items: start;
}
.sessions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  align-content: start;
}
.activity-feed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  position: sticky;
  top: 20px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.activity-feed h2 {
  font-size: 14px; margin: 0 0 4px; letter-spacing: .2px;
  display: flex; align-items: center; gap: 6px;
}
.activity-feed h2::before { content: "⏱️"; font-size: 13px; }
.activity-feed-hint { font-size: 11px; color: var(--muted); margin: 0 0 12px; }
.activity-feed-hint a { color: var(--primary); text-decoration: none; }
.activity-feed-hint a:hover { text-decoration: underline; }
.activity-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }
.activity-item-new > .activity-item-header { animation: fade-highlight 1.4s ease-out; }
@keyframes fade-highlight { from { background: var(--primary-soft); } to { background: transparent; } }

/* Tıklanınca açılıp kapanan canlı akış kartı */
.activity-item {
  border: 1px solid transparent;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
  transition: border-color .2s ease, background-color .2s ease;
}
.activity-item:last-child { border-bottom: none; }
.activity-item.is-open { border-color: var(--border); background: var(--surface-alt); }
.activity-item-header {
  padding: 8px 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  user-select: none;
}
.activity-item-header:hover { background: var(--surface-hover); }
.activity-item-icon {
  flex: none; width: 18px; height: 18px; margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; border-radius: 50%;
  background: var(--surface-hover); color: var(--muted);
}
.activity-time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 11.5px; margin-top: 2px; }
.activity-msg { flex: 1; min-width: 0; overflow-wrap: break-word; font-weight: 600; line-height: 1.35; }
.activity-caret { flex: none; color: var(--muted); font-size: 9px; transition: transform 0.15s ease; margin-top: 4px; }
.activity-item.is-open .activity-caret { transform: rotate(90deg); }

/* Hata olan olaylar: kırmızı vurgulu ikon + başlık */
.activity-item.is-error .activity-item-icon { background: var(--danger-soft); color: var(--danger); }
.activity-item.is-error .activity-msg { color: var(--danger); }
.activity-item.is-error.is-open { border-color: var(--danger); }

/* Genişletilebilir detay paneli: adım adım iş akışı (timeline) */
.activity-trace {
  display: none;
  margin: 2px 8px 10px 25px;
  padding-left: 14px;
  border-left: 2px solid var(--border);
}
.activity-item.is-open .activity-trace { display: block; }
.activity-trace-step { position: relative; padding: 5px 0 5px 4px; font-size: 12px; color: var(--ink); }
.activity-trace-step::before {
  content: "";
  position: absolute; left: -18px; top: 11px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px var(--surface);
}
.activity-trace-step.status-error::before { background: var(--danger); }
.activity-trace-step.status-info::before { background: var(--primary); }
.activity-trace-step .step-num { color: var(--muted); font-size: 10.5px; font-weight: 700; margin-right: 3px; }
.activity-trace-step b { font-weight: 600; }
.activity-trace-step .step-detail { color: var(--muted); display: block; font-size: 11.5px; margin-top: 2px; line-height: 1.5; }
.activity-trace-step .step-tech {
  display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.tech-badge {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 10.5px; padding: 2px 7px; border-radius: 5px;
  background: var(--surface-hover); border: 1px solid var(--border); color: var(--ink);
  white-space: nowrap;
}
.tech-badge.tech-badge-error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.activity-error-box {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.activity-error-box .error-box-title {
  font-weight: 700; color: var(--danger); margin-bottom: 4px;
  display: flex; align-items: center; gap: 5px;
}
.activity-error-box .error-row { padding: 2px 0; display: flex; gap: 6px; }
.activity-error-box .error-row b { color: var(--ink); flex: none; min-width: 78px; font-weight: 600; }
.activity-error-box .error-row span { color: var(--ink); overflow-wrap: anywhere; }
.activity-error-box .error-row.reason span { color: var(--danger); font-weight: 600; }

.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 11.5px; font-weight: 650; color: white; margin-bottom: 4px;
}
.status-bagli { background: var(--primary); }
.status-qr_bekleniyor { background: var(--warn); color: #452b00; }
.status-baglaniyor, .status-baslatiliyor { background: var(--info); }
.status-durduruldu { background: var(--muted-2); }
.status-koptu, .status-hata { background: var(--danger); }

.mini-badge { display: inline-block; background: var(--surface-hover); color: var(--muted); font-size: 10.5px; padding: 2px 8px; border-radius: 10px; margin: 3px 4px 0 0; }
.mini-badge-ok { background: var(--primary-soft); color: var(--primary-strong); }
.mini-badge-err { background: var(--danger-soft); color: var(--danger); }

/* ---- Sekmeler (eski .tabs adı korunuyor, app.js/html bunu kullanıyor) ---- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }

/* ---- Canlı log kutusu ---- */
.log-box {
  background: #0b1210; color: #63e6a3;
  padding: 12px; height: 300px; overflow-y: auto;
  font-size: 12px; font-family: var(--font-mono);
  border-radius: var(--radius-sm); white-space: pre-wrap;
  border: 1px solid var(--border);
}

/* ---- Adım oluşturucu (kısayol/zamanlama/toplu gönderim) ---- */
.step-builder { margin-bottom: 8px; display: flex; flex-direction: column; gap: 6px; }
.step-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.step-row select, .step-row input, .step-row textarea { flex: 1; min-width: 120px; margin-bottom: 0; }
.step-actions { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* ---- QR kodu modalı ---- */
.qr-image { width: 100%; max-width: 300px; display: block; margin: 14px auto; border-radius: var(--radius-sm); }
.qr-countdown-wrap { margin-top: 10px; }
.qr-countdown-bar { height: 6px; background: var(--primary); border-radius: 4px; width: 100%; transition: width .25s linear; }
.qr-countdown-text { display: block; text-align: center; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---- Medya listesi ---- */
.media-list { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.media-chip {
  background: var(--surface-alt); border: 1px solid var(--border);
  padding: 6px 10px; border-radius: var(--radius-sm); font-size: 12.5px;
  display: flex; align-items: center; gap: 8px; max-width: 220px;
}
.media-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-chip button { border: none; background: none; color: var(--danger); cursor: pointer; font-weight: 700; flex-shrink: 0; }

.scheduled-list { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.broadcast-result { margin-top: 12px; font-size: 13px; background: var(--surface-alt); padding: 10px 12px; border-radius: var(--radius-sm); min-height: 20px; }

/* ---- Geçmiş (Activity) sayfası tablosu ---- */
.history-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.history-toolbar select { max-width: 220px; margin-bottom: 0; }
.history-count { color: var(--muted); font-size: 13px; margin-left: auto; }
.history-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
.history-table th, .history-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.history-table th { background: var(--surface-alt); position: sticky; top: 0; font-size: 11.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
.history-table tr:last-child td { border-bottom: none; }

/* ============================================================
   MOBİL UYUM
   ============================================================ */
@media (max-width: 900px) {
  .content-layout { grid-template-columns: 1fr; }
  .activity-feed { position: static; max-height: 320px; }
  .sessions-grid { grid-template-columns: 1fr; }
  .modal-box, .modal-wide { max-width: 94vw; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .tabs, .tab-bar { flex-wrap: nowrap; }
  .tab-btn { font-size: 12px; padding: 9px 10px; }
  .step-row { flex-wrap: wrap; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   OTURUM DETAY MODALI — geniş, dikey sekme raylı çalışma alanı
   ============================================================ */

.modal-session {
  width: 94vw;
  max-width: 1080px;
  height: 86vh;
  max-height: 780px;
}
.session-modal-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.session-tab-rail {
  width: 196px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  background: var(--surface-alt);
}
.session-tab-rail .tab-btn {
  justify-content: flex-start;
  text-align: left;
  border: none;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  width: 100%;
}
.session-tab-rail .tab-btn:hover { background: var(--surface-hover); }
.session-tab-rail .tab-btn.active {
  border-left-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-strong);
}
.session-tab-rail .tab-icon { margin-right: 9px; }
.session-tab-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 22px 26px;
}
.session-tab-content h3 { font-size: 14px; margin: 18px 0 10px; }
.session-tab-content .card { background: var(--surface-alt); }

@media (max-width: 760px) {
  .modal-session { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }
  .session-modal-body { flex-direction: column; }
  .session-tab-rail {
    width: 100%; flex-direction: row; overflow-x: auto; overflow-y: hidden;
    border-right: none; border-bottom: 1px solid var(--border);
  }
  .session-tab-rail .tab-btn { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; flex-shrink: 0; }
  .session-tab-rail .tab-btn.active { border-left-color: transparent; border-bottom-color: var(--primary); }
  .session-tab-content { padding: 16px; }
}

/* ============================================================
   ÇALIŞMA ALANLARI (birden fazla bağlantıyı gruplayan görünüm)
   ============================================================ */

.workspace-list { display: flex; flex-direction: column; gap: 22px; }
.workspace-group {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.workspace-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.workspace-header h3 { font-size: 15px; margin: 0; display: flex; align-items: center; gap: 8px; }
.workspace-header .ws-count { font-size: 12px; color: var(--muted); font-weight: 500; }
.workspace-header .ws-actions { display: flex; gap: 6px; }

.platform-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 650; padding: 2px 8px; border-radius: var(--radius-full);
  background: var(--surface-hover); color: var(--muted);
}
.platform-badge.whatsapp { background: #e6f8ee; color: #128c4a; }
.platform-badge.telegram { background: #e5f2ff; color: #1c7ed6; }
[data-theme="dark"] .platform-badge.whatsapp { background: rgba(31,174,110,.16); color: #34d399; }
[data-theme="dark"] .platform-badge.telegram { background: rgba(28,126,214,.18); color: #60a5fa; }

/* ============================================================
   BAĞLANTI EKLEME MODALI: platform seçici
   ============================================================ */

.platform-picker { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.platform-choice {
  flex: 1; min-width: 120px;
  padding: 12px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.platform-choice:hover:not(:disabled) { background: var(--surface-hover); }
.platform-choice.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-strong); }
.platform-choice:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   TEKNOLOJİK AKSAN — GENEL YARDIMCI SINIFLAR
   Sadece opt-in: hiçbir mevcut bileşen bunları otomatik miras almaz,
   sayfalar bilinçli olarak class="gradient-text" vb. ekleyerek kullanır.
   ============================================================ */

.gradient-text {
  background: var(--tech-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tech-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.tech-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--tech-gradient);
  opacity: 0; transition: opacity .2s ease;
}
.tech-card:hover::before { opacity: 1; }

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
}

.dot-pulse {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: var(--tech-3); box-shadow: 0 0 0 0 rgba(6,182,212,.6);
  animation: dotPulseRing 1.8s infinite;
}
@keyframes dotPulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(6,182,212,.55); }
  70%  { box-shadow: 0 0 0 9px rgba(6,182,212,0); }
  100% { box-shadow: 0 0 0 0 rgba(6,182,212,0); }
}
