/* ============================================================================
   İYİ CRM — Panel görsel sistemi v2 (FAZ 3B: Cila & Marka)
   Kural: v1'deki HER selector korunur; yalnız görünüm zenginleşir.
   ========================================================================== */
:root {
    --bg: #eef1f8;
    --card: #ffffff;
    --border: #e3e8f3;
    --text: #17203a;
    --muted: #66708c;
    --primary: #1d3fb8;          /* logo mavisi */
    --primary-dark: #16309199;
    --primary-deep: #142c86;
    --primary-soft: #e8edfc;
    --grad-primary: linear-gradient(135deg, #2a53d8 0%, #1d3fb8 55%, #16308f 100%);
    --danger: #c22525;
    --danger-soft: #fdeeee;
    --ok: #148a45;
    --ok-soft: #e6f7ed;
    --warn: #b3610a;
    --warn-soft: #fdf3e3;
    --success: #1fb45c;          /* 1E'den beri eksikti — nokta artık yeşil */
    --sidebar: #0d1530;
    --sidebar-2: #16244f;
    --sidebar-text: #c3cbe4;
    --ring: 0 0 0 3px rgba(45, 84, 216, .18);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
    --shadow: 0 4px 14px rgba(16, 24, 40, .08);
    --shadow-lg: 0 14px 34px rgba(13, 21, 48, .18);
    --r: 12px;
    --r-lg: 16px;
    --tr: .18s cubic-bezier(.4, 0, .2, 1);
    --container: 1720px;   /* header + başlık barı + içerik ortak genişlik */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background:
        radial-gradient(1100px 500px at 85% -10%, rgba(42, 83, 216, .07), transparent 60%),
        radial-gradient(900px 420px at -10% 110%, rgba(31, 180, 92, .05), transparent 55%),
        var(--bg);
    color: var(--text); font-size: 14px; line-height: 1.55;
}
a { color: var(--primary); text-decoration: none; transition: color var(--tr); }
a:hover { color: var(--primary-deep); }
::selection { background: rgba(42, 83, 216, .22); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c6cee6; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #a9b4d8; background-clip: content-box; border: 2px solid transparent; }

/* --------------------------------------------------------- Animasyonlar */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn  { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes drop     { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes ringPop  { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(8deg); } 100% { transform: scale(1); } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }

/* --------------------------------------------- Yerleşim: üst menü düzeni */
.wrap { display: flex; flex-direction: column; min-height: 100vh; }
.sidebar {
    width: 100%; color: var(--sidebar-text); position: relative; z-index: 50;
    background: linear-gradient(90deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
    box-shadow: 0 2px 14px rgba(13, 21, 48, .25);
}
.nav-inner {
    max-width: var(--container); margin: 0 auto; padding: 10px 24px;
    display: flex; align-items: center; gap: 6px;
}
.sidebar .brand { margin-right: 18px; flex-shrink: 0; }
.brand-logo { display: block; height: 34px; width: auto; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35)); }
.sidebar nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.sidebar nav a, .sidebar-foot a {
    display: inline-block; padding: 9px 13px; color: var(--sidebar-text);
    border-radius: 9px; position: relative; font-weight: 500;
    transition: background var(--tr), color var(--tr);
}
.sidebar nav a::after {
    content: ""; position: absolute; left: 13px; right: 13px; bottom: 5px; height: 2px;
    background: #6d93ff; border-radius: 2px; opacity: 0; transform: scaleX(.4);
    transition: opacity var(--tr), transform var(--tr);
}
.sidebar nav a:hover, .sidebar-foot a:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.sidebar nav a:hover::after { opacity: 1; transform: scaleX(1); }
.sidebar-foot { margin-left: auto; flex-shrink: 0; }
.sidebar-foot a { border: 1px solid rgba(255, 255, 255, .22); }
.sidebar-foot a:hover { border-color: rgba(255, 255, 255, .45); }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content {
    width: 100%; max-width: var(--container); margin: 26px auto 44px; padding: 0 24px;
    animation: fadeUp .28s ease both;
}

/* ------------------------------------------------------------- Topbar */
.topbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(255, 255, 255, .82); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 10px 24px;
    box-shadow: var(--shadow-sm);
}
.topbar-inner { max-width: var(--container); margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.topbar-title { font-weight: 700; flex: 1; letter-spacing: .01em; }
.topbar-user { color: var(--muted); font-size: 13px; }
.role-badge {
    background: var(--primary-soft); border: 1px solid #d5defa; color: var(--primary-deep);
    border-radius: 20px; padding: 2px 10px; margin-left: 6px; font-size: 12px; font-weight: 600;
}
.menu-toggle { display: none; margin-left: auto; background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .3); border-radius: 8px; padding: 4px 11px; font-size: 16px; cursor: pointer; }

/* -------------------------------------------------------------- Kart */
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm);
    transition: box-shadow var(--tr), transform var(--tr);
    animation: fadeUp .3s ease both;
}
.card:hover { box-shadow: var(--shadow); }
.card h2 { font-size: 16px; margin-bottom: 12px; font-weight: 700; }
.card h3 { font-size: 14px; margin: 10px 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 0; position: relative; padding-left: 12px; }
.card-head h2::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px; border-radius: 4px; background: var(--grad-primary); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-num { display: block; font-size: 26px; font-weight: 700; }
.stat-num.ok { color: var(--ok); }
.stat-num.warn { color: var(--warn); }
.stat-label { color: var(--muted); font-size: 13px; }

