/* ============================================================
   Arkan Group — أنماط الميزات الجديدة (الإحصائيات، المساعد الذكي، تنبيهات)
   ============================================================ */

/* ---------- لوحة الإحصائيات ---------- */
.an-modal{ max-width: 980px; width: 96vw; max-height: 90vh; overflow:auto; padding: 22px 22px 26px; }
.an-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.an-head h3{ margin:0; font-size:19px; }
.an-head-actions{ display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.an-head-actions .btn-ghost-dark{ padding:7px 12px; font-size:12px; }
.an-live{ font-size:12px; font-weight:800; color:#176b45; background:#e6f5ec; border:1px solid #bfe3cd; padding:6px 12px; border-radius:99px; }
.an-kpis{ display:grid; grid-template-columns: repeat(4, 1fr); gap:12px; margin-bottom:14px; }
.an-kpi{ background: var(--paper); border:1px solid var(--line); border-radius:12px; padding:14px 16px; }
.an-kpi-t{ font-size:12px; color:#8b8474; font-weight:700; }
.an-kpi-v{ font-size:28px; font-weight:900; color: var(--ink); margin-top:2px; line-height:1.2; }
.an-kpi-s{ font-size:11px; color:#8b8474; margin-top:4px; }
.an-delta{ font-size:11.5px; font-weight:800; padding:2px 8px; border-radius:99px; vertical-align:middle; margin-inline-start:4px; }
.an-delta.up{ color:#176b45; background:#e6f5ec; }
.an-delta.down{ color:#a3321f; background:#fbe9e5; }
.an-delta.flat{ color:#726c5d; background:#f0ecdf; }
.an-card{ background:#fff; border:1px solid var(--line); border-radius:12px; padding:16px 18px; margin-bottom:14px; }
.an-card h4{ margin:0 0 12px; font-size:14px; color: var(--ink); }
.an-card-h{ display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.an-card-h h4{ margin:0; }
.an-tabs{ margin:0; }
.an-legend{ display:flex; gap:16px; font-size:11.5px; color:#726c5d; margin:10px 0 4px; }
.an-legend .lg{ display:inline-block; vertical-align:middle; margin-inline-end:6px; }
.an-legend .lg.bar{ width:12px; height:12px; border-radius:3px; background: var(--gold); }
.an-legend .lg.line{ width:16px; height:3px; border-radius:2px; background: var(--ink); }
.an-chart-wrap{ position:relative; direction:ltr; }
.an-svg{ width:100%; height:auto; display:block; }
.an-grid{ stroke: rgba(14,92,103,.12); stroke-width:1; }
.an-ytxt, .an-xtxt{ font-size:10.5px; fill:#8b8474; font-family:inherit; }
.an-bar{ fill: var(--gold); opacity:.9; }
.an-hit:hover{ fill: rgba(14,92,103,.07); }
.an-line{ fill:none; stroke: var(--ink); stroke-width:2.4; stroke-linejoin:round; stroke-linecap:round; }
.an-dot{ fill:#fff; stroke: var(--ink); stroke-width:2; }
.an-tip{ position:absolute; z-index:5; direction:rtl; background:#14281f; color:#fff; font-size:12px; line-height:1.7; padding:8px 12px; border-radius:8px; box-shadow:0 8px 24px rgba(0,0,0,.25); pointer-events:none; white-space:nowrap; }
.an-sums{ display:flex; gap:12px; flex-wrap:wrap; margin-top:10px; }
.an-sums > div{ flex:1; min-width:120px; background: var(--paper); border:1px solid var(--line); border-radius:10px; padding:10px 12px; text-align:center; }
.an-sums b{ display:block; font-size:20px; color: var(--ink); }
.an-sums span{ font-size:11px; color:#8b8474; }
.an-foot{ font-size:11px; color:#8b8474; margin-top:10px; line-height:1.8; }
.an-grid2{ display:grid; grid-template-columns: 1fr 1fr; gap:14px; }
.an-grid2 .an-card{ margin-bottom:0; }
.an-hb{ display:flex; flex-direction:column; gap:9px; }
.an-hb-row{ display:grid; grid-template-columns: 96px 1fr auto; gap:10px; align-items:center; font-size:12.5px; }
.an-hb-l{ color:#3a362e; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.an-hb-track{ height:10px; background:#f1ead3; border-radius:99px; overflow:hidden; }
.an-hb-fill{ height:100%; background: linear-gradient(90deg, var(--ink-soft), var(--emerald-light)); border-radius:99px; }
.an-hb-v{ font-weight:800; color: var(--ink); min-width:60px; text-align:end; }
.an-hb-v small{ color:#8b8474; font-weight:600; }
.an-hrs{ display:grid; grid-template-columns: repeat(12, 1fr); gap:4px; direction:ltr; }
.an-hr{ aspect-ratio:1; border-radius:6px; background: rgba(14,92,103, var(--a)); display:flex; align-items:center; justify-content:center; }
.an-hr span{ font-size:9.5px; color:#fff; mix-blend-mode:difference; font-weight:700; }
.an-note{ font-size:11.5px; color:#726c5d; margin-top:10px; line-height:1.8; }
.an-mini{ display:grid; grid-template-columns: 1fr 1fr; gap:10px; }
.an-mini > div{ background: var(--paper); border:1px solid var(--line); border-radius:10px; padding:10px; text-align:center; }
.an-mini b{ display:block; font-size:21px; color: var(--ink); }
.an-mini span{ font-size:11px; color:#8b8474; }
@media (max-width: 760px){
  .an-kpis{ grid-template-columns: 1fr 1fr; }
  .an-grid2{ grid-template-columns: 1fr; }
  .an-hb-row{ grid-template-columns: 78px 1fr auto; }
  .an-kpi-v{ font-size:23px; }
  .an-modal{ padding:16px 14px 22px; }
}

/* ---------- المساعد الذكي (نافذة الزوار) ---------- */
.chat-fab{
  position:fixed; bottom:62px; inset-inline-start:16px; z-index:44;
  width:56px; height:56px; border-radius:50%; border:none; cursor:pointer;
  background: linear-gradient(135deg, var(--ink), var(--ink-soft)); color:#fff; font-size:25px;
  box-shadow: 0 10px 28px rgba(14,92,103,.45); display:flex; align-items:center; justify-content:center;
  transition: transform .2s ease;
}
.chat-fab:hover{ transform: scale(1.07); }
.chat-fab::after{ content:""; position:absolute; top:6px; inset-inline-end:6px; width:11px; height:11px; border-radius:50%; background:#3ddc84; border:2px solid #fff; }
.chat-fab[hidden]{ display:none; }
.chat-panel{
  position:fixed; bottom:62px; inset-inline-start:16px; z-index:150; width:370px; max-width:calc(100vw - 24px);
  height:min(560px, calc(100vh - 90px)); background: var(--paper); border:1px solid var(--line); border-radius:18px;
  box-shadow:0 24px 70px rgba(0,0,0,.35); display:none; flex-direction:column; overflow:hidden;
}
.chat-panel.open{ display:flex; animation: chatIn .22s ease; }
@keyframes chatIn{ from{ opacity:0; transform: translateY(14px) scale(.98);} to{ opacity:1; transform:none; } }
.chat-head{ background: linear-gradient(135deg, var(--ink), var(--ink-soft)); color:#fff; padding:13px 16px; display:flex; align-items:center; gap:11px; }
.chat-head img{ width:36px; height:36px; border-radius:9px; object-fit:cover; background:#111; }
.chat-head .t{ font-weight:800; font-size:14.5px; }
.chat-head .s{ font-size:11px; opacity:.85; }
.chat-head button{ margin-inline-start:auto; background:rgba(255,255,255,.14); color:#fff; border-radius:8px; width:30px; height:30px; font-size:15px; }
.chat-body{ flex:1; overflow-y:auto; padding:14px 12px; display:flex; flex-direction:column; gap:10px; background:#fbf6e8; }
.chat-msg{ max-width:88%; padding:10px 13px; border-radius:14px; font-size:13.5px; line-height:1.85; white-space:pre-wrap; word-break:break-word; }
.chat-msg.bot{ align-self:flex-start; background:#fff; border:1px solid var(--line); border-end-start-radius:4px; color:#2b2820; }
.chat-msg.me{ align-self:flex-end; background: var(--ink); color:#fff; border-end-end-radius:4px; }
.chat-acts{ display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.chat-act{ background: var(--gold); color:#2a2000; font-weight:800; font-size:12px; padding:6px 12px; border-radius:99px; border:none; cursor:pointer; }
.chat-act.wa{ background:#25d366; color:#06361a; }
.chat-chips{ display:flex; flex-wrap:wrap; gap:6px; padding:0 12px 10px; background:#fbf6e8; }
.chat-chip{ background:#fff; border:1px solid var(--line); color: var(--ink); font-size:12px; font-weight:700; padding:6px 11px; border-radius:99px; cursor:pointer; }
.chat-chip:hover{ background: var(--ivory); }
.chat-typing{ align-self:flex-start; background:#fff; border:1px solid var(--line); border-radius:14px; padding:12px 16px; display:flex; gap:5px; }
.chat-typing i{ width:7px; height:7px; border-radius:50%; background: var(--ink); opacity:.35; animation: chatDot 1s infinite; }
.chat-typing i:nth-child(2){ animation-delay:.15s; } .chat-typing i:nth-child(3){ animation-delay:.3s; }
@keyframes chatDot{ 0%,80%,100%{ opacity:.25; transform:none;} 40%{ opacity:1; transform: translateY(-3px);} }
.chat-form{ display:flex; gap:8px; padding:10px; border-top:1px solid var(--line); background:#fff; }
.chat-form input{ flex:1; border:1px solid #ddd3ba; border-radius:99px; padding:10px 15px; font-size:14px; font-family:inherit; min-width:0; }
.chat-form input:focus{ outline:2px solid var(--gold); outline-offset:0; }
.chat-form button{ background: var(--ink); color:#fff; border-radius:99px; padding:0 18px; font-weight:800; font-size:13px; }
.chat-form button:disabled{ opacity:.5; cursor:not-allowed; }
.chat-foot{ font-size:10.5px; color:#8b8474; text-align:center; padding:0 10px 8px; background:#fff; }
@media (max-width:480px){
  .chat-panel{ inset-inline:0; bottom:0; width:100%; max-width:100%; height:78vh; border-radius:18px 18px 0 0; }
  .chat-fab{ bottom:58px; }
}
@media (prefers-reduced-motion: reduce){ .chat-panel.open, .chat-typing i{ animation:none; } }

/* ---------- إدارة المساعد (ADMIN) ---------- */
.as-sec{ border-top:1px solid var(--line); margin-top:16px; padding-top:14px; }
.as-sec:first-of-type{ border-top:none; margin-top:0; padding-top:0; }
.as-sec h4{ margin:0 0 8px; font-size:14px; color:var(--ink); }
.as-row{ display:flex; gap:8px; align-items:flex-start; background:#fff; border:1px solid var(--line); border-radius:8px; padding:9px 12px; margin-bottom:6px; font-size:12.5px; }
.as-row .q{ font-weight:800; color:var(--ink); }
.as-row .a{ color:#4a463c; margin-top:3px; white-space:pre-wrap; }
.as-badge{ font-size:10.5px; font-weight:800; padding:2px 8px; border-radius:99px; background:#f0ecdf; color:#726c5d; }
.as-badge.warn{ background:#fbe9e5; color:#a3321f; }
.as-badge.ai{ background:#e8f0fb; color:#244a8f; }
.as-form input, .as-form textarea{ width:100%; border:1px solid #ddd3ba; border-radius:6px; padding:9px 11px; font-size:13px; font-family:inherit; margin-bottom:6px; }
.as-stats{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
.as-stats > div{ flex:1; min-width:110px; background:var(--paper); border:1px solid var(--line); border-radius:8px; padding:8px 10px; text-align:center; font-size:11px; color:#8b8474; }
.as-stats b{ display:block; font-size:18px; color:var(--ink); }

/* ---------- تحذير كلمة المرور المبدئية ---------- */
.pw-warning{ background:#fff4d6; border:1px solid #e8c766; color:#6b4b00; border-radius:8px; padding:10px 14px; font-size:12.5px; font-weight:700; margin-bottom:12px; line-height:1.8; }
