/* ============================================================
   Maho CRM — shadcn design system, rebuilt in pure CSS (RTL)
   توکن‌ها عیناً از shadcn-ui-kit/app/globals.css
   ============================================================ */
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --base-50:  oklch(0.985 0.0013 286.84);
  --base-100: oklch(0.967 0.0027 286.38);
  --base-200: oklch(0.92 0.0053 286.32);
  --base-300: oklch(0.871 0.008 286.29);
  --base-400: oklch(0.705 0.012 286.07);
  --base-500: oklch(0.552 0.016 285.94);
  --base-600: oklch(0.442 0.0147 285.79);
  --base-700: oklch(0.37 0.012 285.81);
  --base-800: oklch(0.274 0.008 286.03);
  --base-900: oklch(0.21 0.0053 285.89);
  --base-950: oklch(0.141 0.004 285.83);

  --background: #fff;
  --foreground: var(--base-800);
  --card: #fff;
  --card-foreground: var(--base-800);
  --popover: #fff;
  --popover-foreground: var(--base-800);
  --primary: var(--base-950);
  --primary-foreground: #fff;
  --secondary: var(--base-300);
  --secondary-foreground: var(--base-800);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: var(--base-200);
  --accent-foreground: var(--base-800);
  --destructive: oklch(0.577 0.245 27.325);
  --success: oklch(0.627 0.17 149.2);
  --info: oklch(0.588 0.158 241.97);
  --warning: oklch(0.769 0.155 70.08);
  --border: var(--base-200);
  --input: var(--base-300);
  --ring: var(--base-800);
  --chart-1: var(--base-950);
  --chart-2: var(--base-600);
  --chart-3: var(--base-800);
  --chart-4: var(--base-400);
  --chart-5: var(--base-300);
  --radius: 0.5rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --sidebar: var(--base-100);
  --sidebar-foreground: var(--base-500);
  --sidebar-primary: var(--base-950);
  --sidebar-primary-foreground: #fff;
  --sidebar-accent: var(--base-200);
  --sidebar-accent-foreground: var(--base-950);
  --sidebar-border: var(--base-200);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);
}

.dark {
  --background: var(--base-950);
  --foreground: var(--base-200);
  --card: var(--base-950);
  --card-foreground: var(--base-200);
  --popover: var(--base-950);
  --popover-foreground: var(--base-200);
  --primary: var(--base-50);
  --primary-foreground: var(--base-900);
  --secondary: var(--base-500);
  --secondary-foreground: var(--base-200);
  --muted: var(--base-900);
  --muted-foreground: var(--base-400);
  --accent: var(--base-900);
  --accent-foreground: var(--base-200);
  --destructive: oklch(0.704 0.191 22.216);
  --success: oklch(0.723 0.15 149.2);
  --info: oklch(0.685 0.14 241.97);
  --border: var(--base-800);
  --input: var(--base-700);
  --ring: var(--base-200);
  --chart-1: var(--base-50);
  --chart-2: var(--base-400);
  --chart-3: var(--base-200);
  --chart-4: var(--base-600);
  --chart-5: var(--base-700);
  --sidebar: var(--base-900);
  --sidebar-foreground: var(--base-200);
  --sidebar-primary: var(--base-50);
  --sidebar-primary-foreground: var(--base-900);
  --sidebar-accent: var(--base-800);
  --sidebar-accent-foreground: var(--base-200);
  --sidebar-border: var(--base-800);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--foreground);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
