/* ============ چت‌آنلاین — استایل پنل (تم دارک/لایت) ============ */
@import url('fonts/fonts.css');

/* تم دارک (پیش‌فرض) */
:root, [data-theme="dark"] {
    --bg: #0F1319;
    --bg-2: #0B0E14;
    --card: #151B24;
    --card-2: #1B222E;
    --input: #12181F;
    --border: #232B38;
    --text: #E8ECF4;
    --muted: #98A2B8;
    --accent: #3B82F6;
    --accent-dark: #2563EB;
    --accent-soft: rgba(59, 130, 246, .14);
    --danger: #EF4444;
    --danger-soft: rgba(239, 68, 68, .14);
    --success: #22C55E;
    --success-soft: rgba(34, 197, 94, .14);
    --radius: 14px;
    --shadow: 0 4px 18px rgba(0, 0, 0, .25);
    --code-bg: #0B0E14;
    color-scheme: dark;
}

/* تم لایت */
[data-theme="light"] {
    --bg: #F5F6FA;
    --bg-2: #FFFFFF;
    --card: #FFFFFF;
    --card-2: #F1F3F8;
    --input: #FFFFFF;
    --border: #E4E7F0;
    --text: #1B2130;
    --muted: #7A8296;
    --accent: #3B82F6;
    --accent-dark: #2563EB;
    --accent-soft: rgba(59, 130, 246, .1);
    --danger: #DC2626;
    --danger-soft: #FEE2E2;
    --success: #16A34A;
    --success-soft: #DCFCE7;
    --shadow: 0 4px 18px rgba(30, 27, 75, .07);
    --code-bg: #171C26;
    color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'IRANSans', 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    font-size: 14.5px;
    line-height: 1.7;
}

a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-weight: 700; }
code { background: var(--card-2); padding: 2px 6px; border-radius: 6px; direction: ltr; display: inline-block; }

svg.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- دکمه‌ها ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: none; cursor: pointer; border-radius: 10px;
    padding: 10px 20px; font-family: inherit; font-size: 14px; font-weight: 600;
    transition: filter .15s, transform .05s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-light { background: var(--card-2); color: var(--text); border: 1px solid var(--border); }
.btn-light:hover { border-color: var(--muted); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- فرم‌ها ---------- */
.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 7px; font-weight: 600; font-size: 13px; }
.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field textarea, .field select {
    width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 10px;
    font-family: inherit; font-size: 14px; background: var(--input); color: var(--text);
    transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--accent); }
.field input[type="color"] { width: 64px; height: 40px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--input); cursor: pointer; padding: 3px; }
.field .field-hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 4px; display: block; }

.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 13.5px; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }

