/* LiveDesk · yönetim paneli */
:root {
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef2ff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e8ebf2;
  --line-2: #f1f4f9;
  --bg: #f5f6fa;
  --card: #ffffff;
  --rail: #101527;
  --rail-ink: #9aa4bf;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

[data-theme="dark"] {
  --ink: #e8ecf6; --ink-2: #c3cadb; --muted: #94a1bd; --faint: #6b7793;
  --line: #232a3d; --line-2: #1b2133; --bg: #0c1020; --card: #131a2c;
  --brand-soft: #1e2542; --rail: #090d19;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 18px 40px -18px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased; font-size: 14px;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brand); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 34%, transparent); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

/* -------------------------------- login ---------------------------------- */
#login {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 100;
  background:
    radial-gradient(900px 480px at 15% -10%, rgba(79, 70, 229, .35), transparent 62%),
    radial-gradient(760px 420px at 108% 108%, rgba(124, 58, 237, .3), transparent 58%),
    #0b1020;
  padding: 20px;
}
.login-card {
  width: min(420px, 100%); background: var(--card); color: var(--ink);
  border-radius: 20px; padding: 34px 32px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .6);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.login-brand .mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800;
}
.login-card h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.02em; }
.login-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.hint {
  margin-top: 18px; padding: 11px 13px; border-radius: 11px;
  background: var(--brand-soft); color: var(--brand); font-size: 12.5px; line-height: 1.5;
}

/* ------------------------------ form atoms ------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent); }
textarea.input { resize: vertical; min-height: 84px; line-height: 1.55; }
.input.small { padding: 7px 10px; font-size: 13px; }
.help { font-size: 11.5px; color: var(--faint); margin-top: 5px; line-height: 1.5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer;
  transition: filter .15s, transform .1s, background .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; filter: none; }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { background: var(--line-2); filter: none; }
.btn.subtle { background: var(--brand-soft); color: var(--brand); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }
.btn svg { width: 15px; height: 15px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative;
  transition: background .18s; flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch span.lbl { font-size: 13px; }

/* --------------------------------- shell --------------------------------- */
.app { display: grid; grid-template-columns: 74px 1fr; height: 100vh; overflow: hidden; }

