/* =====================================================
   SevinSoft CRM — تم اصلی پنل مدیریت
   RTL / Dark+Light / Vazirmatn
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700&display=swap');

/* ── توکن‌های تم تیره (پیش‌فرض) ── */
:root {
  --bg-root:      #0D0F14;
  --bg-surface:   #141720;
  --bg-elevated:  #1A1E2E;
  --border:       #1E2230;
  --border-light: #262C42;

  --accent:       #5B6EF5;
  --accent-soft:  rgba(91,110,245,.12);
  --accent-glow:  rgba(91,110,245,.35);
  --purple:       #8B5CF6;
  --purple-soft:  rgba(139,92,246,.12);

  --text-primary: #E2E8F0;
  --text-muted:   #64748B;
  --text-faint:   #3A4155;

  --success:      #22C55E;
  --warning:      #F59E0B;
  --danger:       #EF4444;
  --info:         #38BDF8;

  --sidebar-w:    260px;
  --header-h:     60px;
  --radius:       10px;
  --radius-sm:    6px;

  --font: 'Vazirmatn', system-ui, sans-serif;
  --transition: 180ms cubic-bezier(.4,0,.2,1);

  /* aliases برای سازگاری با کد قدیمی */
  --c-bg:         var(--bg-root);
  --c-surface:    var(--bg-surface);
  --c-border:     var(--border);
  --c-accent:     var(--accent);
  --c-text:       var(--text-primary);
  --c-text-muted: var(--text-muted);
  --c-danger:     var(--danger);
  --c-success:    var(--success);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.4);
  --shadow-md:    0 4px 20px rgba(0,0,0,.5);
}

/* ── توکن‌های تم روشن ── */
[data-theme="light"] {
  --bg-root:      #F1F4F9;
  --bg-surface:   #FFFFFF;
  --bg-elevated:  #F8FAFC;
  --border:       #E2E8F0;
  --border-light: #CBD5E1;

  --accent:       #4F63E7;
  --accent-soft:  rgba(79,99,231,.09);
  --accent-glow:  rgba(79,99,231,.2);
  --purple:       #7C3AED;
  --purple-soft:  rgba(124,58,237,.09);

  --text-primary: #0F172A;
  --text-muted:   #64748B;
  --text-faint:   #94A3B8;

  --success:      #16A34A;
  --warning:      #D97706;
  --danger:       #DC2626;
  --info:         #0284C7;

  --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
}

/* ── ریست ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg-root);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ═══════════════════════════════════════
   App Shell Layout
═══════════════════════════════════════ */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ── */
.app-topbar {
  height: var(--header-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  position: fixed;
  top: 0; right: 0; left: 0;
  z-index: 190;
}

.menu-toggle {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: all var(--transition);
}
.menu-toggle:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--accent); }

