/* css/task-modal.css — قالب واحد برای همهٔ پنجره‌های «جزئیات دستورکار»
 * (کارتابل تکنسین/سرپرست/تمام‌شده و صفحهٔ زمان‌بندی). همهٔ رنگ‌ها اینجا تعریف می‌شوند؛
 * هیچ پنجرهٔ دستورکار نباید رنگ اختصاصی جدا داشته باشد. فونت: Vazirmatn (از css/main.css). */

:root {
    --tm-ink: #1f2937;
    --tm-muted: #6b7280;
    --tm-line: #e5e7eb;
    --tm-surface: #ffffff;
    --tm-bg: #f9fafb;
    --tm-accent: #ea580c;
    --tm-red: #b91c1c;     --tm-red-bg: #fef2f2;     --tm-red-line: #fecaca;
    --tm-blue: #1d4ed8;    --tm-blue-bg: #eff6ff;    --tm-blue-line: #bfdbfe;
    --tm-green: #15803d;   --tm-green-bg: #f0fdf4;   --tm-green-line: #bbf7d0;
    --tm-amber: #b45309;   --tm-amber-bg: #fffbeb;   --tm-amber-line: #fde68a;
    --tm-violet: #6d28d9;  --tm-violet-bg: #f5f3ff;  --tm-violet-line: #ddd6fe;
}

/* رنگ وضعیت دستورکار — یک رنگ ثابت برای هر وضعیت در کل سیستم.
 * استفاده: <span class="st-chip st-{statusId}">…</span>  (شناسه‌ها مطابق constants در api/tasks.php) */