.rail {
  background: var(--rail); display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 4px;
  /* Kısa ekranlarda simgeler sığmayınca ray kendi içinde kaysın; yoksa tüm
     panel taşıp üst çubuğu ekran dışına itiyor. */
  min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail .logo {
  width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; margin-bottom: 10px;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px;
}
.rail button.nav {
  width: 44px; height: 44px; flex: 0 0 auto; border: 0; border-radius: 13px; background: transparent;
  color: var(--rail-ink); cursor: pointer; display: grid; place-items: center; position: relative;
  transition: background .16s, color .16s;
}
.rail button.nav:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail button.nav.active { background: var(--brand); color: #fff; }
.rail button.nav svg { width: 20px; height: 20px; }
.rail button.nav .dot {
  position: absolute; top: 8px; right: 8px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  display: none; place-items: center; border: 2px solid var(--rail);
}
.rail button.nav .dot.show { display: grid; }
.rail .spacer { flex: 1 0 8px; }
.rail .tip {
  position: absolute; left: 62px; background: #0b1020; color: #fff; padding: 5px 9px;
  border-radius: 8px; font-size: 12px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity .15s; z-index: 60;
}
.rail button.nav:hover .tip { opacity: 1; }

/* min-height:0 şart: grid/flex çocukları varsayılan olarak içeriğe göre uzayıp
   üst çubuğu ekran dışına itiyor ve iç kaydırma alanları çalışmıyor. */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.topbar {
  height: 62px; flex: 0 0 auto; display: flex; align-items: center; gap: 14px;
  padding: 0 22px; background: var(--card); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 16.5px; margin: 0; font-weight: 650; letter-spacing: -.02em; }
.topbar .crumb { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.topbar .grow { flex: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px;
  border-radius: 999px; background: var(--line-2); font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.pill .dot.off { background: var(--warn); }
.avatar-btn {
  width: 34px; height: 34px; border-radius: 11px; border: 0; cursor: pointer;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff;
  font-weight: 700; font-size: 12.5px; display: grid; place-items: center;
}
.view { flex: 1; min-height: 0; overflow: auto; padding: 22px; }
.view.flush { padding: 0; overflow: hidden; }

/* --------------------------------- cards --------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-h { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.card-h h3 { margin: 0; font-size: 14px; font-weight: 650; }
.card-h .grow { flex: 1; }
.card-b { padding: 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 17px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -.03em; margin-top: 8px; line-height: 1; }
.stat .d { font-size: 11.5px; color: var(--faint); margin-top: 7px; }
.stat .ico {
  position: absolute; right: 14px; top: 14px; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}
.stat .ico svg { width: 16px; height: 16px; }

.stat.alert { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 8%, var(--card)); }
.stat.alert .ico { background: color-mix(in srgb, var(--warn) 20%, transparent); color: #b45309; }
.stat.alert .v { color: #b45309; }
[data-theme="dark"] .stat.alert .ico, [data-theme="dark"] .stat.alert .v { color: #fcd34d; }

.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* --------------------------------- table --------------------------------- */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--faint); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .12s; }
table.tbl tbody tr:hover { background: var(--line-2); }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2);
}
.tag.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: #047857; }
.tag.warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: #b45309; }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.tag.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: #b91c1c; }
[data-theme="dark"] .tag.ok { color: #6ee7b7; }
[data-theme="dark"] .tag.warn { color: #fcd34d; }
[data-theme="dark"] .tag.danger { color: #fca5a5; }

.avatar {
  width: 34px; height: 34px; border-radius: 11px; flex: 0 0 auto; overflow: hidden;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center;
  font-weight: 700; font-size: 12.5px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.online::after {
  content: ""; position: absolute; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--card); transform: translate(12px, 12px);
}
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who .nm { font-weight: 600; font-size: 13.5px; }
.who .sub { font-size: 11.5px; color: var(--faint); }

.empty { text-align: center; padding: 46px 20px; color: var(--faint); }
.empty .big { font-size: 34px; margin-bottom: 10px; }
.empty p { margin: 6px 0 0; font-size: 13px; }

/* ------------------------------- inbox ----------------------------------- */
.inbox { display: grid; grid-template-columns: 320px 1fr 306px; height: 100%; min-height: 0; overflow: hidden; }
.inbox > * { min-height: 0; }
@media (max-width: 1280px) { .inbox { grid-template-columns: 290px 1fr; } .inbox .insight { display: none; } }

.conv-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--card); min-width: 0; }
.conv-tools { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 9px; }
.seg { display: flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  flex: 1; border: 0; background: transparent; padding: 6px 4px; border-radius: 8px;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .14s;
}
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.conv-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.conv-item {
  display: flex; gap: 11px; padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line-2); position: relative; transition: background .12s;
}
.conv-item:hover { background: var(--line-2); }
.conv-item.on { background: var(--brand-soft); }
.conv-item.on::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.conv-item .meta { min-width: 0; flex: 1; }
.conv-item .top { display: flex; align-items: baseline; gap: 8px; }
.conv-item .nm { font-weight: 650; font-size: 13.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .tm { font-size: 11px; color: var(--faint); flex: 0 0 auto; }
.conv-item .pv { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-item .conv-mail {
  font-size: 11.5px; color: var(--brand); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-item .badges { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.unread-pill {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--brand);
  color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; flex: 0 0 auto;
}

.conv-item.pending { background: color-mix(in srgb, var(--warn) 9%, transparent); }
.conv-item.pending::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--warn); }
.conv-item.pending.on { background: color-mix(in srgb, var(--warn) 16%, transparent); }

.thread { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.thread-head {
  flex: 0 0 auto; height: 62px; display: flex; align-items: center; gap: 10px;
  padding: 0 18px; background: var(--card); border-bottom: 1px solid var(--line);
}
/* Başlıktaki eylemler daralıp metnin üstüne binmesin. */
.thread-head > .btn, .thread-head > .tag, .thread-head > a { flex: 0 0 auto; white-space: nowrap; }
.thread-body { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 22px; }
.thread-foot { flex: 0 0 auto; background: var(--card); border-top: 1px solid var(--line); padding: 10px 14px; }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-row textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  resize: none; max-height: 140px; min-height: 42px; outline: none; background: var(--card); line-height: 1.5;
}
.composer-row textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.icon-btn {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: var(--card);
  color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: 0 0 auto; transition: all .14s;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.icon-btn.primary:hover { filter: brightness(1.08); background: var(--brand); color: #fff; }
.icon-btn:disabled { opacity: .45; cursor: default; }

/* ---------------------- sohbete katılma onay çubuğu ---------------------- */
.accept-bar {
  display: flex; align-items: center; gap: 13px; padding: 13px 15px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 9%, var(--card));
  border-radius: 13px;
}
.accept-bar .pulse {
  width: 11px; height: 11px; border-radius: 50%; background: var(--warn); flex: 0 0 auto;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 70%, transparent);
  animation: ld-pulse 1.8s infinite;
}
@keyframes ld-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 65%, transparent); }
  70% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.join-line {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  margin: 16px auto 14px; padding: 7px 14px; width: fit-content; max-width: 90%;
  border-radius: 999px; font-size: 12.5px; color: var(--ink-2);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
}
.join-line b { font-weight: 650; }