/* -------------------------------------------------------------- Tablo */
.table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f7f9ff; }
.table th:first-child { border-radius: 8px 0 0 8px; }
.table th:last-child { border-radius: 0 8px 8px 0; }
.table tbody tr, .table tr { transition: background var(--tr); }
.table tr:hover td { background: #f7f9ff; }
.table tr:last-child td { border-bottom: none; }
.right { text-align: right; }
.actions-inline { white-space: nowrap; }
.actions-inline form { display: inline-block; margin-left: 6px; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* -------------------------------------------------------------- Form */
label { display: block; font-size: 13px; color: var(--text); margin-bottom: 12px; font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="datetime-local"], select, textarea {
    width: 100%; margin-top: 5px; padding: 10px 12px; font-size: 14px;
    border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text);
    transition: border-color var(--tr), box-shadow var(--tr);
    font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: #c9d3ef; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-card { max-width: 720px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; margin-top: 0; }
.sep { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------- Buton */
.btn {
    display: inline-block; padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text);
    transition: transform var(--tr), box-shadow var(--tr), background var(--tr), border-color var(--tr);
    box-shadow: var(--shadow-sm);
}
.btn:hover { background: #f7f9ff; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--grad-primary); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--grad-primary); filter: brightness(1.08); }
.btn-danger { background: linear-gradient(135deg, #d63030, #b91c1c); border-color: transparent; color: #fff; }
.btn-danger:hover { background: linear-gradient(135deg, #d63030, #b91c1c); filter: brightness(1.07); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; box-shadow: none; }
textarea:disabled { background: #f1f3f9; }

/* -------------------------------------------------------------- Rozet */
.badge { display: inline-block; padding: 2.5px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; line-height: 1.5; }
.badge-active { background: var(--ok-soft); color: var(--ok); }
.badge-expired { background: var(--danger-soft); color: var(--danger); }
.badge-suspended { background: var(--warn-soft); color: var(--warn); }
.badge-cancelled { background: #eef1f8; color: var(--muted); }

/* -------------------------------------------------------------- Uyarı */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; border-left-width: 4px; animation: drop .25s ease both; box-shadow: var(--shadow-sm); }
.alert-success { background: var(--ok-soft); color: #0d6b35; border-color: #bfe6cc; border-left-color: var(--ok); }
.alert-error { background: var(--danger-soft); color: #9d1d1d; border-color: #f3c6c6; border-left-color: var(--danger); }

/* -------------------------------------------------------- Sayfalama */
.pagination { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.pagination a { padding: 5px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text); background: #fff; transition: all var(--tr); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.pagination a.current { background: var(--grad-primary); border-color: transparent; color: #fff; }

/* -------------------------------------------------------------- Giriş */
.auth-body {
    display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;
    background:
        radial-gradient(900px 460px at 15% 0%, rgba(42, 83, 216, .16), transparent 60%),
        radial-gradient(800px 420px at 100% 100%, rgba(20, 44, 134, .14), transparent 55%),
        linear-gradient(160deg, #f2f5fd 0%, #e7ecf9 100%);
}
.auth-box {
    width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border);
    border-radius: 18px; padding: 30px 28px; box-shadow: var(--shadow-lg);
    animation: scaleIn .3s ease both;
}
.auth-brand { text-align: center; margin-bottom: 20px; }
.auth-logo { height: 52px; width: auto; max-width: 100%; }
.auth-form h1 { font-size: 17px; margin-bottom: 14px; }
.auth-link { display: block; text-align: center; margin-top: 12px; font-size: 13px; }

/* --------------------------------------------------------------- Hata */
.error-page { text-align: center; padding: 30px 10px; }
.error-page h1 { font-size: 44px; margin-bottom: 8px; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page p { margin-bottom: 16px; }
.danger-zone { border-color: #f3c6c6; }

/* ---------------------------------------------------------- Responsive */
@media (max-width: 920px) {
    .menu-toggle { display: inline-block; }
    .sidebar nav, .sidebar-foot { display: none; }

    /* Açıkken: tam ekran karartma + ortada yüzen menü paneli */
    .sidebar.open {
        position: fixed; inset: 0; z-index: 80;
        background: rgba(13, 21, 48, .58); backdrop-filter: blur(4px);
        overflow-y: auto; animation: fadeIn .18s ease both;
    }
    .sidebar.open .nav-inner {
        position: relative; flex-direction: column; align-items: stretch; gap: 4px;
        background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
        width: calc(100% - 32px); max-width: 360px; margin: 64px auto 24px;
        padding: 20px 18px 16px; border-radius: 18px;
        box-shadow: var(--shadow-lg); animation: scaleIn .2s ease both;
    }
    .sidebar.open .brand { margin: 0 auto 4px; }
    .sidebar.open .menu-toggle { position: absolute; top: 12px; right: 12px; }
    .sidebar.open nav {
        display: flex; flex-direction: column; align-items: stretch; gap: 2px;
        width: 100%; margin-top: 12px; padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, .14);
    }
    .sidebar.open nav a { display: block; text-align: center; }
    .sidebar.open nav a::after { display: none; }
    .sidebar.open .sidebar-foot { display: block; width: 100%; margin: 10px 0 2px; }
    .sidebar.open .sidebar-foot a { display: block; text-align: center; }

    .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 0 14px; margin-top: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ----------------------------------------------------- Kanal rozetleri */
.badge-ch-form      { background: #e8effc; color: #2450cf; }
.badge-ch-messenger { background: #ece7fd; color: #6d28d9; }
.badge-ch-instagram { background: linear-gradient(135deg, #fdeef6, #fce7f3); color: #be185d; }
.badge-ch-whatsapp  { background: #e5f8ec; color: #128a44; }
.badge-ch-manual    { background: #eef1f8; color: #66708c; }

.bell { position: relative; font-size: 16px; text-decoration: none; padding: 2px 6px; transition: transform var(--tr); display: inline-block; }
.bell:hover { animation: ringPop .4s ease; }
.bell-badge {
    position: absolute; top: -5px; right: -7px; background: linear-gradient(135deg, #e23d3d, #b91c1c); color: #fff;
    border-radius: 12px; font-size: 10px; font-weight: 700; padding: 1px 5px; line-height: 1.35;
    box-shadow: 0 2px 6px rgba(185, 28, 28, .45);
}

.activity { list-style: none; }
.activity li { padding: 9px 0 9px 14px; border-left: 2px solid var(--border); margin-left: 4px; font-size: 14px; transition: background var(--tr); }
.activity li:hover { background: #f7f9ff; }
.activity li.unread { border-left-color: var(--primary); background: #f4f8ff; }

/* ----------------------------------------------------- Kanban */
.kb-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.kb-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px; font-size: 13px; font-weight: 500;
    text-decoration: none; color: var(--text); background: var(--card);
    transition: all var(--tr); box-shadow: var(--shadow-sm);
}
.chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.chip-active { background: var(--grad-primary); border-color: transparent; color: #fff; }
.chip-active:hover { color: #fff; filter: brightness(1.07); }

.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding: 4px 2px 14px; }
.kb-col {
    flex: 0 0 284px; background: rgba(238, 241, 248, .75); backdrop-filter: blur(4px);
    border: 1px solid var(--border); border-radius: 14px;
    max-height: calc(100vh - 190px); display: flex; flex-direction: column;
    box-shadow: var(--shadow-sm); animation: fadeUp .3s ease both;
}
.kb-head { position: relative; display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-top: 3px solid var(--primary); border-radius: 12px 12px 0 0; background: var(--card); cursor: grab; }
.kb-head:active { cursor: grabbing; }
.kb-title { font-weight: 700; font-size: 14px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-count { background: var(--primary-soft); color: var(--primary-deep); border-radius: 12px; padding: 1px 9px; font-size: 12px; font-weight: 600; }
.kb-menu-btn { border: 0; background: none; font-size: 16px; cursor: pointer; color: var(--muted); padding: 0 4px; line-height: 1; transition: color var(--tr); }
.kb-menu-btn:hover { color: var(--text); }
.kb-menu { display: none; position: absolute; top: 38px; right: 8px; z-index: 30; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 14px; width: 236px; animation: scaleIn .16s ease both; }
.kb-menu.open { display: block; }
.kb-menu form + form { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.kb-sys-note { font-size: 12px; margin-top: 8px; }
.kb-palette { display: flex; gap: 6px; margin: 8px 0 10px; }
.kb-swatch input { display: none; }
.kb-swatch span { display: block; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: transform var(--tr); }
.kb-swatch span:hover { transform: scale(1.15); }
.kb-swatch input:checked + span { border-color: #101828; transform: scale(1.1); }

.kb-list { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; min-height: 60px; }
.kb-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 11px 13px; cursor: pointer;
    box-shadow: var(--shadow-sm); transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
}
.kb-card:hover { border-color: #b9c6ef; transform: translateY(-2px); box-shadow: var(--shadow); }
.kb-card-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 14px; }
.kb-card-sub { font-size: 13px; margin-top: 4px; }
.kb-card-time { font-size: 12px; margin-top: 4px; }
.kb-dm { background: #101828; color: #fff; }
.kb-ghost { opacity: .45; }
.sortable-ghost { opacity: .4; background: var(--primary-soft) !important; border: 1px dashed var(--primary) !important; }
.sortable-chosen { box-shadow: var(--shadow-lg) !important; transform: rotate(1.2deg) scale(1.02); }
.kb-add { background: none; border-style: dashed; padding: 12px; box-shadow: none; }
.kb-add:hover { border-color: var(--primary); box-shadow: none; transform: none; }
.kb-add label { font-size: 13px; color: var(--muted); display: block; }
.kb-add input[type="text"] { width: 100%; margin-top: 6px; }

/* ----------------------------------------------------- Konuşmalar */
.conv-list { display: flex; flex-direction: column; }
.conv-row { display: flex; align-items: center; gap: 12px; padding: 13px 8px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text); border-radius: 10px; transition: background var(--tr), transform var(--tr); }
.conv-row:hover { background: #f6f9ff; transform: translateX(2px); }
.conv-dot { width: 9px; height: 9px; border-radius: 50%; background: #cbd2dc; flex: 0 0 auto; transition: background var(--tr); }
.conv-dot.open { background: var(--success); box-shadow: 0 0 0 3px rgba(31, 180, 92, .18); }
.conv-main { flex: 1; min-width: 0; }
.conv-name { display: block; font-weight: 600; font-size: 14px; }
.conv-preview { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-side { text-align: right; font-size: 12px; flex: 0 0 auto; }
.conv-unread { display: inline-block; margin-top: 4px; background: linear-gradient(135deg, #e23d3d, #b91c1c); color: #fff; border-radius: 12px; padding: 1px 8px; font-size: 11px; font-weight: 700; }

.chat-card { display: flex; flex-direction: column; max-height: calc(100vh - 140px); }
.chat-window-note { margin-bottom: 10px; }
.chat-box {
    flex: 1; overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; gap: 10px;
    background:
        radial-gradient(420px 220px at 100% 0%, rgba(42, 83, 216, .05), transparent 60%),
        #f3f6fc;
    border: 1px solid var(--border); border-radius: 14px; min-height: 260px;
}
.msg { display: flex; flex-direction: column; max-width: 72%; animation: slideIn .22s ease both; }
.msg-in  { align-self: flex-start; }
.msg-out { align-self: flex-end; align-items: flex-end; }
.msg-bubble { padding: 10px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; word-wrap: break-word; box-shadow: var(--shadow-sm); }
.msg-in  .msg-bubble { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 5px; }
.msg-out .msg-bubble { background: var(--grad-primary); color: #fff; border-bottom-right-radius: 5px; }
.msg-out .msg-bubble a { color: #fff; text-decoration: underline; }
.msg-att { margin-top: 4px; font-size: 13px; }
.msg-meta { font-size: 11px; margin-top: 3px; padding: 0 4px; }
.chat-composer { display: flex; gap: 8px; margin-top: 12px; }
.chat-composer textarea { flex: 1; resize: vertical; }

/* ----------------------------------------------------- Dashboard */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { text-align: center; padding: 20px 10px 16px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--grad-primary); opacity: .9; }
.stat-grid .stat:nth-child(2)::before { background: linear-gradient(135deg, #1fb45c, #148a45); }
.stat-grid .stat:nth-child(3)::before { background: linear-gradient(135deg, #f0a12e, #c97a08); }
.stat-grid .stat:nth-child(4)::before { background: linear-gradient(135deg, #7c5cff, #5b3df0); }
.stat-grid .stat:nth-child(5)::before { background: linear-gradient(135deg, #16b3c4, #0e8794); }
.stat-grid .stat:nth-child(6)::before { background: linear-gradient(135deg, #e46bb2, #c02d86); }
.stat-grid .stat:nth-child(7)::before { background: linear-gradient(135deg, #2a53d8, #16308f); }
.stat:hover { transform: translateY(-2px); }
.stat .num { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -.02em; }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat .num-small { font-size: 16px; line-height: 1.3; padding-top: 6px; min-height: 34px; font-weight: 700; }
.chan-row { display: flex; gap: 10px; flex-wrap: wrap; }
.chan-row .chip { display: flex; align-items: center; gap: 8px; }
.dash-cols { align-items: start; }

/* ----------------------------------------------------- WhatsApp / Modal */
.msg-status { font-size: 11px; }
.msg-status-failed { color: var(--danger); font-weight: 600; }
.wa-inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.wa-inline-form label { flex: 1; min-width: 260px; }
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(13, 21, 48, .5); backdrop-filter: blur(3px); z-index: 60; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop.open { display: flex; }
.modal { background: var(--card); border-radius: 16px; padding: 22px; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); animation: scaleIn .2s ease both; }
.modal h3 { font-size: 16px; margin-bottom: 12px; font-weight: 700; }
.modal label { display: block; margin-bottom: 10px; font-size: 13px; }
.modal input, .modal select { width: 100%; margin-top: 4px; }
.sch-kind-row { display: flex; gap: 16px; margin-bottom: 10px; font-size: 13px; }
.sch-kind-row label { display: flex; align-items: center; gap: 6px; margin: 0; }

/* ----------------------------------------------------- Randevular */
.appt-today td { background: #eefaf2; }
.appt-actions { white-space: nowrap; }
.appt-actions form { display: inline-block; margin-left: 4px; }
h3.sub { font-size: 14px; margin: 6px 0 10px; color: var(--muted); }

/* ----------------------------------------------------- Satış */
.kb-sale { background: linear-gradient(135deg, #e6f8ee, #d8f3e3); color: #0f7a3b; border: 1px solid #b9e6ca; font-weight: 700; }
.sale-amount { font-size: 14px; padding: 4px 12px; }
.sale-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.sale-form label { margin: 0; }

/* ----------------------------------------------------- Atama */
.kb-assignee {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 50%;
    background: var(--grad-primary); color: #fff;
    font-size: 10px; font-weight: 700; letter-spacing: .3px;
    box-shadow: 0 2px 6px rgba(29, 63, 184, .35);
}
.assign-form { display: flex; gap: 10px; align-items: center; }
.assign-form select { max-width: 260px; }

/* ----------------------------------------------------- FAZ 3C: Kolon otomasyonu */
.kb-auto { background: linear-gradient(135deg, #f0a12e, #d98a10); color: #fff; border-radius: 10px;
  padding: 1px 8px; font-size: 10px; font-weight: 800; letter-spacing: .5px; }
.kb-auto-hint { font-size: 11px; line-height: 1.4; margin: -4px 0 8px; }

/* ----------------------------------------------------- FAZ 3D: Lead modalı */
.kb-lead-modal {
    width: min(1120px, 94vw); height: 88vh;
    background: var(--card); border-radius: 16px; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); animation: scaleIn .2s ease both;
}
.kb-lead-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: #f7f9ff; }
.kb-lead-title { flex: 1; font-weight: 700; }
#kbLeadFrame { flex: 1; width: 100%; border: 0; background: var(--bg); }
body.embed { background: var(--bg); }
body.embed .content { max-width: 100%; margin: 14px auto 24px; padding: 0 16px; animation: none; }

/* ----------------------------------------------------- FAZ 4A: AI Asistan */
.ai-chip {
    display: inline-flex; align-items: center; padding: 2.5px 12px; margin-left: 4px;
    border-radius: 20px; font-size: 12px; font-weight: 800; letter-spacing: .5px;
    border: 1px solid var(--border); background: #eef1f8; color: var(--muted);
    cursor: pointer; transition: all var(--tr);
}
.ai-chip:hover { border-color: var(--primary); color: var(--primary); }
.ai-chip.on {
    background: linear-gradient(135deg, #7c5cff, #5b3df0); border-color: transparent; color: #fff;
    box-shadow: 0 2px 8px rgba(92, 61, 240, .4);
}