svg.icon { width: 1rem; height: 1rem; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100dvh; }
.sidebar {
  width: 16rem; flex-shrink: 0;
  background: var(--sidebar); color: var(--sidebar-foreground);
  border-inline-end: 1px solid var(--sidebar-border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100dvh;
}
.sidebar-header { display: flex; align-items: center; gap: 0.625rem; padding: 1rem; }
.brand-mark {
  width: 2rem; height: 2rem; border-radius: var(--radius-lg);
  background: var(--sidebar-primary); color: var(--sidebar-primary-foreground);
  display: grid; place-items: center; font-weight: 800; font-size: 1rem;
}
.brand-name { font-weight: 800; font-size: 1.05rem; color: var(--sidebar-accent-foreground); }
.brand-sub { font-size: 0.7rem; color: var(--sidebar-foreground); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.5rem; display: flex; flex-direction: column; gap: 0.125rem; }
.nav-label { font-size: 0.7rem; font-weight: 600; padding: 0.75rem 0.75rem 0.25rem; color: var(--sidebar-foreground); opacity: 0.8; }
.nav-item {
  display: flex; align-items: center; gap: 0.625rem;
  padding: 0.5rem 0.75rem; border-radius: var(--radius-md);
  font-size: 0.85rem; font-weight: 500; color: var(--sidebar-foreground);
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); }
.nav-item.active { background: var(--sidebar-primary); color: var(--sidebar-primary-foreground); box-shadow: var(--shadow-sm); }
.nav-item .icon { width: 1.05rem; height: 1.05rem; }
.sidebar-footer { padding: 0.75rem; border-top: 1px solid var(--sidebar-border); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1.5rem; border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 85%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 30;
}
.topbar h1 { font-size: 1.05rem; }
.topbar-spacer { flex: 1; }
.content { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }

/* ---------- Card ---------- */
.card {
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.card-header { padding: 1.1rem 1.25rem 0; display: flex; align-items: flex-start; gap: 0.5rem; }
.card-title { font-size: 0.95rem; font-weight: 700; }
.card-desc { font-size: 0.8rem; color: var(--muted-foreground); margin-top: 0.15rem; }
.card-body { padding: 1.1rem 1.25rem; }
.card-header + .card-body { padding-top: 0.85rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  height: 2.25rem; padding: 0 1rem;
  border-radius: var(--radius-md); border: 1px solid transparent;
  font: inherit; font-size: 0.85rem; font-weight: 600; white-space: nowrap;
  cursor: pointer; transition: opacity 0.15s, background 0.15s, border-color 0.15s;
  background: var(--primary); color: var(--primary-foreground);
}
.btn:hover { opacity: 0.9; }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn-outline { background: var(--background); color: var(--foreground); border-color: var(--input); box-shadow: var(--shadow-sm); }
.btn-outline:hover { background: var(--accent); color: var(--accent-foreground); opacity: 1; }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover { background: var(--accent); opacity: 1; }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-sm { height: 2rem; padding: 0 0.75rem; font-size: 0.8rem; }
.btn-icon { width: 2.25rem; padding: 0; }
.btn-icon.btn-sm { width: 2rem; }
.btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* ---------- Forms ---------- */
.label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 0.35rem; }
.input, .select, .textarea {
  width: 100%; height: 2.25rem; padding: 0 0.75rem;
  font: inherit; font-size: 0.85rem;
  color: var(--foreground); background: var(--background);
  border: 1px solid var(--input); border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm); transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 5rem; padding: 0.5rem 0.75rem; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ring) 25%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 0.6rem center;
  padding-inline-end: 0.75rem; padding-inline-start: 2rem;
}
.field { display: flex; flex-direction: column; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.25rem; }
.input-search { position: relative; }
.input-search .icon { position: absolute; inset-inline-start: 0.65rem; top: 50%; translate: 0 -50%; color: var(--muted-foreground); }
.input-search .input { padding-inline-start: 2.1rem; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.table th {
  text-align: start; font-weight: 600; color: var(--muted-foreground);
  padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: color-mix(in oklab, var(--muted) 60%, transparent); }
.table tbody tr:last-child td { border-bottom: none; }
.table .row-actions { display: flex; gap: 0.25rem; justify-content: flex-end; }
.th-sort { display: inline-flex; align-items: center; gap: 0.2rem; color: inherit; text-decoration: none; cursor: pointer; }
.th-sort:hover { color: var(--foreground); }
.th-sort.active { color: var(--foreground); }
.th-sort .th-sort-ic { width: 0.9rem; height: 0.9rem; }
.cell-sub { display: block; font-size: 0.75rem; color: var(--muted-foreground); }

/* ---------- Badge ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.1rem 0.6rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; border: 1px solid transparent;
  background: var(--primary); color: var(--primary-foreground);
}
.badge-secondary { background: var(--accent); color: var(--accent-foreground); }
.badge-outline { background: transparent; color: var(--foreground); border-color: var(--border); }
.badge-success { background: color-mix(in oklab, var(--success) 15%, transparent); color: var(--success); }
.badge-destructive { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); }
.badge-info { background: color-mix(in oklab, var(--info) 14%, transparent); color: var(--info); }
.badge-warning { background: color-mix(in oklab, var(--warning) 18%, transparent); color: oklch(0.55 0.14 70); }

/* ---------- Avatar ---------- */
.avatar {
  display: inline-grid; place-items: center;
  width: 2rem; height: 2rem; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
img.avatar { object-fit: cover; border: 1px solid var(--border); }
.sidebar-user { border-radius: var(--radius-md); padding: 0.2rem 0.3rem; margin: -0.2rem -0.3rem; }
.sidebar-user:hover { background: var(--sidebar-accent); }
.avatar.lg { width: 2.75rem; height: 2.75rem; font-size: 1.05rem; }
.avatar.sm { width: 1.6rem; height: 1.6rem; font-size: 0.7rem; }
.av-1 { background: oklch(0.55 0.18 264); } .av-2 { background: oklch(0.6 0.15 162); }
.av-3 { background: oklch(0.62 0.19 29); }  .av-4 { background: oklch(0.58 0.16 303); }
.av-5 { background: oklch(0.65 0.14 84); }  .av-6 { background: oklch(0.57 0.15 220); }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: fixed; top: 0; left: 0; right: auto; z-index: 1000;
  min-width: 11rem; padding: 0.25rem;
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none; flex-direction: column;
}
.dropdown.open .dropdown-menu { display: flex; animation: pop 0.12s ease-out; }
.dropdown-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.6rem; border-radius: var(--radius-sm);
  font: inherit; font-size: 0.83rem; text-align: start;
  background: none; border: none; cursor: pointer; color: inherit; width: 100%;
}
.dropdown-item:hover { background: var(--accent); color: var(--accent-foreground); }
.dropdown-item.danger { color: var(--destructive); }
.dropdown-sep { height: 1px; background: var(--border); margin: 0.25rem 0.35rem; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }

