:root {
  --bg: #f4f5f7; --panel: #fff; --ink: #14161a; --ink2: #4b5260; --muted: #7a8190; --line: #e4e6eb; --line2: #eef0f3;
  --brand: #3b4ef0; --brand-ink: #fff; --brand-soft: #eceefe;
  --ok: #12805c; --ok-soft: #e3f5ee; --warn: #b25e09; --warn-soft: #fff3e0; --err: #c0262d; --err-soft: #fdecec;
  --meta: #1d6ef2; --google: #e2771b; --organic: #0f9b8e; --manual: #7656d6; --other: #8a909c;
  --r: 10px; --sh: 0 1px 2px rgba(16, 24, 40, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; margin-bottom: 12px; }
h3 { font-size: 14px; font-weight: 650; margin: 18px 0 8px; }
code { font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--line2); padding: 1px 5px; border-radius: 5px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sm { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.ell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; align-items: flex-end; }
.gap { gap: 10px; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.inline { display: inline; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: #12141a; color: #c9cdd6; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: #fff; padding: 0 8px 18px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #5b6cff, #3b4ef0); display: grid; place-items: center; color: #fff; font-weight: 800; }
.client-switch { padding: 0 8px 14px; }
.client-switch label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7d8494; margin-bottom: 4px; }
.client-switch select { width: 100%; background: #1d2029; color: #fff; border: 1px solid #2b2f3a; }
.client-name { padding: 0 8px 14px; color: #fff; font-weight: 600; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side a, .side .linkbtn { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #c9cdd6; font-weight: 500; text-decoration: none; }
.side a:hover, .side .linkbtn:hover { background: #1d2029; color: #fff; }
.side a.on { background: #262a36; color: #fff; }
.side a span { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.side a small { color: #7d8494; font-size: 11.5px; }
.pill { background: var(--brand); color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 99px; font-weight: 600; }
.side-foot { margin-top: auto; border-top: 1px solid #23262f; padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.linkbtn { background: none; border: 0; font: inherit; cursor: pointer; color: var(--brand); padding: 0; width: 100%; text-align: left; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 18px 28px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 18px; cursor: pointer; }
.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 16px; max-width: 1400px; }
.flash { margin: 16px 28px 0; padding: 10px 14px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.content .flash, .auth-card .flash, .card .flash { margin: 0 0 12px; }
.flash.err { background: var(--err-soft); color: var(--err); }
.flash.info { background: var(--brand-soft); color: var(--brand); }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--sh); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 640px; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-h h2 { margin: 0; }
.card-h small { color: var(--muted); }
.card-h.pad { padding: 16px 20px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-lead { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.empty { color: var(--muted); text-align: center; padding: 24px 12px; margin: 0; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; box-shadow: var(--sh); }
.kpi span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin: 2px 0; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.accent { border-color: #c9cffb; background: linear-gradient(180deg, #f6f7ff, #fff); }
.kpi.accent b { color: var(--brand); }
.kpi.warn { border-color: #f3d3a7; background: var(--warn-soft); }

/* Forms */
input, select, textarea { font: inherit; color: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7cdfc; border-color: var(--brand); }
textarea { resize: vertical; }
label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: 13px; color: var(--ink2); }
label small { font-weight: 400; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--brand); }
input:disabled { background: var(--line2); color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 12px; display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; }
fieldset > .row { width: 100%; }
legend { font-size: 12.5px; font-weight: 600; color: var(--ink2); padding: 0 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.form-grid .span2, .form-grid fieldset, .form-grid .form-actions, .form-grid .checks { grid-column: 1 / -1; }
.form-actions, .checks { display: flex; gap: 10px; flex-wrap: wrap; }
.checks { gap: 8px 20px; }
.otp { font-size: 22px; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.w-stage { width: 110px; padding-bottom: 10px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; justify-content: center; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none !important; line-height: 1.3; }
.btn:hover { background: var(--line2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #2f41d6; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink2); }
.btn.ghost:hover { background: var(--line2); }
.btn.danger { color: var(--err); border-color: #f2c4c6; }
.btn.danger:hover { background: var(--err-soft); }
.btn.wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn.wa:hover { background: #178d46; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn.sm .ic { width: 15px; height: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.icbtn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; color: var(--ink2); border: 1px solid var(--line); background: #fff; }
.icbtn:hover { background: var(--line2); text-decoration: none; }
.icbtn.wa { color: #1fa855; }
.icbtn .ic { width: 16px; height: 16px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink2); }
.chip.ok { color: var(--ok); border-color: #b9e3d2; background: var(--ok-soft); }
.chip.off { color: var(--muted); }
.chip.warn { color: var(--warn); border-color: #f3d3a7; background: var(--warn-soft); text-decoration: none; }

/* Badges */
.badge, .tag, .src { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line2); color: var(--ink2); white-space: nowrap; line-height: 1.6; }
.st-new { background: var(--brand-soft); color: var(--brand); }
.st-contacted { background: #e7f3fd; color: #1667a8; }
.st-qualified { background: #f1ebfd; color: #6941c6; }
.st-won { background: var(--ok-soft); color: var(--ok); }
.st-lost { background: var(--err-soft); color: var(--err); }
.st-junk { background: var(--line2); color: var(--muted); }
.src { background: transparent; padding-left: 0; color: var(--ink2); }
.src::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--other); }
.src-meta::before { background: var(--meta); } .src-google::before { background: var(--google); } .src-organic::before { background: var(--organic); } .src-manual::before { background: var(--manual); }
.tag.ok, .conv-sent { background: var(--ok-soft); color: var(--ok); }
.tag.warn, .conv-pending, .conv-feed { background: var(--warn-soft); color: var(--warn); }
.tag.err, .conv-failed { background: var(--err-soft); color: var(--err); }
.score { display: inline-block; min-width: 34px; text-align: center; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.score.hot { background: #fde8e3; color: #c4320a; }
.score.warm { background: #fef4dc; color: #a15c07; }
.score.cold { background: #eaf1fb; color: #3f6ba9; }

/* Tables */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbff; }
.tbl tr.is-new .lead-name { font-weight: 700; }
.tbl tr.dim { opacity: .55; }
.tbl.num td:not(.txt), .tbl.num th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .w1 { width: 1%; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.lead-name { color: var(--ink); font-weight: 600; }
.card > .tbl, .card > .table-wrap { margin: 0; }
.card:not(.flush) .table-wrap { margin: 0 -20px -18px; }

/* Filters / toolbar */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; }
.filters input[type=search] { min-width: 200px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk { display: flex; gap: 6px; align-items: center; }
.bulk select { padding: 5px 8px; font-size: 12.5px; }
.pager { display: flex; gap: 4px; justify-content: center; }
.pager a { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink2); }
.pager a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink2); font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }

/* Lists, bars */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--line2); }
.list li:last-child { border-bottom: 0; }
.list li > a { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink); flex: 1; }
.list li details { width: 100%; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 40px auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-row small { color: var(--muted); min-width: 56px; }
.bar { height: 10px; background: var(--line2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .4s; }
.src-bg-meta { background: var(--meta) !important; } .src-bg-google { background: var(--google) !important; } .src-bg-organic { background: var(--organic) !important; } .src-bg-manual { background: var(--manual) !important; } .src-bg-other { background: var(--other) !important; }
.cols-chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding-top: 8px; }
.cc { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; min-width: 6px; }
.cc i { width: 100%; max-width: 28px; background: #c9cffb; border-radius: 4px 4px 0 0; display: flex; align-items: flex-end; min-height: 2px; }
.cc em { display: block; width: 100%; background: var(--ok); border-radius: 4px 4px 0 0; }
.cc span { font-size: 10.5px; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: -1px; }
.d-lead { background: #c9cffb; } .d-won { background: var(--ok); }

/* Lead detail */
.lead-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.lead-head p { margin: 6px 0 0; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-i { flex-direction: row; cursor: pointer; }
.seg-i input { position: absolute; opacity: 0; pointer-events: none; }
.seg-i span { padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; font-weight: 600; font-size: 12.5px; color: var(--ink2); background: #fff; }
.seg-i input:checked + span { border-color: currentColor; }
.seg-i.st-new input:checked + span { background: var(--brand-soft); color: var(--brand); }
.seg-i.st-contacted input:checked + span { background: #e7f3fd; color: #1667a8; }
.seg-i.st-qualified input:checked + span { background: #f1ebfd; color: #6941c6; }
.seg-i.st-won input:checked + span { background: var(--ok-soft); color: var(--ok); }
.seg-i.st-lost input:checked + span { background: var(--err-soft); color: var(--err); }
.seg-i.st-junk input:checked + span { background: var(--line2); color: var(--ink2); }
.seg-i input:focus-visible + span { outline: 2px solid #c7cdfc; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line2); }
.timeline li { position: relative; padding: 0 0 14px 10px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--line); }
.timeline li.t-status::before, .timeline li.t-assigned::before { border-color: var(--brand); }
.timeline li.t-call::before, .timeline li.t-whatsapp::before, .timeline li.t-meeting::before { border-color: var(--ok); }
.timeline li.t-conversion::before { border-color: var(--meta); }
.timeline li.t-sla::before, .timeline li.t-duplicate::before { border-color: var(--warn); }
.timeline p { margin: 4px 0 0; color: var(--ink2); }
.danger-zone { text-align: right; }
.pre { white-space: pre-wrap; word-break: break-all; font-size: 11.5px; background: var(--line2); padding: 8px; border-radius: 6px; max-height: 160px; overflow: auto; }
.code { display: flex; gap: 8px; align-items: flex-start; background: #f6f7f9; border: 1px solid var(--line); border-radius: 8px; padding: 8px 8px 8px 12px; margin: 6px 0 12px; }
.code code { flex: 1; background: none; padding: 0; white-space: pre-wrap; word-break: break-all; }
.code code.secret { font-size: 16px; letter-spacing: .08em; }
.steps { padding-left: 20px; margin: 8px 0 12px; color: var(--ink2); }
.steps li { margin-bottom: 6px; }

/* Auth */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, #e5e8ff, transparent), var(--bg); }
.auth-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 12px 32px rgba(16, 24, 40, .08); }
.auth-card.wide { max-width: 640px; }
.auth-card .brand { color: var(--ink); padding: 0 0 18px; }
.auth-card h2 { font-size: 18px; margin-bottom: 14px; }
.checklist { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 0 0 8px; }
.checklist .ok { color: var(--ok); } .checklist .bad { color: var(--err); font-weight: 600; }

@media (max-width: 1100px) { .grid-lead, .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .menu-btn { display: inline-block; }
  .top { padding: 12px 16px; }
  .content { padding: 16px; }
  .flash { margin: 12px 16px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 90px 1fr 32px; }
  .bar-row small { display: none; }
  .kv { grid-template-columns: 100px 1fr; }
  .filters > * { flex: 1 1 140px; }
}

/* düzeltmeler */
.seg-i { background: none !important; padding: 0; }
label.row { flex-direction: row; align-items: center; }
.lead-head > .row, .lead-head > div > .row { flex-wrap: wrap; }
.side { align-self: start; }
.tbl td .muted.sm { white-space: nowrap; }
.legal h3 { margin-top: 20px; } .legal p { color: var(--ink2); }

/* Closyra marka */
.logo { width: 30px; height: 30px; border-radius: 8px; display: block; background: none; }
.brand span { letter-spacing: -.02em; }
.tagline { margin: -10px 0 18px; color: var(--muted); font-size: 13px; }
.timeline li.t-wa_in::before { border-color: #1fa855; background: #e6f6ec; }
.timeline li.t-wa_out::before { border-color: #1fa855; background: #1fa855; }
.timeline li.t-wa_in p, .timeline li.t-wa_out p { background: #f4faf6; border-radius: 8px; padding: 6px 10px; display: inline-block; }
.timeline li.t-wa_out p { background: #e6f6ec; }
.src-whatsapp::before { background: #1fa855; }
.src-bg-whatsapp { background: #1fa855 !important; }

/* Çok kiracılı yapı: ajans markası, menü grupları */
.agency-logo { display: block; max-height: 38px; max-width: 170px; object-fit: contain; }
.side .agency-logo { background: #fff; padding: 5px 9px; border-radius: 8px; box-sizing: content-box; }
.auth-card .brand { justify-content: center; }
.auth-card .agency-logo { max-height: 56px; max-width: 220px; }
.nav-h { padding: 14px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: #6c7383; }
.powered { font-size: 11px; color: #6c7383; padding: 8px 10px 0; }
.powered.center { text-align: center; padding: 16px 0 0; color: var(--muted); }
.chip.info { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; font-size: 13px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label { flex-direction: row; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-weight: 500; }
.choice label small { display: block; color: var(--muted); font-weight: 400; }
.choice input { margin-top: 3px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.plan { border: 1px solid var(--line); border-radius: 12px; padding: 18px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.plan.current { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.plan .price { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.plan .price small { font-size: 13px; font-weight: 500; color: var(--muted); }
.plan ul { margin: 0; padding-left: 18px; color: var(--ink2); }
.plan form { margin-top: auto; }
.swatch { display: inline-block; width: 18px; height: 18px; border-radius: 5px; vertical-align: middle; border: 1px solid var(--line); }
.logo-preview { background: #12141a; padding: 14px; border-radius: 10px; display: inline-block; }
#iyzipay-checkout-form { min-height: 200px; }
.mt { margin-top: 12px; }
