/* BT Asistan — arayüz (Control Center görsel dili) */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary-ring); outline-offset: 2px; border-radius: 8px; }
kbd { font-family: var(--font-mono); font-size: 10px; padding: 1px 5px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted); background: var(--bg-card); }

/* ---------- Genel butonlar ---------- */
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.btn-primary, .btn-primary-sm {
  border: 0; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { height: 44px; width: 100%; font-size: var(--text-md); }
.btn-primary-sm { height: 34px; padding: 0 12px; font-size: var(--text-base); }
.btn-primary-sm svg { width: 15px; height: 15px; }
.btn-primary:hover, .btn-primary-sm:hover { filter: brightness(1.08); }
.btn-ghost-sm {
  height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-2); font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
}
.btn-ghost-sm:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Yerleşim ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

/* ---------- Kenar çubuğu ---------- */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  transition: margin-left .22s ease, transform .22s ease;
  z-index: 40;
}
.app.sb-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 14px; height: var(--topbar-h); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-weight: 700; font-size: var(--text-md); letter-spacing: -.01em; }
.brand-mark {
  /* Logo: Kalkan İmleç — kalkan metin renginde, istem (>_) marka mavisinde */
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  color: var(--text); --logo-accent: var(--primary);
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-mark--lg { width: 52px; height: 52px; }
.brand-mark--lg svg { width: 48px; height: 48px; }
:root[data-theme="dark"] .brand-mark { --logo-accent: #78b8ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-mark { --logo-accent: #78b8ff; } }

.sb-new {
  margin: 6px 10px 8px; height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  font-weight: 600; font-size: var(--text-md); box-shadow: var(--shadow-sm);
}
.sb-new:hover { border-color: var(--primary); }
.sb-new svg { width: 16px; height: 16px; color: var(--primary); }
.sb-new kbd { margin-left: auto; }

.sb-nav { display: flex; flex-direction: column; gap: 1px; padding: 0 8px; }
.sb-sect { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; }
.sb-sect:first-of-type { padding-top: 6px; }
/* Misafirde üyelere özel menü öğeleri gizli (görünürlük; yetki sunucuda) */
html:not(.is-auth) [data-member] { display: none !important; }
.sb-link {
  display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 10px; border-radius: 9px;
  color: var(--text-2); text-decoration: none; font-size: var(--text-md); border: 0; background: transparent; text-align: left; width: 100%;
}
.sb-link:hover { background: var(--bg-hover); color: var(--text); }
.sb-link svg { width: 16px; height: 16px; color: var(--muted); }
.sb-count { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.sb-tag { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }

.sb-search { margin: 8px 10px 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-card); }
.sb-search svg { width: 15px; height: 15px; color: var(--muted); }
.sb-search input { flex: 1; border: 0; background: transparent; outline: none; font-size: var(--text-base); min-width: 0; }

.sb-history { flex: 1; overflow-y: auto; padding: 10px 8px; margin-top: 6px; border-top: 1px solid var(--border); }
.sb-group { font-size: var(--text-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.sb-item {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 0 6px 0 10px; border-radius: 9px;
  border: 0; background: transparent; text-align: left; font-size: var(--text-base); color: var(--text-2);
}
.sb-item:hover, .sb-item.is-active { background: var(--bg-hover); color: var(--text); }
.sb-item.is-active { font-weight: 600; }
.sb-item-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item-del { opacity: 0; width: 26px; height: 26px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.sb-item:hover .sb-item-del, .sb-item:focus-within .sb-item-del { opacity: 1; }
.sb-item-del:hover { color: var(--danger); background: var(--danger-soft); }
.sb-item-del svg { width: 14px; height: 14px; }
.sb-empty { padding: 16px 10px; font-size: var(--text-sm); color: var(--muted); line-height: 1.5; }
.sb-clear { margin: 8px 10px 0; border: 0; background: transparent; color: var(--muted); font-size: var(--text-sm); text-decoration: underline; padding: 4px 0; }
.sb-clear:hover { color: var(--danger); }

.risk-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--border-strong); }
.risk-dot--danger { background: var(--danger); }
.risk-dot--warn { background: var(--warn); }
.risk-dot--safe { background: var(--safe); }

.sb-foot { padding: 10px; border-top: 1px solid var(--border); }
.guest-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.guest-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bg-block); border: 1px solid var(--border); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.guest-avatar svg { width: 16px; height: 16px; }
.guest-meta { flex: 1; min-width: 0; }
.guest-name { font-weight: 600; font-size: var(--text-md); }
.guest-sub { font-size: var(--text-xs); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.scrim { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 35; }

/* ---------- Üst çubuk + sekmeler (Control Center) ---------- */
.topbar {
  height: var(--topbar-h); flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 8px;
  background: var(--bg-topbar); border-bottom: 1px solid var(--border);
}
.sb-open { display: none; }
.app.sb-collapsed .sb-open { display: inline-flex; }
.tabbar { flex: 1; min-width: 0; display: flex; align-items: stretch; gap: 4px; height: 100%; padding-top: 8px; }
.tab-strip { display: flex; align-items: stretch; gap: 4px; min-width: 0; height: 100%; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tab-strip::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; height: 100%; padding: 0 6px 0 12px; width: 200px; min-width: 140px; flex-shrink: 1;
  border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; background: transparent; cursor: pointer; user-select: none;
  color: var(--muted); font-size: var(--text-base); font-weight: 600; position: relative; top: 1px;
}
.tab svg { width: 15px; height: 15px; flex-shrink: 0; }
.tab:hover { color: var(--text); background: var(--bg-hover); }
.tab.is-active { background: var(--bg); border-color: var(--border); color: var(--text); }
.tab:not(.is-active):not(:hover) + .tab:not(.is-active):not(:hover)::before { content: ""; position: absolute; left: -3px; top: 25%; height: 50%; width: 1px; background: var(--border); }
.tab-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-close { width: 24px; height: 24px; flex-shrink: 0; border: 0; border-radius: 6px; padding: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; opacity: .55; }
.tab:hover .tab-close, .tab.is-active .tab-close, .tab-close:focus-visible { opacity: 1; }
.tab-close svg { width: 13px; height: 13px; }
.tab-close:hover { background: var(--bg-hover); color: var(--text); }
.tab .risk-dot { width: 8px; height: 8px; margin: 0 3px; }
.tab-new { flex-shrink: 0; width: 32px; height: 32px; align-self: center; margin-left: 2px; }
.view[hidden] { display: none !important; }
#view-news, #view-osint, #view-ioc, #view-dm, #view-phish, #view-incidents, #view-incident, #view-lab, #view-labsess, #view-malware { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.ic-moon { display: none; }
:root[data-theme="dark"] .ic-sun { display: none; }
:root[data-theme="dark"] .ic-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ic-sun { display: none; }
  :root:not([data-theme="light"]) .ic-moon { display: block; }
}

/* ---------- ANA SAYFA: gökyüzü hero ---------- */
.home { flex: 1; min-height: 0; overflow-y: auto; background: var(--sky); }
.hero { max-width: 820px; margin: 0 auto; padding: clamp(28px, 8vh, 84px) 20px 18px; text-align: center; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
  background: rgba(29, 78, 216, .28); border: 1px solid rgba(255,255,255,.4); color: var(--hero-text);
  font-size: var(--text-sm); font-weight: 600; backdrop-filter: blur(6px);
}
:root[data-theme="dark"] .hero-badge { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.3); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(74,222,128,0); } }
.hero h1 {
  margin: 0 0 10px; font-size: clamp(1.45rem, 3.4vw, 2rem); font-weight: 650; line-height: 1.3;
  letter-spacing: -.02em; color: var(--hero-text); text-shadow: var(--hero-shadow);
}
.hero-sub { margin: 0 auto 26px; max-width: 560px; color: var(--hero-sub); font-size: var(--text-lg); text-shadow: var(--hero-shadow); }