/* ---------------------- kayıtlı mesaj seçici ("/") ---------------------- */
.canned-picker {
  position: absolute; left: 14px; right: 14px; bottom: 100%; margin-bottom: 8px;
  max-height: 290px; overflow-y: auto; z-index: 20;
  background: var(--card); border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 20px 46px -18px rgba(15, 23, 42, .45);
  animation: rise .16s ease;
}
.thread-foot { position: relative; }
.cp-head {
  padding: 9px 13px; font-size: 11px; color: var(--faint); border-bottom: 1px solid var(--line-2);
  position: sticky; top: 0; background: var(--card);
}
.cp-item { padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.cp-item:last-child { border-bottom: 0; }
.cp-item:hover, .cp-item.on { background: var(--brand-soft); }
.cp-t { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.cp-t code {
  font-size: 11px; background: var(--line-2); color: var(--brand);
  padding: 1px 6px; border-radius: 5px; font-weight: 600;
}
.cp-x { font-size: 12px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------- kayıtlı mesaj kartları ------------------------ */
.saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.saved-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 9px;
}
.saved-h { display: flex; align-items: center; gap: 9px; }
.saved-t { font-weight: 650; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-s {
  font-size: 11.5px; background: var(--brand-soft); color: var(--brand);
  padding: 2px 8px; border-radius: 6px; font-weight: 600; flex: 0 0 auto;
}
.saved-x {
  font-size: 13px; line-height: 1.55; color: var(--muted); flex: 1;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.saved-f { display: flex; gap: 7px; border-top: 1px solid var(--line-2); padding-top: 10px; }

.canned-bar { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 0 9px; }
.canned-bar button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; transition: all .14s;
}
.canned-bar button:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

.bubble-row { display: flex; gap: 9px; margin-bottom: 4px; align-items: flex-end; }
.bubble-row.agent { flex-direction: row-reverse; }
.bubble {
  max-width: 72%; padding: 10px 13px; border-radius: 15px; font-size: 13.8px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; background: var(--card); border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.bubble-row.agent .bubble {
  background: var(--brand); color: #fff; border-color: transparent;
  border-bottom-left-radius: 15px; border-bottom-right-radius: 5px;
}
.bubble a { color: inherit; text-decoration: underline; }
.bubble img.att { max-width: 220px; border-radius: 10px; display: block; cursor: zoom-in; }
.bubble-meta { font-size: 10.5px; color: var(--faint); margin: 0 0 12px 44px; }
.bubble-row.agent + .bubble-meta { text-align: right; margin: 0 44px 12px 0; }
.sys-line { text-align: center; margin: 14px 0; }
.sys-line span { background: var(--line-2); color: var(--muted); font-size: 11.5px; padding: 5px 12px; border-radius: 999px; }
.day-sep { text-align: center; margin: 16px 0 12px; position: relative; font-size: 11px; color: var(--faint); }
.day-sep span { background: var(--bg); padding: 0 10px; position: relative; z-index: 1; }
.day-sep::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }

/* ---- canlı taslak: ziyaretçi yazıyor, henüz göndermedi (sneak peek) ---- */
.draft-bubble {
  max-width: 72%; padding: 9px 13px; border-radius: 15px; border-bottom-left-radius: 5px;
  background: color-mix(in srgb, var(--brand) 5%, var(--card));
  border: 1px dashed color-mix(in srgb, var(--brand) 42%, transparent);
  animation: fade .15s ease;
}
.draft-text {
  font-size: 13.8px; line-height: 1.55; color: var(--muted); font-style: italic;
  white-space: pre-wrap; word-break: break-word;
}
.draft-text .caret {
  display: inline-block; width: 2px; height: 14px; vertical-align: -2px; margin-left: 2px;
  background: var(--brand); animation: ld-caret 1s steps(2) infinite;
}
@keyframes ld-caret { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }
.draft-tag { font-size: 10.5px; color: var(--brand); margin-top: 5px; font-weight: 600; }
.conv-item .pv.draft { color: var(--brand); font-style: italic; }
.live-draft {
  font-size: 11.5px; color: var(--brand); font-style: italic; margin-top: 5px;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.typing-row { display: flex; gap: 5px; padding: 8px 13px; width: fit-content; background: var(--card); border: 1px solid var(--line); border-radius: 15px; border-bottom-left-radius: 5px; }
.typing-row i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: bnc 1.2s infinite; }
.typing-row i:nth-child(2) { animation-delay: .15s; }
.typing-row i:nth-child(3) { animation-delay: .3s; }
@keyframes bnc { 0%, 60%, 100% { transform: translateY(0); opacity: .5 } 30% { transform: translateY(-4px); opacity: 1 } }

.insight { border-left: 1px solid var(--line); background: var(--card); overflow-y: auto; padding: 16px; }
.insight h4 {
  margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint);
}
.insight .block { margin-bottom: 20px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line-2); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); flex: 0 0 auto; }
.kv .v { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
/* --------------------- e-posta eşleştirme kutusu ------------------------- */
.mail-box {
  border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent);
  background: var(--brand-soft); border-radius: 12px; padding: 11px 12px;
}
.mail-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); font-weight: 700; }
.mail-v { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.mail-v code {
  flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.mail-hist { font-size: 11.5px; color: var(--muted); margin-top: 9px; line-height: 1.5; }
.mail-link {
  display: block; width: 100%; text-align: left; border: 1px solid var(--line);
  background: var(--card); border-radius: 8px; padding: 5px 8px; font-size: 11.5px;
  color: var(--ink-2); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mail-link:hover { border-color: var(--brand); color: var(--brand); }

.note { background: var(--line-2); border-radius: 10px; padding: 9px 11px; font-size: 12.5px; margin-bottom: 8px; }
.note .who { font-size: 11px; color: var(--faint); margin-top: 5px; display: block; }

/* ------------------------------- settings -------------------------------- */
.settings-grid { display: grid; grid-template-columns: 1fr 372px; gap: 18px; align-items: start; }
@media (max-width: 1150px) { .settings-grid { grid-template-columns: 1fr; } }
.section { margin-bottom: 16px; }
.section h3 { font-size: 13.5px; margin: 0 0 3px; }
.section p.sub { margin: 0 0 14px; font-size: 12.5px; color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .row-2 { grid-template-columns: 1fr; } }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] { width: 44px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 3px; cursor: pointer; }
.swatches { display: flex; gap: 6px; }
.swatches button { width: 24px; height: 24px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.swatches button.on { border-color: var(--ink); }

.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px;
  padding: 13px 16px; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 -6px 24px -14px rgba(15, 23, 42, .35);
}
.save-bar .note { background: transparent; margin: 0; align-self: center; color: var(--faint); font-size: 12.5px; }

.preview-wrap {
  position: sticky; top: 22px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.preview-head { padding: 12px 15px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.preview-stage {
  height: 560px; background:
    repeating-linear-gradient(45deg, var(--line-2) 0 10px, transparent 10px 20px);
  position: relative; overflow: hidden;
}
.preview-stage iframe { width: 100%; height: 100%; border: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px;
  background: var(--line-2); font-size: 12px;
}
.chip button { border: 0; background: transparent; color: var(--faint); cursor: pointer; padding: 0; line-height: 1; font-size: 14px; }
.chip button:hover { color: var(--danger); }

.link-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--card);
  display: flex; gap: 14px; align-items: flex-start; box-shadow: var(--shadow-sm); margin-bottom: 12px;
}
.link-card .grow { flex: 1; min-width: 0; }
.url-box {
  display: flex; align-items: center; gap: 8px; margin-top: 10px;
  background: var(--line-2); border-radius: 10px; padding: 8px 10px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px; color: var(--ink-2);
}
.url-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

pre.code {
  background: #0d1224; color: #cbd5f5; padding: 15px; border-radius: 12px; overflow-x: auto;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.6; margin: 0;
}
pre.code .tk { color: #8b93ff; }
pre.code .at { color: #7dd3fc; }
pre.code .st { color: #86efac; }

/* --------------------------------- modal --------------------------------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(8, 12, 26, .55); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 90; padding: 20px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: var(--card);
  border-radius: 18px; box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .6);
  animation: rise .2s cubic-bezier(.34, 1.4, .64, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }
.modal-h { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-h h3 { margin: 0; font-size: 15.5px; }
.modal-b { padding: 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 9px; }

#toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 9px; z-index: 200; }
.toast {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--brand);
  border-radius: 11px; padding: 11px 15px; box-shadow: var(--shadow); font-size: 13px;
  min-width: 230px; animation: rise .2s ease;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }

/* --------------------------------- chart --------------------------------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 168px; padding-top: 8px; }
.bars .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bars .bar {
  width: 100%; max-width: 42px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #fff));
  transition: height .4s cubic-bezier(.4, 0, .2, 1); min-height: 4px; position: relative;
}
.bars .bar:hover::after {
  content: attr(data-v); position: absolute; top: -25px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--card); font-size: 11px; padding: 3px 7px; border-radius: 6px; white-space: nowrap;
}
.bars .lb { font-size: 11px; color: var(--faint); }