/* ---------- Notifications ---------- */
.notif-bell { position: relative; }
.notif-dot {
  position: absolute; top: 0.15rem; inset-inline-end: 0.15rem;
  min-width: 1.05rem; height: 1.05rem; padding: 0 0.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--destructive); color: #fff;
  font-size: 0.62rem; font-weight: 700; line-height: 1; border: 2px solid var(--background);
}
.notif-menu { width: 22rem; max-width: 90vw; padding: 0; max-height: 26rem; overflow-y: auto; }
.notif-menu-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 0.75rem; font-size: 0.8rem; font-weight: 700;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--popover);
}
.notif-empty { padding: 1.5rem 0.75rem; text-align: center; }
.notif-item {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.notif-item:hover { background: var(--accent); }
.notif-item.unread { background: color-mix(in oklab, var(--primary) 6%, transparent); }
.notif-item-ic { width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; color: var(--muted-foreground); flex-shrink: 0; }
.notif-item-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.notif-title { font-size: 0.83rem; }
.notif-item.unread .notif-title { font-weight: 700; }
.notif-msg { font-size: 0.78rem; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-time { font-size: 0.72rem; color: var(--muted-foreground); }
.btn-link { background: none; border: none; padding: 0; color: var(--primary); font: inherit; font-size: 0.75rem; font-weight: 600; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Dialog ---------- */
dialog.dialog {
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--card); color: var(--card-foreground);
  padding: 0; width: min(32rem, calc(100vw - 2rem));
  box-shadow: var(--shadow-lg);
}
dialog.dialog::backdrop { background: rgb(0 0 0 / 0.2); backdrop-filter: blur(4px); }
dialog.dialog[open] { animation: pop 0.15s ease-out; }
.dialog-header { padding: 1.1rem 1.25rem 0; }
.dialog-body { padding: 1.1rem 1.25rem; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat-card { padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted-foreground); font-size: 0.78rem; font-weight: 600; }
.stat-top .icon { width: 1.1rem; height: 1.1rem; }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.stat-sub { font-size: 0.75rem; color: var(--muted-foreground); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(15rem, 1fr); gap: 1rem; overflow-x: auto; padding-bottom: 0.5rem; }
.kanban-col { background: color-mix(in oklab, var(--muted) 70%, transparent); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; min-height: 12rem; }
.kanban-head { display: flex; align-items: center; justify-content: space-between; padding: 0.25rem 0.4rem; font-size: 0.8rem; font-weight: 700; }
.kanban-count { font-size: 0.72rem; color: var(--muted-foreground); background: var(--background); border: 1px solid var(--border); border-radius: 999px; padding: 0 0.5rem; }
.kanban-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.7rem 0.8rem; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 0.35rem; }
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-title { font-size: 0.83rem; font-weight: 600; }
.kanban-meta { display: flex; align-items: center; justify-content: space-between; font-size: 0.73rem; color: var(--muted-foreground); }

/* ---------- Charts (SVG از PHP) ---------- */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 0.9rem; font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.5rem; }
.chart-legend .dot { width: 0.6rem; height: 0.6rem; border-radius: 3px; display: inline-block; margin-inline-end: 0.3rem; }