/* ---------- Composer kartı (ortak) ---------- */
.composer-card {
  background: var(--bg-card); border-radius: 20px; padding: 6px; text-align: left;
  box-shadow: var(--shadow-lg); border: 1px solid transparent; transition: border-color .15s, box-shadow .15s;
}
:root[data-theme="dark"] .composer-card { border-color: var(--border); }
.composer-card:focus-within { border-color: var(--primary-ring); }
.composer-card textarea {
  display: block; width: 100%; border: 0; outline: none; resize: none; background: transparent;
  padding: 12px 12px 6px; font-size: var(--text-xl); line-height: 1.5; color: var(--text);
  min-height: 84px; max-height: 240px;
}
.composer-card textarea::placeholder { color: var(--muted); }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 4px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.hint { font-size: var(--text-sm); color: var(--muted); margin-right: 6px; white-space: nowrap; }
.mode-btn {
  height: 32px; display: inline-flex; align-items: center; gap: 4px; padding: 0 8px 0 11px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--text-2); font-size: var(--text-base); font-weight: 600;
}
.mode-btn svg { width: 14px; height: 14px; color: var(--muted); }
.mode-btn:hover, .mode-btn[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); }
.mode-btn.is-set { background: var(--primary-soft); border-color: transparent; color: var(--primary-deep); }
.detect-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 999px;
  background: var(--bg-block); color: var(--muted); font-size: var(--text-sm); font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; animation: fade-in .2s ease;
}
.detect-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.send-btn {
  width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
  transition: transform .12s, opacity .12s;
}
.send-btn:hover:not(:disabled) { transform: scale(1.05); }
.send-btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.send-btn .ic-stop { display: none; }
.send-btn.is-stop { background: var(--text); color: var(--bg-card); box-shadow: none; }
.send-btn.is-stop .ic-send { display: none; }
.send-btn.is-stop .ic-stop { display: block; }