.st-1  { --st-bg: #e0e7ff; --st-fg: #3730a3; }   /* برنامه‌ریزی */
.st-2  { --st-bg: #ffedd5; --st-fg: #9a3412; }   /* در دست تعمیر */
.st-3  { --st-bg: #fee2e2; --st-fg: #991b1b; }   /* متوقف شده */
.st-4  { --st-bg: #dcfce7; --st-fg: #166534; }   /* تمام شده */
.st-5  { --st-bg: #e0f2fe; --st-fg: #075985; }   /* کارتابل مسئول نت */
.st-6  { --st-bg: #fef3c7; --st-fg: #92400e; }   /* در انتظار تایید */
.st-7  { --st-bg: #ffe4e6; --st-fg: #9f1239; }   /* رد شده */
.st-8  { --st-bg: #fae8ff; --st-fg: #86198f; }   /* رد شده - در دست بررسی */
.st-9  { --st-bg: #fef9c3; --st-fg: #854d0e; }   /* منتظر تایید درخواست‌کننده */
.st-10 { --st-bg: #dbeafe; --st-fg: #1e40af; }   /* کارتابل تکنسین */
.st-11 { --st-bg: #ccfbf1; --st-fg: #115e59; }   /* تعیین زمان تحویل */
.st-12 { --st-bg: #cffafe; --st-fg: #155e75; }   /* بررسی تحویل */
.st-13 { --st-bg: #ecfccb; --st-fg: #3f6212; }   /* تحویل تجهیز */
.st-14 { --st-bg: #ede9fe; --st-fg: #5b21b6; }   /* تحویل انجام شد */
.st-15 { --st-bg: #e5e7eb; --st-fg: #374151; }   /* لغو شده */
.st-chip { background: var(--st-bg, #f3f4f6); color: var(--st-fg, #374151); display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 9px; font-size: .72rem; font-weight: 800; white-space: nowrap; }

/* پوسته و سربرگ */
.tm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--tm-line); background: var(--tm-surface); }
.tm-heading { flex: 1; min-width: 0; }
.tm-title { font-size: 1.05rem; font-weight: 900; color: var(--tm-ink); margin: 0; }
.tm-sub { font-size: .78rem; color: var(--tm-muted); margin-top: 2px; font-weight: 700; }
.tm-code { font-family: ui-monospace, Consolas, monospace; font-weight: 900; color: var(--tm-accent); direction: ltr; display: inline-block; }
.tm-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; background: var(--tm-surface); overflow-y: auto; }
.tm-foot { padding: 14px 18px; border-top: 1px solid var(--tm-line); background: var(--tm-bg); display: flex; flex-direction: column; gap: 8px; }

/* نشان‌ها (اولویت / وضعیت) */
.tm-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-badge { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 800; padding: 4px 11px; border-radius: 999px; background: #f3f4f6; color: #374151; }

/* شبکهٔ فیلدها: برچسب کوچک خاکستری + مقدار پررنگ */
.tm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.tm-field { background: var(--tm-bg); border: 1px solid var(--tm-line); border-radius: 12px; padding: 8px 11px; min-width: 0; }
.tm-k { display: block; font-size: .72rem; font-weight: 800; color: var(--tm-muted); margin-bottom: 2px; }
.tm-v { display: block; font-size: .86rem; font-weight: 800; color: var(--tm-ink); word-break: break-word; }
.tm-v-text { font-size: .86rem; font-weight: 600; color: var(--tm-ink); white-space: pre-wrap; word-break: break-word; line-height: 1.8; }

/* بلوک‌های متنی (شرح خرابی، توضیحات، یادداشت‌ها) — تُن رنگی ثابت */
.tm-block { border: 1px solid var(--tm-line); border-radius: 12px; padding: 10px 12px; background: var(--tm-surface); }
.tm-block .tm-k { margin-bottom: 4px; }
.tm-tone-red    { background: var(--tm-red-bg);    border-color: var(--tm-red-line); }
.tm-tone-blue   { background: var(--tm-blue-bg);   border-color: var(--tm-blue-line); }
.tm-tone-green  { background: var(--tm-green-bg);  border-color: var(--tm-green-line); }
.tm-tone-amber  { background: var(--tm-amber-bg);  border-color: var(--tm-amber-line); }
.tm-tone-violet { background: var(--tm-violet-bg); border-color: var(--tm-violet-line); }
.tm-tone-red .tm-k    { color: var(--tm-red); }
.tm-tone-blue .tm-k   { color: var(--tm-blue); }
.tm-tone-green .tm-k  { color: var(--tm-green); }
.tm-tone-amber .tm-k  { color: var(--tm-amber); }
.tm-tone-violet .tm-k { color: var(--tm-violet); }

/* عنوان بخش */
.tm-section { font-size: .86rem; font-weight: 900; color: var(--tm-ink); display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.tm-section i { color: var(--tm-accent); }

/* یادداشت‌های سرپرست (فقط سرپرست و مدیر سیستم) */
.tm-notes { display: flex; flex-direction: column; gap: 8px; }
.tm-notes[hidden] { display: none; }
.tm-note { border: 1px solid var(--tm-violet-line); border-right: 4px solid var(--tm-violet); border-radius: 12px; padding: 9px 11px; background: var(--tm-surface); display: flex; flex-direction: column; gap: 6px; }
.tm-note.editing { border-right-color: var(--tm-amber); }
.tm-note-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .72rem; font-weight: 700; color: var(--tm-muted); }
.tm-note-meta .tm-edited { color: var(--tm-amber); }
.tm-note-body { font-size: .84rem; color: var(--tm-ink); white-space: pre-wrap; word-break: break-word; line-height: 1.8; }
.tm-note-form { display: flex; flex-direction: column; gap: 6px; }
.tm-textarea { width: 100%; border: 2px solid var(--tm-line); border-radius: 12px; padding: 8px 10px; font: inherit; font-size: .85rem; background: var(--tm-surface); color: var(--tm-ink); resize: vertical; direction: rtl; }
.tm-textarea:focus { outline: none; border-color: var(--tm-accent); }
.tm-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tm-btn { border: 2px solid var(--tm-line); background: var(--tm-surface); color: var(--tm-ink); border-radius: 10px; padding: 5px 12px; font: inherit; font-size: .76rem; font-weight: 800; cursor: pointer; }
.tm-btn:hover { border-color: var(--tm-accent); }
.tm-btn-primary { background: var(--tm-accent); border-color: var(--tm-accent); color: #fff; }
.tm-btn-primary:hover { opacity: .92; }
.tm-btn-danger:hover { border-color: var(--tm-red); color: var(--tm-red); }
.tm-empty { font-size: .8rem; color: var(--tm-muted); text-align: center; padding: 10px; }
