/* ===== الثيمات والألوان الإضافية والطباعة والكانبان والجانت ===== */

/* ثيمات لونية عبر data-color على html */
:root[data-color="blue"] { --primary: #2563eb; --primary-600: #1d4ed8; --primary-50: #dbeafe; }
:root[data-color="purple"] { --primary: #7c3aed; --primary-600: #6d28d9; --primary-50: #ede9fe; }
:root[data-color="green"] { --primary: #15803d; --primary-600: #166534; --primary-50: #dcfce7; }
:root[data-color="orange"] { --primary: #ea580c; --primary-600: #c2410c; --primary-50: #ffedd5; }
:root[data-theme="dark"][data-color="blue"] { --primary-50: #1e2a4a; }
:root[data-theme="dark"][data-color="purple"] { --primary-50: #2a2148; }
:root[data-theme="dark"][data-color="green"] { --primary-50: #0f2f22; }
:root[data-theme="dark"][data-color="orange"] { --primary-50: #3a2415; }

/* بطاقات ملونة، إحصائيات مصغرة */
.stat-mini { display: flex; gap: .6rem; align-items: center; padding: .7rem .9rem; }
.progress { height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #14b8a6); border-radius: 99px; transition: width .4s; }

/* كانبان CRM */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: start; }
.kanban-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); min-height: 200px; }
.kanban-col h4 { padding: .8rem 1rem; font-size: .9rem; display: flex; justify-content: space-between; align-items: center; }
.kanban-col h4 .count { background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 0 .55rem; font-size: .75rem; }
.kanban-cards { padding: .6rem; display: flex; flex-direction: column; gap: .6rem; min-height: 120px; }
.kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .7rem .8rem; box-shadow: var(--shadow-sm); cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .5; }
.kanban-col.dragover { outline: 2px dashed var(--primary); outline-offset: -4px; }
@media (max-width: 900px) { .kanban { grid-template-columns: 1fr; } }

/* جانت مبسط للإنتاج */
.gantt { display: flex; flex-direction: column; gap: .5rem; }
.gantt-row { display: grid; grid-template-columns: 180px 1fr; gap: .75rem; align-items: center; }
.gantt-track { background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; height: 22px; position: relative; overflow: hidden; }
.gantt-bar { position: absolute; top: 0; bottom: 0; border-radius: 99px; background: linear-gradient(90deg, var(--primary), #14b8a6); display: flex; align-items: center; padding-inline-start: .6rem; color: #fff; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.gantt-bar.done { background: linear-gradient(90deg, #16a34a, #4ade80); }
.gantt-bar.late { background: linear-gradient(90deg, #dc2626, #f87171); }

/* شجرة الحسابات */
.tree { padding: .5rem; }
.tree details { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: .5rem; background: var(--surface); }
.tree summary { padding: .6rem .9rem; cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.tree summary::-webkit-details-marker { display: none; }
.tree .tree-children { padding: 0 .9rem .8rem; }

/* فاتورة الطباعة */
.invoice-paper { background: #fff; color: #111; border-radius: 12px; padding: 2rem; max-width: 800px; margin: 0 auto; }
.invoice-paper h2 { margin: 0; }
.invoice-paper table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.invoice-paper th, .invoice-paper td { border: 1px solid #ddd; padding: .6rem; font-size: .9rem; }
.invoice-paper th { background: #f3f4f6; }

/* شارات الحالات الإضافية */
.badge.primary { background: var(--primary-50); color: var(--primary); }
.badge.purple { background: #ede9fe; color: #6d28d9; }

/* أدوات الجداول */
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.toolbar .spacer { flex: 1; }
.cols-menu { position: relative; }
.cols-menu .panel { position: absolute; top: 110%; inset-inline-end: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: .6rem .8rem; z-index: 30; min-width: 180px; display: none; }
.cols-menu.open .panel { display: block; }
.tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.tabs button { padding: .45rem .95rem; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); font-weight: 700; font-size: .85rem; color: var(--text-muted); }
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* طباعة */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .card, .invoice-paper { box-shadow: none !important; border: 1px solid #ddd !important; }
  .toasts, .modal-overlay { display: none !important; }
}