/* ---------- Progress ---------- */
.progress { height: 0.5rem; background: var(--muted); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--chart-1); border-radius: 999px; }

/* ---------- Alert / flash ---------- */
.toast {
  position: fixed; bottom: 1.25rem; inset-inline-start: 1.25rem; z-index: 100;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.7rem 1rem; border-radius: var(--radius-lg);
  background: var(--popover); color: var(--popover-foreground);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  font-size: 0.85rem; font-weight: 500;
  animation: toast-in 0.25s ease-out;
}
.toast.success .icon { color: var(--success); }
.toast.error .icon { color: var(--destructive); }
@keyframes toast-in { from { opacity: 0; transform: translateY(0.75rem); } }

/* ---------- Tabs ---------- */
.tabs { display: inline-flex; gap: 0.25rem; background: var(--muted); border-radius: var(--radius-lg); padding: 0.25rem; }
.tab {
  padding: 0.35rem 0.9rem; border-radius: var(--radius-md);
  font-size: 0.82rem; font-weight: 600; color: var(--muted-foreground); cursor: pointer;
}
.tab.active { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }

/* ---------- Empty state ---------- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 3rem 1rem; color: var(--muted-foreground); text-align: center; }
.empty .icon { width: 2.2rem; height: 2.2rem; opacity: 0.5; }

/* ---------- Login ---------- */
.login-page { min-height: 100dvh; display: grid; place-items: center; background: var(--muted); padding: 1rem; }
.login-card { width: 100%; max-width: 24rem; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; }
.login-brand .brand-mark { width: 3rem; height: 3rem; font-size: 1.4rem; border-radius: var(--radius-xl); }