/* ---------- Hızlı başlangıç çipleri ---------- */
.pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--pill-border); background: var(--pill-bg); color: var(--text-2);
  font-size: var(--text-base); font-weight: 600; box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.pill:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(15, 23, 42, .1); border-color: var(--primary); color: var(--primary-deep); }
.pill-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.pd-news { background: linear-gradient(135deg, var(--primary), var(--violet)); }
.pd-ioc { background: linear-gradient(135deg, #f59e0b, #dc2626); }
.pd-link { background: linear-gradient(135deg, #dc2626, var(--violet)); }
.pd-cve { background: linear-gradient(135deg, #f97316, #e11d48); }
.pd-osint { background: linear-gradient(135deg, #059669, var(--cyan)); }
.pd-leak { background: linear-gradient(135deg, var(--cyan), var(--primary)); }

/* ---------- Ana sayfa liste kartı ---------- */
.list-wrap { max-width: 1000px; margin: 0 auto; padding: 22px 20px 28px; }
.list-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.list-tabs { display: flex; gap: 4px; padding: 10px 14px 0; border-bottom: 1px solid var(--border); }
.list-tab {
  display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; border: 0; background: transparent;
  color: var(--muted); font-size: var(--text-base); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.list-tab svg { width: 15px; height: 15px; }
.list-tab.is-active { color: var(--text); border-bottom-color: var(--primary); }
.list-tab:hover { color: var(--text); }
.news-row, .recent-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; width: 100%; padding: 14px 18px;
  border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; color: inherit;
}
.news-row:last-child, .recent-row:last-child { border-bottom: 0; }
.news-row:hover, .recent-row:hover { background: var(--bg-block); }
.news-tag { font-size: var(--text-xs); font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; text-transform: uppercase; letter-spacing: .03em; }
.news-tag--danger { background: var(--danger-soft); color: var(--danger); }
.news-tag--warn { background: var(--warn-soft); color: var(--warn); }
.news-tag--info { background: var(--primary-soft); color: var(--primary-deep); }
.news-title { font-weight: 600; font-size: var(--text-md); color: var(--text); line-height: 1.4; }
.news-meta { font-size: var(--text-sm); color: var(--muted); margin-top: 3px; }
.news-cta { font-size: var(--text-sm); font-weight: 600; color: var(--primary); white-space: nowrap; }
.list-empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: var(--text-md); }

.legal { font-size: var(--text-sm); color: var(--muted); text-align: center; margin: 14px 0 0; }
.legal a { color: var(--muted); }
.legal--dock { margin: 8px 0 0; font-size: var(--text-xs); }

/* ---------- SOHBET ---------- */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.agent-bar {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px; flex-shrink: 0;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.agent-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.agent-avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.agent-titles { min-width: 0; }
.agent-title { font-weight: 700; font-size: var(--text-lg); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-sub { font-size: var(--text-sm); color: var(--muted); }
.agent-conn { display: flex; gap: 6px; }
.conn-pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.conn-ok { border-color: var(--safe-line); color: var(--safe); background: var(--safe-soft); }
.conn-warn { border-color: var(--warn-line); color: var(--warn); background: var(--warn-soft); }
.agent-actions { display: flex; gap: 2px; }
.pop-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 6px); width: 280px; z-index: 30;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 10px;
}
.popover-head { font-weight: 700; font-size: var(--text-base); padding: 2px 4px 8px; }
.popover-foot { font-size: var(--text-xs); color: var(--muted); padding: 8px 4px 0; border-top: 1px solid var(--border); margin-top: 6px; }
.health-list { list-style: none; margin: 0; padding: 0; }
.health-list li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: var(--text-base); }
.health-list li span:nth-child(2) { flex: 1; }
.health-list .ms { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); }

.thread { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.thread-inner { max-width: 780px; margin: 0 auto; padding: 24px 20px 12px; display: flex; flex-direction: column; gap: 22px; }

.msg { display: flex; gap: 12px; animation: fade-in .22s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.msg--user { justify-content: flex-end; }
.msg--user .bubble {
  max-width: min(78%, 600px); background: var(--bubble-user); color: var(--bubble-user-text);
  padding: 10px 15px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; word-break: break-word; font-size: var(--text-lg);
}
.msg--user .bubble.mono { font-family: var(--font-mono); font-size: var(--text-base); }
.msg--user .att { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-sm); opacity: .9; margin-bottom: 6px; padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,.15); }
.msg--user .att svg { width: 14px; height: 14px; }
.msg--bot .bot-ava { width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.msg--bot .bot-ava svg { width: 16px; height: 16px; }
.bot-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

/* Asistan metni (markdown) */
.md { font-size: var(--text-lg); line-height: 1.65; color: var(--text); word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md h3, .md h4 { font-size: var(--text-lg); font-weight: 700; margin: 1.1em 0 .4em; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.4em; }
.md li { margin: .2em 0; }
.md code { font-family: var(--font-mono); font-size: .85em; padding: .12em .4em; border-radius: 6px; background: var(--bg-block); border: 1px solid var(--border); }
.md pre { margin: 0 0 .8em; padding: 12px 14px; border-radius: 10px; background: var(--bg-block); border: 1px solid var(--border); overflow-x: auto; }
.md pre code { padding: 0; border: 0; background: none; font-size: var(--text-base); }
.md a { color: var(--primary); text-underline-offset: 2px; }
.md blockquote { margin: 0 0 .7em; padding: 2px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md .tbl { overflow-x: auto; margin: 0 0 .8em; border: 1px solid var(--border); border-radius: 10px; }
.md table { border-collapse: collapse; width: 100%; font-size: var(--text-base); }
.md th, .md td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.md th { background: var(--bg-block); font-weight: 700; font-size: var(--text-sm); color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.md tr:last-child td { border-bottom: 0; }
.md .ac { text-align: center; } .md .ar { text-align: right; }
.caret::after { content: ""; display: inline-block; width: 8px; height: 1.1em; margin-left: 2px; vertical-align: text-bottom; background: var(--primary); border-radius: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Agent trace (Control Center "düşünüyor" satırı) */
.trace { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); overflow: hidden; max-width: 560px; }
.trace-toggle { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border: 0; background: transparent; text-align: left; color: var(--text-2); }
.trace-toggle:hover { background: var(--bg-hover); }
.trace-spin { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.trace-ok { color: var(--safe); width: 15px; height: 15px; }
.trace.is-done .trace-spin { display: none; }
.trace:not(.is-done) .trace-ok { display: none; }
.trace-sum { flex: 1; min-width: 0; font-weight: 600; font-size: var(--text-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trace:not(.is-done) .trace-sum { background: linear-gradient(90deg, var(--text-2) 0%, var(--muted) 40%, var(--text-2) 80%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.trace-count { font-size: var(--text-xs); color: var(--muted); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border); }
.trace-chev { width: 15px; height: 15px; color: var(--muted); transition: transform .15s; }
.trace[data-open="1"] .trace-chev { transform: rotate(180deg); }
.trace-body { display: none; flex-direction: column; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--border); background: var(--bg-block); }
.trace[data-open="1"] .trace-body { display: flex; }
.trace-step { display: flex; align-items: flex-start; gap: 9px; padding: 7px 9px; border-radius: 8px; background: var(--bg-card); border-left: 3px solid var(--border); font-size: var(--text-base); }
.trace-step--done { border-left-color: var(--safe); }
.trace-step--run { border-left-color: var(--warn); }
.trace-step--err { border-left-color: var(--danger); }
.trace-step-t { flex: 1; color: var(--text-2); }
.trace-step-ms { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); }

/* Risk sonuç kartı */
.rcard-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rcard-actions .btn-soft { text-decoration: none; }
.rcard { border: 1px solid var(--border); border-radius: 16px; background: var(--bg-card); overflow: hidden; box-shadow: var(--shadow-sm); max-width: 640px; }
.rcard--danger { border-color: var(--danger-line); }
.rcard--warn { border-color: var(--warn-line); }
.rcard--safe { border-color: var(--safe-line); }
.rcard-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; flex-wrap: wrap; }
.risk-badge { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px; font-size: var(--text-base); font-weight: 700; }
.risk-badge svg { width: 15px; height: 15px; }
.risk-badge--danger { background: var(--danger-soft); color: var(--danger); }
.risk-badge--warn { background: var(--warn-soft); color: var(--warn); }
.risk-badge--safe { background: var(--safe-soft); color: var(--safe); }
.rcard-module { font-size: var(--text-sm); color: var(--muted); font-weight: 600; }
.rcard-score { margin-left: auto; display: flex; align-items: baseline; gap: 2px; font-weight: 700; font-size: 1.35rem; letter-spacing: -.02em; }
.rcard-score small { font-size: var(--text-sm); color: var(--muted); font-weight: 600; }
.rcard-bar { margin: 10px 16px 0; height: 6px; border-radius: 999px; background: var(--bg-block); overflow: hidden; }
.rcard-bar i { display: block; height: 100%; border-radius: inherit; width: 0; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.rcard--danger .rcard-bar i { background: var(--danger); }
.rcard--warn .rcard-bar i { background: var(--warn); }
.rcard--safe .rcard-bar i { background: var(--safe); }
.rcard--danger .rcard-score { color: var(--danger); }
.rcard--warn .rcard-score { color: var(--warn); }
.rcard--safe .rcard-score { color: var(--safe); }
.rcard-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.rcard-title { font-size: 1.05rem; font-weight: 700; line-height: 1.35; margin: 0; }
.rcard-target { font-family: var(--font-mono); font-size: var(--text-base); padding: 8px 11px; border-radius: 9px; background: var(--bg-block); border: 1px solid var(--border); color: var(--text-2); word-break: break-all; user-select: all; }
.rcard-summary { margin: 0; color: var(--text-2); font-size: var(--text-md); line-height: 1.6; }
.rcard-advice { display: flex; gap: 10px; padding: 11px 13px; border-radius: 11px; font-size: var(--text-md); line-height: 1.5; }
.rcard-advice svg { width: 17px; height: 17px; margin-top: 1px; }
.rcard-advice b { display: block; font-size: var(--text-sm); margin-bottom: 2px; }
.rcard--danger .rcard-advice { background: var(--danger-soft); color: var(--text); } .rcard--danger .rcard-advice svg, .rcard--danger .rcard-advice b { color: var(--danger); }
.rcard--warn .rcard-advice { background: var(--warn-soft); color: var(--text); } .rcard--warn .rcard-advice svg, .rcard--warn .rcard-advice b { color: var(--warn); }
.rcard--safe .rcard-advice { background: var(--safe-soft); color: var(--text); } .rcard--safe .rcard-advice svg, .rcard--safe .rcard-advice b { color: var(--safe); }
.rcard-more { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--primary); font-weight: 600; font-size: var(--text-base); padding: 4px 0; min-height: 32px; }
.rcard-more svg { width: 15px; height: 15px; transition: transform .15s; }
.rcard-more[aria-expanded="true"] svg { transform: rotate(180deg); }
.rcard-details { margin: 0; display: grid; grid-template-columns: minmax(110px, 38%) 1fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: var(--text-base); }
.rcard-details dt, .rcard-details dd { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.rcard-details dt { color: var(--muted); background: var(--bg-block); font-weight: 600; }
.rcard-details dd { font-family: var(--font-mono); font-size: var(--text-sm); word-break: break-word; }
.rcard-details dt:nth-last-child(2), .rcard-details dd:last-child { border-bottom: 0; }
.rcard-news { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--border-strong); text-decoration: none; color: var(--text); font-size: var(--text-base); }
.rcard-news:hover { border-color: var(--primary); }
.rcard-news svg { color: var(--primary); }
.rcard-news span { flex: 1; min-width: 0; }
.rcard-news small { display: block; color: var(--muted); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }

/* Mesaj araçları */
.msg-tools { display: flex; gap: 2px; margin-left: -6px; opacity: .85; }
.msg-tools .icon-btn { width: 32px; height: 32px; border-radius: 8px; }
.msg-tools .icon-btn svg { width: 16px; height: 16px; }
.msg-tools .icon-btn.is-on { color: var(--primary); }
.msg-tools .why-btn { width: auto; padding: 0 10px; gap: 6px; font-size: var(--text-sm); font-weight: 600; }

/* Takip önerileri */
.followups { display: flex; flex-wrap: wrap; gap: 8px; }
.followup { min-height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-2); font-size: var(--text-base); font-weight: 500; text-align: left; }
.followup:hover { border-color: var(--primary); color: var(--primary); }

.err-box { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border-radius: 11px; background: var(--danger-soft); color: var(--text); font-size: var(--text-md); }
.err-box svg { color: var(--danger); margin-top: 2px; }
.err-box button { margin-left: auto; }

/* Alt composer */
.composer-dock { position: relative; flex-shrink: 0; max-width: 820px; width: 100%; margin: 0 auto; padding: 6px 20px 12px; }
.dock-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px 6px; }
.model-picker { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-card); color: var(--muted); }
.model-picker svg { width: 14px; height: 14px; }
.model-picker select { border: 0; background: transparent; outline: none; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); padding-right: 4px; }
.agent-status { display: inline-flex; align-items: center; gap: 7px; font-size: var(--text-sm); color: var(--muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--safe); }
.status-dot.is-busy { background: var(--warn); animation: pulse-w 1.2s ease-in-out infinite; }
@keyframes pulse-w { 50% { opacity: .35; } }
.composer-card--dock { border-radius: 18px; box-shadow: var(--shadow); border-color: var(--border); }
.composer-card--dock textarea { min-height: 52px; padding: 11px 12px 4px; font-size: var(--text-lg); }
.jump-btn { position: absolute; top: -46px; left: 50%; transform: translateX(-50%); width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-2); box-shadow: var(--shadow); display: inline-flex; align-items: center; justify-content: center; }
.attach-strip { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 6px 8px; }
.att-chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 6px 0 10px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-card); font-size: var(--text-sm); font-weight: 600; max-width: 280px; }
.att-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-chip small { color: var(--muted); font-weight: 500; }
.att-chip svg { width: 14px; height: 14px; color: var(--muted); }
.att-chip button { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.att-chip button:hover { background: var(--bg-hover); }

/* Analiz türü menüsü */
.menu { position: fixed; z-index: 60; width: 270px; padding: 6px; border-radius: 14px; background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: fade-in .14s ease; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-hover); }
.menu-item .pill-dot { box-shadow: none; }
.menu-item b { display: block; font-size: var(--text-md); font-weight: 600; }
.menu-item small { display: block; font-size: var(--text-sm); color: var(--muted); }
.menu-item .menu-check { margin-left: auto; color: var(--primary); width: 16px; height: 16px; visibility: hidden; }
.menu-item[aria-selected="true"] .menu-check { visibility: visible; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(15, 23, 42, .5); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade-in .15s ease; }
.modal { position: relative; width: 100%; max-width: 400px; padding: 28px 24px 22px; border-radius: 20px; background: var(--bg-card); box-shadow: var(--shadow-lg); text-align: center; }
.modal-x { position: absolute; top: 10px; right: 10px; }
.modal h2 { margin: 14px 0 6px; font-size: 1.2rem; letter-spacing: -.01em; }
.modal-sub { margin: 0 0 18px; color: var(--muted); font-size: var(--text-md); }
.btn-oauth { width: 100%; height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-card); font-weight: 600; }
.btn-oauth:hover { background: var(--bg-hover); }
.btn-oauth svg { stroke: none; }
.modal-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: var(--text-sm); }
.modal-or::before, .modal-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.modal-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.modal-form label { display: flex; flex-direction: column; gap: 5px; font-size: var(--text-sm); font-weight: 600; color: var(--text-2); }
.modal-form input { height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); outline: none; font-size: var(--text-md); }
.modal-form input:focus { border-color: var(--primary); }
.modal-foot { margin: 14px 0 0; font-size: var(--text-sm); color: var(--muted); }

