:root {
  --bg: #0f172a;
  --bg-soft: #1e293b;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-soft: #64748b;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --info: #0891b2;
  --info-soft: #cffafe;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- Layout ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 256px; background: var(--bg); color: #cbd5e1;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand {
  padding: 22px 22px 18px; display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.sidebar .brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px;
}
.sidebar .brand b { color: #fff; font-size: 15px; display: block; line-height: 1.2; }
.sidebar .brand span { font-size: 11px; color: #64748b; }
.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav .group-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #475569; padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  color: #cbd5e1; font-weight: 500; margin-bottom: 2px; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav a.active { background: var(--primary); color: #fff; }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar .user {
  padding: 14px; border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
}
.sidebar .user .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #334155; color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.sidebar .user .meta { flex: 1; min-width: 0; }
.sidebar .user .meta b { color: #e2e8f0; font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .user .meta span { font-size: 11px; color: #64748b; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mobile-bar { display: none; }
.sidebar-backdrop { display: none; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 16px 28px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; font-weight: 700; }
.topbar .crumbs { font-size: 12px; color: var(--text-soft); }
.main { padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------------- Components ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card .card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card .card-head h2 { font-size: 15px; font-weight: 600; }
.card .card-body { padding: 20px; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.stat .label { font-size: 12px; color: var(--text-soft); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-size: 28px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; }
.stat .sub { font-size: 12px; color: var(--text-soft); margin-top: 4px; }
.stat .icon { float: right; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 13px; font-family: var(--font); transition: all .15s; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-light { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-light:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color:#fff; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* Tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-soft); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2); white-space: nowrap;
}
table.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #f1f5f9; color: var(--text-soft); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.form-group label .req { color: var(--danger); }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); background: var(--surface); color: var(--text); transition: border .15s, box-shadow .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--text-soft); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width:680px){ .form-row { grid-template-columns: 1fr; } }

/* Alerts / flash */
.flash-stack { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.alert {
  padding: 13px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start; animation: slideIn .25s ease;
  border-left: 4px solid;
}
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity:1; transform:none; } }
.alert-success { background: #f0fdf4; color: #166534; border-color: var(--success); }
.alert-error { background: #fef2f2; color: #991b1b; border-color: var(--danger); }
.alert-info { background: #ecfeff; color: #155e75; border-color: var(--info); }
.alert .close { margin-left: auto; cursor: pointer; opacity: .5; background: none; border: none; font-size: 18px; line-height: 1; }
.alert .close:hover { opacity: 1; }

/* Page header */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 14px; flex-wrap: wrap; }
.page-head .title h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.page-head .title p { color: var(--text-soft); margin-top: 3px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Empty state */
.empty { text-align: center; padding: 50px 20px; color: var(--text-soft); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* Avatar list */
.lead-cell { display: flex; align-items: center; gap: 11px; }
.lead-cell .av { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.lead-cell .nm b { display: block; font-weight: 600; }
.lead-cell .nm span { font-size: 12px; color: var(--text-soft); }

/* Pagination */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 22px; }
.pagination a, .pagination span {
  padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text);
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* Kanban */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; }
.kanban-col { min-width: 290px; width: 290px; flex-shrink: 0; background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--border); }
.kanban-col .col-head { padding: 13px 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.kanban-col .col-head .ttl { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
.kanban-col .col-head .ct { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; color: var(--text-soft); }
.kanban-col .col-body { padding: 12px; min-height: 120px; display: flex; flex-direction: column; gap: 10px; }
.kanban-col .col-body.drag-over { background: var(--primary-soft); outline: 2px dashed var(--primary); outline-offset: -6px; border-radius: var(--radius); }
.kard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; cursor: grab; box-shadow: var(--shadow); transition: box-shadow .15s, transform .1s;
}
.kard:hover { box-shadow: var(--shadow-lg); }
.kard:active { cursor: grabbing; }
.kard.dragging { opacity: .5; }
.kard .knm { font-weight: 600; margin-bottom: 4px; }
.kard .kmeta { font-size: 12px; color: var(--text-soft); display: flex; flex-direction: column; gap: 2px; }
.kard .kfoot { margin-top: 9px; display: flex; align-items: center; justify-content: space-between; }
.kard .kval { font-weight: 700; font-size: 13px; }

/* Detail layout */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px){ .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; }
.kv dt { color: var(--text-soft); font-weight: 500; }
.kv dd { font-weight: 600; }

/* Timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content:''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline .item { position: relative; padding-bottom: 18px; }
.timeline .item::before { content:''; position: absolute; left: -22px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--border); }
.timeline .item .when { font-size: 12px; color: var(--text-soft); }
.timeline .item .what { font-weight: 600; margin: 2px 0; }

/* Code block */
pre.code { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 12.5px; line-height: 1.6; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Stage pills row (mini funnel) */
.funnel { display: flex; gap: 6px; flex-wrap: wrap; }
.funnel .pill { display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.funnel .pill .n { font-weight: 800; }

/* Boş kanban kolonu ipucu */
.kanban-col .col-empty { color: #94a3b8; font-size: 12px; text-align: center; padding: 18px 8px; border: 1px dashed var(--border); border-radius: var(--radius-sm); }

/* Toplu işlem çubuğu */
.bulk-bar { display: none; align-items: center; gap: 10px; padding: 10px 14px; background: var(--primary-soft); border: 1px solid var(--primary); border-radius: var(--radius-sm); margin-bottom: 14px; }
.bulk-bar.show { display: flex; }
.bulk-bar .count { font-weight: 700; color: var(--primary-dark); }

/* ---------------- Mobil / Responsive ---------------- */
@media (max-width: 860px) {
  .mobile-bar {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
  }
  .hamburger { background: none; border: 1px solid var(--border); border-radius: 8px; font-size: 20px; line-height: 1; padding: 5px 11px; cursor: pointer; color: var(--text); }
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 50; }
  .main { padding: 18px 14px; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}

.text-soft { color: var(--text-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-2{margin-bottom:16px}
.flex{display:flex}.items-center{align-items:center}.gap-2{gap:8px}.justify-between{justify-content:space-between}
.w-full{width:100%}