.topbar-title {
  font-weight: 700;
  font-size: .9rem;
  color: var(--text-primary);
  flex: 1;
  text-align: center;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── دکمه سوئیچ تم ── */
.theme-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.theme-switcher button {
  padding: 3px 9px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
  font-family: var(--font);
  transition: all var(--transition);
}
.theme-switcher button:hover { color: var(--text-primary); background: var(--bg-root); }
.theme-switcher button.active { background: var(--accent); color: #fff; }

/* ── اندازه فونت ── */
.font-switcher {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.font-switcher button {
  padding: 3px 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  font-size: .72rem;
  font-family: var(--font);
  transition: all var(--transition);
}
.font-switcher button:hover { color: var(--text-primary); background: var(--bg-root); }

/* ── icon-btn عمومی ── */
.topbar-icons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.icon-btn {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--accent); }
.icon .icon { pointer-events: none; }

/* بج عدد روی آیکون */
.icon-badge {
  position: absolute;
  top: -5px; left: -5px;
  background: var(--danger);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 10px;
  padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}

/* ── اعلان dropdown ── */
.notif-wrap { position: relative; }
.notif-dropdown {
  display: none;
  position: absolute;
  left: 0; top: calc(100% + 8px);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 260px;
  z-index: 200;
}
.notif-dropdown.open { display: block; }
.notif-header { padding: 10px 14px; font-size: .8rem; font-weight: 700; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.notif-list { list-style: none; max-height: 220px; overflow-y: auto; }
.notif-list li a { display: block; padding: 9px 14px; font-size: .82rem; color: var(--text-primary); border-bottom: 1px solid var(--border); }
.notif-list li a:hover { background: var(--accent-soft); }
.notif-footer { display: block; padding: 8px 14px; font-size: .78rem; color: var(--accent); text-align: center; }

/* ── منوی کاربر ── */
.user-menu-wrap { position: relative; }
.user-btn { gap: 6px; width: auto; padding: 0 10px; }
.avatar-sm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #fff; font-weight: 700; font-size: .75rem;
  flex-shrink: 0;
}
.user-dropdown {
  display: none;
  position: absolute;
  left: 0; top: calc(100% + 8px);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 170px;
  padding: 8px 0;
  z-index: 200;
}
.user-dropdown.open { display: block; }
.user-dropdown-name { padding: 6px 14px; font-weight: 700; font-size: .85rem; }
.user-dropdown-role { padding: 0 14px 8px; font-size: .72rem; color: var(--text-muted); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.user-dropdown a { display: block; padding: 8px 14px; font-size: .83rem; color: var(--text-primary); }
.user-dropdown a:hover { background: var(--accent-soft); }
.user-dropdown a.danger { color: var(--danger); }

/* ═══════════════════════════════════════
   Body Layout (sidebar + content)
═══════════════════════════════════════ */
.app-body {
  display: flex;
  margin-top: var(--header-h);
  min-height: calc(100vh - var(--header-h) - 38px);
}

/* ── Sidebar ── */
.app-sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 38px;
  z-index: 100;
  overflow: hidden;
  transition: right var(--transition);
}

/* خط درخشان بالای sidebar */
.app-sidebar::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--purple), transparent);
  animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { opacity: .4; transform: scaleX(.6); }
  50%       { opacity: 1;  transform: scaleX(1); }
}

.sidebar-profile {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-profile .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; font-weight: 700;
  margin-bottom: 8px;
}
.sidebar-profile .name { font-size: .88rem; font-weight: 700; }

/* نوار منو */
.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
  scrollbar-width: none;
}
.sidebar-menu::-webkit-scrollbar { display: none; }

.menu-title {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--text-faint);
  padding: 14px 18px 5px;
  text-transform: uppercase;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  font-size: .87rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  transition: color var(--transition), background var(--transition);
}
.sidebar-menu a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,.03);
}
.sidebar-menu a.active {
  color: var(--text-primary);
  background: var(--accent-soft);
}
.sidebar-menu a.active::before {
  content: '';
  position: absolute;
  right: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), var(--purple));
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

/* overlay موبایل */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* ── Content ── */
.app-content {
  flex: 1;
  margin-right: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.breadcrumb-bar {
  padding: 10px 24px 0;
  font-size: .78rem;
  color: var(--text-muted);
}

.toolbar-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 24px 0;
  min-height: 0;
}

.main-content {
  flex: 1;
  padding: 18px 24px 30px;
  overflow-y: auto;
}

/* ── Footer ── */
.app-footer {
  height: 38px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  font-size: .75rem;
  color: var(--text-muted);
  position: fixed;
  bottom: 0; right: 0; left: 0;
  z-index: 90;
}

/* ═══════════════════════════════════════
   Badge نقش‌ها
═══════════════════════════════════════ */
.role-badge {
  display: inline-block;
  font-size: .68rem; font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  margin-top: 4px;
}
.role-badge.admin   { background: rgba(239,68,68,.12);  color: var(--danger); }
.role-badge.manager { background: var(--accent-soft);   color: var(--accent); }
.role-badge.driver  { background: rgba(34,197,94,.1);   color: var(--success); }

/* ═══════════════════════════════════════
   Toolbar inputs
═══════════════════════════════════════ */
.tb-search, .tb-select {
  padding: 7px 11px;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: .83rem;
  outline: none;
  transition: border-color var(--transition);
}
.tb-search:focus, .tb-select:focus { border-color: var(--accent); }
.tb-search { min-width: 190px; }

.tb-btn {
  padding: 7px 15px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: .83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.tb-btn:hover { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--accent); }
.tb-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.tb-btn.primary:hover { opacity: .88; }