.toast:not(.has-action) { pointer-events: none; }
.toast.has-action { display: flex; align-items: center; gap: 14px; }
.toast-act { background: none; border: 0; padding: 4px 2px; min-height: 32px; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg-card); font-size: var(--text-base); font-weight: 600; box-shadow: var(--shadow-lg); animation: fade-in .18s ease; max-width: calc(100vw - 32px); }

/* ---------- Duyarlı tasarım ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; box-shadow: var(--shadow-lg); }
  .app.sb-collapsed .sidebar { margin-left: 0; transform: translateX(-100%); box-shadow: none; }
  .agent-conn { display: none; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 8px 0 4px; }
  .tab { width: 44px; min-width: 44px; flex-shrink: 0; justify-content: center; padding: 0; }
  .tab.is-active { width: 160px; min-width: 160px; justify-content: flex-start; padding: 0 4px 0 10px; }
  .tab:not(.is-active) .tab-label, .tab:not(.is-active) .tab-close { display: none; }
  .tab::before { display: none !important; }
  .topbar-right .btn-primary-sm span { display: none; }
  .topbar-right .btn-primary-sm { width: 34px; padding: 0; }
  .hero { padding: 28px 16px 12px; }
  .hero-sub { font-size: var(--text-md); }
  .hint { display: none; }
  .pills { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; margin: 16px -16px 0; padding: 0 16px 6px; scrollbar-width: none; }
  .pills::-webkit-scrollbar { display: none; }
  .pill { flex-shrink: 0; }
  .list-wrap { padding: 16px 16px 24px; }
  .news-row { grid-template-columns: 1fr; gap: 6px; }
  .news-tag { justify-self: start; }
  .news-cta { display: none; }
  .thread-inner { padding: 18px 16px 10px; }
  .composer-dock { padding: 4px 12px 10px; }
  .msg--user .bubble { max-width: 88%; }
  .msg--bot .bot-ava { display: none; }
  .rcard-details { grid-template-columns: 1fr; }
  .rcard-details dt { border-bottom: 0; padding-bottom: 2px; }
  .legal--dock { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Duyarlı temel: her görünüm bir container. Modül düzenleri @media yerine @container view (…) kullanır;
   böylece hem telefonda hem iki panelli görünümün dar panelinde aynı kurallar çalışır. ---------- */