/* ---------- Utilities ---------- */
.page-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.page-head h2 { font-size: 1.25rem; }
.page-head .sub { color: var(--muted-foreground); font-size: 0.82rem; }
.grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.flex { display: flex; align-items: center; gap: 0.5rem; }
.muted { color: var(--muted-foreground); }
.text-sm { font-size: 0.8rem; }
.num { font-variant-numeric: tabular-nums; }
.mt-2 { margin-top: 0.5rem; } .mt-4 { margin-top: 1rem; }
.w-auto { width: auto; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-inline-start: 1.4rem; display: flex; flex-direction: column; gap: 1.1rem; }
.timeline::before {
  content: ''; position: absolute; inset-inline-start: 0.32rem; top: 0.4rem; bottom: 0.4rem;
  width: 2px; background: var(--border); border-radius: 2px;
}
.timeline-item { position: relative; }
.timeline-dot {
  position: absolute; inset-inline-start: -1.4rem; top: 0.3rem;
  width: 0.75rem; height: 0.75rem; border-radius: 999px;
  background: var(--chart-2); border: 2px solid var(--card); box-shadow: 0 0 0 2px var(--border);
}
.tl-call    { background: var(--info); }
.tl-meeting { background: var(--warning); }
.tl-note    { background: var(--chart-2); }
.tl-task    { background: var(--success); }
.timeline-head { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.timeline-body { margin-top: 0.3rem; font-size: 0.85rem; color: var(--foreground); }

/* ---------- Combobox ---------- */
.combobox { position: relative; }
.combobox-menu {
  position: absolute; top: calc(100% + 0.3rem); inset-inline: 0; z-index: 60;
  max-height: 15rem; overflow-y: auto; padding: 0.25rem;
  background: var(--popover); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: none; flex-direction: column;
}
.combobox.open .combobox-menu { display: flex; animation: pop 0.12s ease-out; }
.combobox-item {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  padding: 0.45rem 0.6rem; border-radius: var(--radius-sm);
  font: inherit; font-size: 0.83rem; text-align: start;
  background: none; border: none; cursor: pointer; color: inherit; width: 100%;
}
.combobox-item:hover, .combobox-item.hl { background: var(--accent); color: var(--accent-foreground); }
.cb-phone { font-size: 0.75rem; color: var(--muted-foreground); }
.combobox-empty { padding: 0.75rem; text-align: center; }

/* ---------- Jalali date picker ---------- */
.jdp { position: relative; }
.jdp-display { cursor: pointer; background: var(--background); }
.jdp-panel {
  position: absolute; top: calc(100% + 0.3rem); inset-inline-start: 0; z-index: 70;
  width: 17rem; padding: 0.75rem;
  background: var(--popover); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  animation: pop 0.12s ease-out;
}
.jdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.jdp-title { font-weight: 700; font-size: 0.85rem; }
.jdp-nav { display: flex; gap: 0.15rem; }
.jdp-nav button {
  width: 1.7rem; height: 1.7rem; display: grid; place-items: center;
  background: none; border: none; border-radius: var(--radius-sm);
  cursor: pointer; color: var(--muted-foreground); font: inherit; font-size: 0.9rem;
}
.jdp-nav button:hover { background: var(--accent); color: var(--accent-foreground); }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jdp-wd { text-align: center; font-size: 0.68rem; color: var(--muted-foreground); padding: 0.2rem 0; font-weight: 600; }
.jdp-day {
  aspect-ratio: 1; display: grid; place-items: center;
  background: none; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font: inherit; font-size: 0.78rem; color: var(--foreground);
}
.jdp-day:hover { background: var(--accent); }
.jdp-day.today { box-shadow: inset 0 0 0 1px var(--ring); }
.jdp-day.sel { background: var(--primary); color: var(--primary-foreground); font-weight: 700; }
.jdp-day.out { visibility: hidden; }
.jdp-foot { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.6rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.jdp-foot .input { height: 1.9rem; font-size: 0.78rem; }
.jdp-time { width: 6rem; direction: ltr; text-align: center; }

/* ---------- Deal items (پروفایل مشتری) ---------- */
.deal-item {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 0.75rem 0.85rem; display: flex; flex-direction: column; gap: 0.55rem;
  background: color-mix(in oklab, var(--muted) 35%, transparent);
}
.deal-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.78rem; color: var(--muted-foreground); }
.deal-meta > span { display: inline-flex; align-items: center; gap: 0.3rem; }
.deal-meta .icon { width: 0.85rem; height: 0.85rem; }

/* ---------- Product rows (فرم فرصت) ---------- */
.prod-rows { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.5rem; }
.prod-row {
  display: flex; align-items: center; gap: 0.5rem;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 0.4rem 0.6rem;
  background: color-mix(in oklab, var(--muted) 40%, transparent);
  font-size: 0.83rem;
}
.prod-row input[name$="[qty]"] { width: 4.2rem; height: 1.9rem; font-size: 0.8rem; text-align: center; flex-shrink: 0; }
.prod-row .prod-price { width: 8.5rem; height: 1.9rem; font-size: 0.8rem; flex-shrink: 0; }
.prod-row .prod-total { min-width: 5.5rem; text-align: left; white-space: nowrap; }
.prod-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }

/* ---------- Detail rows ---------- */
.detail-rows { display: flex; flex-direction: column; }
.detail-rows > div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.5rem 0; border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}
.detail-rows > div:last-child { border-bottom: none; }
.detail-rows > div > span:last-child { font-weight: 600; text-align: left; }

/* ---------- Settings rows ---------- */
.settings-row { display: flex; align-items: center; gap: 0.6rem; }
.settings-row .flex { gap: 0.4rem; }
.settings-move { display: flex; align-items: center; gap: 0.1rem; }

/* ---------- Kanban clickable ---------- */
.kanban-card[data-href] { cursor: pointer; }
.kanban-card .kanban-title:hover { text-decoration: underline; }

/* ---------- Responsive ---------- */
.menu-btn { display: none; }
@media (max-width: 960px) {
  .sidebar { position: fixed; inset-inline-start: 0; z-index: 60; transform: translateX(100%); transition: transform 0.2s ease; }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; background: rgb(0 0 0 / 0.3); z-index: 55; display: none; }
  .sidebar-overlay.show { display: block; }
  .menu-btn { display: inline-flex; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .content { padding: 1rem; }
}