/* ═══════════════════════════════════════
   Cards
═══════════════════════════════════════ */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-title { font-size: .92rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-body.no-pad { padding: 0; }

/* ═══════════════════════════════════════
   Stat Cards
═══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card.loading { opacity: .6; }
.stat-label { font-size: .76rem; color: var(--text-muted); margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 700; letter-spacing: -.02em; color: var(--accent); }
.stat-icon { position: absolute; bottom: 10px; left: 14px; font-size: 1.8rem; opacity: .07; }

/* ═══════════════════════════════════════
   Buttons
═══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600;
  border: none; cursor: pointer;
  font-family: var(--font);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 0 0 0 var(--accent-glow); }
.btn-primary:hover { opacity: .9; box-shadow: 0 0 18px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-light); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-sm { padding: 5px 11px; font-size: .78rem; }

/* ═══════════════════════════════════════
   Tables
═══════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .83rem; }
.data-table thead th {
  padding: 10px 14px;
  text-align: right;
  font-size: .72rem; font-weight: 600;
  color: var(--text-muted);
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.015);
  white-space: nowrap;
  position: sticky; top: 0;
}
.data-table tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(91,110,245,.04); }
.data-table tbody td { padding: 11px 14px; vertical-align: middle; }

/* ── badge وضعیت سفارش ── */
.order-status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .72rem; font-weight: 700;
}
.status-1  { background: rgba(245,158,11,.12);  color: var(--warning); }  /* ثبت شده */
.status-2  { background: rgba(56,189,248,.12);  color: var(--info); }     /* دریافت */
.status-3  { background: rgba(91,110,245,.12);  color: var(--accent); }   /* شستشو */
.status-4  { background: rgba(139,92,246,.12);  color: var(--purple); }   /* شسته شده */
.status-5  { background: rgba(34,197,94,.12);   color: var(--success); }  /* آماده */
.status-6  { background: rgba(34,197,94,.2);    color: var(--success); }  /* تحویل */
.status-11 { background: rgba(239,68,68,.12);   color: var(--danger); }   /* لغو */

/* ═══════════════════════════════════════
   Forms
═══════════════════════════════════════ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-control {
  width: 100%;
  background: var(--bg-root);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 9px 12px;
  font-size: .87rem;
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-control::placeholder { color: var(--text-faint); }

/* ═══════════════════════════════════════
   Loading
═══════════════════════════════════════ */
.loading-spinner {
  display: block; padding: 36px; text-align: center;
  color: var(--text-muted); font-size: .85rem;
}