#main > .view { container: view / inline-size; }

/* Yönetici bağlantıları yalnız yöneticide görünür (görsel gizleme; yetki sunucuda denetlenir) */
html:not(.is-admin) [data-role="admin"] { display: none !important; }

/* ---------- Üst çubuk: bildirim zili (shell.js → BTShell.notify) ---------- */
.nb-btn { position: relative; }
.nb-badge { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--bg-topbar); font-variant-numeric: tabular-nums; pointer-events: none; }
.nb-badge[hidden] { display: none; }
.nb-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nb-pop { width: 360px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; z-index: 50; }
.nb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 6px 16px; }
.nb-head b { font-size: var(--text-lg); }
.nb-all { border: 0; background: transparent; color: var(--primary); font-weight: 600; font-size: var(--text-sm); padding: 6px 8px; border-radius: 8px; min-height: 32px; }
.nb-all:hover { background: var(--bg-hover); }
.nb-list { list-style: none; margin: 0; padding: 0 6px 6px; max-height: min(440px, 62vh); overflow-y: auto; }
.nb-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 10px; border-radius: 10px; min-height: 44px; }
.nb-item:hover { background: var(--bg-hover); }
.nb-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: transparent; box-shadow: inset 0 0 0 1px var(--border); }
.nb-item.is-unread .nb-dot { background: var(--primary); box-shadow: none; }
.nb-item.is-unread .nb-dot.is-danger { background: var(--danger); }
.nb-item.is-unread .nb-dot.is-warn { background: var(--warn); }
.nb-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.nb-title { font-weight: 600; font-size: var(--text-base); overflow-wrap: anywhere; }
.nb-item:not(.is-unread) .nb-title { font-weight: 500; color: var(--muted); }
.nb-text { font-size: var(--text-sm); color: var(--muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nb-main time { font-size: var(--text-xs); color: var(--muted); }
.nb-empty { padding: 18px 16px 22px; color: var(--muted); font-size: var(--text-base); text-align: center; }
@media (max-width: 640px) {
  .nb-pop { position: fixed; top: calc(var(--topbar-h, 56px) + 4px); left: 8px; right: 8px; width: auto; max-width: none; }
  .nb-list { max-height: calc(100dvh - var(--topbar-h, 56px) - 90px); }
}