/* سوییچ (toggle) */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
    position: absolute; inset: 0; background: var(--border); border-radius: 999px;
    cursor: pointer; transition: background .2s;
}
.switch .track::before {
    content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; top: 3px; right: 3px; transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::before { transform: translateX(-20px); }

/* ---------- صفحات ورود/ثبت‌نام ---------- */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(900px 500px at 80% -10%, var(--accent-soft), transparent), var(--bg);
    padding: 20px;
}
.auth-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 20px;
    box-shadow: var(--shadow); padding: 36px 32px; width: 100%; max-width: 420px;
}
.auth-logo { font-size: 22px; font-weight: 800; color: var(--accent); text-align: center; margin-bottom: 18px; }
.auth-title { font-size: 19px; text-align: center; margin-bottom: 6px; }
.auth-hint { color: var(--muted); font-size: 13px; text-align: center; margin-bottom: 20px; }
.auth-switch { margin-top: 18px; text-align: center; font-size: 13.5px; color: var(--muted); }
.auth-tabs { display: flex; gap: 6px; background: var(--card-2); border-radius: 11px; padding: 4px; margin-bottom: 20px; }
.auth-tab {
    flex: 1; text-align: center; padding: 8px 10px; border-radius: 8px;
    font-size: 12.5px; font-weight: 700; color: var(--muted);
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

/* ---------- چیدمان پنل ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 252px; flex-shrink: 0; display: flex; flex-direction: column;
    background: var(--bg-2); border-left: 1px solid var(--border);
    position: sticky; top: 0; height: 100vh;
}

.ws-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.ws-avatar {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    background: var(--accent); color: #fff; font-weight: 800; font-size: 15px;
    display: flex; align-items: center; justify-content: center;
}
.ws-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a, .nav-group-btn {
    display: flex; align-items: center; gap: 11px; color: var(--muted);
    padding: 10px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
    transition: background .15s, color .15s;
    background: none; border: none; width: 100%; font-family: inherit; cursor: pointer; text-align: right;
}
.sidebar-nav a:hover, .nav-group-btn:hover { background: var(--card-2); color: var(--text); }
.sidebar-nav a.active { background: var(--card-2); color: var(--text); font-weight: 700; }
.nav-group-btn .chev { margin-right: auto; transition: transform .2s; }
.nav-group.open .chev { transform: rotate(180deg); }
.nav-sub { display: none; flex-direction: column; gap: 2px; padding-right: 14px; }
.nav-group.open .nav-sub { display: flex; }
.nav-sub a { font-size: 13px; padding: 8px 12px; }
.nav-group-btn.active { color: var(--text); font-weight: 700; }
.nav-sub-label {
    display: flex; align-items: center; gap: 7px;
    color: var(--muted); font-size: 11.5px; font-weight: 700;
    padding: 10px 12px 4px; user-select: none;
}
.nav-sub-label svg.icon { width: 14px; height: 14px; }
svg.icon.icon-sm { width: 14px; height: 14px; }
.nav-label { display: flex; align-items: center; }
.nav-label-dot { width: 11px; height: 11px; border-radius: 3.5px; flex-shrink: 0; margin-right: auto; }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-top: 1px solid var(--border);
}
.user-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; position: relative;
    background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.user-avatar .online-dot { position: absolute; bottom: 0; left: 0; }
.user-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.user-meta { flex: 1; min-width: 0; color: inherit; }
a.user-meta:hover .user-name { color: var(--accent); }
.user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mail { color: var(--muted); font-size: 11px; direction: ltr; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
    background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px;
    border-radius: 8px; display: inline-flex; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--card-2); color: var(--text); }

.content { flex: 1; padding: 28px 32px; min-width: 0; }
.content--chat { padding: 0; height: 100%; overflow: hidden; display: flex; }
.content--chat { padding: 0; height: 100vh; overflow: hidden; }

/* صفحه گفتگوها: بدون اسکرول صفحه (قفل کامل ارتفاع) */
html:has(body.no-scroll) { overflow: hidden; height: 100%; }
body.no-scroll { overflow: hidden; height: 100%; }
body.no-scroll .layout { height: 100%; overflow: hidden; }
body.no-scroll .content--chat { height: 100%; }

/* اسکرول‌بار باریک و تمیز برای بخش‌های داخلی */
.conv-items::-webkit-scrollbar, .chat-messages::-webkit-scrollbar, .visitor-panel::-webkit-scrollbar, .sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.conv-items::-webkit-scrollbar-thumb, .chat-messages::-webkit-scrollbar-thumb, .visitor-panel::-webkit-scrollbar-thumb, .sidebar-nav::-webkit-scrollbar-thumb {
    background: var(--border); border-radius: 999px;
}
.conv-items::-webkit-scrollbar-thumb:hover, .chat-messages::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.conv-items, .chat-messages, .visitor-panel { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

.page-title { font-size: 21px; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }

/* ---------- صفحه تنظیمات (ستون وسط، مثل نمونه) ---------- */
.settings-page { max-width: 620px; margin: 0 auto; padding-top: 14px; }
.section-title { font-size: 16px; margin-bottom: 24px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 30px 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 4px 0; }
.setting-name { font-weight: 700; font-size: 15px; }
.setting-desc { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.save-hint { font-size: 12px; color: var(--success); margin-top: 8px; min-height: 18px; transition: opacity .3s; }

/* ---------- کارت و آمار ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-card .stat-label { color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; }
.stat-card.stat-accent .stat-value { color: var(--accent); }
.stat-card.stat-green .stat-value { color: var(--success); }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card h2 { font-size: 16px; margin-bottom: 14px; }

.code-box {
    background: var(--code-bg); color: #E9ECF4; border-radius: 10px; padding: 14px 16px;
    direction: ltr; text-align: left; font-family: Consolas, monospace; font-size: 13px;
    overflow-x: auto; white-space: pre; margin-bottom: 10px; border: 1px solid var(--border);
}
.steps { list-style: none; counter-reset: step; }
.steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.steps li::before {
    content: counter(step); flex-shrink: 0;
    width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}

/* ---------- جدول ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.table tr:last-child td { border-bottom: none; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .big { font-size: 44px; margin-bottom: 12px; }
.empty-state h2 { color: var(--text); font-size: 17px; margin-bottom: 8px; }

/* ---------- صفحه گفتگوها ---------- */
.chat-app { display: grid; grid-template-columns: 320px 1fr 300px; height: 100%; background: var(--bg); flex: 1; min-width: 0; }

.conv-list { border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; background: var(--bg-2); }
.conv-list-header { padding: 16px 18px 10px; }
.conv-list-header h2 { font-size: 16px; }
.conv-search { padding: 0 14px 10px; position: relative; }
.conv-search input {
    width: 100%; padding: 8px 34px 8px 12px; border: 1.5px solid var(--border); border-radius: 10px;
    background: var(--input); color: var(--text); font-family: inherit; font-size: 13px;
}
.conv-search input:focus { outline: none; border-color: var(--accent); }
.conv-search input:focus + .conv-search-ico, .conv-search:focus-within .conv-search-ico { color: var(--accent); }
/* آیکن جستجو داخل کادر (RTL: سمت راست) */
.conv-search-ico { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.conv-search-ico svg.icon { width: 16px; height: 16px; }
.conv-tabs { display: flex; gap: 6px; padding: 0 14px 12px; border-bottom: 1px solid var(--border); }
.conv-tab {
    border: none; background: var(--card-2); color: var(--muted); font-family: inherit; font-size: 12.5px;
    font-weight: 600; padding: 6px 14px; border-radius: 999px; cursor: pointer;
}
.conv-tab.active { background: var(--accent); color: #fff; }
.conv-tabs2 { border-bottom: 1px solid var(--border); padding-top: 2px; }
.conv-tab2 {
    border: none; background: none; color: var(--muted); font-family: inherit; font-size: 12px;
    font-weight: 600; padding: 5px 8px; border-radius: 8px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 5px;
}
.conv-tab2:hover { color: var(--text); }
.conv-tab2.active { color: var(--accent); background: var(--accent-soft); }
.tab-count { font-size: 10.5px; opacity: .8; }
.conv-assigned { color: var(--muted); font-size: 11px; margin-top: 3px; }
.btn-success-soft { background: var(--success-soft); color: var(--success); }
.conv-items { flex: 1; overflow-y: auto; }
.conv-item { display: flex; gap: 10px; padding: 13px 18px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .1s; }
.conv-item:hover { background: var(--card-2); }
.conv-item.selected { background: var(--accent-soft); }
.conv-avatar {
    width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; position: relative;
    background: linear-gradient(135deg, var(--accent), #6366F1); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.conv-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.online-dot {
    position: absolute; bottom: 0; left: 0; width: 11px; height: 11px; border-radius: 50%;
    background: var(--muted); border: 2px solid var(--bg-2);
}
.online-dot.on { background: var(--success); }
.conv-body { flex: 1; min-width: 0; }
.conv-name-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.conv-name { font-weight: 700; font-size: 13.5px; }
.conv-time { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.conv-snippet { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-unread {
    background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
    min-width: 19px; height: 19px; border-radius: 999px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
}
.conv-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }

.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 10px; }
.chat-empty .big { font-size: 44px; }
.chat-header {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 13px 20px; background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.chat-header-title { font-weight: 700; font-size: 14.5px; }
.chat-header-status { font-size: 12px; color: var(--muted); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.chat-messages .load-more-wrap { text-align: center; padding-bottom: 4px; flex-shrink: 0; }
.msg { max-width: 68%; padding: 9px 14px; border-radius: 14px; font-size: 13.5px; word-break: break-word; white-space: pre-wrap; }
.msg-body { display: block; }
.msg-time { display: block; font-size: 10.5px; opacity: .65; margin-top: 4px; }
.bot-tag { display: inline-block; font-size: 10px; font-weight: 700; background: rgba(255,255,255,.22); color: #fff; padding: 1px 7px; border-radius: 20px; margin-bottom: 4px; }
.msg.them { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-top-right-radius: 4px; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-top-left-radius: 4px; }
.msg.sys {
    align-self: center; background: var(--card-2); color: var(--muted);
    font-size: 11.5px; border-radius: 999px; padding: 5px 14px;
    max-width: 92%; text-align: center;
}
/* تب‌های پاسخ / یادداشت داخلی */
.composer-tabs {
    display: flex; align-items: center; gap: 4px;
    padding: 8px 18px 0; background: var(--bg-2); border-top: 1px solid var(--border);
}
/* نوار دستیار اپراتور (Copilot) */
.copilot-bar { display: flex; align-items: center; gap: 6px; padding: 6px 18px; background: var(--bg-2); flex-wrap: wrap; }
.copilot-bar .cp-brand { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--accent); }
.copilot-bar .cp-brand svg.icon { width: 15px; height: 15px; }
.cp-btn { border: 1px solid var(--border); background: var(--card); color: var(--text); font-family: inherit;
    font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 20px; cursor: pointer; transition: .12s; }
.cp-btn:hover { border-color: var(--accent); color: var(--accent); }
.cp-btn:disabled { opacity: .5; cursor: default; }
.cp-status { font-size: 11.5px; color: var(--muted); margin-right: auto; }
.cp-menu-wrap { position: relative; display: inline-flex; }
.cp-menu { display: none; position: absolute; bottom: calc(100% + 4px); right: 0; z-index: 40;
    background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 5px; min-width: 150px; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.cp-menu.open { display: block; }
.cp-menu button { display: block; width: 100%; text-align: right; border: none; background: none; color: var(--text);
    font-family: inherit; font-size: 12.5px; padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.cp-menu button:hover { background: var(--card-2); }
#snooze-menu { top: calc(100% + 4px); bottom: auto; }
.ai-summary-box { margin: 10px 16px 0; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 12px;
    background: var(--accent-soft, rgba(59,130,246,.08)); font-size: 13px; line-height: 1.9; white-space: pre-wrap; position: relative; }
.ai-summary-box .ai-sum-close { position: absolute; left: 8px; top: 6px; cursor: pointer; color: var(--muted); font-size: 16px; background: none; border: none; }
.ai-summary-box .ai-sum-title { font-weight: 700; color: var(--accent); margin-bottom: 4px; display: flex; align-items: center; gap: 5px; }
.att-transcribe { display: block; margin-top: 5px; border: 1px solid var(--border); background: var(--card); color: var(--muted);
    font-family: inherit; font-size: 11px; padding: 3px 9px; border-radius: 14px; cursor: pointer; }
.att-transcribe:hover { color: var(--accent); border-color: var(--accent); }
.att-stt { margin-top: 5px; font-size: 12.5px; color: var(--text); background: var(--card-2); border-radius: 8px; padding: 6px 9px; line-height: 1.8; }
/* ترجمهٔ زندهٔ پیام */
.msg-tr { margin-top: 6px; padding-top: 6px; border-top: 1px dashed rgba(255,255,255,.25); font-size: 13px; line-height: 1.8; opacity: .95; }
.msg.them .msg-tr { border-top-color: var(--border); }
.msg-tr-tag { display: inline-block; font-size: 10px; font-weight: 700; opacity: .7; margin-left: 6px; }
.cp-btn.cp-on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft, rgba(59,130,246,.08)); }
.cp-menu button.cp-active { background: var(--accent-soft, rgba(59,130,246,.12)); color: var(--accent); font-weight: 700; }
.msg-tr.msg-tr-loading { opacity: .6; font-style: italic; }
.msg-tr.msg-tr-loading .msg-tr-tag { animation: trpulse 1.1s ease-in-out infinite; }
@keyframes trpulse { 0%,100% { opacity: .5 } 50% { opacity: 1 } }
.search-sec-title { font-size: 11px; font-weight: 700; color: var(--muted); padding: 10px 16px 4px; background: var(--bg-2); border-top: 1px solid var(--border); }
.conv-item.search-hit .conv-snippet { color: var(--muted); font-size: 12px; }
.ctab {
    border: none; background: none; color: var(--muted); font-family: inherit;
    font-size: 12.5px; font-weight: 700; padding: 6px 12px; border-radius: 8px 8px 0 0; cursor: pointer;
}
.ctab.active { color: var(--text); background: var(--card-2); }
.ctab-hint { color: #B45309; font-size: 11px; margin-right: 8px; }
.chat-composer.note-mode textarea { background: rgba(245, 158, 11, .08); border-color: rgba(245, 158, 11, .4); }

/* یادداشت داخلی در رشته پیام‌ها */
.msg.note {
    align-self: flex-end; background: rgba(245, 158, 11, .12);
    border: 1px dashed rgba(245, 158, 11, .5); color: var(--text);
}
.msg.note .note-label { display: block; font-size: 10.5px; font-weight: 700; color: #B45309; margin-bottom: 3px; }

.chat-composer { display: flex; gap: 10px; padding: 14px 18px; background: var(--bg-2); border-top: none; position: relative; }
.canned-dropdown {
    position: absolute; bottom: calc(100% + 6px); right: 18px; left: 18px;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow); max-height: 230px; overflow-y: auto; display: none; z-index: 60;
}
.canned-dropdown.open { display: block; }
.canned-hint { padding: 8px 14px; color: var(--muted); font-size: 11.5px; border-bottom: 1px solid var(--border); }
.canned-item {
    padding: 10px 14px; cursor: pointer; display: flex; gap: 10px; align-items: baseline;
    border-bottom: 1px solid var(--border);
}
.canned-item:last-child { border-bottom: none; }
.canned-item:hover, .canned-item.hl { background: var(--card-2); }
.canned-code { color: var(--accent); font-weight: 700; font-size: 13px; flex-shrink: 0; direction: ltr; }
.canned-text { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ایموجی و پیوست در باکس پیام پنل */
.composer-icon { align-self: center; }
.composer-icon svg.icon { width: 20px; height: 20px; }
.emoji-panel-p {
    position: absolute; bottom: calc(100% + 6px); right: 18px; width: 320px; max-width: calc(100% - 36px);
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: var(--shadow); padding: 10px; display: none; flex-wrap: wrap; gap: 2px;
    max-height: 180px; overflow-y: auto; z-index: 70;
}
.emoji-panel-p.open { display: flex; }
.emoji-panel-p button { background: none; border: none; font-size: 21px; cursor: pointer; padding: 4px; border-radius: 6px; }
.emoji-panel-p button:hover { background: var(--card-2); }
.msg .att-img { max-width: 220px; border-radius: 10px; display: block; margin-top: 4px; }
.msg .att-file { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: inherit; }
.msg.them .att-file { color: var(--accent); }
.msg .att-audio { display: block; margin-top: 4px; max-width: 250px; height: 40px; }

/* نوار ضبط پیام صوتی */
.voice-bar { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; }
.voice-rec-dot {
    width: 10px; height: 10px; border-radius: 50%; background: #EF4444;
    animation: vrec 1s infinite;
}
@keyframes vrec { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* جدول فیلدهای فرم پیش‌چت */
.pcf-table th, .pcf-table td { padding: 10px 8px; }
.pcf-input {
    width: 100%; min-width: 160px; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 8px;
    background: var(--input); color: var(--text); font-family: inherit; font-size: 13px;
}
.pcf-input:focus { outline: none; border-color: var(--accent); }
.chat-composer textarea {
    flex: 1; resize: none; border: 1.5px solid var(--border); border-radius: 12px;
    padding: 10px 14px; font-family: inherit; font-size: 14px; max-height: 120px;
    background: var(--input); color: var(--text);
}
.chat-composer textarea:focus { outline: none; border-color: var(--accent); }

/* هشدار پاسخگویی همزمان */
.viewers-bar {
    background: rgba(245, 158, 11, .12); color: #B45309; border-bottom: 1px solid rgba(245, 158, 11, .25);
    padding: 8px 20px; font-size: 12.5px; font-weight: 600; flex-shrink: 0;
}

/* سلکت پشتیبان در ستون اطلاعات */
.vp-select {
    width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: 9px;
    background: var(--input); color: var(--text); font-family: inherit; font-size: 12.5px; margin-top: 3px;
}
.vp-select:focus { outline: none; border-color: var(--accent); }

.visitor-panel { border-right: 1px solid var(--border); padding: 0; overflow-y: auto; background: var(--bg-2); }
.visitor-panel h3 { font-size: 14px; margin-bottom: 14px; }
.vp-row { margin-bottom: 13px; }
.vp-row:last-child { margin-bottom: 0; }
.vp-label { color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.vp-value { font-size: 13px; word-break: break-all; }
.vp-value a { font-size: 12.5px; }

/* بخش‌های ستون مخاطب (مثل nim.chat) */
.vp-sec { border-bottom: 1px solid var(--border); }
.vp-sec-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px; cursor: pointer; user-select: none;
    font-size: 12.5px; font-weight: 700; color: var(--text);
}
.vp-sec-head:hover { background: var(--card-2); }
.vp-sec-head b { color: var(--muted); font-weight: 400; font-size: 15px; }
.vp-sec-body { padding: 4px 18px 16px; }
.vp-contact-head { padding: 22px 18px 18px; text-align: center; }
.vp-contact-head .conv-avatar { margin: 0 auto 10px; display: inline-flex; }
.vp-name { display: block; font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.vp-name:hover { color: var(--accent); }
.vp-contact-row { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-bottom: 4px; }
.vp-contact-row svg.icon { width: 14px; height: 14px; flex-shrink: 0; }
.vp-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.vp-sec-body .vp-chips { justify-content: flex-start; margin: 6px 0; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.vp-chip { cursor: pointer; }
.vp-chip b { font-weight: 400; color: var(--muted); }
.vp-chip:hover b { color: var(--danger); }
.vp-more { border-top: 1px dashed var(--border); padding-top: 12px; margin-bottom: 10px; }
.vp-note { background: rgba(245, 158, 11, .08); border: 1px solid rgba(245, 158, 11, .25); border-radius: 10px; padding: 9px 11px; margin-top: 9px; }
.vp-note-body { font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
.vp-note-meta { color: var(--muted); font-size: 11px; margin-top: 5px; }
.vp-note-meta a { color: var(--danger); font-size: 11px; }
.vp-empty { color: var(--muted); font-size: 12px; line-height: 1.9; margin-top: 8px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.badge-open { background: var(--success-soft); color: var(--success); }
.badge-closed { background: var(--card-2); color: var(--muted); }

/* ---------- صفحه اپراتورها ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.info-text { max-width: 760px; margin-bottom: 28px; }
.info-text p { font-size: 13.5px; margin-bottom: 12px; }
.info-text .muted { color: var(--muted); }

.op-row-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0; position: relative;
    background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff; font-weight: 700;
    display: inline-flex; align-items: center; justify-content: center;
}
.op-row-avatar .online-dot { border-color: var(--card); }
.op-cell { display: flex; align-items: center; gap: 12px; }
.op-cell .op-mail { color: var(--muted); font-size: 11.5px; direction: ltr; text-align: right; }
.badge-pending { background: rgba(245, 158, 11, .15); color: #F59E0B; }

/* ---------- مودال ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200; display: none;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(5, 8, 14, .62); backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--card); border: 1px solid var(--border); border-radius: 18px;
    width: 100%; max-width: 560px; padding: 30px 28px; position: relative; box-shadow: var(--shadow);
}
.modal-close {
    position: absolute; top: 14px; left: 14px; background: none; border: none;
    color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; padding: 6px;
}
.modal-close:hover { color: var(--text); }
.modal h2 { font-size: 17px; margin-bottom: 6px; }
.modal .modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.modal-actions { display: flex; gap: 10px; margin-top: 6px; }
.invite-link-box {
    background: var(--card-2); border: 1px dashed var(--border); border-radius: 10px;
    padding: 12px 14px; direction: ltr; text-align: left; font-family: Consolas, monospace;
    font-size: 12px; word-break: break-all; margin: 14px 0;
}

/* ---------- صندوق‌های ورودی ---------- */
.inbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.inbox-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.inbox-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.inbox-card-stats { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; margin-bottom: 14px; flex-wrap: wrap; }

.tab-bar { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 8px; flex-wrap: wrap; }
.tab-link {
    padding: 10px 13px; color: var(--muted); font-size: 13px; font-weight: 600;
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--text); border-color: var(--accent); }
.tab-link.disabled { opacity: .4; cursor: not-allowed; }

.inbox-section {
    display: grid; grid-template-columns: 230px 1fr; gap: 34px;
    padding: 26px 0; border-bottom: 1px solid var(--border);
}
.inbox-section:last-child { border-bottom: none; }
.is-title { color: var(--accent); font-weight: 700; font-size: 14.5px; margin-bottom: 6px; }
.is-desc { color: var(--muted); font-size: 12.5px; line-height: 1.8; }

.channel-avatar {
    width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--card-2); border: 1px solid var(--border); font-size: 28px; font-weight: 800; color: var(--accent);
}

.chips-box {
    display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
    padding: 10px; min-height: 54px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--input);
}
.chip {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--card-2); border: 1px solid var(--border); border-radius: 8px;
    padding: 5px 10px; font-size: 13px; font-weight: 600;
}
.chip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 0; }
.chip button:hover { color: var(--danger); }
.chips-box select { border: none; background: none; color: var(--muted); font-family: inherit; font-size: 13px; outline: none; cursor: pointer; }

.hours-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13.5px; flex-wrap: wrap; }
.hours-row input[type="time"] {
    padding: 6px 9px; border: 1.5px solid var(--border); border-radius: 8px;
    background: var(--input); color: var(--text); font-family: inherit; font-size: 13px;
}

/* رضایت مشتری */
.csat-styles { display: flex; gap: 14px; flex-wrap: wrap; }
.csat-style-card {
    border: 1.5px solid var(--border); border-radius: 14px; padding: 18px 26px;
    cursor: pointer; background: var(--card); transition: border-color .15s;
}
.csat-style-card:hover { border-color: var(--muted); }
.csat-style-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.csat-style-card input { display: none; }
.csat-preview { font-size: 22px; letter-spacing: 4px; white-space: nowrap; }

/* شخصی‌سازی ظاهر */
.ap-colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px 16px; margin-bottom: 6px; }
.ap-colors .field { margin-bottom: 6px; }
.ap-colors .field span { font-size: 12px; }
.icon-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.icon-card {
    width: 52px; height: 52px; border: 1.5px solid var(--border); border-radius: 12px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    background: var(--card); color: var(--text); transition: border-color .15s;
}
.icon-card:hover { border-color: var(--muted); }
.icon-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); color: var(--accent); }
.icon-card input { display: none; }

/* سازنده ابزارک */
.builder-grid { display: grid; grid-template-columns: 1fr 400px; gap: 34px; padding-top: 22px; }
.builder-mode { display: flex; gap: 20px; margin-bottom: 14px; }
.builder-frame {
    width: 100%; height: 540px; border: 1px solid var(--border); border-radius: 16px;
    background: #fff; box-shadow: var(--shadow);
}
@media (max-width: 980px) {
    .builder-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .inbox-section { grid-template-columns: 1fr; gap: 14px; }
}

/* ---------- مخاطبین ---------- */
.contacts-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.contacts-toolbar .btn { margin-right: auto; }
.contacts-search { position: relative; display: flex; align-items: center; }
.contacts-search input {
    padding: 9px 36px 9px 14px; border: 1.5px solid var(--border); border-radius: 10px;
    background: var(--input); color: var(--text); font-family: inherit; font-size: 13px; width: 240px;
}
.contacts-search input:focus { outline: none; border-color: var(--accent); }
.contacts-search .conv-search-ico { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.contacts-search:focus-within .conv-search-ico { color: var(--accent); }

.contact-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    padding: 16px 18px; margin-bottom: 12px;
}
.contact-main { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.contact-field { font-size: 13px; min-width: 110px; }
.contact-field .cf-label { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.contact-details {
    display: none; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px;
}
.contact-card.open .contact-details { display: grid; }
.chev-btn .icon { transition: transform .2s; }
.contact-card.open .chev-btn .icon { transform: rotate(180deg); }

/* صفحه پروفایل مخاطب */
.contact-page { display: grid; grid-template-columns: 480px 1fr; gap: 26px; align-items: start; }
.cp-profile, .cp-tabs-col {
    background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px;
}
.cp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.cp-labels { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 1100px) { .contact-page { grid-template-columns: 1fr; } }

/* جزئیات کامل مخاطب */
.cd-block { border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 12px; }
.cd-title { font-weight: 700; font-size: 12.5px; margin-bottom: 8px; }
.cd-row {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 12.5px; padding: 5px 0; border-bottom: 1px solid var(--border);
}
.cd-row:last-child { border-bottom: none; }
.cd-time { color: var(--muted); font-size: 11px; flex-shrink: 0; min-width: 86px; }
.cd-url { font-size: 12px; word-break: break-all; }
.cd-mut { color: var(--muted); font-size: 11.5px; }
.cd-empty { color: var(--muted); font-size: 12px; }

.pagination-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 10px 16px; margin-top: 16px; font-size: 12.5px; color: var(--muted);
}
.page-btns { display: flex; gap: 4px; }
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px;
    border: 1px solid var(--border); color: var(--text); font-size: 13px;
}
.page-btn:hover { border-color: var(--accent); }
.page-btn.disabled { opacity: .35; pointer-events: none; }

/* ---------- خودکارسازی ---------- */
.fieldset-label { font-weight: 600; font-size: 13px; margin: 4px 0 8px; }
.cond-wrap { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.cond-row { display: flex; gap: 8px; margin-bottom: 10px; align-items: center; }
.cond-row select, .cond-row input {
    padding: 9px 10px; border: 1.5px solid var(--border); border-radius: 10px;
    background: var(--input); color: var(--text); font-family: inherit; font-size: 13px;
}
.cond-row select:focus, .cond-row input:focus { outline: none; border-color: var(--accent); }
.cond-row input { flex: 1; min-width: 0; }
.cond-remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 4px; flex-shrink: 0; }
.cond-remove:hover { color: var(--danger); }
.add-cond {
    background: none; border: none; color: var(--accent); cursor: pointer;
    font-family: inherit; font-size: 13px; font-weight: 700; padding: 4px 0;
}
.rule-snippet { color: var(--muted); font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- ویزارد تیم‌ها ---------- */
.back-link { color: var(--muted); font-size: 13px; font-weight: 600; }
.back-link:hover { color: var(--text); }
.title-row { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.title-row .page-title { margin-bottom: 0; }

.wizard-card { display: grid; grid-template-columns: 250px 1fr; gap: 34px; padding: 30px 28px; }
.wizard-steps { display: flex; flex-direction: column; gap: 30px; }
.wstep { display: flex; gap: 13px; align-items: flex-start; }
.wstep-num {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    border: 1.5px solid var(--border); color: var(--muted);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.wstep.active .wstep-num { border-color: var(--accent); color: var(--accent); }
.wstep.done .wstep-num { background: var(--accent); border-color: var(--accent); color: #fff; }
.wstep-title { font-weight: 700; font-size: 14px; }
.wstep.active .wstep-title { color: var(--accent); }
.wstep-desc { color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.7; }

.wizard-main h2 { font-size: 18px; margin-bottom: 6px; }
.wizard-main .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; line-height: 1.9; }

input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.check-row { display: flex; align-items: center; gap: 9px; margin: 18px 0 22px; font-size: 13.5px; cursor: pointer; }

.member-table td, .member-table th { vertical-align: middle; }
.member-count { color: var(--muted); font-size: 13px; margin: 12px 0 18px; }

.finish-box { text-align: center; padding: 30px 10px; }
.finish-box .big { font-size: 52px; margin-bottom: 14px; }
.finish-box h2 { margin-bottom: 8px; }
.finish-box p { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }

@media (max-width: 860px) {
    .wizard-card { grid-template-columns: 1fr; }
    .wizard-steps { flex-direction: row; gap: 14px; }
    .wstep-desc { display: none; }
}

/* ---------- پیش‌نمایش تایپ مشتری ---------- */
.typing-preview {
    align-self: flex-start; max-width: 70%;
    background: var(--card-2); border: 1.5px dashed var(--border); border-radius: 14px;
    padding: 9px 13px; margin-top: 4px; opacity: .85;
    animation: tpIn .25s ease;
}
@keyframes tpIn { from { opacity: 0; transform: translateY(4px); } to { opacity: .85; transform: none; } }
.typing-preview .tp-label { display: block; color: var(--muted); font-size: 10.5px; margin-bottom: 3px; }
.typing-preview .tp-text { font-size: 13px; font-style: italic; color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* ---------- بازدیدکنندگان آنلاین ---------- */
.title-row { display: flex; align-items: center; }
.lv-nochat { color: #F59E0B; font-size: 11.5px; font-weight: 700; }
.lv-watching { font-size: 13px; }

/* ---------- مشاهده زنده رفتار ---------- */
.lv-app { display: flex; flex-direction: column; height: 100%; flex: 1; min-width: 0; }
.lv-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--bg-2); flex-wrap: wrap;
}
.lv-url { color: var(--muted); font-size: 11.5px; font-family: Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.lv-main { display: grid; grid-template-columns: 1fr 260px; flex: 1; min-height: 0; }
.lv-stage-wrap {
    position: relative; overflow: hidden; background:
        repeating-conic-gradient(var(--card-2) 0% 25%, var(--bg) 0% 50%) 50% / 24px 24px;
    display: flex; align-items: center; justify-content: center; padding: 2px;
}
.lv-stage { position: relative; transform-origin: center center; display: none; box-shadow: 0 10px 40px rgba(0,0,0,.35); background: #fff; }
.lv-stage iframe { width: 100%; height: 100%; border: none; display: block; background: #fff; }
.lv-overlay { position: absolute; inset: 0; pointer-events: none; }
.lv-cursor { position: absolute; z-index: 5; transition: left .35s linear, top .35s linear; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.lv-ripple {
    position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
    border: 3px solid #EF4444; animation: lvRipple .9s ease-out forwards; z-index: 4;
}
@keyframes lvRipple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.lv-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; font-size: 14px; }
.lv-side { border-right: 1px solid var(--border); background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.lv-side-sec { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.lv-side-head { font-size: 12.5px; font-weight: 700; margin-bottom: 10px; }
.lv-stats { display: flex; gap: 8px; text-align: center; }
.lv-stats > div { flex: 1; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 4px; }
.lv-stats b { display: block; font-size: 17px; }
.lv-stats span { color: var(--muted); font-size: 10.5px; }
.lv-log { overflow-y: auto; flex: 1; min-height: 0; }
.lv-log-item { font-size: 11.5px; padding: 7px 8px; border-bottom: 1px dashed var(--border); word-break: break-word; }
.lv-log-time { color: var(--muted); font-size: 10px; margin-left: 4px; }
.lv-log-empty { color: var(--muted); font-size: 12px; padding: 8px; }
@media (max-width: 900px) { .lv-main { grid-template-columns: 1fr; } .lv-side { display: none; } }

/* فیلدهای سفارشی مخاطب */
.cp-custom { display: flex; flex-direction: column; gap: 8px; }
.cp-custom-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 12px; background: var(--card-2); border-radius: 9px; }
.cp-custom-label { color: var(--muted); font-size: 12.5px; min-width: 120px; font-weight: 600; }
.cp-custom-val { font-size: 13px; word-break: break-word; }

/* دسترسی اپراتور */
.perm-list { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.perm-chips { display: inline-flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.perm-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.perm-chip.on  { background: var(--success-soft); color: var(--success); }
.perm-chip.off { background: var(--card-2); color: var(--muted); }

/* ---------- راه‌اندازی (Onboarding) ---------- */
.nav-badge {
    display: inline-flex; align-items: center; justify-content: center; margin-right: auto;
    min-width: 18px; height: 18px; border-radius: 999px; background: #EF4444; color: #fff;
    font-size: 11px; font-weight: 800; padding: 0 5px;
}
.ob-wrap { max-width: 820px; }
.ob-hero {
    position: relative; overflow: hidden; border-radius: 20px; padding: 30px 32px; margin-bottom: 22px;
    background: linear-gradient(120deg, #2563EB 0%, #4F46E5 55%, #7C3AED 100%); color: #fff;
    box-shadow: 0 14px 34px -14px rgba(79, 70, 229, .55); text-align: center;
}
.ob-hero-glow { position: absolute; inset: auto -60px -120px auto; width: 300px; height: 300px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%); }
.ob-hero-emoji { font-size: 40px; margin-bottom: 8px; }
.ob-hero h1 { font-size: 22px; margin-bottom: 8px; }
.ob-hero p { font-size: 13.5px; opacity: .92; max-width: 520px; margin: 0 auto; line-height: 1.9; }
.ob-progress { max-width: 420px; margin: 18px auto 0; }
.ob-progress-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.25); overflow: hidden; }
.ob-progress-bar span { display: block; height: 100%; background: #fff; border-radius: 999px; transition: width .4s; }
.ob-progress-text { font-size: 12px; opacity: .9; margin-top: 8px; }

.ob-steps { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.ob-step {
    display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--border);
    border-radius: 14px; padding: 16px 18px; transition: border-color .15s;
}
.ob-step:hover { border-color: var(--accent); }
.ob-step.done { opacity: .72; }
.ob-step-num {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--border); color: var(--muted); font-weight: 800; font-size: 14px;
}
.ob-step.done .ob-step-num { background: var(--success); border-color: var(--success); color: #fff; }
.ob-step-body { flex: 1; min-width: 0; }
.ob-step-title { font-weight: 700; font-size: 14px; }
.ob-step.done .ob-step-title { text-decoration: line-through; }
.ob-opt { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--card-2); border-radius: 999px; padding: 2px 8px; margin-right: 6px; }
.ob-step-desc { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.ob-step-ok { color: var(--success); font-size: 12.5px; font-weight: 700; }
.ob-embed { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.ob-embed-head { margin-bottom: 12px; }
.ob-embed-head b { font-size: 14px; }
.ob-embed-head span { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.ob-embed-code { display: flex; align-items: center; gap: 10px; background: var(--card-2); border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; }
.ob-embed-code code { flex: 1; min-width: 0; direction: ltr; text-align: left; font-family: Consolas, monospace; font-size: 12px; word-break: break-all; }

/* ---------- تور راهنما ---------- */
.tour-overlay { position: fixed; inset: 0; z-index: 400; }
.tour-spot {
    position: fixed; border-radius: 12px; transition: all .25s ease;
    box-shadow: 0 0 0 9999px rgba(8, 12, 20, .68); pointer-events: none;
}
.tour-pop {
    position: fixed; width: 300px; max-width: calc(100vw - 24px); z-index: 401;
    background: var(--card); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .5); padding: 16px 18px; transition: all .25s ease;
}
.tour-pop-title { font-weight: 800; font-size: 14.5px; margin-bottom: 6px; }
.tour-pop-text { font-size: 13px; color: var(--muted); line-height: 1.9; }
.tour-pop-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.tour-step-n { font-size: 11.5px; color: var(--muted); }
.tour-btns { display: flex; gap: 8px; }

/* ---------- وضعیت شناور اپراتور ---------- */
.status-fab {
    position: fixed; bottom: 18px; left: 18px; z-index: 180;
    display: flex; align-items: center; gap: 8px;
    background: var(--card); border: 1px solid var(--border); border-radius: 999px;
    padding: 9px 16px; cursor: pointer; font-family: inherit; font-size: 12.5px; font-weight: 700;
    color: var(--text); box-shadow: 0 8px 22px -8px rgba(0, 0, 0, .4);
    transition: transform .15s, border-color .15s;
}
.status-fab:hover { transform: translateY(-2px); border-color: var(--accent); }
.status-fab-dot { width: 11px; height: 11px; border-radius: 50%; background: #6B7280; transition: background .2s, box-shadow .2s; }
.status-fab.on .status-fab-dot { background: #22C55E; box-shadow: 0 0 9px rgba(34, 197, 94, .7); }

/* ---------- گزارش‌ها ---------- */
.nav-disabled { opacity: .4; cursor: not-allowed; }

/* نوار خوش‌آمدگویی */
.rep-hero {
    position: relative; overflow: hidden; border-radius: 20px; margin-bottom: 20px;
    padding: 26px 30px; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
    background: linear-gradient(120deg, #2563EB 0%, #4F46E5 55%, #7C3AED 100%);
    color: #fff; box-shadow: 0 14px 34px -14px rgba(79, 70, 229, .55);
    animation: heroIn .5s ease both;
}
@keyframes heroIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rep-hero-glow {
    position: absolute; inset: auto -60px -120px auto; width: 300px; height: 300px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%); pointer-events: none;
}
.rep-hero-hi { font-size: 21px; font-weight: 800; margin-bottom: 6px; }
.rep-hero-date { font-size: 13px; opacity: .85; }
.rep-hero-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.rep-hero-stat {
    background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
    backdrop-filter: blur(4px); border-radius: 14px; padding: 12px 20px; text-align: center; min-width: 110px;
}
.rep-hero-stat b { display: block; font-size: 24px; font-weight: 800; }
.rep-hero-stat span { font-size: 11.5px; opacity: .9; }

.rep-top { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 1100px) { .rep-top { grid-template-columns: 1fr; } }
.rep-card {
    background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 20px 22px;
    transition: transform .18s, box-shadow .18s;
}
.rep-card:hover { box-shadow: 0 10px 28px -14px rgba(0, 0, 0, .35); }
.rep-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.rep-card-head h3 { font-size: 15px; }
.live-badge { color: var(--success); background: var(--success-soft); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.rep-chip { background: var(--card-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 12px; font-size: 12px; font-weight: 700; }
.rep-select {
    background: var(--card-2); border: 1px solid var(--border); border-radius: 9px; color: var(--text);
    padding: 7px 10px; font-family: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.rep-stats { display: flex; gap: 10px; }
.rep-stat { flex: 1; }
.rep-stat-label { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; }
.rep-stat-num { font-size: 30px; font-weight: 800; }

/* کارت‌های شاخص با آیکون */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi-grid-3 { grid-template-columns: repeat(3, 1fr); }
.kpi {
    background: var(--card-2); border: 1px solid var(--border); border-radius: 14px;
    padding: 16px 12px; text-align: center; transition: transform .18s, border-color .18s;
}
.kpi:hover { transform: translateY(-3px); border-color: var(--accent); }
.kpi-ico {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 12px; margin-bottom: 10px;
}
.kpi-ico svg { width: 21px; height: 21px; }
.kpi-blue   { background: rgba(59, 130, 246, .14); color: #3B82F6; }
.kpi-amber  { background: rgba(245, 158, 11, .14); color: #F59E0B; }
.kpi-purple { background: rgba(139, 92, 246, .14); color: #8B5CF6; }
.kpi-gray   { background: rgba(107, 114, 128, .16); color: #9CA3AF; }
.kpi-num { font-size: 28px; font-weight: 800; line-height: 1.2; }
.kpi-label { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.op-status-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin: 13px 0; }
@media (max-width: 700px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* انتخاب بازه زمانی */
.range-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.range-chip {
    padding: 8px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
    background: var(--card); border: 1px solid var(--border); color: var(--muted);
    transition: all .18s;
}
.range-chip:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.range-chip.active {
    background: linear-gradient(120deg, #2563EB, #7C3AED); color: #fff; border-color: transparent;
    box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .6);
}

/* نمودار روند (SVG) */
.chart-wrap { width: 100%; }
.ch-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.ch-ylabel, .ch-xlabel { fill: var(--muted); font-size: 10.5px; font-family: inherit; }
.ch-line { filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .25)); }
.ch-dot { transition: r .15s; pointer-events: none; }
circle[data-tip]:hover + .ch-dot, .ch-dot:hover { r: 5; }

/* نقشه حرارتی گفتگوها */
.heatmap { overflow-x: auto; padding-bottom: 4px; }
.hm-row { display: flex; align-items: center; gap: 3px; margin-bottom: 3px; }
.hm-day { width: 86px; flex-shrink: 0; font-size: 11px; line-height: 1.5; }
.hm-day b { display: block; font-size: 11.5px; }
.hm-day span { color: var(--muted); font-size: 10.5px; }
.hm-cell {
    width: 30px; height: 30px; flex-shrink: 0; border-radius: 6px;
    background: var(--card-2); cursor: default; transition: transform .12s;
}
.hm-cell[data-tip]:hover { transform: scale(1.18); }
.hm-hours .hm-cell { background: none; }
.hm-hour { color: var(--muted); font-size: 10.5px; display: flex; align-items: center; justify-content: center; height: 18px; }
.hm-legend { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.hm-legend-bar {
    width: 120px; height: 8px; border-radius: 999px;
    background: linear-gradient(90deg, rgba(var(--lg), .08), rgba(var(--lg), 1));
}
.hm-tip {
    display: none; position: absolute; z-index: 300; transform: translateX(-50%);
    background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    padding: 5px 10px; font-size: 11.5px; font-weight: 700; box-shadow: var(--shadow); pointer-events: none;
}

.rep-table td { vertical-align: middle; }
.rep-pager {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 14px; color: var(--muted); font-size: 12px; flex-wrap: wrap;
}
.rep-pager-btns { display: flex; gap: 6px; }
.rep-page {
    min-width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--border);
    background: none; color: var(--text); font-family: inherit; font-size: 12px; cursor: pointer;
}
.rep-page.active { border-color: var(--accent); color: var(--accent); font-weight: 700; }

/* نمودار توزیع رضایت مشتری */
.csat-bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.csat-bar-label { width: 90px; font-size: 12px; }
.csat-bar-track { flex: 1; height: 10px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.csat-bar-fill { display: block; height: 100%; border-radius: 999px; background: #F59E0B; }
.csat-bar-num { width: 40px; font-size: 12.5px; font-weight: 700; }

/* ---------- ریسپانسیو ---------- */
@media (max-width: 980px) {
    .chat-app { grid-template-columns: 280px 1fr; }
    .visitor-panel { display: none; }
}
/* ---------- موبایل: منوی کشویی + دکمهٔ شناور (بدون هیچ اثری روی دسکتاپ) ---------- */
.m-nav-fab, .m-nav-backdrop { display: none; }
.m-status-chip, .m-search-toggle { display: none; }

@media (max-width: 760px) {
    /* سایدبار اصلی → منوی کشویی تمام‌قد (مطابق طرح) */
    .layout { flex-direction: column; }
    .sidebar {
        position: fixed; top: 0; bottom: 0; right: 0; z-index: 300;
        width: 84%; max-width: 330px; height: 100dvh;
        transform: translateX(105%); transition: transform .25s ease;
        border-left: none; box-shadow: -12px 0 40px rgba(0,0,0,.25);
        overflow-y: auto; display: flex; flex-direction: column;
    }
    body.m-nav-open .sidebar { transform: translateX(0); }
    .m-nav-backdrop {
        display: block; position: fixed; inset: 0; z-index: 290;
        background: rgba(15,18,30,.45); opacity: 0; pointer-events: none; transition: opacity .25s;
    }
    body.m-nav-open .m-nav-backdrop { opacity: 1; pointer-events: auto; }
    .m-nav-fab {
        display: flex; align-items: center; justify-content: center;
        position: fixed; bottom: 72px; left: 18px; z-index: 280;
        width: 50px; height: 50px; border-radius: 50%;
        background: var(--card); color: var(--text); border: 1px solid var(--border);
        box-shadow: 0 10px 26px -8px rgba(0,0,0,.45); cursor: pointer;
    }
    .m-nav-fab svg { width: 22px; height: 22px; }
    body.m-nav-open .m-nav-fab { z-index: 310; }

    .content { padding: 12px 10px; }

    /* صفحهٔ گفتگوها: فقط لیست؛ با انتخاب گفتگو، چت تمام‌صفحه */
    .chat-app { grid-template-columns: 1fr; height: calc(100dvh - 60px); }
    .conv-list { display: none; width: 100%; border-left: none; }
    .chat-app.mobile-list .conv-list { display: flex; }
    .chat-app.mobile-list .chat-main { display: none; }

    /* هدر لیست مطابق طرح: عنوان + چیپ وضعیت + دکمهٔ جستجو */
    .conv-list-header { display: flex; align-items: center; gap: 10px; padding: 14px 16px 8px; }
    .conv-list-header h2 { font-size: 18px; }
    .m-status-chip {
        display: inline-flex; font-size: 11px; font-weight: 700; padding: 3px 10px;
        border-radius: 999px; background: var(--card-2); border: 1px solid var(--border);
        color: var(--muted); cursor: pointer;
    }
    .m-search-toggle {
        display: inline-flex; margin-right: auto; width: 36px; height: 36px; border-radius: 10px;
        align-items: center; justify-content: center; background: var(--card-2);
        border: 1px solid var(--border); color: var(--text); cursor: pointer;
    }
    .m-search-toggle svg { width: 17px; height: 17px; }
    .conv-search { display: none; }
    .conv-list.m-search-open .conv-search { display: flex; }
    .conv-tabs:not(.conv-tabs2) { display: none; }  /* وضعیت با چیپ هدر عوض می‌شود */
    .conv-tabs2 { padding: 4px 12px 8px; }

    /* ردیف گفتگو مطابق طرح: نام اپراتور کوچک بالای نام مشتری + فلش پاسخ */
    .conv-item { padding: 13px 14px; }
    .conv-body { display: flex; flex-direction: column; }
    .conv-assigned { order: -1; font-size: 11px; }
    .sn-pre { display: none; }
    .conv-snippet.op::before { content: '↩ '; opacity: .6; }

    /* هدر چت: فقط بازگشت + بستن؛ ابزارهای هوش مصنوعی در نوار دستیار قابل‌اسکرول */
    #btn-back { display: inline-flex !important; }
    #btn-summarize, #btn-email-transcript, .chat-header > div:last-child .cp-menu-wrap { display: none; }
    .chat-header { padding: 10px 12px; }
    .copilot-bar { overflow-x: auto; flex-wrap: nowrap; white-space: nowrap; scrollbar-width: none; }
    .copilot-bar::-webkit-scrollbar { display: none; }
}