/* ═══════════════════════════════════════
   Call Panel (SIP)
═══════════════════════════════════════ */
.call-panel {
  position: fixed; bottom: 50px; left: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 240px;
  box-shadow: var(--shadow-md);
  z-index: 500;
  animation: callIn .2s ease;
}
@keyframes callIn { from { opacity:0; transform:translateY(10px); } }
.call-panel-caller { margin-bottom: 10px; }
.call-panel-number { font-size: 1.1rem; font-weight: 700; display: block; }
.call-panel-status { font-size: .78rem; color: var(--text-muted); }
.call-panel-customer { font-size: .82rem; color: var(--accent); margin-bottom: 12px; }
.call-panel-actions { display: flex; gap: 8px; }
.call-btn { padding: 7px 14px; border-radius: var(--radius-sm); border: none; font-weight: 700; font-size: .82rem; font-family: var(--font); }
.call-btn.answer  { background: var(--success); color: #fff; }
.call-btn.reject  { background: var(--danger);  color: #fff; }
.call-btn.hangup  { background: var(--danger);  color: #fff; }

/* ═══════════════════════════════════════
   Toast
═══════════════════════════════════════ */
.toast-container { position: fixed; top: 70px; left: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: .83rem;
  display: flex; align-items: center; gap: 9px;
  min-width: 240px;
  box-shadow: var(--shadow-md);
  animation: toastIn .18s ease;
}
@keyframes toastIn { from { opacity:0; transform:translateX(-10px); } }
.toast.success { border-right: 3px solid var(--success); }
.toast.error   { border-right: 3px solid var(--danger);  }
.toast.info    { border-right: 3px solid var(--accent);  }

/* ═══════════════════════════════════════
   Responsive - موبایل
═══════════════════════════════════════ */
@media (max-width: 768px) {
  .app-sidebar {
    right: calc(-1 * var(--sidebar-w));
    transition: right .25s ease;
  }
  .app-sidebar.open { right: 0; }

  .app-content { margin-right: 0; }

  .main-content { padding: 14px 14px 80px; }
  .breadcrumb-bar, .toolbar-bar { padding-right: 14px; padding-left: 14px; }

  .topbar-controls { display: none; }

  .data-table { min-width: 580px; }
  .table-wrap { overflow-x: auto; }

  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── تم روشن: سایه‌های ملایم ── */
[data-theme="light"] .app-sidebar,
[data-theme="light"] .app-topbar { box-shadow: 0 1px 0 var(--border); }
[data-theme="light"] .card { box-shadow: var(--shadow-sm); }
[data-theme="light"] .data-table tbody tr:hover { background: rgba(79,99,231,.04); }
[data-theme="light"] .app-sidebar::before { opacity: .7; }

/* ═══════════════════════════════════════════════════
   نشانگر SIP در topbar
═══════════════════════════════════════════════════ */
.sip-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  transition: background .3s;
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(0,0,0,.15);
}
.sip-dot--online  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.sip-dot--offline { background: var(--danger);  }
.sip-dot--busy    { background: var(--warning); box-shadow: 0 0 6px var(--warning); animation: sipPulse 1s ease-in-out infinite; }

@keyframes sipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.6); }
  50%       { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

.sip-wrap {
  display: flex; align-items: center; gap: 6px;
  padding: 0 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  height: 34px;
  cursor: pointer;
  font-size: .76rem;
  color: var(--text-muted);
  transition: all var(--transition);
}
.sip-wrap:hover { background: var(--bg-elevated); border-color: var(--accent); color: var(--text-primary); }
.sip-label { display: none; }
@media (min-width: 900px) { .sip-label { display: inline; } }

/* ═══════════════════════════════════════════════════
   پنل تماس ورودی
═══════════════════════════════════════════════════ */
.call-panel {
  position: fixed;
  bottom: 50px; left: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 270px;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  z-index: 800;
  animation: callSlide .2s ease;
}
@keyframes callSlide { from { opacity:0; transform:translateY(12px); } }
.call-panel-caller { margin-bottom: 10px; }
.call-panel-number { font-size: 1.1rem; font-weight: 700; display: block; direction: ltr; }
.call-panel-status { font-size: .75rem; color: var(--text-muted); margin-top: 2px; display: block; }
.call-panel-customer { font-size: .83rem; padding: 8px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; min-height: 36px; }
.call-cname { font-weight: 700; font-size: .9rem; margin-bottom: 3px; }
.call-cmeta { font-size: .75rem; color: var(--text-muted); }
.call-order { display: inline-block; margin-top: 3px; color: var(--accent); }
.call-lookup, .call-unknown { color: var(--text-muted); font-size: .78rem; }
.call-panel-customer[style*="cursor"] .call-cname::after { content: ' ←'; font-size: .7rem; color: var(--accent); }
.call-panel-actions { display: flex; gap: 8px; }
.call-btn {
  flex: 1; padding: 8px; border-radius: var(--radius-sm);
  border: none; font-weight: 700; font-size: .82rem;
  font-family: var(--font); cursor: pointer;
  transition: opacity .15s;
}
.call-btn:hover { opacity: .85; }
.call-btn.answer { background: var(--success); color: #fff; }
.call-btn.reject { background: var(--danger);  color: #fff; }
.call-btn.hangup { background: var(--danger);  color: #fff; }

/* ═══════════════════════════════════════════════════
   مودال فاکتور تمام‌صفحه
═══════════════════════════════════════════════════ */
.ofm-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 900;
  align-items: stretch;
  justify-content: stretch;
  animation: fadeIn .15s ease;
}
.ofm-overlay.open { display: flex; }

.ofm-box {
  background: var(--bg-surface);
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* هدر مودال */
.ofm-header {
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  height: 56px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ofm-title {
  font-size: 1rem; font-weight: 700;
  color: var(--accent); flex-shrink: 0;
}
.ofm-header-meta {
  flex: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: .8rem; color: var(--text-muted);
}
.ofm-customer { font-weight: 600; color: var(--text-primary); }
.ofm-status-pill {
  padding: 2px 9px; border-radius: 20px;
  font-size: .7rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}
.ofm-status-pill.s11 { background: rgba(239,68,68,.1); color: var(--danger); }
.ofm-status-pill.s6,
.ofm-status-pill.s9  { background: rgba(34,197,94,.1); color: var(--success); }
.ofm-date { font-size: .75rem; }

.ofm-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; border: 1px solid var(--border-light);
  color: var(--text-muted); font-size: .9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
}
.ofm-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* تب‌ها */
.ofm-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ofm-tabs::-webkit-scrollbar { display: none; }
.ofm-tab {
  padding: 10px 18px; border: none; background: transparent;
  color: var(--text-muted); font-size: .84rem; font-weight: 500;
  font-family: var(--font); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.ofm-tab:hover { color: var(--text-primary); }
.ofm-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* بدنه */
.ofm-body {
  flex: 1; overflow-y: auto; padding: 20px 24px 40px;
}
.ofm-loading {
  padding: 48px; text-align: center; color: var(--text-muted); font-size: .88rem;
}

/* خلاصه مالی */
.ofm-summary {
  display: flex; flex-wrap: wrap; gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 16px;
}
.ofm-sum-row {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 120px; flex: 1;
}
.ofm-sum-row span:first-child { font-size: .72rem; color: var(--text-muted); }
.ofm-sum-row span:last-child  { font-size: .95rem; font-weight: 700; }
.ofm-total  { color: var(--accent); }
.ofm-paid   { color: var(--success); }
.ofm-remain { color: var(--text-primary); }
.ofm-remain.debt { color: var(--danger); }

/* جدول درون مودال */
.ofm-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.ofm-table thead th {
  padding: 9px 12px; text-align: right;
  font-size: .72rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated); position: sticky; top: 0;
}
.ofm-table tbody tr { border-bottom: 1px solid var(--border); transition: background var(--transition); }
.ofm-table tbody tr:hover { background: rgba(91,110,245,.04); }
.ofm-table tbody td { padding: 10px 12px; vertical-align: top; }

/* badge پرداخت */
.ofm-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: .72rem; font-weight: 700; }
.ofm-badge.ok   { background: rgba(34,197,94,.1); color: var(--success); }
.ofm-badge.fail { background: rgba(239,68,68,.1); color: var(--danger); }

/* جزئیات */
.ofm-details-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.ofm-drow {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 14px;
}
.ofm-drow label { display: block; font-size: .72rem; color: var(--text-muted); margin-bottom: 4px; }
.ofm-drow span  { font-size: .85rem; font-weight: 600; }

.sp-0,.sp-1  { background:rgba(245,158,11,.12); color:#D97706; }
.sp-2        { background:rgba(56,189,248,.12);  color:#0284C7; }
.sp-3        { background:rgba(91,110,245,.12);  color:var(--accent); }
.sp-4        { background:rgba(139,92,246,.12);  color:var(--purple); }
.sp-5,.sp-6  { background:rgba(34,197,94,.12);   color:var(--success); }
.sp-7,.sp-8  { background:rgba(34,197,94,.18);   color:var(--success); }
.sp-9        { background:rgba(34,197,94,.2);    color:var(--success); }
.sp-10,.sp-11{ background:rgba(239,68,68,.1);    color:var(--danger); }
.sp-14,.sp-15{ background:rgba(245,158,11,.18);  color:#D97706; }

table tbody tr:nth-child(odd) {
    background-color: #25253a;
}

table tbody tr:nth-child(even) {
    background-color: #1e1e2f;
}

[data-theme="light"] table tbody tr:nth-child(odd) {
    background-color: #f5f5f5; /* ردیف‌های فرد */
}

[data-theme="light"] table tbody tr:nth-child(even) {
    background-color: #ffffff; /* ردیف‌های زوج */
}



@media (max-width: 600px) {
  .ofm-body { padding: 14px 12px 40px; }
  .ofm-header { padding: 0 12px; }
  .ofm-tab { padding: 10px 12px; font-size: .78rem; }
  .ofm-details-grid { grid-template-columns: 1fr 1fr; }
}
